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 08/14] Nested Virtualization: efer

To: "Dong, Eddie" <eddie.dong@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 08/14] Nested Virtualization: efer
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Thu, 19 Aug 2010 09:41:03 +0100
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 19 Aug 2010 01:42:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1A42CE6F5F474C41B63392A5F80372B22A3E5C8F@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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: <1A42CE6F5F474C41B63392A5F80372B22A3E5C8F@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
At 04:33 +0100 on 19 Aug (1282192384), Dong, Eddie wrote:
> > # HG changeset patch
> > # User cegger
> > # Date 1281003856 -7200
> > Allow guest to enable SVM in EFER
> > 
> > diff -r 7789f1d7d7e7 -r 8c7c597735c6 xen/arch/x86/hvm/hvm.c
> > --- a/xen/arch/x86/hvm/hvm.c
> > +++ b/xen/arch/x86/hvm/hvm.c
> > @@ -616,6 +616,7 @@ static bool_t hvm_efer_valid(uint64_t va
> >  {
> >      return !((value & ~efer_validbits) ||
> >               ((sizeof(long) != 8) && (value & EFER_LME)) ||
> > +             (!cpu_has_svm && (value & EFER_SVME)) ||
> >               (!cpu_has_nx && (value & EFER_NX)) ||
> >               (!cpu_has_syscall && (value & EFER_SCE)) ||
> >               (!cpu_has_lmsl && (value & EFER_LMSLE)) ||
> > @@ -630,6 +631,7 @@ static int hvm_load_cpu_ctxt(struct doma
> >      struct hvm_hw_cpu ctxt;
> >      struct segment_register seg;
> >      struct vcpu_guest_context *vc;
> > +    uint64_t efer_validbits;
> > 
> >      /* Which vcpu is this? */
> >      vcpuid = hvm_load_instance(h);
> > @@ -669,9 +671,12 @@ static int hvm_load_cpu_ctxt(struct doma
> >          return -EINVAL;
> >      }
> > 
> > -    if ( !hvm_efer_valid(
> > -        ctxt.msr_efer,
> > -        EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_LMA | EFER_NX |
> > EFER_SCE) ) +    efer_validbits = EFER_FFXSE | EFER_LMSLE | EFER_LME
> > | EFER_LMA +                   | EFER_NX | EFER_SCE;
> > +    if ( nestedhvm_enabled(v->domain) )
> > +        efer_validbits |= EFER_SVME;
> 
> Check it is running on SVM first. 

This check is made in hvm_efer_valid().  But it might be less confusing
to have hvm_efer_valid() check nestedhvm_enabled() as well rather than
do half the check in the caller and half in the function.

Tim.


-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

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

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