]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/boot: introduce domid field to struct boot_domain
authorDaniel P. Smith <dpsmith@apertussolutions.com>
Wed, 9 Apr 2025 13:32:26 +0000 (15:32 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 9 Apr 2025 13:32:26 +0000 (15:32 +0200)
boot_domain stores the domid until it is used to create (and allocate)
struct domain. d->domain_id is not available early enough.

boot_domain domids are initialized to DOMID_INVALID. If not overridden
by device tree, domids of DOMID_INVALID are assigned a valid value. The
domid will be optionally parsed from the device tree configuration.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/include/asm/boot-domain.h
xen/arch/x86/setup.c

index 5e1e1a0b61df45870f56aa063576a78701f5b4df..fcbedda0f00e2049d107dbf8bbad9843b6144e71 100644 (file)
@@ -8,7 +8,11 @@
 #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;
 
index ddb10ea03d305e1804a5ce20766168f017889808..3c257f0bad8cf0280b914502cb4d3f0ed7bb45cc 100644 (file)
@@ -295,6 +295,7 @@ static const char *cmdline_cook(const char *p, const char *loader_name);
 struct boot_info __initdata xen_boot_info = {
     .loader = "unknown",
     .cmdline = "",
+    .domains = { [0 ... MAX_NR_BOOTDOMS - 1] = { .domid = DOMID_INVALID } },
 };
 
 static struct boot_info *__init multiboot_fill_boot_info(
@@ -994,7 +995,6 @@ static struct domain *__init create_dom0(struct boot_info *bi)
     };
     struct boot_domain *bd = &bi->domains[0];
     struct domain *d;
-    domid_t domid;
 
     if ( opt_dom0_pvh )
     {
@@ -1010,15 +1010,15 @@ static struct domain *__init create_dom0(struct boot_info *bi)
         dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
 
     /* Create initial domain.  Not d0 for pvshim. */
-    domid = get_initial_domain_id();
-    d = domain_create(domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged);
+    bd->domid = get_initial_domain_id();
+    d = domain_create(bd->domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged);
     if ( IS_ERR(d) )
-        panic("Error creating d%u: %ld\n", domid, PTR_ERR(d));
+        panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d));
 
     init_dom0_cpuid_policy(d);
 
     if ( alloc_dom0_vcpu0(d) == NULL )
-        panic("Error creating d%uv0\n", domid);
+        panic("Error creating %pdv0\n", d);
 
     /* Grab the DOM0 command line. */
     if ( bd->kernel->cmdline_pa || bi->kextra )