From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 02/11] early PV on HVM Date: Mon, 10 May 2010 11:46:34 -0400 Message-ID: <20100510154634.GK29517@phenom.dumpdata.com> References: <> <1273501247-27267-3-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1273501247-27267-3-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefano Stabellini Cc: xen-devel@lists.xensource.com, "Yaozu (Eddie) Dong" , Sheng Yang List-Id: xen-devel@lists.xenproject.org On Mon, May 10, 2010 at 03:20:38PM +0100, Stefano Stabellini wrote: > From: Sheng Yang > > Signed-off-by: Stefano Stabellini > Signed-off-by: Sheng Yang > Signed-off-by: Yaozu (Eddie) Dong > --- > 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 > #include > +#include > > #include > #include > @@ -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 > #include > #include > +#include > +#include > #include > #include > #include > @@ -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?