Skip to contentSkip to conversation

x86/nSVM: Don't clear TLB_CONTROL on #VMEXIT

PATCH In review Lin Liu 2 participants 2 messages Sep 20

lore
Share & tools
lore

Lin Liu

author
#0 lore raw

PATCH 1/1 x86/nSVM: Don't clear TLB_CONTROL on #VMEXIT

nsvm_vmcb_prepare4vmexit() zeroes TLB_CONTROL in the L1-provided VMCB. That VMCB is mapped writable, so the store lands in L1's memory and L1 sees a field it wrote come back as 0.

APM vol 2 rev 3.45 15.16.1 (p.550): "The VMRUN instruction reads, but does not change, the value of the TLB_CONTROL field."

Fixes 9a779e4fc161 ("Implement SVM specific part for Nested Virtualization")
Assisted-by Claude:claude-opus-5
---
 xen/arch/x86/hvm/svm/nestedsvm.c | 3 ---
 1 file changed, 3 deletions(-)
xen/arch/x86/hvm/svm/nestedsvm.c +0 -3
index a8b15d6eae..1ac2e57b3b 100644
@@ -991,9 +991,6 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
     /* ASID */
     /* vmcb_set_asid(ns_vmcb, vmcb_get_asid(n2vmcb)); */
 
-    /* TLB control */
-    ns_vmcb->tlb_control = 0;
-
     /* Virtual Interrupts */
     ns_vmcb->_vintr = n2vmcb->_vintr;
     if ( !svm->ns_hostflags.fields.vintrmask )
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw

Le 20/09/2026 à 05:37, Lin Liu a écrit :

Quoted 19 lines

nsvm_vmcb_prepare4vmexit() zeroes TLB_CONTROL in the L1-provided VMCB. That VMCB is mapped writable, so the store lands in L1's memory and L1 sees a field it wrote come back as 0.

APM vol 2 rev 3.45 15.16.1 (p.550): "The VMRUN instruction reads, but does not change, the value of the TLB_CONTROL field."

Fixes 9a779e4fc161 ("Implement SVM specific part for Nested Virtualization")
Assisted-by Claude:claude-opus-5
---
  xen/arch/x86/hvm/svm/nestedsvm.c | 3 ---
  1 file changed, 3 deletions(-)
xen/arch/x86/hvm/svm/nestedsvm.c +0 -0
index a8b15d6eae..1ac2e57b3b 100644

xen/arch/x86/hvm/svm/nestedsvm.c nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs) · line 996

Quoted 9 lines
xen/arch/x86/hvm/svm/nestedsvm.c +0 -3
@@ -991,9 +991,6 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
      /* ASID */
      /* vmcb_set_asid(ns_vmcb, vmcb_get_asid(n2vmcb)); */
 
-    /* TLB control */
-    ns_vmcb->tlb_control = 0;
-
      /* Virtual Interrupts */
      ns_vmcb->_vintr = n2vmcb->_vintr;
      if ( !svm->ns_hostflags.fields.vintrmask )