]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
x86: be more verbose when running on a hypervisor
authorWei Liu <liuwe@microsoft.com>
Mon, 30 Sep 2019 13:23:27 +0000 (14:23 +0100)
committerWei Liu <liuwe@microsoft.com>
Tue, 5 Nov 2019 11:19:52 +0000 (11:19 +0000)
Signed-off-by: Wei Liu <liuwe@microsoft.com>
---
V3: Address Roger's comment, add ASSERTs

xen/arch/x86/guest/hypervisor.c
xen/arch/x86/setup.c
xen/include/asm-x86/guest/hypervisor.h

index 33bf1a769d9a89de5501197867451a1480c3195d..a666ad952621c3f48c59b67cd40da805bbf47b7b 100644 (file)
@@ -46,6 +46,12 @@ bool hypervisor_probe(void)
     return false;
 }
 
+const char *hypervisor_name(void)
+{
+    ASSERT(hops);
+    return hops->name;
+}
+
 void hypervisor_setup(void)
 {
     if ( hops && hops->setup )
index 0ee11b15a6ac83fbef731f59303f2b5f34451d85..cf5a7b8e1edef283f401f861b0791daf3e64fadc 100644 (file)
@@ -689,6 +689,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     int i, j, e820_warn = 0, bytes = 0;
     bool acpi_boot_table_init_done = false, relocated = false;
     int ret;
+    bool running_on_hypervisor;
     struct ns16550_defaults ns16550 = {
         .data_bits = 8,
         .parity    = 'n',
@@ -763,7 +764,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
      * allocing any xenheap structures wanted in lower memory. */
     kexec_early_calculations();
 
-    hypervisor_probe();
+    running_on_hypervisor = hypervisor_probe();
 
     parse_video_info();
 
@@ -789,6 +790,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Xen image load base address: %#lx\n", xen_phys_start);
 
+    if ( running_on_hypervisor )
+        printk("Running on %s\n", hypervisor_name());
+
 #ifdef CONFIG_VIDEO
     printk("Video information:\n");
 
index 38344e2e89dcfd8b4a891b57c6cd777a60da7276..e106fd7a5f4d3df705ce65992fa30a4addce2578 100644 (file)
@@ -36,15 +36,18 @@ bool hypervisor_probe(void);
 void hypervisor_setup(void);
 void hypervisor_ap_setup(void);
 void hypervisor_resume(void);
+const char *hypervisor_name(void);
 
 #else
 
+#include <xen/lib.h>
 #include <xen/types.h>
 
 static inline bool hypervisor_probe(void) { return false; }
 static inline void hypervisor_setup(void) {}
 static inline void hypervisor_ap_setup(void) {}
 static inline void hypervisor_resume(void) {}
+static inline const char *hypervisor_name(void) { ASSERT_UNREACHABLE(); return NULL; }
 
 #endif  /* CONFIG_GUEST */