All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <pdurrant@gmail.com>
To: Wei Liu <wl@xen.org>
Cc: "Wei Liu" <liuwe@microsoft.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Michael Kelley" <mikelley@microsoft.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Xen Development List" <xen-devel@lists.xenproject.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH for-next v3 8/9] x86: be more verbose when running on a hypervisor
Date: Wed, 23 Oct 2019 10:03:43 +0100	[thread overview]
Message-ID: <CACCGGhAbawhxSWHbewiDH+ypWREd4Td0OZk5CHFekMofnjT64w@mail.gmail.com> (raw)
In-Reply-To: <20191021155718.28653-9-liuwe@microsoft.com>

On Mon, 21 Oct 2019 at 17:00, Wei Liu <wl@xen.org> wrote:
>
> Signed-off-by: Wei Liu <liuwe@microsoft.com>

Reviewed-by: Paul Durrant <paul@xen.org>

> ---
> V3: Address Roger's comment, add ASSERTs
> ---
>  xen/arch/x86/guest/hypervisor.c        | 6 ++++++
>  xen/arch/x86/setup.c                   | 6 +++++-
>  xen/include/asm-x86/guest/hypervisor.h | 3 +++
>  3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c
> index 33bf1a769d..a666ad9526 100644
> --- a/xen/arch/x86/guest/hypervisor.c
> +++ b/xen/arch/x86/guest/hypervisor.c
> @@ -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 )
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index 0ee11b15a6..cf5a7b8e1e 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -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");
>
> diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h
> index 38344e2e89..b583722f5d 100644
> --- a/xen/include/asm-x86/guest/hypervisor.h
> +++ b/xen/include/asm-x86/guest/hypervisor.h
> @@ -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 char *hypervisor_name(void) { ASSERT_UNREACHABLE(); return NULL; }
>
>  #endif  /* CONFIG_GUEST */
>
> --
> 2.20.1
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel

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

  reply	other threads:[~2019-10-23  9:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 15:57 [Xen-devel] [PATCH for-next v3 0/9] Port Xen to Hyper-V Wei Liu
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 1/9] x86: introduce CONFIG_GUEST and move code Wei Liu
2019-10-23  7:55   ` Paul Durrant
2019-10-23 10:49     ` Wei Liu
2019-11-15 13:34   ` Jan Beulich
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 2/9] x86: include asm_defns.h directly in hypercall.h Wei Liu
2019-11-15 13:36   ` Jan Beulich
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 3/9] x86: drop hypervisor_cpuid_base Wei Liu
2019-11-15 13:39   ` Jan Beulich
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 4/9] x86: include xen/lib.h in guest/hypercall.h Wei Liu
2019-11-15 13:40   ` Jan Beulich
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 5/9] x86: introduce hypervisor framework Wei Liu
2019-10-23  8:19   ` Paul Durrant
2019-11-15 13:48   ` Jan Beulich
2019-11-21 16:27     ` Wei Liu
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 6/9] x86: rename hypervisor_{alloc, free}_unused_page Wei Liu
2019-11-15 13:49   ` Jan Beulich
2019-11-21 16:27     ` Wei Liu
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 7/9] x86: switch xen implementation to use hypervisor framework Wei Liu
2019-10-23  9:02   ` Paul Durrant
2019-11-15 13:56   ` Jan Beulich
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 8/9] x86: be more verbose when running on a hypervisor Wei Liu
2019-10-23  9:03   ` Paul Durrant [this message]
2019-11-15 13:59   ` Jan Beulich
2019-10-21 15:57 ` [Xen-devel] [PATCH for-next v3 9/9] x86: introduce CONFIG_HYPERV and detection code Wei Liu
2019-10-23  9:07   ` Paul Durrant
2019-10-23 10:50     ` Wei Liu
2019-11-15 14:07   ` Jan Beulich
2019-11-21 16:27     ` Wei Liu
2019-11-21 16:59       ` Jan Beulich
2019-11-21 17:02         ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACCGGhAbawhxSWHbewiDH+ypWREd4Td0OZk5CHFekMofnjT64w@mail.gmail.com \
    --to=pdurrant@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=liuwe@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.