Skip to contentSkip to conversation

nestedsvm: fix tlb_control

PATCH New Christoph Egger 1 participant 1 message May 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nestedsvm: fix tlb_control

On VMRUN emulation evaluate the virtual tlb_control only to match hw behaviour. Deal with l1 guests which use flush-by-asid w/o checking cpuid bits or fill tlb_control with random data.

P.S.: No, this patch does not implement flush-by-asid for nested virtualization.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
xen/arch/x86/hvm/svm/nestedsvm.c +4 -2
diff -r d7c755c25bb9 xen/arch/x86/hvm/svm/nestedsvm.c
@@ -460,7 +460,7 @@ static int nsvm_vmcb_prepare4vmrun(struc
     /* ASID - Emulation handled in hvm_asid_handle_vmenter() */
 
     /* TLB control */
-    n2vmcb->tlb_control = n1vmcb->tlb_control | ns_vmcb->tlb_control;
+    n2vmcb->tlb_control = ns_vmcb->tlb_control;
 
     /* Virtual Interrupts */
     if (!vcleanbit_set(tpr)) {
@@ -655,7 +655,9 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct
     svm->ns_vmcb_guestcr3 = ns_vmcb->_cr3;
     svm->ns_vmcb_hostcr3 = ns_vmcb->_h_cr3;
 
-    nv->nv_flushp2m = ns_vmcb->tlb_control;
+    /* Convert explicitely to boolean. Deals with l1 guests
+     * that use flush-by-asid w/o checking the cpuid bits */
+    nv->nv_flushp2m = !!ns_vmcb->tlb_control;
     if ( svm->ns_guest_asid != ns_vmcb->_guest_asid )
     {
         nv->nv_flushp2m = 1;

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