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.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|