From: Christoph Egger Date: Tue, 31 May 2011 12:55:50 +0000 (+0100) Subject: nestedsvm: fix tlb_control X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10260 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d2e4f64d612734bb31fed23be840b1671c404d5d;p=xen.git 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. Signed-off-by: Christoph Egger --- diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c index 44668fcfdf..86af8ed1a7 100644 --- a/xen/arch/x86/hvm/svm/nestedsvm.c +++ b/xen/arch/x86/hvm/svm/nestedsvm.c @@ -460,7 +460,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs) /* 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 cpu_user_regs *regs, 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;