nestedsvm: fix checks of guest writes to HSAVE_PA MSR
authorChristoph Egger <Christoph.Egger@amd.com>
Thu, 13 Oct 2011 11:21:10 +0000 (12:21 +0100)
committerChristoph Egger <Christoph.Egger@amd.com>
Thu, 13 Oct 2011 11:21:10 +0000 (12:21 +0100)
Accessing HSAVE_PA MSR does not require SVM to be enabled nor any
special guest paging mode.
But accessing HSAVE_PA MSR requires the address to be 4k aligned.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/hvm/svm/nestedsvm.c

index bbd8866c1de3c514b5fa8f3b9c258f0f5f3eb8d3..f7fae0da78b1e2046a4e5613f1072286c235ea69 100644 (file)
@@ -51,7 +51,8 @@ nestedsvm_vcpu_stgi(struct vcpu *v)
 static int
 nestedsvm_vmcb_isvalid(struct vcpu *v, uint64_t vmcxaddr)
 {
-    if ( !hvm_svm_enabled(v) || hvm_guest_x86_mode(v) < 2 )
+    /* Address must be 4k aligned */
+    if ( (vmcxaddr & ~PAGE_MASK) != 0 )
         return 0;
 
     /* Maximum valid physical address.