All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xensource.com,
	"Yaozu (Eddie) Dong" <eddie.dong@intel.com>,
	Sheng Yang <sheng@linux.intel.com>
Subject: Re: [PATCH 02/11] early PV on HVM
Date: Mon, 10 May 2010 11:46:34 -0400	[thread overview]
Message-ID: <20100510154634.GK29517@phenom.dumpdata.com> (raw)
In-Reply-To: <1273501247-27267-3-git-send-email-stefano.stabellini@eu.citrix.com>

On Mon, May 10, 2010 at 03:20:38PM +0100, Stefano Stabellini wrote:
> From: Sheng Yang <sheng@linux.intel.com>
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
> ---
>  arch/x86/include/asm/xen/hypervisor.h |    2 +
>  arch/x86/kernel/setup.c               |    2 +
>  arch/x86/xen/enlighten.c              |   87 +++++++++++++++++++++++++++++++++
>  drivers/input/xen-kbdfront.c          |    2 +-
>  drivers/video/xen-fbfront.c           |    2 +-
>  drivers/xen/xenbus/xenbus_probe.c     |   14 ++++-
>  6 files changed, 104 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
> index d5b7e90..128bc14 100644
> --- a/arch/x86/include/asm/xen/hypervisor.h
> +++ b/arch/x86/include/asm/xen/hypervisor.h
> @@ -45,8 +45,10 @@ enum xen_domain_type {
>  
>  #ifdef CONFIG_XEN
>  extern enum xen_domain_type xen_domain_type;
> +extern void xen_guest_init(void);
>  #else
>  #define xen_domain_type		XEN_NATIVE
> +#define xen_guest_init() do { } while (0)
>  #endif
>  
>  #define xen_domain()		(xen_domain_type != XEN_NATIVE)
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 2a34f9c..cd38ca0 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -102,6 +102,7 @@
>  
>  #include <asm/paravirt.h>
>  #include <asm/hypervisor.h>
> +#include <asm/xen/hypervisor.h>
>  
>  #include <asm/percpu.h>
>  #include <asm/topology.h>
> @@ -1014,6 +1015,7 @@ void __init setup_arch(char **cmdline_p)
>  	probe_nr_irqs_gsi();
>  
>  	kvm_guest_init();
> +	xen_guest_init();

Upstream has this new mechanism for detecting hypervisors with a fancy
data structure that makes '->detect' and other things. You might want to
take that under consideration as when you post this patch upstream
upstream they are going to ask why you aren't using it.

>  
>  	e820_reserve_resources();
>  	e820_mark_nosave_regions(max_low_pfn);
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index dfbf70e..723f53c 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -32,6 +32,8 @@
>  #include <xen/interface/version.h>
>  #include <xen/interface/physdev.h>
>  #include <xen/interface/vcpu.h>
> +#include <xen/interface/memory.h>
> +#include <xen/interface/hvm/hvm_op.h>
>  #include <xen/features.h>
>  #include <xen/page.h>
>  #include <xen/hvc-console.h>
> @@ -1189,3 +1191,88 @@ asmlinkage void __init xen_start_kernel(void)
>  	x86_64_start_reservations((char *)__pa_symbol(&boot_params));
>  #endif
>  }
> +
> +static uint32_t xen_cpuid_base(void)
> +{
> +	uint32_t base, eax, ebx, ecx, edx;
> +	char signature[13];
> +
> +	for (base = 0x40000000; base < 0x40010000; base += 0x100) {
> +		cpuid(base, &eax, &ebx, &ecx, &edx);
> +		*(uint32_t*)(signature + 0) = ebx;
> +		*(uint32_t*)(signature + 4) = ecx;
> +		*(uint32_t*)(signature + 8) = edx;
> +		signature[12] = 0;
> +
> +		if (!strcmp("XenVMMXenVMM", signature) && ((eax - base) >= 2))
> +			return base;
> +	}
> +
> +	return 0;
> +}

And this seems to be used by the VMWare/HyperV detection engine too.

Maybe make another patch that makes a generic cpuid function that can be
shared with VMWAre/HyperV/Xen?

  reply	other threads:[~2010-05-10 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10 14:20 [PATCH 02/11] early PV on HVM Stefano Stabellini
2010-05-10 15:46 ` Konrad Rzeszutek Wilk [this message]
2010-05-11 11:23   ` Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2010-05-24 18:25 [PATCH 0 of 12] PV on HVM Xen Stefano Stabellini
2010-05-24 18:27 ` [PATCH 02/11] early PV on HVM Stefano Stabellini

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=20100510154634.GK29517@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=sheng@linux.intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.