[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/x86: Check supported features even for PVH dom0


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Frediano Ziglio <freddy77@xxxxxxxxx>
  • Date: Sat, 4 Apr 2026 12:32:18 +0100
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qSgJUGOjVvt6CunX03PcQu1j3L3Kic8yq9H+84Der8g=; fh=jtpI8BNv+OQCCB7Kc0MT2qsQdfu4U3IegNxehlgRw8Y=; b=YsCcweSqNCvDj3eEciFcFUM5wsB9N0BYqLyAjoYrIZPkuoUn7StGkcqYFrNdiNslsE n3b1NBTNv2Ek26WBG8ZMNOolfNDZ4pDikkDD/qMz1UKZVaA2n3ENhgdaCmzCudNvsQVG y2kPTIMKrmbRhIpKNXqPgo/2TI1ngbipacpXCnJOY1RkiOAw4jooZkHmiId9Xfn+Iuop Y60/kyaR7Ez5vdXXDZtzzMOpBn8l10vTjf8huE8TZlOntN3RX5z2SC2a/VFDwqsxMUlN alqxyPbbK8KVYjJR0b2OU/k/PE/mbQ+evHVRQfQchwUNWQMIi5opqWYSlCnmyjQHnU4p 3xmg==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1775302350; cv=none; d=google.com; s=arc-20240605; b=JQRxQQOHWy4IgqgNYUm0IdKHxqJmBWyZXk8xsQY84e1uO+5uk3zVkErLB+9Ps+b8RR VLVsMeaWxMmb7T366PVO/U9/cwtXopAuItdEWl94caziAkhJzUCb8ht9pcAkKyurOZub KEZsgqawnzDmpgCNex5Kx2IVb5Nkv0gkpigH8j6CwlXdKZy0vqv6s86hJ8yx0R6WlSia H+02OubRmIZCni5g1x9WDL+vDhCk/j3a9+GSeZCqTLCDsxoZcKiAM1SccJwzyB9d7EGK TQi1B7T1r+QFPS+p++xx/n6XF/9hjbKhjKJsRUz1MAuXcLgkCggYUG/43q+lvVnHnU9g 8hiw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Frediano Ziglio <frediano.ziglio@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Sat, 04 Apr 2026 11:32:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, 3 Apr 2026 at 11:11, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
>
> On Thu, Apr 02, 2026 at 04:55:10PM +0100, Frediano Ziglio wrote:
> > The supported features ELF notes was tested only if the dom0 was
> > PV. Factor out a function to check ELF notes and reuse it even
> > for PVH.
> >
> > Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
> > --
> > Changes since v1:
> > - fix typo in title;
> > - fix minor formatting issue;
> > - use is_hardware_domain instead of checking is_pv_shim;
> > - reduce indentation returning earlier;
> > - return error instead of jumping to cleanup code.
> > ---
> >  xen/arch/x86/dom0_build.c             | 14 ++++++++++++++
> >  xen/arch/x86/hvm/dom0_build.c         |  3 +++
> >  xen/arch/x86/include/asm/dom0_build.h |  2 ++
> >  xen/arch/x86/pv/dom0_build.c          | 10 ++--------
> >  4 files changed, 21 insertions(+), 8 deletions(-)
> >
> > diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
> > index 864dd9e53e..a33ce77321 100644
> > --- a/xen/arch/x86/dom0_build.c
> > +++ b/xen/arch/x86/dom0_build.c
> > @@ -320,6 +320,20 @@ unsigned long __init dom0_paging_pages(const struct 
> > domain *d,
> >      return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
> >  }
> >
> > +int __init dom0_check_parms(
> > +    struct domain *d, const struct elf_dom_parms *parms)
>
> d should be const also.
>
> > +{
> > +    if ( parms->elf_notes[XEN_ELFNOTE_SUPPORTED_FEATURES].type == 
> > XEN_ENT_NONE )
> > +        return 0;
> > +
> > +    if ( is_hardware_domain(d) && !test_bit(XENFEAT_dom0, 
> > parms->f_supported) )
> > +    {
> > +        printk("Kernel does not support Dom0 operation\n");
> > +        return -EINVAL;
> > +    }
> > +
> > +    return 0;
> > +}
> >
> >  /*
> >   * If allocation isn't specified, reserve 1/16th of available memory for
> > diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
> > index d69a83b089..f95a00acfd 100644
> > --- a/xen/arch/x86/hvm/dom0_build.c
> > +++ b/xen/arch/x86/hvm/dom0_build.c
> > @@ -699,6 +699,9 @@ static int __init pvh_load_kernel(
> >      if ( !check_and_adjust_load_address(d, &elf, &parms) )
> >          return -ENOSPC;
> >
> > +    if ( (rc = dom0_check_parms(d, &parms)) != 0 )
> > +        return rc;
>
> I would do the check ahead of check_and_adjust_load_address(), as then
> we could avoid the load address adjustment if we detect earlier than
> the dom0 feature is not present.  But that's just my taste.
>
> I can adjust the const-ification of d on commit if there are no
> further objections:
>
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>
> Thanks, Roger.

Fine with me.

Frediano



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.