This function will return the number of pages that need to be reserved
in the machine address space.

E820 code will use that number to adjust the maximum PFN available to
Xen.

Signed-off-by: Wei Liu <li...@microsoft.com>
---
 xen/arch/x86/guest/hypervisor.c        | 8 ++++++++
 xen/include/asm-x86/guest/hypervisor.h | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c
index e72c92ffdf..8b9cf1ce4c 100644
--- a/xen/arch/x86/guest/hypervisor.c
+++ b/xen/arch/x86/guest/hypervisor.c
@@ -66,6 +66,14 @@ void hypervisor_resume(void)
         ops->resume();
 }
 
+unsigned int hypervisor_reserve_top_pages(void)
+{
+    if ( ops && ops->reserve_top_pages )
+        return ops->reserve_top_pages();
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/guest/hypervisor.h 
b/xen/include/asm-x86/guest/hypervisor.h
index b503854c5b..37eb9d531e 100644
--- a/xen/include/asm-x86/guest/hypervisor.h
+++ b/xen/include/asm-x86/guest/hypervisor.h
@@ -28,6 +28,8 @@ struct hypervisor_ops {
     int (*ap_setup)(void);
     /* Resume from suspension */
     void (*resume)(void);
+    /* How many top pages to be reserved in machine address space? */
+    unsigned int (*reserve_top_pages)(void);
 };
 
 #ifdef CONFIG_GUEST
@@ -36,6 +38,7 @@ const char *hypervisor_probe(void);
 void hypervisor_setup(void);
 int hypervisor_ap_setup(void);
 void hypervisor_resume(void);
+unsigned int hypervisor_reserve_top_pages(void);
 
 #else
 
@@ -46,6 +49,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) { ASSERT_UNREACHABLE(); return 0; }
 static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); }
+static inline unsigned int hypervisor_reserve_top_pages(void) { return 0; }
 
 #endif  /* CONFIG_GUEST */
 
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to