diff mbox series

[RFC,06/10] hyperlaunch: add structures to hold parsed dtb

Message ID 20211217233437.13791-7-dpsmith@apertussolutions.com (mailing list archive)
State New, archived
Headers show
Series Hyperlaunch x86 Dom0 launch | expand

Commit Message

Daniel P. Smith Dec. 17, 2021, 11:34 p.m. UTC
Hyperlaunch builds from dom0less' `struct bootmodule` as the representation of
a boot module provided by a bootloader. From there it expands to cover the
representations proposed in the hyperlaunch design documentation.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Reviewed-by: Christopher Clark <christopher.clark@starlab.io>
---
 xen/include/xen/setup.h | 81 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
diff mbox series

Patch

diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h
index 6fbe87860e..69ea042716 100644
--- a/xen/include/xen/setup.h
+++ b/xen/include/xen/setup.h
@@ -5,6 +5,87 @@ 
 
 #include <asm/setup.h>
 
+/* Reusing Dom0less definitions */
+typedef enum {
+    BOOTMOD_XEN,
+    BOOTMOD_FDT,
+    BOOTMOD_KERNEL,
+    BOOTMOD_RAMDISK,
+    BOOTMOD_MICROCODE,
+    BOOTMOD_XSM,
+    BOOTMOD_GUEST_DTB,
+    BOOTMOD_GUEST_CONF,
+    BOOTMOD_UNKNOWN
+}  bootmodule_kind;
+
+struct bootmodule {
+    bootmodule_kind kind;
+    bool domU;
+    paddr_t start;
+    paddr_t size;
+};
+
+/* End reuse */
+
+struct memrange {
+    paddr_t start;
+    paddr_t size;
+};
+
+/* Currently only two config modules supported, microcode and xsm policy */
+#define HL_MAX_CONFIG_MODULES 2
+struct bootconfig {
+    uint16_t nr_mods;
+    struct bootmodule mods[HL_MAX_CONFIG_MODULES];
+};
+
+struct bootdomain {
+#define HL_PERMISSION_NONE          (0)
+#define HL_PERMISSION_CONTROL       (1 << 0)
+#define HL_PERMISSION_HARDWARE      (1 << 1)
+    uint32_t permissions;
+
+#define HL_FUNCTION_NONE            (0)
+#define HL_FUNCTION_BOOT            (1 << 0)
+#define HL_FUNCTION_CRASH           (1 << 1)
+#define HL_FUNCTION_CONSOLE         (1 << 2)
+#define HL_FUNCTION_XENSTORE        (1 << 30)
+#define HL_FUNCTION_LEGACY_DOM0     (1 << 31)
+    uint32_t functions;
+
+#define HL_MODE_PARAVIRTUALIZED     (1 << 0) /* PV | PVH/HVM */
+#define HL_MODE_ENABLE_DEVICE_MODEL (1 << 1) /* HVM | PVH */
+#define HL_MODE_LONG                (1 << 2) /* 64 BIT | 32 BIT */
+    uint32_t mode;
+
+    domid_t domid;
+    uint8_t uuid[16];
+
+    uint32_t ncpus;
+    bool maxmem_set;
+    struct memrange memrange[2]; /* 0: min; 1: max */
+
+#define HL_MAX_SECID_LEN 64
+    unsigned char secid[HL_MAX_SECID_LEN];
+
+#define HL_MAX_DOMAIN_MODULES 3
+    uint16_t nr_mods;
+    struct bootmodule modules[HL_MAX_DOMAIN_MODULES];
+#define HL_MAX_CMDLINE_LEN 1024
+    unsigned char cmdline[HL_MAX_CMDLINE_LEN];
+};
+
+struct hyperlaunch_config {
+    const void *fdt;
+#ifdef CONFIG_MULTIBOOT
+    module_t *mods;
+#endif
+    struct bootconfig config;
+#define HL_MAX_BOOT_DOMAINS 64
+    uint16_t nr_doms;
+    struct bootdomain domains[HL_MAX_BOOT_DOMAINS];
+};
+
 #ifdef CONFIG_HYPERLAUNCH
 extern bool hyperlaunch_enabled;
 #else