Commit c63e4563 authored by Wanpeng Li's avatar Wanpeng Li Committed by Paolo Bonzini

KVM: VMX: Better name x2apic msr bitmaps

Renames x2apic_apicv_inactive msr_bitmaps to x2apic and original
x2apic bitmaps to x2apic_apicv.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent d9092f52
...@@ -924,10 +924,10 @@ static unsigned long *vmx_io_bitmap_a; ...@@ -924,10 +924,10 @@ static unsigned long *vmx_io_bitmap_a;
static unsigned long *vmx_io_bitmap_b; static unsigned long *vmx_io_bitmap_b;
static unsigned long *vmx_msr_bitmap_legacy; static unsigned long *vmx_msr_bitmap_legacy;
static unsigned long *vmx_msr_bitmap_longmode; static unsigned long *vmx_msr_bitmap_longmode;
static unsigned long *vmx_msr_bitmap_legacy_x2apic_apicv;
static unsigned long *vmx_msr_bitmap_longmode_x2apic_apicv;
static unsigned long *vmx_msr_bitmap_legacy_x2apic; static unsigned long *vmx_msr_bitmap_legacy_x2apic;
static unsigned long *vmx_msr_bitmap_longmode_x2apic; static unsigned long *vmx_msr_bitmap_longmode_x2apic;
static unsigned long *vmx_msr_bitmap_legacy_x2apic_apicv_inactive;
static unsigned long *vmx_msr_bitmap_longmode_x2apic_apicv_inactive;
static unsigned long *vmx_vmread_bitmap; static unsigned long *vmx_vmread_bitmap;
static unsigned long *vmx_vmwrite_bitmap; static unsigned long *vmx_vmwrite_bitmap;
...@@ -2529,14 +2529,14 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu) ...@@ -2529,14 +2529,14 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu)
SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)) { SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)) {
if (enable_apicv && kvm_vcpu_apicv_active(vcpu)) { if (enable_apicv && kvm_vcpu_apicv_active(vcpu)) {
if (is_long_mode(vcpu)) if (is_long_mode(vcpu))
msr_bitmap = vmx_msr_bitmap_longmode_x2apic; msr_bitmap = vmx_msr_bitmap_longmode_x2apic_apicv;
else else
msr_bitmap = vmx_msr_bitmap_legacy_x2apic; msr_bitmap = vmx_msr_bitmap_legacy_x2apic_apicv;
} else { } else {
if (is_long_mode(vcpu)) if (is_long_mode(vcpu))
msr_bitmap = vmx_msr_bitmap_longmode_x2apic_apicv_inactive; msr_bitmap = vmx_msr_bitmap_longmode_x2apic;
else else
msr_bitmap = vmx_msr_bitmap_legacy_x2apic_apicv_inactive; msr_bitmap = vmx_msr_bitmap_legacy_x2apic;
} }
} else { } else {
if (is_long_mode(vcpu)) if (is_long_mode(vcpu))
...@@ -4668,14 +4668,14 @@ static void vmx_disable_intercept_for_msr(u32 msr, bool longmode_only) ...@@ -4668,14 +4668,14 @@ static void vmx_disable_intercept_for_msr(u32 msr, bool longmode_only)
static void vmx_enable_intercept_msr_read_x2apic(u32 msr, bool apicv_active) static void vmx_enable_intercept_msr_read_x2apic(u32 msr, bool apicv_active)
{ {
if (apicv_active) { if (apicv_active) {
__vmx_enable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic, __vmx_enable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
__vmx_enable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic, __vmx_enable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
} else { } else {
__vmx_enable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv_inactive, __vmx_enable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
__vmx_enable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv_inactive, __vmx_enable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
} }
} }
...@@ -4683,14 +4683,14 @@ static void vmx_enable_intercept_msr_read_x2apic(u32 msr, bool apicv_active) ...@@ -4683,14 +4683,14 @@ static void vmx_enable_intercept_msr_read_x2apic(u32 msr, bool apicv_active)
static void vmx_disable_intercept_msr_read_x2apic(u32 msr, bool apicv_active) static void vmx_disable_intercept_msr_read_x2apic(u32 msr, bool apicv_active)
{ {
if (apicv_active) { if (apicv_active) {
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
} else { } else {
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv_inactive, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv_inactive, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic,
msr, MSR_TYPE_R); msr, MSR_TYPE_R);
} }
} }
...@@ -4698,14 +4698,14 @@ static void vmx_disable_intercept_msr_read_x2apic(u32 msr, bool apicv_active) ...@@ -4698,14 +4698,14 @@ static void vmx_disable_intercept_msr_read_x2apic(u32 msr, bool apicv_active)
static void vmx_disable_intercept_msr_write_x2apic(u32 msr, bool apicv_active) static void vmx_disable_intercept_msr_write_x2apic(u32 msr, bool apicv_active)
{ {
if (apicv_active) { if (apicv_active) {
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv,
msr, MSR_TYPE_W); msr, MSR_TYPE_W);
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv,
msr, MSR_TYPE_W); msr, MSR_TYPE_W);
} else { } else {
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic_apicv_inactive, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_legacy_x2apic,
msr, MSR_TYPE_W); msr, MSR_TYPE_W);
__vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic_apicv_inactive, __vmx_disable_intercept_for_msr(vmx_msr_bitmap_longmode_x2apic,
msr, MSR_TYPE_W); msr, MSR_TYPE_W);
} }
} }
...@@ -6364,28 +6364,28 @@ static __init int hardware_setup(void) ...@@ -6364,28 +6364,28 @@ static __init int hardware_setup(void)
if (!vmx_msr_bitmap_legacy) if (!vmx_msr_bitmap_legacy)
goto out1; goto out1;
vmx_msr_bitmap_legacy_x2apic = vmx_msr_bitmap_legacy_x2apic_apicv =
(unsigned long *)__get_free_page(GFP_KERNEL); (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_legacy_x2apic) if (!vmx_msr_bitmap_legacy_x2apic_apicv)
goto out2; goto out2;
vmx_msr_bitmap_legacy_x2apic_apicv_inactive = vmx_msr_bitmap_legacy_x2apic =
(unsigned long *)__get_free_page(GFP_KERNEL); (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_legacy_x2apic_apicv_inactive) if (!vmx_msr_bitmap_legacy_x2apic)
goto out3; goto out3;
vmx_msr_bitmap_longmode = (unsigned long *)__get_free_page(GFP_KERNEL); vmx_msr_bitmap_longmode = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_longmode) if (!vmx_msr_bitmap_longmode)
goto out4; goto out4;
vmx_msr_bitmap_longmode_x2apic = vmx_msr_bitmap_longmode_x2apic_apicv =
(unsigned long *)__get_free_page(GFP_KERNEL); (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_longmode_x2apic) if (!vmx_msr_bitmap_longmode_x2apic_apicv)
goto out5; goto out5;
vmx_msr_bitmap_longmode_x2apic_apicv_inactive = vmx_msr_bitmap_longmode_x2apic =
(unsigned long *)__get_free_page(GFP_KERNEL); (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_longmode_x2apic_apicv_inactive) if (!vmx_msr_bitmap_longmode_x2apic)
goto out6; goto out6;
vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL); vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
...@@ -6476,13 +6476,13 @@ static __init int hardware_setup(void) ...@@ -6476,13 +6476,13 @@ static __init int hardware_setup(void)
vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_EIP, false); vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_EIP, false);
vmx_disable_intercept_for_msr(MSR_IA32_BNDCFGS, true); vmx_disable_intercept_for_msr(MSR_IA32_BNDCFGS, true);
memcpy(vmx_msr_bitmap_legacy_x2apic, memcpy(vmx_msr_bitmap_legacy_x2apic_apicv,
vmx_msr_bitmap_legacy, PAGE_SIZE); vmx_msr_bitmap_legacy, PAGE_SIZE);
memcpy(vmx_msr_bitmap_longmode_x2apic, memcpy(vmx_msr_bitmap_longmode_x2apic_apicv,
vmx_msr_bitmap_longmode, PAGE_SIZE); vmx_msr_bitmap_longmode, PAGE_SIZE);
memcpy(vmx_msr_bitmap_legacy_x2apic_apicv_inactive, memcpy(vmx_msr_bitmap_legacy_x2apic,
vmx_msr_bitmap_legacy, PAGE_SIZE); vmx_msr_bitmap_legacy, PAGE_SIZE);
memcpy(vmx_msr_bitmap_longmode_x2apic_apicv_inactive, memcpy(vmx_msr_bitmap_longmode_x2apic,
vmx_msr_bitmap_longmode, PAGE_SIZE); vmx_msr_bitmap_longmode, PAGE_SIZE);
set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */ set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */
...@@ -6560,15 +6560,15 @@ static __init int hardware_setup(void) ...@@ -6560,15 +6560,15 @@ static __init int hardware_setup(void)
out8: out8:
free_page((unsigned long)vmx_vmread_bitmap); free_page((unsigned long)vmx_vmread_bitmap);
out7: out7:
free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic_apicv_inactive);
out6:
free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic); free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic);
out6:
free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic_apicv);
out5: out5:
free_page((unsigned long)vmx_msr_bitmap_longmode); free_page((unsigned long)vmx_msr_bitmap_longmode);
out4: out4:
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic_apicv_inactive);
out3:
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic); free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic);
out3:
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic_apicv);
out2: out2:
free_page((unsigned long)vmx_msr_bitmap_legacy); free_page((unsigned long)vmx_msr_bitmap_legacy);
out1: out1:
...@@ -6581,10 +6581,10 @@ static __init int hardware_setup(void) ...@@ -6581,10 +6581,10 @@ static __init int hardware_setup(void)
static __exit void hardware_unsetup(void) static __exit void hardware_unsetup(void)
{ {
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic_apicv);
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic); free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic);
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic_apicv_inactive); free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic_apicv);
free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic); free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic);
free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic_apicv_inactive);
free_page((unsigned long)vmx_msr_bitmap_legacy); free_page((unsigned long)vmx_msr_bitmap_legacy);
free_page((unsigned long)vmx_msr_bitmap_longmode); free_page((unsigned long)vmx_msr_bitmap_longmode);
free_page((unsigned long)vmx_io_bitmap_b); free_page((unsigned long)vmx_io_bitmap_b);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment