[PATCH v7 03/11] x86: Replace arch-specific boot_domain with the common one

Alejandro Vallejo posted 11 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH v7 03/11] x86: Replace arch-specific boot_domain with the common one
Posted by Alejandro Vallejo 3 months, 2 weeks ago
No functional change intended.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/hvm/dom0_build.c          |  2 +-
 xen/arch/x86/include/asm/boot-domain.h | 33 --------------------------
 xen/arch/x86/include/asm/bootinfo.h    |  1 -
 xen/arch/x86/pv/dom0_build.c           |  2 +-
 xen/arch/x86/setup.c                   |  2 +-
 xen/include/xen/bootfdt.h              |  4 ++++
 6 files changed, 7 insertions(+), 37 deletions(-)
 delete mode 100644 xen/arch/x86/include/asm/boot-domain.h

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 2bb8ef355c..8d2734f2b5 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -648,7 +648,7 @@ static int __init pvh_load_kernel(
 {
     struct domain *d = bd->d;
     struct boot_module *image = bd->kernel;
-    struct boot_module *initrd = bd->module;
+    struct boot_module *initrd = bd->initrd;
     void *image_base = bootstrap_map_bm(image);
     void *image_start = image_base + image->arch.headroom;
     unsigned long image_len = image->size;
diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/asm/boot-domain.h
deleted file mode 100644
index d7c6042e25..0000000000
--- a/xen/arch/x86/include/asm/boot-domain.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2024 Apertus Solutions, LLC
- * Author: Daniel P. Smith <dpsmith@apertussolutions.com>
- * Copyright (c) 2024 Christopher Clark <christopher.w.clark@gmail.com>
- */
-
-#ifndef __XEN_X86_BOOTDOMAIN_H__
-#define __XEN_X86_BOOTDOMAIN_H__
-
-#include <public/xen.h>
-
-struct boot_domain {
-    domid_t domid;
-
-    struct boot_module *kernel;
-    struct boot_module *module;
-    const char *cmdline;
-
-    struct domain *d;
-};
-
-#endif
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index d33b100e04..4f2cc5906e 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -12,7 +12,6 @@
 #include <xen/init.h>
 #include <xen/multiboot.h>
 #include <xen/types.h>
-#include <asm/boot-domain.h>
 
 /* Max number of boot modules a bootloader can provide in addition to Xen */
 #define MAX_NR_BOOTMODS 63
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index a4b5362357..c37bea9454 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -375,7 +375,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
     struct vcpu *v = d->vcpu[0];
 
     struct boot_module *image = bd->kernel;
-    struct boot_module *initrd = bd->module;
+    struct boot_module *initrd = bd->initrd;
     void *image_base;
     unsigned long image_len;
     void *image_start;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 7e70b46332..7380f1053f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2171,7 +2171,7 @@ void asmlinkage __init noreturn __start_xen(void)
     if ( initrdidx < MAX_NR_BOOTMODS )
     {
         bi->mods[initrdidx].kind = BOOTMOD_RAMDISK;
-        bi->domains[0].module = &bi->mods[initrdidx];
+        bi->domains[0].initrd = &bi->mods[initrdidx];
         if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMODS )
             printk(XENLOG_WARNING
                    "Multiple initrd candidates, picking module #%u\n",
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index 28f7d18262..ac2a79b59b 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -103,6 +103,10 @@ struct shared_meminfo {
 struct boot_domain {
     struct domain *d;
 
+#ifdef CONFIG_X86
+    domid_t domid;
+#endif
+
     struct boot_module *kernel;
     struct boot_module *initrd;
 
-- 
2.43.0
Re: [PATCH v7 03/11] x86: Replace arch-specific boot_domain with the common one
Posted by Jan Beulich 3 months, 2 weeks ago
On 15.07.2025 18:10, Alejandro Vallejo wrote:
> No functional change intended.
> 
> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Jan Beulich <jbeulich@suse.com>
Re: [PATCH v7 03/11] x86: Replace arch-specific boot_domain with the common one
Posted by Stefano Stabellini 3 months, 2 weeks ago
Hi Jan,

It looks like this patch is the only one missing an Ack. (Aside from
patch #11).

Cheers,

Stefano

On Tue, 15 Jul 2025, Alejandro Vallejo wrote:
> No functional change intended.
> 
> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
>  xen/arch/x86/hvm/dom0_build.c          |  2 +-
>  xen/arch/x86/include/asm/boot-domain.h | 33 --------------------------
>  xen/arch/x86/include/asm/bootinfo.h    |  1 -
>  xen/arch/x86/pv/dom0_build.c           |  2 +-
>  xen/arch/x86/setup.c                   |  2 +-
>  xen/include/xen/bootfdt.h              |  4 ++++
>  6 files changed, 7 insertions(+), 37 deletions(-)
>  delete mode 100644 xen/arch/x86/include/asm/boot-domain.h
> 
> diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
> index 2bb8ef355c..8d2734f2b5 100644
> --- a/xen/arch/x86/hvm/dom0_build.c
> +++ b/xen/arch/x86/hvm/dom0_build.c
> @@ -648,7 +648,7 @@ static int __init pvh_load_kernel(
>  {
>      struct domain *d = bd->d;
>      struct boot_module *image = bd->kernel;
> -    struct boot_module *initrd = bd->module;
> +    struct boot_module *initrd = bd->initrd;
>      void *image_base = bootstrap_map_bm(image);
>      void *image_start = image_base + image->arch.headroom;
>      unsigned long image_len = image->size;
> diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/asm/boot-domain.h
> deleted file mode 100644
> index d7c6042e25..0000000000
> --- a/xen/arch/x86/include/asm/boot-domain.h
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> - * Copyright (c) 2024 Apertus Solutions, LLC
> - * Author: Daniel P. Smith <dpsmith@apertussolutions.com>
> - * Copyright (c) 2024 Christopher Clark <christopher.w.clark@gmail.com>
> - */
> -
> -#ifndef __XEN_X86_BOOTDOMAIN_H__
> -#define __XEN_X86_BOOTDOMAIN_H__
> -
> -#include <public/xen.h>
> -
> -struct boot_domain {
> -    domid_t domid;
> -
> -    struct boot_module *kernel;
> -    struct boot_module *module;
> -    const char *cmdline;
> -
> -    struct domain *d;
> -};
> -
> -#endif
> -
> -/*
> - * Local variables:
> - * mode: C
> - * c-file-style: "BSD"
> - * c-basic-offset: 4
> - * tab-width: 4
> - * indent-tabs-mode: nil
> - * End:
> - */
> diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
> index d33b100e04..4f2cc5906e 100644
> --- a/xen/arch/x86/include/asm/bootinfo.h
> +++ b/xen/arch/x86/include/asm/bootinfo.h
> @@ -12,7 +12,6 @@
>  #include <xen/init.h>
>  #include <xen/multiboot.h>
>  #include <xen/types.h>
> -#include <asm/boot-domain.h>
>  
>  /* Max number of boot modules a bootloader can provide in addition to Xen */
>  #define MAX_NR_BOOTMODS 63
> diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
> index a4b5362357..c37bea9454 100644
> --- a/xen/arch/x86/pv/dom0_build.c
> +++ b/xen/arch/x86/pv/dom0_build.c
> @@ -375,7 +375,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
>      struct vcpu *v = d->vcpu[0];
>  
>      struct boot_module *image = bd->kernel;
> -    struct boot_module *initrd = bd->module;
> +    struct boot_module *initrd = bd->initrd;
>      void *image_base;
>      unsigned long image_len;
>      void *image_start;
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 7e70b46332..7380f1053f 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -2171,7 +2171,7 @@ void asmlinkage __init noreturn __start_xen(void)
>      if ( initrdidx < MAX_NR_BOOTMODS )
>      {
>          bi->mods[initrdidx].kind = BOOTMOD_RAMDISK;
> -        bi->domains[0].module = &bi->mods[initrdidx];
> +        bi->domains[0].initrd = &bi->mods[initrdidx];
>          if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMODS )
>              printk(XENLOG_WARNING
>                     "Multiple initrd candidates, picking module #%u\n",
> diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
> index 28f7d18262..ac2a79b59b 100644
> --- a/xen/include/xen/bootfdt.h
> +++ b/xen/include/xen/bootfdt.h
> @@ -103,6 +103,10 @@ struct shared_meminfo {
>  struct boot_domain {
>      struct domain *d;
>  
> +#ifdef CONFIG_X86
> +    domid_t domid;
> +#endif
> +
>      struct boot_module *kernel;
>      struct boot_module *initrd;
>  
> -- 
> 2.43.0
>
Re: [PATCH v7 03/11] x86: Replace arch-specific boot_domain with the common one
Posted by Jan Beulich 3 months, 2 weeks ago
On 18.07.2025 02:09, Stefano Stabellini wrote:
> It looks like this patch is the only one missing an Ack. (Aside from
> patch #11).

I've sent an ack. Yet according to my records patch 1 also is still
lacking an (XSM) ack. Plus, to be honest, a ping after ...

> On Tue, 15 Jul 2025, Alejandro Vallejo wrote:

... just 3 days feels a little early. Especially as I'm sure you're
aware I'm looking at lots of patches ... (If only many of my patches
were looked at at all, let alone within 3 days.)

Jan

>> No functional change intended.
>>
>> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
>> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>> ---
>>  xen/arch/x86/hvm/dom0_build.c          |  2 +-
>>  xen/arch/x86/include/asm/boot-domain.h | 33 --------------------------
>>  xen/arch/x86/include/asm/bootinfo.h    |  1 -
>>  xen/arch/x86/pv/dom0_build.c           |  2 +-
>>  xen/arch/x86/setup.c                   |  2 +-
>>  xen/include/xen/bootfdt.h              |  4 ++++
>>  6 files changed, 7 insertions(+), 37 deletions(-)
>>  delete mode 100644 xen/arch/x86/include/asm/boot-domain.h
>>
>> diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
>> index 2bb8ef355c..8d2734f2b5 100644
>> --- a/xen/arch/x86/hvm/dom0_build.c
>> +++ b/xen/arch/x86/hvm/dom0_build.c
>> @@ -648,7 +648,7 @@ static int __init pvh_load_kernel(
>>  {
>>      struct domain *d = bd->d;
>>      struct boot_module *image = bd->kernel;
>> -    struct boot_module *initrd = bd->module;
>> +    struct boot_module *initrd = bd->initrd;
>>      void *image_base = bootstrap_map_bm(image);
>>      void *image_start = image_base + image->arch.headroom;
>>      unsigned long image_len = image->size;
>> diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/asm/boot-domain.h
>> deleted file mode 100644
>> index d7c6042e25..0000000000
>> --- a/xen/arch/x86/include/asm/boot-domain.h
>> +++ /dev/null
>> @@ -1,33 +0,0 @@
>> -/* SPDX-License-Identifier: GPL-2.0-or-later */
>> -/*
>> - * Copyright (c) 2024 Apertus Solutions, LLC
>> - * Author: Daniel P. Smith <dpsmith@apertussolutions.com>
>> - * Copyright (c) 2024 Christopher Clark <christopher.w.clark@gmail.com>
>> - */
>> -
>> -#ifndef __XEN_X86_BOOTDOMAIN_H__
>> -#define __XEN_X86_BOOTDOMAIN_H__
>> -
>> -#include <public/xen.h>
>> -
>> -struct boot_domain {
>> -    domid_t domid;
>> -
>> -    struct boot_module *kernel;
>> -    struct boot_module *module;
>> -    const char *cmdline;
>> -
>> -    struct domain *d;
>> -};
>> -
>> -#endif
>> -
>> -/*
>> - * Local variables:
>> - * mode: C
>> - * c-file-style: "BSD"
>> - * c-basic-offset: 4
>> - * tab-width: 4
>> - * indent-tabs-mode: nil
>> - * End:
>> - */
>> diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
>> index d33b100e04..4f2cc5906e 100644
>> --- a/xen/arch/x86/include/asm/bootinfo.h
>> +++ b/xen/arch/x86/include/asm/bootinfo.h
>> @@ -12,7 +12,6 @@
>>  #include <xen/init.h>
>>  #include <xen/multiboot.h>
>>  #include <xen/types.h>
>> -#include <asm/boot-domain.h>
>>  
>>  /* Max number of boot modules a bootloader can provide in addition to Xen */
>>  #define MAX_NR_BOOTMODS 63
>> diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
>> index a4b5362357..c37bea9454 100644
>> --- a/xen/arch/x86/pv/dom0_build.c
>> +++ b/xen/arch/x86/pv/dom0_build.c
>> @@ -375,7 +375,7 @@ static int __init dom0_construct(const struct boot_domain *bd)
>>      struct vcpu *v = d->vcpu[0];
>>  
>>      struct boot_module *image = bd->kernel;
>> -    struct boot_module *initrd = bd->module;
>> +    struct boot_module *initrd = bd->initrd;
>>      void *image_base;
>>      unsigned long image_len;
>>      void *image_start;
>> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
>> index 7e70b46332..7380f1053f 100644
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -2171,7 +2171,7 @@ void asmlinkage __init noreturn __start_xen(void)
>>      if ( initrdidx < MAX_NR_BOOTMODS )
>>      {
>>          bi->mods[initrdidx].kind = BOOTMOD_RAMDISK;
>> -        bi->domains[0].module = &bi->mods[initrdidx];
>> +        bi->domains[0].initrd = &bi->mods[initrdidx];
>>          if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMODS )
>>              printk(XENLOG_WARNING
>>                     "Multiple initrd candidates, picking module #%u\n",
>> diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
>> index 28f7d18262..ac2a79b59b 100644
>> --- a/xen/include/xen/bootfdt.h
>> +++ b/xen/include/xen/bootfdt.h
>> @@ -103,6 +103,10 @@ struct shared_meminfo {
>>  struct boot_domain {
>>      struct domain *d;
>>  
>> +#ifdef CONFIG_X86
>> +    domid_t domid;
>> +#endif
>> +
>>      struct boot_module *kernel;
>>      struct boot_module *initrd;
>>  
>> -- 
>> 2.43.0
>>