nVMX: Rename union vmx_basic and related global variable

vmx_basic is somewhat confusing with exit_reason.basic, rename the former
definition to vmx_basic_msr and the global variable to make them self-
descriptive.

No functional change intended.

Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
Link: https://lore.kernel.org/r/20230913235006.74172-3-weijiang.yang@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
diff --git a/x86/vmx.c b/x86/vmx.c
index 1c27850..9f08c09 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -66,7 +66,7 @@
 static int guest_finished;
 static int in_guest;
 
-union vmx_basic basic;
+union vmx_basic_msr basic_msr;
 union vmx_ctrl_msr ctrl_pin_rev;
 union vmx_ctrl_msr ctrl_cpu_rev[2];
 union vmx_ctrl_msr ctrl_exit_rev;
@@ -369,7 +369,7 @@
 	struct vmcs *vmcs = alloc_page();
 	u32 vmcs_enum_max, max_index = 0;
 
-	vmcs->hdr.revision_id = basic.revision;
+	vmcs->hdr.revision_id = basic_msr.revision;
 	assert(!vmcs_clear(vmcs));
 	assert(!make_vmcs_current(vmcs));
 
@@ -430,7 +430,7 @@
 	void *vpage = alloc_vpage();
 
 	memset(vmcs, 0, PAGE_SIZE);
-	vmcs->hdr.revision_id = basic.revision;
+	vmcs->hdr.revision_id = basic_msr.revision;
 	assert(!vmcs_clear(vmcs));
 	assert(!make_vmcs_current(vmcs));
 
@@ -456,7 +456,7 @@
 {
 	struct vmcs *vmcs = alloc_page();
 
-	vmcs->hdr.revision_id = basic.revision;
+	vmcs->hdr.revision_id = basic_msr.revision;
 	assert(!vmcs_clear(vmcs));
 	assert(!make_vmcs_current(vmcs));
 
@@ -482,7 +482,7 @@
 
 	for (i = 0; i < ARRAY_SIZE(vmcs); i++) {
 		vmcs[i] = alloc_page();
-		vmcs[i]->hdr.revision_id = basic.revision;
+		vmcs[i]->hdr.revision_id = basic_msr.revision;
 	}
 
 #define VMPTRLD(_i) do { \
@@ -731,13 +731,13 @@
 		vmcs[i] = alloc_page();
 	}
 
-	vmcs[0]->hdr.revision_id = basic.revision;
+	vmcs[0]->hdr.revision_id = basic_msr.revision;
 	assert(!vmcs_clear(vmcs[0]));
 	assert(!make_vmcs_current(vmcs[0]));
 	set_all_vmcs_fields(0x86);
 
 	assert(!vmcs_clear(vmcs[0]));
-	memcpy(vmcs[1], vmcs[0], basic.size);
+	memcpy(vmcs[1], vmcs[0], basic_msr.size);
 	assert(!make_vmcs_current(vmcs[1]));
 	report(check_all_vmcs_fields(0x86),
 	       "test vmclear flush (current VMCS)");
@@ -745,7 +745,7 @@
 	set_all_vmcs_fields(0x87);
 	assert(!make_vmcs_current(vmcs[0]));
 	assert(!vmcs_clear(vmcs[1]));
-	memcpy(vmcs[2], vmcs[1], basic.size);
+	memcpy(vmcs[2], vmcs[1], basic_msr.size);
 	assert(!make_vmcs_current(vmcs[2]));
 	report(check_all_vmcs_fields(0x87),
 	       "test vmclear flush (!current VMCS)");
@@ -1232,7 +1232,7 @@
 int init_vmcs(struct vmcs **vmcs)
 {
 	*vmcs = alloc_page();
-	(*vmcs)->hdr.revision_id = basic.revision;
+	(*vmcs)->hdr.revision_id = basic_msr.revision;
 	/* vmclear first to init vmcs */
 	if (vmcs_clear(*vmcs)) {
 		printf("%s : vmcs_clear error\n", __func__);
@@ -1279,14 +1279,14 @@
 
 static void init_vmx_caps(void)
 {
-	basic.val = rdmsr(MSR_IA32_VMX_BASIC);
-	ctrl_pin_rev.val = rdmsr(basic.ctrl ? MSR_IA32_VMX_TRUE_PIN
+	basic_msr.val = rdmsr(MSR_IA32_VMX_BASIC);
+	ctrl_pin_rev.val = rdmsr(basic_msr.ctrl ? MSR_IA32_VMX_TRUE_PIN
 			: MSR_IA32_VMX_PINBASED_CTLS);
-	ctrl_exit_rev.val = rdmsr(basic.ctrl ? MSR_IA32_VMX_TRUE_EXIT
+	ctrl_exit_rev.val = rdmsr(basic_msr.ctrl ? MSR_IA32_VMX_TRUE_EXIT
 			: MSR_IA32_VMX_EXIT_CTLS);
-	ctrl_enter_rev.val = rdmsr(basic.ctrl ? MSR_IA32_VMX_TRUE_ENTRY
+	ctrl_enter_rev.val = rdmsr(basic_msr.ctrl ? MSR_IA32_VMX_TRUE_ENTRY
 			: MSR_IA32_VMX_ENTRY_CTLS);
-	ctrl_cpu_rev[0].val = rdmsr(basic.ctrl ? MSR_IA32_VMX_TRUE_PROC
+	ctrl_cpu_rev[0].val = rdmsr(basic_msr.ctrl ? MSR_IA32_VMX_TRUE_PROC
 			: MSR_IA32_VMX_PROCBASED_CTLS);
 	if ((ctrl_cpu_rev[0].clr & CPU_SECONDARY) != 0)
 		ctrl_cpu_rev[1].val = rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2);
@@ -1311,7 +1311,7 @@
 	write_cr0((read_cr0() & fix_cr0_clr) | fix_cr0_set);
 	write_cr4((read_cr4() & fix_cr4_clr) | fix_cr4_set | X86_CR4_VMXE);
 
-	*vmxon_region = basic.revision;
+	*vmxon_region = basic_msr.revision;
 }
 
 static void alloc_bsp_vmx_pages(void)
@@ -1515,7 +1515,7 @@
 	/* and finally a valid region, with valid-but-tweaked cr0/cr4 */
 	write_cr0(orig_cr0 ^ flexible_cr0);
 	write_cr4(orig_cr4 ^ flexible_cr4);
-	*bsp_vmxon_region = basic.revision;
+	*bsp_vmxon_region = basic_msr.revision;
 	ret = vmxon_safe();
 	report(!ret, "test vmxon with valid vmxon region");
 	write_cr0(orig_cr0);
@@ -1529,7 +1529,7 @@
 	int width = cpuid_maxphyaddr();
 
 	vmcs = alloc_page();
-	vmcs->hdr.revision_id = basic.revision;
+	vmcs->hdr.revision_id = basic_msr.revision;
 
 	/* Unaligned page access */
 	tmp_root = (struct vmcs *)((intptr_t)vmcs + 1);
@@ -1592,10 +1592,10 @@
 
 	printf("\nTest suite: VMX capability reporting\n");
 
-	report((basic.revision & (1ul << 31)) == 0 &&
-	       basic.size > 0 && basic.size <= 4096 &&
-	       (basic.type == 0 || basic.type == 6) &&
-	       basic.reserved1 == 0 && basic.reserved2 == 0,
+	report((basic_msr.revision & (1ul << 31)) == 0 &&
+	       basic_msr.size > 0 && basic_msr.size <= 4096 &&
+	       (basic_msr.type == 0 || basic_msr.type == 6) &&
+	       basic_msr.reserved1 == 0 && basic_msr.reserved2 == 0,
 	       "MSR_IA32_VMX_BASIC");
 
 	val = rdmsr(MSR_IA32_VMX_MISC);
@@ -1609,7 +1609,7 @@
 		default1 = vmx_ctl_msr[n].default1;
 		ok = (ctrl.set & default1) == default1;
 		ok = ok && (ctrl.set & ~ctrl.clr) == 0;
-		if (ok && basic.ctrl) {
+		if (ok && basic_msr.ctrl) {
 			true_ctrl.val = rdmsr(vmx_ctl_msr[n].true_index);
 			ok = ctrl.clr == true_ctrl.clr;
 			ok = ok && ctrl.set == (true_ctrl.set | default1);
diff --git a/x86/vmx.h b/x86/vmx.h
index bc61a58..25d3895 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -130,7 +130,7 @@
 	void (*v2)(void);
 };
 
-union vmx_basic {
+union vmx_basic_msr {
 	u64 val;
 	struct {
 		u32 revision;
@@ -752,7 +752,7 @@
 
 extern struct regs regs;
 
-extern union vmx_basic basic;
+extern union vmx_basic_msr basic_msr;
 extern union vmx_ctrl_msr ctrl_pin_rev;
 extern union vmx_ctrl_msr ctrl_cpu_rev[2];
 extern union vmx_ctrl_msr ctrl_exit_rev;
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 7fdc605..8b1c961 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3446,7 +3446,7 @@
 {
 	unsigned bit;
 
-	printf("%s: %lx\n", basic.ctrl ? "MSR_IA32_VMX_TRUE_PIN" :
+	printf("%s: %lx\n", basic_msr.ctrl ? "MSR_IA32_VMX_TRUE_PIN" :
 	       "MSR_IA32_VMX_PINBASED_CTLS", ctrl_pin_rev.val);
 	for (bit = 0; bit < 32; bit++)
 		test_rsvd_ctl_bit("pin-based controls",
@@ -3463,7 +3463,7 @@
 {
 	unsigned bit;
 
-	printf("\n%s: %lx\n", basic.ctrl ? "MSR_IA32_VMX_TRUE_PROC" :
+	printf("\n%s: %lx\n", basic_msr.ctrl ? "MSR_IA32_VMX_TRUE_PROC" :
 	       "MSR_IA32_VMX_PROCBASED_CTLS", ctrl_cpu_rev[0].val);
 	for (bit = 0; bit < 32; bit++)
 		test_rsvd_ctl_bit("primary processor-based controls",
@@ -5300,7 +5300,7 @@
 		report_prefix_pop();
 	}
 
-	if (basic.val & (1ul << 48))
+	if (basic_msr.val & (1ul << 48))
 		addr_len = 32;
 
 	test_vmcs_addr_values("VM-entry-MSR-load address",
@@ -5428,7 +5428,7 @@
 		report_prefix_pop();
 	}
 
-	if (basic.val & (1ul << 48))
+	if (basic_msr.val & (1ul << 48))
 		addr_len = 32;
 
 	test_vmcs_addr_values("VM-exit-MSR-store address",
@@ -10180,7 +10180,7 @@
 	vmcs_write(VMWRITE_BITMAP, virt_to_phys(bitmap[ACCESS_VMWRITE]));
 
 	shadow = alloc_page();
-	shadow->hdr.revision_id = basic.revision;
+	shadow->hdr.revision_id = basic_msr.revision;
 	shadow->hdr.shadow_vmcs = 1;
 	TEST_ASSERT(!vmcs_clear(shadow));