]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Architecture specific setup, obtaining the PV start_info page
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 18 Mar 2015 12:44:38 +0000 (13:44 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 24 Sep 2015 20:08:08 +0000 (21:08 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/boot/head_pv.S
arch/x86/setup.c [new file with mode: 0644]
common/setup.c
config/files.mk
include/arch/x86/config.h [new file with mode: 0644]
include/xen/arch-x86/xen.h [new file with mode: 0644]
include/xen/xen.h
include/xtf/framework.h [new file with mode: 0644]

index 35efa0bf7346d2d4bf486230ba22164f3122c5ab..42c60d049af5317a3f628e830a0780a16e187f8d 100644 (file)
@@ -24,6 +24,14 @@ ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes")
 
  /* PV entry point. */
 GLOBAL(_start)
+
+        /* Stash start_info_t pointer from domain build. */
+#ifdef __x86_64__
+        mov %rsi, start_info
+#else
+        mov %esi, start_info
+#endif
+
         call xtf_main
         ud2
 SIZE(_start)
diff --git a/arch/x86/setup.c b/arch/x86/setup.c
new file mode 100644 (file)
index 0000000..2a2451d
--- /dev/null
@@ -0,0 +1,25 @@
+#include <xtf/types.h>
+
+#include <arch/x86/config.h>
+
+#include <xen/xen.h>
+
+#ifdef CONFIG_ENV_pv
+/* Filled in by head_pv.S */
+start_info_t *start_info = NULL;
+#endif
+
+void arch_setup(void)
+{
+
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
index 219150744694176180b89e03e0fe7c09ae1c45c7..a3e609f4d5664d37453b04c95042ff8c77cce791 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <xtf/compiler.h>
 #include <xtf/hypercall.h>
+#include <xtf/framework.h>
 #include <xtf/test.h>
 
 /**
@@ -15,6 +16,8 @@
  */
 void __noreturn xtf_main(void)
 {
+    arch_setup();
+
     test_main();
 
     hypercall_shutdown(SHUTDOWN_poweroff);
index 145df002a507cc26e5f49e496e0184eade731166..7ca9f2a4fe17bce3e9c2364078fac715d61237b0 100644 (file)
@@ -6,5 +6,7 @@
 
 obj-perarch += $(ROOT)/common/setup.o
 
+obj-perenv += $(ROOT)/arch/x86/setup.o
+
 # Always link hypercall_page.S last as it is a page of data replaced by the hyperisor
 obj-perenv += $(ROOT)/arch/x86/hypercall_page.o
diff --git a/include/arch/x86/config.h b/include/arch/x86/config.h
new file mode 100644 (file)
index 0000000..a99619b
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef XTF_X86_CONFIG_H
+#define XTF_X86_CONFIG_H
+
+#if defined(CONFIG_ENV_pv64) || defined(CONFIG_ENV_pv32)
+# define CONFIG_ENV_pv
+#endif
+
+#endif /* XTF_X86_CONFIG_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/include/xen/arch-x86/xen.h b/include/xen/arch-x86/xen.h
new file mode 100644 (file)
index 0000000..da19b16
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Xen x86 public interface
+ */
+
+#ifndef XEN_PUBLIC_ARCH_X86_XEN_H
+#define XEN_PUBLIC_ARCH_X86_XEN_H
+
+#ifndef __ASSEMBLY__
+typedef unsigned long xen_pfn_t;
+#endif
+
+#endif /* XEN_PUBLIC_ARCH_X86_XEN_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
index f56fd893bae4983d578089533ed3891d8b0cf795..305c47eeaa66864f53630dd22eb8787ca384440b 100644 (file)
@@ -5,8 +5,50 @@
 #ifndef XEN_PUBLIC_XEN_H
 #define XEN_PUBLIC_XEN_H
 
+#if defined(__i386__) || defined(__x86_64__)
+#include "arch-x86/xen.h"
+#else
+#error Bad architecture
+#endif
+
 #define __HYPERVISOR_sched_op             29
 
+#ifndef __ASSEMBLY__
+struct start_info {
+    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.    */
+    char magic[32];             /* "xen-<version>-<platform>".            */
+    unsigned long nr_pages;     /* Total pages allocated to this domain.  */
+    unsigned long shared_info;  /* MACHINE address of shared info struct. */
+    uint32_t flags;             /* SIF_xxx flags.                         */
+    xen_pfn_t store_mfn;        /* MACHINE page number of shared page.    */
+    uint32_t store_evtchn;      /* Event channel for store communication. */
+    union {
+        struct {
+            xen_pfn_t mfn;      /* MACHINE page number of console page.   */
+            uint32_t  evtchn;   /* Event channel for console page.        */
+        } domU;
+        struct {
+            uint32_t info_off;  /* Offset of console_info struct.         */
+            uint32_t info_size; /* Size of console_info struct from start.*/
+        } dom0;
+    } console;
+    /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
+    unsigned long pt_base;      /* VIRTUAL address of page directory.     */
+    unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames.       */
+    unsigned long mfn_list;     /* VIRTUAL address of page-frame list.    */
+    unsigned long mod_start;    /* VIRTUAL address of pre-loaded module   */
+                                /* (PFN of pre-loaded module if           */
+                                /*  SIF_MOD_START_PFN set in flags).      */
+    unsigned long mod_len;      /* Size (bytes) of pre-loaded module.     */
+#define MAX_GUEST_CMDLINE 1024
+    int8_t cmd_line[MAX_GUEST_CMDLINE];
+    /* The pfn range here covers both page table and p->m table frames.   */
+    unsigned long first_p2m_pfn;/* 1st pfn forming initial P->M table.    */
+    unsigned long nr_p2m_frames;/* # of pfns forming initial P->M table.  */
+};
+typedef struct start_info start_info_t;
+#endif
+
 #endif /* XEN_PUBLIC_XEN_H */
 
 /*
diff --git a/include/xtf/framework.h b/include/xtf/framework.h
new file mode 100644 (file)
index 0000000..cb81ae9
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef XTF_FRAMEWORK_H
+#define XTF_FRAMEWORK_H
+
+/* To be implemented by each arch */
+void arch_setup(void);
+
+#endif /* XTF_FRAMEWORK_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */