]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Revert "x86/vvmx: correct nested shadow VMCS handling"
authorJan Beulich <jbeulich@suse.com>
Fri, 17 Mar 2017 08:31:19 +0000 (09:31 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 17 Mar 2017 08:31:19 +0000 (09:31 +0100)
This reverts commit dc05c0ceeb8609b6d60f6a117a0192e9160946b8,
causing a regression.

xen/arch/x86/hvm/vmx/vvmx.c
xen/include/asm-x86/hvm/vmx/vvmx.h

index 3017849177b3e4e43156fadb4fa1cc7c4a32fb3d..09e4250bd350f70d0f6fd2fbff26c53aa5b1ecb8 100644 (file)
@@ -1119,19 +1119,10 @@ static bool_t nvmx_vpid_enabled(const struct vcpu *v)
 
 static void nvmx_set_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
 {
-    struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
     paddr_t vvmcs_maddr = v->arch.hvm_vmx.vmcs_shadow_maddr;
 
     __vmpclear(vvmcs_maddr);
-    if ( !nvmx->shadow_vmcs )
-    {
-        /*
-         * We must set the shadow VMCS-indicator in order for the next vmentry
-         * to succeed with a newly set up link pointer in vmcs01.
-         * Note: guest can see that this bit was set.
-         */
-        vvmcs->vmcs_revision_id |= VMCS_RID_TYPE_MASK;
-    }
+    vvmcs->vmcs_revision_id |= VMCS_RID_TYPE_MASK;
     __vmwrite(VMCS_LINK_POINTER, vvmcs_maddr);
     __vmwrite(VMREAD_BITMAP, page_to_maddr(v->arch.hvm_vmx.vmread_bitmap));
     __vmwrite(VMWRITE_BITMAP, page_to_maddr(v->arch.hvm_vmx.vmwrite_bitmap));
@@ -1139,13 +1130,10 @@ static void nvmx_set_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
 
 static void nvmx_clear_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
 {
-    struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
     paddr_t vvmcs_maddr = v->arch.hvm_vmx.vmcs_shadow_maddr;
 
     __vmpclear(vvmcs_maddr);
-    if ( !nvmx->shadow_vmcs )
-        vvmcs->vmcs_revision_id &= ~VMCS_RID_TYPE_MASK;
-    nvmx->shadow_vmcs = false;
+    vvmcs->vmcs_revision_id &= ~VMCS_RID_TYPE_MASK;
     __vmwrite(VMCS_LINK_POINTER, ~0ul);
     __vmwrite(VMREAD_BITMAP, 0);
     __vmwrite(VMWRITE_BITMAP, 0);
@@ -1686,14 +1674,12 @@ int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
         {
             if ( writable )
             {
-                struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
                 struct vmcs_struct *vvmcs = vvmcx;
 
-                nvmx->shadow_vmcs =
-                    vvmcs->vmcs_revision_id & ~VMX_BASIC_REVISION_MASK;
                 if ( ((vvmcs->vmcs_revision_id ^ vmx_basic_msr) &
                                          VMX_BASIC_REVISION_MASK) ||
-                     (!cpu_has_vmx_vmcs_shadowing && nvmx->shadow_vmcs) )
+                     (!cpu_has_vmx_vmcs_shadowing &&
+                      (vvmcs->vmcs_revision_id & ~VMX_BASIC_REVISION_MASK)) )
                 {
                     hvm_unmap_guest_frame(vvmcx, 1);
                     vmfail(regs, VMX_INSN_VMPTRLD_INCORRECT_VMCS_ID);
index 9a652184feecb8c399c56c206524bfea06f4f16b..ca2fb2535c6fd67406dfe4260261aa30f214e95f 100644 (file)
@@ -51,7 +51,6 @@ struct nestedvmx {
     } ept;
     uint32_t guest_vpid;
     struct list_head launched_list;
-    bool shadow_vmcs;
 };
 
 #define vcpu_2_nvmx(v) (vcpu_nestedhvm(v).u.nvmx)