All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] nestedsvm: fix tlb_control
Date: Mon, 30 May 2011 13:30:32 +0200	[thread overview]
Message-ID: <4DE37FD8.7040100@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]


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 <Christoph.Egger@amd.com>

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

[-- Attachment #2: xen_tlbcontrol.diff --]
[-- Type: text/plain, Size: 988 bytes --]

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;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2011-05-30 11:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DE37FD8.7040100@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.