]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Introduce support for booting with the PVH ABI
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 26 Jan 2018 16:39:15 +0000 (16:39 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 Jan 2018 11:43:43 +0000 (11:43 +0000)
All XTF HVM guests are compatible with the PVH ABI.  Populate the PHYS32_ENTRY
elfnote and stash the pvh_start_info pointer provided by the domain builder.

Skip the Qemu console setup when booting PVH.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/hvm/head.S
arch/x86/hvm/traps.c
arch/x86/include/arch/traps.h
arch/x86/setup.c
include/xen/arch-x86/hvm/start_info.h [new file with mode: 0644]
include/xen/elfnote.h

index 07ec34f8431b226dd883149be0d0333dbfa176b6..5a444171ee015a1f3dbb06649f505d0e7151b274 100644 (file)
@@ -5,6 +5,8 @@
 #include <arch/msr-index.h>
 #include <arch/segment.h>
 
+#include <xen/elfnote.h>
+
         .code32                 /* Always starts in 32bit flat mode. */
 GLOBAL(_start)                  /* HVM common setup. */
 
@@ -92,6 +94,13 @@ ENDFUNC(_start)
 
 DECLSTR(.Lmain_err_msg, "xtf_main() returned\n")
 
+/* All HVM XTF guests are compatible with the PVH ABI. */
+ENTRY(_pvh_start)
+        mov %ebx, pvh_start_info
+        jmp _start
+ENDFUNC(_pvh_start)
+ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long _pvh_start)
+
 /*
  * Local variables:
  * tab-width: 8
index 2a466dfd6f9691e9a72980b609dbbff02de35b55..2797bce039cafd029fe196c48d038bfe50a48022 100644 (file)
@@ -7,6 +7,9 @@
 #include <arch/processor.h>
 #include <arch/desc.h>
 
+/* Filled in by hvm/head.S if started via the PVH entrypoint. */
+xen_pvh_start_info_t *pvh_start_info;
+
 /* Real entry points */
 void entry_DE(void);
 void entry_DB(void);
index 1a0e7470d0c4b6821dadc972323e13c40b8a0df1..e2e7f6942f246a5ac32f74dfe3891b5c122853a6 100644 (file)
@@ -7,6 +7,7 @@
 #include <arch/page.h>
 
 #include <xen/xen.h>
+#include <xen/arch-x86/hvm/start_info.h>
 
 /*
  * Arch-specific function to initialise the exception entry points, etc.
@@ -55,6 +56,7 @@ extern uint8_t boot_stack[3 * PAGE_SIZE];
 extern uint8_t user_stack[PAGE_SIZE];
 
 extern xen_pv_start_info_t *pv_start_info;
+extern xen_pvh_start_info_t *pvh_start_info;
 extern shared_info_t shared_info;
 
 #endif /* XTF_X86_TRAPS_H */
index 5e317c5597a4332da94750a05f83e0ec94aef0af..c41ace441233e9d4d398f3e92ff7454ec42480c3 100644 (file)
@@ -237,7 +237,7 @@ static void xen_console_write(const char *buf, size_t len)
 
 void arch_setup(void)
 {
-    if ( IS_DEFINED(CONFIG_HVM) )
+    if ( IS_DEFINED(CONFIG_HVM) && !pvh_start_info )
         register_console_callback(qemu_console_write);
 
     register_console_callback(xen_console_write);
diff --git a/include/xen/arch-x86/hvm/start_info.h b/include/xen/arch-x86/hvm/start_info.h
new file mode 100644 (file)
index 0000000..2755bc6
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H
+#define XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H
+
+/*
+ * Start of day structure passed to PVH guests and to HVM guests in %ebx.
+ *
+ * NOTE: nothing will be loaded at physical address 0, so a 0 value in any
+ * of the address fields should be treated as not present.
+ *
+ *  0 +----------------+
+ *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
+ *    |                | ("xEn3" with the 0x80 bit of the "E" set).
+ *  4 +----------------+
+ *    | version        | Version of this structure. Current version is 0. New
+ *    |                | versions are guaranteed to be backwards-compatible.
+ *  8 +----------------+
+ *    | flags          | SIF_xxx flags.
+ * 12 +----------------+
+ *    | nr_modules     | Number of modules passed to the kernel.
+ * 16 +----------------+
+ *    | modlist_paddr  | Physical address of an array of modules
+ *    |                | (layout of the structure below).
+ * 24 +----------------+
+ *    | cmdline_paddr  | Physical address of the command line,
+ *    |                | a zero-terminated ASCII string.
+ * 32 +----------------+
+ *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
+ * 40 +----------------+
+ *
+ * The layout of each entry in the module structure is the following:
+ *
+ *  0 +----------------+
+ *    | paddr          | Physical address of the module.
+ *  8 +----------------+
+ *    | size           | Size of the module in bytes.
+ * 16 +----------------+
+ *    | cmdline_paddr  | Physical address of the command line,
+ *    |                | a zero-terminated ASCII string.
+ * 24 +----------------+
+ *    | reserved       |
+ * 32 +----------------+
+ *
+ * The address and sizes are always a 64bit little endian unsigned integer.
+ *
+ * NB: Xen on x86 will always try to place all the data below the 4GiB
+ * boundary.
+ */
+#define XEN_HVM_START_MAGIC_VALUE 0x336ec578
+
+struct xen_hvm_start_info {
+    uint32_t magic;             /* Contains the magic value 0x336ec578       */
+                                /* ("xEn3" with the 0x80 bit of the "E" set).*/
+    uint32_t version;           /* Version of this structure.                */
+    uint32_t flags;             /* SIF_xxx flags.                            */
+    uint32_t nr_modules;        /* Number of modules passed to the kernel.   */
+    uint64_t modlist_paddr;     /* Physical address of an array of           */
+                                /* hvm_modlist_entry.                        */
+    uint64_t cmdline_paddr;     /* Physical address of the command line.     */
+    uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
+                                /* structure.                                */
+};
+typedef struct xen_hvm_start_info xen_pvh_start_info_t;
+
+struct xen_hvm_modlist_entry {
+    uint64_t paddr;             /* Physical address of the module.           */
+    uint64_t size;              /* Size of the module in bytes.              */
+    uint64_t cmdline_paddr;     /* Physical address of the command line.     */
+    uint64_t reserved;
+};
+
+#endif /* XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H */
index e4bfc2052bcb7a3d1d9c7d76e47adab653f0c41e..0f50527886cde57e8700e5b822871cb5c919891c 100644 (file)
@@ -14,6 +14,8 @@
 #define XEN_ELFNOTE_FEATURES      10
 #define XEN_ELFNOTE_BSD_SYMTAB    11
 
+#define XEN_ELFNOTE_PHYS32_ENTRY  18
+
 #endif /* XEN_PUBLIC_ELFNOTE_H */
 
 /*