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

Re: [PATCH v1 3/3] xen: introduce CONFIG_HAS_DOMAIN_TYPE


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 20 Apr 2026 10:03:31 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UWvzZOX0hDO+ITJIMv2XGIAaFknfMcrBwxN2uVX5dy0=; b=mrfNtEViCDJ1EaSlnnK3V8lyBSdTq2VJkGT2RscPUMjOKL6Rr067wQdN7Zj7/MzV3LTkBUY0gLux3c+pGkv/mYrUY1ENvlT7VIg+ldUnyRZ57Ty0LMWAQ+MB7bUO4AoaULuA9jFoWsmdLRJnn6XvK2YS/22SEMVIrHfm8//xEPCYo0+0rxA/Ee4dc1Hons5fBuGc6dmQBwKgFPuHrK1D0Q+GVIsySx/y9AqXqYj1cgT39zffX9L0mEtt3RF+wqocZH3iDI2EBOPnO3wxJiPTkvtN+o64gtHTlXNsLwaL50hmQNnRXX233gnhYXqztm/I7x29vZvV6lgjVEYUe7P6Lg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OocauKv/iPxHzbRdC6BWGcvf4UtgayRi+fw/Cs7/DG+G3fX61ZFPU9ePXTpU/LLLCx0BC2hqb+h1b9NllU59wzGTSE80C9waCbQpMj/8zHbOoSzxeRWqu80DnxpZrmSY8JoOxCVk0hc+7WkfiX/69JMyJ8L2//KRH69RI1EW70d/FURIMHHU32G6t04GcwxiMiWU+cQ/jmEpYLFXnfWiJCI/w4yDEZHzof1EdOTM106fy7Zls+olJNaeg7eLIi5w/rur9K5YTbN6vQRzHo38z7mLPOr3Hyi604LeB8E+pn1l/hlsBm8Dgjp+pe9BpsBZTbdxgBu0yacURqLiLsJ48A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 20 Apr 2026 08:03:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16/04/2026 16:21, Oleksii Kurochko wrote:
> As domain type is part of common code now there is no any reason
> to have architecture-specific set_domain_type() functions so
> it is dropped.
> 
> The CONFIG_ARM_64 guard in xen/arch/arm/domain_build.c is intentionally
> left unchanged: it is ARM-specific code, and ARM_64 selects
> HAS_DOMAIN_TYPE, so the semantics are identical.
> 
> x86 with CONFIG_64BIT=y shouldn't use is_{32,64}bit_domain() as
> x86 doesn't have support of CONFIG_HAS_DOMAIN_TYPE. For x86_32
> it is fine to follow generic is_{32,64}_bit_domain() implementations.
I thought x86_32 Xen no longer builds. This means the fallback is only for 
arm32.

> 
> Generally it probably would be better to introduce CONFIG_32BIT
> and use it to define is_{32,64}bit_domain() as if one day
> CONFIG_128BIT will be introduced is_{32,64}bit_domain() will be
> defined incorrectly but considering that CONFIG_64BIT is maximum
> supported bitness it is fine to define in this way.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> ---
>  xen/arch/Kconfig                        |  3 +++
>  xen/arch/arm/Kconfig                    |  1 +
>  xen/arch/arm/arm64/domctl.c             |  4 ++--
>  xen/arch/arm/dom0less-build.c           | 14 --------------
>  xen/arch/arm/domain_build.c             |  8 ++++----
>  xen/arch/arm/include/asm/domain.h       | 12 ------------
>  xen/arch/arm/include/asm/kernel.h       |  4 ----
>  xen/arch/arm/kernel.c                   | 10 +++++-----
>  xen/common/device-tree/dom0less-build.c |  5 ++++-
>  xen/include/xen/dom0less-build.h        |  2 --
>  xen/include/xen/domain.h                | 13 +++++++++++++
>  xen/include/xen/fdt-kernel.h            |  5 +++++
>  xen/include/xen/sched.h                 |  4 ++++
>  13 files changed, 41 insertions(+), 44 deletions(-)
> 
> diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
> index f9230bfaf872..6c53149f7ee1 100644
> --- a/xen/arch/Kconfig
> +++ b/xen/arch/Kconfig
> @@ -1,6 +1,9 @@
>  config 64BIT
>       bool
>  
> +config HAS_DOMAIN_TYPE
> +     bool
> +
>  config PHYS_ADDR_T_32
>       bool
>  
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 2f2b501fdac4..79622b46a10d 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -7,6 +7,7 @@ config ARM_64
>       def_bool y
>       depends on !ARM_32
>       select 64BIT
> +     select HAS_DOMAIN_TYPE
>       select HAS_FAST_MULTIPLY
>       select HAS_VPCI_GUEST_SUPPORT if PCI_PASSTHROUGH
>  
> diff --git a/xen/arch/arm/arm64/domctl.c b/xen/arch/arm/arm64/domctl.c
> index 8720d126c97d..9e9a29eb1e78 100644
> --- a/xen/arch/arm/arm64/domctl.c
> +++ b/xen/arch/arm/arm64/domctl.c
> @@ -21,10 +21,10 @@ static long switch_mode(struct domain *d, enum 
> domain_type type)
>          return -EINVAL;
>      if ( domain_tot_pages(d) != 0 )
>          return -EBUSY;
> -    if ( d->arch.type == type )
> +    if ( d->type == type )
>          return 0;
>  
> -    d->arch.type = type;
> +    d->type = type;
>  
>      if ( is_64bit_domain(d) )
>          for_each_vcpu(d, v)
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 4181c105389a..6f73c65e5151 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -237,20 +237,6 @@ int __init make_arch_nodes(struct kernel_info *kinfo)
>      return 0;
>  }
>  
> -/* TODO: make arch.type generic ? */
> -#ifdef CONFIG_ARM_64
> -void __init set_domain_type(struct domain *d, struct kernel_info *kinfo)
> -{
> -    /* type must be set before allocate memory */
> -    d->arch.type = kinfo->arch.type;
> -}
> -#else
> -void __init set_domain_type(struct domain *d, struct kernel_info *kinfo)
> -{
> -    /* Nothing to do */
> -}
> -#endif
> -
>  int __init init_vuart(struct domain *d, struct kernel_info *kinfo,
>                        const struct dt_device_node *node)
>  {
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 6740da3d324b..2fd89b3a1345 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1178,7 +1178,7 @@ int __init make_cpus_node(const struct domain *d, 
> struct kernel_info *kinfo)
>      /* Keep the compiler happy with -Og */
>      bool clock_valid = false;
>      uint64_t mpidr_aff;
> -    void *fdt = kinfo;
> +    void *fdt = kinfo->fdt;
Here you are fixing a regression introduced in patch 2/3.

I'm ok with this patch. but since you touch common code too you need to wait for
other's opinion. For now, provided you fix the commit msg and regression remark:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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