]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/hypervisor: provide hypervisor_fixup_e820
authorWei Liu <liuwe@microsoft.com>
Fri, 31 Jan 2020 11:57:31 +0000 (11:57 +0000)
committerWei Liu <liuwe@microsoft.com>
Wed, 5 Feb 2020 15:55:02 +0000 (15:55 +0000)
And implement the hook for Xen guest.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/e820.c
xen/arch/x86/guest/hypervisor.c
xen/arch/x86/guest/xen/xen.c
xen/include/asm-x86/guest/hypervisor.h

index b9f589cac34c1592af8b02633cb84adbf5c9231d..160f029edd0dc8ae034f32949ba599848a7da728 100644 (file)
@@ -691,8 +691,8 @@ unsigned long __init init_e820(const char *str, struct e820map *raw)
 
     machine_specific_memory_setup(raw);
 
-    if ( pv_shim )
-        pv_shim_fixup_e820(&e820);
+    if ( cpu_has_hypervisor )
+        hypervisor_e820_fixup(&e820);
 
     printk("%s RAM map:\n", str);
     print_e820_memory_map(e820.map, e820.nr_map);
index e72c92ffdfeb6803f12ab069df00028fa00b4376..5fd433c8d4ee9e53a721544db185cb2df926ef02 100644 (file)
@@ -66,6 +66,12 @@ void hypervisor_resume(void)
         ops->resume();
 }
 
+void __init hypervisor_e820_fixup(struct e820map *e820)
+{
+    if ( ops && ops->e820_fixup )
+        ops->e820_fixup(e820);
+}
+
 /*
  * Local variables:
  * mode: C
index 22d98989a0ff84889913d6614a18d072b08f7457..1f868f2f8d1a506f25393d106a144a85a4eb71b3 100644 (file)
@@ -314,11 +314,18 @@ static void resume(void)
         pv_console_init();
 }
 
+static void __init e820_fixup(struct e820map *e820)
+{
+    if ( pv_shim )
+        pv_shim_fixup_e820(e820);
+}
+
 static const struct hypervisor_ops ops = {
     .name = "Xen",
     .setup = setup,
     .ap_setup = ap_setup,
     .resume = resume,
+    .e820_fixup = e820_fixup,
 };
 
 const struct hypervisor_ops *__init xg_probe(void)
index 64383f0c3dc5bfeff0021d26ba0038afa8efd650..ade10e74eaff272b316622c6e31ea858f6f437e7 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __X86_HYPERVISOR_H__
 #define __X86_HYPERVISOR_H__
 
+#include <asm/e820.h>
+
 struct hypervisor_ops {
     /* Name of the hypervisor */
     const char *name;
@@ -28,6 +30,8 @@ struct hypervisor_ops {
     int (*ap_setup)(void);
     /* Resume from suspension */
     void (*resume)(void);
+    /* Fix up e820 map */
+    void (*e820_fixup)(struct e820map *e820);
 };
 
 #ifdef CONFIG_GUEST
@@ -36,6 +40,7 @@ const char *hypervisor_probe(void);
 void hypervisor_setup(void);
 int hypervisor_ap_setup(void);
 void hypervisor_resume(void);
+void hypervisor_e820_fixup(struct e820map *e820);
 
 #else
 
@@ -46,6 +51,7 @@ static inline const char *hypervisor_probe(void) { return NULL; }
 static inline void hypervisor_setup(void) { ASSERT_UNREACHABLE(); }
 static inline int hypervisor_ap_setup(void) { return 0; }
 static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); }
+static inline void hypervisor_e820_fixup(struct e820map *e820) {}
 
 #endif  /* CONFIG_GUEST */