All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 06/14] Nested Virtualization: CRn & paged real mode
@ 2010-08-05 15:02 Christoph Egger
  2010-08-09 12:40 ` Tim Deegan
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Egger @ 2010-08-05 15:02 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]


Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

[-- Attachment #2: xen_nh06_cr.diff --]
[-- Type: text/x-diff, Size: 1151 bytes --]

# HG changeset patch
# User cegger
# Date 1280925502 -7200
Allow paged real mode during vmrun emulation.
Emulate cr0 and cr4 when guest does not intercept them.

diff -r 917f9eb07fc3 -r b1a356e5658d xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -54,6 +54,7 @@
 #include <asm/hvm/support.h>
 #include <asm/hvm/cacheattr.h>
 #include <asm/hvm/trace.h>
+#include <asm/hvm/nestedhvm.h>
 #include <asm/mtrr.h>
 #include <asm/apic.h>
 #include <public/sched.h>
@@ -1105,7 +1106,8 @@ int hvm_set_cr0(unsigned long value)
     /* ET is reserved and should be always be 1. */
     value |= X86_CR0_ET;
 
-    if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
+    if ( !nestedhvm_vmentry_emulate(v) &&
+         (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
         goto gpf;
 
     if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )
@@ -1159,7 +1161,7 @@ int hvm_set_cr0(unsigned long value)
         }
     }
 
-    if ( has_arch_mmios(v->domain) )
+    if ( !nestedhvm_vmentry_emulate(v) && has_arch_mmios(v->domain) )
     {
         if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
         {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 06/14] Nested Virtualization: CRn & paged real mode
  2010-08-05 15:02 [PATCH 06/14] Nested Virtualization: CRn & paged real mode Christoph Egger
@ 2010-08-09 12:40 ` Tim Deegan
  2010-08-11  9:12   ` Christoph Egger
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Deegan @ 2010-08-09 12:40 UTC (permalink / raw)
  To: Christoph Egger; +Cc: xen-devel

> Allow paged real mode during vmrun emulation.
> Emulate cr0 and cr4 when guest does not intercept them.

I understand the paged-real-mode case, but why do you also allow CR0.CD
and CR0.NW for nested VMs?

Cheers,

Tim.

> diff -r 917f9eb07fc3 -r b1a356e5658d xen/arch/x86/hvm/hvm.c
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -54,6 +54,7 @@
>  #include <asm/hvm/support.h>
>  #include <asm/hvm/cacheattr.h>
>  #include <asm/hvm/trace.h>
> +#include <asm/hvm/nestedhvm.h>
>  #include <asm/mtrr.h>
>  #include <asm/apic.h>
>  #include <public/sched.h>
> @@ -1105,7 +1106,8 @@ int hvm_set_cr0(unsigned long value)
>      /* ET is reserved and should be always be 1. */
>      value |= X86_CR0_ET;
>  
> -    if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
> +    if ( !nestedhvm_vmentry_emulate(v) &&
> +         (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
>          goto gpf;
>  
>      if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )
> @@ -1159,7 +1161,7 @@ int hvm_set_cr0(unsigned long value)
>          }
>      }
>  
> -    if ( has_arch_mmios(v->domain) )
> +    if ( !nestedhvm_vmentry_emulate(v) && has_arch_mmios(v->domain) )
>      {
>          if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
>          {

Content-Description: ATT00001..txt
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 06/14] Nested Virtualization: CRn & paged real mode
  2010-08-09 12:40 ` Tim Deegan
@ 2010-08-11  9:12   ` Christoph Egger
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Egger @ 2010-08-11  9:12 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel

On Monday 09 August 2010 14:40:12 Tim Deegan wrote:
> > Allow paged real mode during vmrun emulation.
> > Emulate cr0 and cr4 when guest does not intercept them.
>
> I understand the paged-real-mode case, but why do you also allow CR0.CD
> and CR0.NW for nested VMs?

Oh, I haven't considered about those bits. You are right, they should not be
allowed for l2 guests. Thanks for bringing this up. Fixed in my local tree.

Christoph


>
> Cheers,
>
> Tim.
>
> > diff -r 917f9eb07fc3 -r b1a356e5658d xen/arch/x86/hvm/hvm.c
> > --- a/xen/arch/x86/hvm/hvm.c
> > +++ b/xen/arch/x86/hvm/hvm.c
> > @@ -54,6 +54,7 @@
> >  #include <asm/hvm/support.h>
> >  #include <asm/hvm/cacheattr.h>
> >  #include <asm/hvm/trace.h>
> > +#include <asm/hvm/nestedhvm.h>
> >  #include <asm/mtrr.h>
> >  #include <asm/apic.h>
> >  #include <public/sched.h>
> > @@ -1105,7 +1106,8 @@ int hvm_set_cr0(unsigned long value)
> >      /* ET is reserved and should be always be 1. */
> >      value |= X86_CR0_ET;
> >
> > -    if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
> > +    if ( !nestedhvm_vmentry_emulate(v) &&
> > +         (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
> >          goto gpf;
> >
> >      if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )
> > @@ -1159,7 +1161,7 @@ int hvm_set_cr0(unsigned long value)
> >          }
> >      }
> >
> > -    if ( has_arch_mmios(v->domain) )
> > +    if ( !nestedhvm_vmentry_emulate(v) && has_arch_mmios(v->domain) )
> >      {
> >          if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
> >          {
>
> Content-Description: ATT00001..txt
>
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-11  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 15:02 [PATCH 06/14] Nested Virtualization: CRn & paged real mode Christoph Egger
2010-08-09 12:40 ` Tim Deegan
2010-08-11  9:12   ` Christoph Egger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.