Skip to contentSkip to conversation

Nested Virtualization: CRn & paged real mode

PATCH In review Christoph Egger 2 participants 3 messages Nov 12, 2010 – Dec 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 5/13 Nested Virtualization: CRn & paged real mode

Signature · 7 lines
-- 
---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

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

xen/arch/x86/hvm/hvm.c +4 -2
diff -r 5ea6bde78dc6 -r 7edc8a5266f9 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>
@@ -1096,7 +1097,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_vmswitch_in_progress(v) &&
+         (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
         goto gpf;
 
     if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )
@@ -1150,7 +1152,7 @@ int hvm_set_cr0(unsigned long value)
         }
     }
 
-    if ( has_arch_mmios(v->domain) )
+    if ( !nestedhvm_vmswitch_in_progress(v) && has_arch_mmios(v->domain) )
     {
         if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
         {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 11 lines · Christoph Egger
xen/arch/x86/hvm/hvm.c +2 -1
@@ -1096,7 +1097,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_vmswitch_in_progress(v) &&
+         (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
         goto gpf;
 
     if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )

xen/arch/x86/hvm/hvm.c int hvm_set_cr0(unsigned long value) · line 1158

Quoted 8 lines
xen/arch/x86/hvm/hvm.c +1 -1
@@ -1150,7 +1152,7 @@ int hvm_set_cr0(unsigned long value)
         }
     }
 
-    if ( has_arch_mmios(v->domain) )
+    if ( !nestedhvm_vmswitch_in_progress(v) && has_arch_mmios(v->domain) )
     {
         if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
         {

Like I said last time:

I don't think that needs to happen -- it's up to the L1 VMM to decide whether the L2 VMM should be allowed to set cache control bits in CR0.

Cheers,

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#2 lore raw
Quoted 23 lines · On Tuesday 16 November 2010 14:19:14 Tim Deegan wrote:
Quoted 11 lines · Christoph Egger
xen/arch/x86/hvm/hvm.c +2 -1
@@ -1096,7 +1097,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_vmswitch_in_progress(v) &&
+         (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
         goto gpf;
 
     if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )

xen/arch/x86/hvm/hvm.c int hvm_set_cr0(unsigned long value) · line 1158

Quoted 8 lines
xen/arch/x86/hvm/hvm.c +1 -1
@@ -1150,7 +1152,7 @@ int hvm_set_cr0(unsigned long value)
         }
     }
 
-    if ( has_arch_mmios(v->domain) )
+    if ( !nestedhvm_vmswitch_in_progress(v) && has_arch_mmios(v->domain)
 ) {
         if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
         {

Like I said last time:

Quoted 2 lines

I don't think that needs to happen -- it's up to the L1 VMM to decide whether the L2 VMM should be allowed to set cache control bits in CR0.

I think, I misunderstood you then. Fixed in local tree.

Christoph

Signature · 6 lines
---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