All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFCv2 30/38] x86/hyperlaunch: introduce concept of core domains
@ 2025-05-15 13:19 Daniel P. Smith
  2025-05-15 13:19 ` [RFCv2 31/38] common/gzip: add function to read isize field Daniel P. Smith
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Daniel P. Smith @ 2025-05-15 13:19 UTC (permalink / raw)
  To: xen-devel
  Cc: Daniel P. Smith, jason.andryuk, stefano.stabellini, agarciav,
	Jan Beulich, Andrew Cooper, Roger Pau Monné

When constructing a disaggregated Xen system, there are certain domains with
particular capabilities that must be present and running at start-of-day. The
hardware domain is absolutely required, while a xenstore domain is mostly
required.

The function build_core_domains is introduced to encapsulate the construction
of the core domains.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>

---

Changes in RFCv2:
- rewrote build_core_domains due address the reordering event channel creation
---
 xen/arch/x86/domain-builder/core.c     | 66 +++++++++++++++++++++++---
 xen/arch/x86/include/asm/boot-domain.h |  2 +
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/domain-builder/core.c b/xen/arch/x86/domain-builder/core.c
index 4eaf3a111208..af79792b5316 100644
--- a/xen/arch/x86/domain-builder/core.c
+++ b/xen/arch/x86/domain-builder/core.c
@@ -3,24 +3,76 @@
  * Copyright (C) 2025, Apertus Solutions, LLC
  */
 
+#include <xen/bug.h>
 #include <xen/domain-builder.h>
 #include <xen/init.h>
 #include <xen/lib.h>
 
 #include <asm/bootinfo.h>
+#include <asm/pv/shim.h>
+
+static int  __init build_core_domains(struct boot_info *bi)
+{
+    int count = 0;
+    struct boot_domain *bd;
+    int hw, xs;
+
+    hw = first_boot_domain_index(bi, DOMAIN_CAPS_HARDWARE);
+    if ( hw > MAX_NR_BOOTDOMS )
+        panic("%s: hardware domain missing\n", __func__);
+    else
+    {
+        bd = &bi->domains[hw];
+
+        arch_create_dom(bi, bd);
+        if ( bd->d )
+        {
+            bd->constructed = true;
+            count++;
+        }
+    }
+
+    xs = first_boot_domain_index(bi, DOMAIN_CAPS_XENSTORE);
+    if ( xs > MAX_NR_BOOTDOMS )
+        printk(XENLOG_WARNING "No xenstore domain was defined\n");
+    else
+    {
+        if ( !bi->domains[xs].constructed )
+        {
+            bd = &bi->domains[xs];
+
+            arch_create_dom(bi, bd);
+            if ( bd->d )
+            {
+                bd->constructed = true;
+                count++;
+            }
+        }
+    }
+
+    ASSERT(count <= bi->nr_domains);
+
+    return count;
+}
 
 unsigned int __init builder_create_domains(struct boot_info *bi)
 {
     unsigned int build_count = 0;
-    struct boot_domain *bd = &bi->domains[0];
-
-    if ( bd->capabilities & DOMAIN_CAPS_HARDWARE && bd->kernel == NULL )
-        panic("%s: hardware domain missing kernel\n", __func__);
 
+    if ( bi->nr_domains == 0 )
+        panic("%s: no domains defined\n", __func__);
 
-    arch_create_dom(bi, bd);
-    if ( bd->d )
-        build_count++;
+    if ( pv_shim )
+    {
+        arch_create_dom(bi, &bi->domains[0]);
+        if ( bi->domains[0].d )
+        {
+            bi->domains[0].constructed = true;
+            build_count++;
+        }
+    }
+    else
+        build_count = build_core_domains(bi);
 
     arch_builder_finalize(bi);
 
diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/asm/boot-domain.h
index 66f3a71fd597..41246f31acce 100644
--- a/xen/arch/x86/include/asm/boot-domain.h
+++ b/xen/arch/x86/include/asm/boot-domain.h
@@ -36,6 +36,8 @@ struct boot_domain {
     struct domain *d;
 
     xen_pfn_t xs_page, cons_page;
+
+    bool constructed;
 };
 
 static inline bool __init has_dom0_caps(const struct boot_domain *bd)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-05-15 13:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-15 13:19 [RFCv2 30/38] x86/hyperlaunch: introduce concept of core domains Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 31/38] common/gzip: add function to read isize field Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 32/38] x86/hyperlaunch: move headroom under domain builder Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 33/38] x86/hyperlaunch: move kernel extraction " Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 34/38] x86/hyperlaunch: introduce multidomain kconfig option Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 35/38] x86/hyperlaunch: add multidomain construction logic Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 36/38] x86/hyperlaunch: enable unpausing mulitple domains Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 37/38] x86/hyperlaunch: generalize domid assignment Daniel P. Smith
2025-05-15 13:19 ` [RFCv2 38/38] tools: introduce hyperlaunch domain late init Daniel P. Smith

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.