WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 02/11] early PV on HVM

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 02/11] early PV on HVM
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Mon, 10 May 2010 11:46:34 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, "Yaozu \(Eddie\) Dong" <eddie.dong@xxxxxxxxx>, Sheng Yang <sheng@xxxxxxxxxxxxxxx>
Delivery-date: Mon, 10 May 2010 08:47:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1273501247-27267-3-git-send-email-stefano.stabellini@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <> <1273501247-27267-3-git-send-email-stefano.stabellini@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.19 (2009-01-05)
On Mon, May 10, 2010 at 03:20:38PM +0100, Stefano Stabellini wrote:
> From: Sheng Yang <sheng@xxxxxxxxxxxxxxx>
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> Signed-off-by: Sheng Yang <sheng@xxxxxxxxxxxxxxx>
> Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@xxxxxxxxx>
> ---
>  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?

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>