[PATCH v3 14/14] x86/svm: Rename VMCB fields to match KVM

Yosry Ahmed
2025-11-10T23:27:26Z

Rename nested_ctl and virt_ext to misc_ctl and misc_ctl2, respectively,
to match new names in KVM code.

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
---
x86/svm.c | 2 +-
x86/svm.h | 6 +++---
x86/svm_tests.c | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/x86/svm.c b/x86/svm.c
index de9eb19443caa..c40ef154bcacd 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -200,7 +200,7 @@ void vmcb_ident(struct vmcb *vmcb)
ctrl->msrpm_base_pa = virt_to_phys(msr_bitmap);

if (npt_supported()) {
- ctrl->nested_ctl = 1;
+ ctrl->misc_ctl = 1;
ctrl->nested_cr3 = (u64)pml4e;
ctrl->tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID;
}
diff --git a/x86/svm.h b/x86/svm.h
index 264583a6547ef..00d28199f65f5 100644
--- a/x86/svm.h
+++ b/x86/svm.h
@@ -94,12 +94,12 @@ struct __attribute__ ((__packed__)) vmcb_control_area {
u64 exit_info_2;
u32 exit_int_info;
u32 exit_int_info_err;
- u64 nested_ctl;
+ u64 misc_ctl;
u8 reserved_4[16];
u32 event_inj;
u32 event_inj_err;
u64 nested_cr3;
- u64 virt_ext;
+ u64 misc_ctl2;
u32 clean;
u32 reserved_5;
u64 next_rip;
@@ -370,7 +370,7 @@ struct __attribute__ ((__packed__)) vmcb {

#define MSR_BITMAP_SIZE 8192

-#define LBR_CTL_ENABLE_MASK BIT_ULL(0)
+#define SVM_MISC_CTL2_LBR_CTL_ENABLE BIT_ULL(0)

struct svm_test {
const char *name;
diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 47a2edfbb6c9b..49b5906965b7e 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -3139,7 +3139,7 @@ static void svm_lbrv_test1(void)
u64 from_ip, to_ip;

svm_setup_vmrun((u64)svm_lbrv_test_guest1);
- vmcb->control.virt_ext = 0;
+ vmcb->control.misc_ctl2 = 0;

wrmsr(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR);
DO_BRANCH(host_branch1);
@@ -3160,7 +3160,7 @@ static void svm_lbrv_test2(void)
u64 from_ip, to_ip;

svm_setup_vmrun((u64)svm_lbrv_test_guest2);
- vmcb->control.virt_ext = 0;
+ vmcb->control.misc_ctl2 = 0;

wrmsr(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR);
DO_BRANCH(host_branch2);
@@ -3185,7 +3185,7 @@ static void svm_lbrv_test3(void)
u64 from_ip, to_ip;

svm_setup_vmrun((u64)svm_lbrv_test_guest3);
- vmcb->control.virt_ext = 0;
+ vmcb->control.misc_ctl2 = 0;

wrmsr(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR);
DO_BRANCH(host_branch5);
@@ -3214,7 +3214,7 @@ static void svm_lbrv_nested_test1(void)
}

svm_setup_vmrun((u64)svm_lbrv_test_guest1);
- vmcb->control.virt_ext = LBR_CTL_ENABLE_MASK;
+ vmcb->control.misc_ctl2 = SVM_MISC_CTL2_LBR_CTL_ENABLE;
vmcb->save.dbgctl = DEBUGCTLMSR_LBR;

wrmsr(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR);
@@ -3244,7 +3244,7 @@ static void svm_lbrv_nested_test2(void)
}

svm_setup_vmrun((u64)svm_lbrv_test_guest2);
- vmcb->control.virt_ext = LBR_CTL_ENABLE_MASK;
+ vmcb->control.misc_ctl2 = SVM_MISC_CTL2_LBR_CTL_ENABLE;

vmcb->save.dbgctl = 0;
vmcb->save.br_from = (u64)&host_branch2_from;
@@ -3278,7 +3278,7 @@ static void svm_lbrv_nested_test3(void)
}

svm_setup_vmrun((u64)svm_lbrv_test_guest3);
- vmcb->control.virt_ext = LBR_CTL_ENABLE_MASK;
+ vmcb->control.misc_ctl2 = SVM_MISC_CTL2_LBR_CTL_ENABLE;
vmcb->save.dbgctl = 0;

wrmsr(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR);
--
2.51.2.1041.gc1ab5b90ca-goog