From: Stefano Stabellini Subject: Re: [PATCH 02/11] early PV on HVM Date: Tue, 11 May 2010 12:23:28 +0100 Message-ID: References: <> <1273501247-27267-3-git-send-email-stefano.stabellini@eu.citrix.com> <20100510154634.GK29517@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Return-path: In-Reply-To: <20100510154634.GK29517@phenom.dumpdata.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: Konrad Rzeszutek Wilk Cc: "xen-devel@lists.xensource.com" , "Yaozu (Eddie) Dong" , Sheng Yang , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Mon, 10 May 2010, Konrad Rzeszutek Wilk wrote: > > @@ -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. > > > @@ -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? > When I rebased to upstream before sending the series to LKML I'll keep this in mind. I am pretty sure I can at least avoid adding the call to xen_guest_init in setup.c, using init_hypervisor_platform instead.