diff mbox series

[for-next,RFC,8/8] x86: be more verbose when running nested

Message ID 20190923100931.29670-9-liuwe@microsoft.com (mailing list archive)
State Superseded
Headers show
Series Port Xen to Hyper-V | expand

Commit Message

Wei Liu Sept. 23, 2019, 10:09 a.m. UTC
Signed-off-by: Wei Liu <liuwe@microsoft.com>
---
 xen/arch/x86/setup.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Roger Pau Monne Sept. 25, 2019, 10:54 a.m. UTC | #1
On Mon, Sep 23, 2019 at 11:09:31AM +0100, Wei Liu wrote:
> Signed-off-by: Wei Liu <liuwe@microsoft.com>
> ---
>  xen/arch/x86/setup.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index dec60d0301..bbcc5a503d 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -789,6 +789,17 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>  
>      printk("Xen image load base address: %#lx\n", xen_phys_start);
>  
> +#ifdef CONFIG_GUEST
> +#ifdef CONFIG_XEN_GUEST
> +    if ( xen_guest )
> +        printk("Running on Xen hypervisor\n");
> +#endif
> +#ifdef CONFIG_HYPERV_GUEST
> +    if ( hyperv_guest )
> +        printk("Running on Hyper-V\n");
> +#endif
> +#endif

Urg, that's kind of ugly. Why not introduce a hypervisor_name helper
or some such?

You could even have a structure like:

struct hypervisor_ops {
    const char *name;
    bool (*probe)(void);
    void (*setup)(void);
    ...
}

Thanks, Roger.
diff mbox series

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index dec60d0301..bbcc5a503d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -789,6 +789,17 @@  void __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Xen image load base address: %#lx\n", xen_phys_start);
 
+#ifdef CONFIG_GUEST
+#ifdef CONFIG_XEN_GUEST
+    if ( xen_guest )
+        printk("Running on Xen hypervisor\n");
+#endif
+#ifdef CONFIG_HYPERV_GUEST
+    if ( hyperv_guest )
+        printk("Running on Hyper-V\n");
+#endif
+#endif
+
 #ifdef CONFIG_VIDEO
     printk("Video information:\n");