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

[RFC 09/10] hyperlaunch: add domain creation logic


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Fri, 17 Dec 2021 18:34:35 -0500
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769538; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=1+rH6E1T2X2GXGjtweKYSNPXNycy0FvEQLaaEz+oWec=; b=mS9lXSLSCN/7pBwxZs/wY+XHHQu1yfNx0xtU0jHjNWk9rx3HwqE6427IFEkhW4xa15wh2hYuh5I1dwzolT4gawqSF+J4j1v5yB79V0mgezkrTtkakD2/t2goTRUEv0CzqXOkVFi93UptEHs48PurzO1dqBjdTnvSPYTkqyPlmxg=
  • Arc-seal: i=1; a=rsa-sha256; t=1639769538; cv=none; d=zohomail.com; s=zohoarc; b=RDK9IwhFyLlcrau1HLkiCLie1koVD68x2sxkYoIienDSzl0T5QeSv85CMMBq0dlzN6O4nyMS9oB8MV9CSuLp0z098cUrbpY/1IQRxdDO0AykeBgcZd5SU5uI6lP7Oc0z7D0fZnmTejPaDCcKm2uOOFnJlxX9lioZC2lmqPlSGV0=
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Christopher Clark <christopher.clark@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 17 Dec 2021 19:39:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This commit introduces the skeleton of hyperlaunch domain construction
mechanics and adds the preliminary ability to construct dom0.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Christopher Clark <christopher.clark@xxxxxxxxxx>
---
 xen/common/setup.c      | 77 +++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/setup.h | 16 +++++++++
 2 files changed, 93 insertions(+)

diff --git a/xen/common/setup.c b/xen/common/setup.c
index af2b1a422d..cd24f60297 100644
--- a/xen/common/setup.c
+++ b/xen/common/setup.c
@@ -1,3 +1,4 @@
+#include <asm/bzimage.h> /* for bzimage_headroom */
 #include <xen/pci.h> /* needed by device_tree.h */
 #include <xen/device_tree.h>
 #include <xen/init.h>
@@ -368,6 +369,82 @@ bool __init hyperlaunch_mb_init(module_t *mods)
 
     return ret;
 }
+
+void __init hyperlaunch_mb_headroom(void)
+{
+    int i,j;
+
+    for( i = 0; i < hl_config.nr_doms; i++ )
+    {
+        for ( j = 0; j < hl_config.domains[i].nr_mods; j++ )
+        {
+            if ( hl_config.domains[i].modules[j].kind == BOOTMOD_KERNEL )
+            {
+                module_t *kern =
+                    (module_t *)_p(hl_config.domains[i].modules[j].start);
+
+                kern->headroom = bzimage_headroom(bootstrap_map(kern),
+                                                  kern->mod_end);
+                bootstrap_map(NULL);
+            }
+        }
+    }
+}
 #endif
 
+uint32_t __init hyperlaunch_create_domains(
+    struct domain **hwdom, const char *kextra, const char *loader)
+{
+    uint32_t dom_count = 0, functions_used = 0;
+    int i;
+
+    *hwdom = NULL;
+
+    for ( i = 0; i < hl_config.nr_doms; i++ )
+    {
+        struct bootdomain *d = &(hl_config.domains[i]);
+
+        /* build a legacy dom0 and set it as the hwdom */
+        if ( (d->functions & HL_FUNCTION_LEGACY_DOM0) &&
+             !(functions_used & HL_FUNCTION_LEGACY_DOM0) )
+        {
+            module_t *image = NULL, *initrd = NULL;
+            int j;
+
+            for ( j = 0; j < d->nr_mods; j++ )
+            {
+                if ( d->modules[j].kind == BOOTMOD_KERNEL )
+                    image = (module_t *)_p(d->modules[j].start);
+
+                if ( d->modules[j].kind == BOOTMOD_RAMDISK )
+                    initrd = (module_t *)_p(d->modules[j].start);
+
+                if ( image && initrd )
+                    break;
+            }
+
+            if ( image == NULL )
+                return 0;
+
+#ifdef CONFIG_MULTIBOOT
+            *hwdom = create_dom0(image, image->headroom, initrd, kextra,
+                                 loader);
+#endif
+            if ( *hwdom )
+            {
+                functions_used |= HL_FUNCTION_LEGACY_DOM0;
+                dom_count++;
+            }
+            else
+                panic("HYPERLAUNCH: "
+                      "Dom0 config present but dom0 construction failed\n");
+        }
+        else
+            printk(XENLOG_WARNING "hyperlaunch: "
+                   "currently only supports classic dom0 construction");
+    }
+
+    return dom_count;
+}
+
 #endif
diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h
index fd4c23c08f..3833867470 100644
--- a/xen/include/xen/setup.h
+++ b/xen/include/xen/setup.h
@@ -93,8 +93,12 @@ int __init hyperlaunch_init(const void *fdt);
 
 #ifdef CONFIG_MULTIBOOT
 bool __init hyperlaunch_mb_init(module_t *mods);
+void __init hyperlaunch_mb_headroom(void);
 #endif
 
+uint32_t __init hyperlaunch_create_domains(
+    struct domain **hwdom, const char *kextra, const char *loader);
+
 #else /* CONFIG_HYPERLAUNCH */
 
 #define hyperlaunch_enabled false
@@ -109,7 +113,19 @@ static inline bool __init hyperlaunch_mb_init(module_t 
*mods)
 {
     return false;
 }
+
+void __init hyperlaunch_mb_headroom(void)
+{
+    return;
+}
 #endif
 
+static inline uint32_t __init hyperlaunch_create_domains(
+    struct domain **hwdom, const char *kextra, const char *loader)
+{
+    return 0;
+}
+
 #endif /* CONFIG_HYPERLAUNCH */
+
 #endif /* XEN_SETUP_H */
-- 
2.20.1




 


Rackspace

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