From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: [PATCH] nestedsvm: fix tlb_control Date: Mon, 30 May 2011 13:30:32 +0200 Message-ID: <4DE37FD8.7040100@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060708030201040500070201" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --------------060708030201040500070201 Content-Type: text/plain; charset="ISO-8859-15"; format=flowed Content-Transfer-Encoding: 7bit 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 P.S.: No, this patch does not implement flush-by-asid for nested virtualization. -- ---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 --------------060708030201040500070201 Content-Type: text/plain; name="xen_tlbcontrol.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_tlbcontrol.diff" Content-Description: xen_tlbcontrol.diff diff -r d7c755c25bb9 xen/arch/x86/hvm/svm/nestedsvm.c --- a/xen/arch/x86/hvm/svm/nestedsvm.c Sat May 28 08:58:08 2011 +0100 +++ b/xen/arch/x86/hvm/svm/nestedsvm.c Mon May 30 13:15:41 2011 +0200 @@ -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; --------------060708030201040500070201 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------060708030201040500070201--