All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Rahul Singh <rahul.singh@arm.com>
Cc: xen-devel@lists.xenproject.org,
	 Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	 Bertrand Marquis <bertrand.marquis@arm.com>,
	 Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v4 6/7] xen/arm: introduce new xen,enhanced property value
Date: Tue, 6 Sep 2022 15:12:50 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2209061507481.157835@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <667059a3bc6ed9a8b993f64f2b1176a2a131f41e.1662462034.git.rahul.singh@arm.com>

On Tue, 6 Sep 2022, Rahul Singh wrote:
> Introduce a new "xen,enhanced" dom0less property value "no-xenstore" to
> disable xenstore interface for dom0less guests.
> 
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
> ---
> Changes in v4:
>  - Implement defines for dom0less features
> Changes in v3:
>  - new patch in this version
> ---
>  docs/misc/arm/device-tree/booting.txt |  4 ++++
>  xen/arch/arm/domain_build.c           | 10 ++++++----
>  xen/arch/arm/include/asm/kernel.h     | 23 +++++++++++++++++++++--
>  3 files changed, 31 insertions(+), 6 deletions(-)
> 
> diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
> index 98253414b8..1b0dca1454 100644
> --- a/docs/misc/arm/device-tree/booting.txt
> +++ b/docs/misc/arm/device-tree/booting.txt
> @@ -204,6 +204,10 @@ with the following properties:
>      - "disabled"
>      Xen PV interfaces are disabled.
>  
> +    - no-xenstore
> +    Xen PV interfaces, including grant-table will be enabled but xenstore
> +    will be disabled for the VM.

Please use "" for consistency:

    - "no-xenstore"


>      If the xen,enhanced property is present with no value, it defaults
>      to "enabled". If the xen,enhanced property is not present, PV
>      interfaces are disabled.
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 707e247f6a..0b164ef595 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2891,7 +2891,7 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo)
>              goto err;
>      }
>  
> -    if ( kinfo->dom0less_enhanced )
> +    if ( kinfo->dom0less_feature & DOM0LESS_ENHANCED_NO_XS )
>      {
>          ret = make_hypervisor_node(d, kinfo, addrcells, sizecells);
>          if ( ret )
> @@ -3209,10 +3209,12 @@ static int __init construct_domU(struct domain *d,
>           (rc == 0 && !strcmp(dom0less_enhanced, "enabled")) )
>      {
>          if ( hardware_domain )
> -            kinfo.dom0less_enhanced = true;
> +            kinfo.dom0less_feature = DOM0LESS_ENHANCED;
>          else
> -            panic("Tried to use xen,enhanced without dom0\n");
> +            panic("At the moment, Xenstore support requires dom0 to be present\n");
>      }
> +    else if ( rc == 0 && !strcmp(dom0less_enhanced, "no-xenstore") )
> +        kinfo.dom0less_feature = DOM0LESS_ENHANCED_NO_XS;
>  
>      if ( vcpu_create(d, 0) == NULL )
>          return -ENOMEM;
> @@ -3252,7 +3254,7 @@ static int __init construct_domU(struct domain *d,
>      if ( rc < 0 )
>          return rc;
>  
> -    if ( kinfo.dom0less_enhanced )
> +    if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE )
>      {
>          ASSERT(hardware_domain);
>          rc = alloc_xenstore_evtchn(d);
> diff --git a/xen/arch/arm/include/asm/kernel.h b/xen/arch/arm/include/asm/kernel.h
> index c4dc039b54..ad240494ea 100644
> --- a/xen/arch/arm/include/asm/kernel.h
> +++ b/xen/arch/arm/include/asm/kernel.h
> @@ -9,6 +9,25 @@
>  #include <xen/device_tree.h>
>  #include <asm/setup.h>
>  
> +/*
> + * List of possible features for dom0less domUs
> + *
> + * DOM0LESS_ENHANCED_NO_XS: Notify the OS it is running on top of Xen. All the
> + *                          default features (excluding Xenstore) will be
> + *                          available. Note that an OS *must* not rely on the
> + *                          availability of Xen features if this is not set.
> + * DOM0LESS_XENSTORE:       Xenstore will be enabled for the VM. This feature
> + *                          can't be enabled without the
> + *                          DOM0LESS_ENHANCED_NO_XS.
> + * DOM0LESS_ENHANCED:       Notify the OS it is running on top of Xen. All the
> + *                          default features (including Xenstore) will be
> + *                          available. Note that an OS *must* not rely on the
> + *                          availability of Xen features if this is not set.
> + */
> +#define DOM0LESS_ENHANCED_NO_XS  BIT(0, U)
> +#define DOM0LESS_XENSTORE        BIT(1, U)
> +#define DOM0LESS_ENHANCED        (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENSTORE)
> +
>  struct kernel_info {
>  #ifdef CONFIG_ARM_64
>      enum domain_type type;
> @@ -36,8 +55,8 @@ struct kernel_info {
>      /* Enable pl011 emulation */
>      bool vpl011;
>  
> -    /* Enable PV drivers */
> -    bool dom0less_enhanced;
> +    /* Enable/Disable PV drivers interface,grant table, evtchn or xenstore */

missing a whitespace


> +    uint32_t dom0less_feature;

Given that we only really need 2 bits today, and given that uint8_t and
uint16_t are free but uint32_t increases the size of the struct, could
we just use uint16_t dom0less_feature ?


Everything else looks good, these are just minor things.


>      /* GIC phandle */
>      uint32_t phandle_gic;
> -- 
> 2.25.1
> 


  reply	other threads:[~2022-09-06 22:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 13:39 [PATCH v4 0/7] xen/evtchn: implement static event channel signaling Rahul Singh
2022-09-06 13:40 ` [PATCH v4 1/7] xen/evtchn: Make sure all buckets below d->valid_evtchns are allocated Rahul Singh
2022-09-06 13:45   ` Jan Beulich
2022-09-06 13:40 ` [PATCH v4 2/7] xen/evtchn: Add an helper to reserve/allocate a port Rahul Singh
2022-09-06 13:40 ` [PATCH v4 3/7] xen/evtchn: restrict the maximum number of evtchn supported for domUs Rahul Singh
2022-09-07 13:01   ` Julien Grall
2022-09-07 14:19     ` Rahul Singh
2022-09-06 13:40 ` [PATCH v4 4/7] xen/evtchn: modify evtchn_alloc_unbound to allocate specified port Rahul Singh
2022-09-06 13:40 ` [PATCH v4 5/7] xen/evtchn: modify evtchn_bind_interdomain to support static evtchn Rahul Singh
2022-09-06 13:40 ` [PATCH v4 6/7] xen/arm: introduce new xen,enhanced property value Rahul Singh
2022-09-06 22:12   ` Stefano Stabellini [this message]
2022-09-07  8:13     ` Rahul Singh
2022-09-07 13:09   ` Julien Grall
2022-09-07 14:19     ` Rahul Singh
2022-09-06 13:40 ` [PATCH v4 7/7] xen/arm: introduce xen-evtchn dom0less property Rahul Singh
2022-09-06 22:22   ` Stefano Stabellini
2022-09-07  8:12     ` Rahul Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2209061507481.157835@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=rahul.singh@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.