Message ID | b2accc3a-9b54-45b4-8cec-29cad9c2d638@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/HVM: misc tidying | expand |
On 24.11.2023 09:43, Jan Beulich wrote: > ... to a field in the capability/controls struct. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > --- > v2: New. I'm sorry, this really is 15/15 ($subject also adjusted). Jan > --- a/xen/arch/x86/hvm/vmx/vmcs.c > +++ b/xen/arch/x86/hvm/vmx/vmcs.c > @@ -162,7 +162,6 @@ static int cf_check parse_ept_param_runt > > /* Dynamic (run-time adjusted) execution control flags. */ > struct vmx_caps __ro_after_init vmx_caps; > -static uint64_t __read_mostly vmx_vmfunc; > > static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region); > static DEFINE_PER_CPU(paddr_t, current_vmcs); > @@ -234,7 +233,6 @@ static int vmx_init_vmcs_config(bool bsp > u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt; > struct vmx_caps caps; > u64 _vmx_misc_cap = 0; > - u64 _vmx_vmfunc = 0; > bool mismatch = false; > > rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high); > @@ -426,14 +424,14 @@ static int vmx_init_vmcs_config(bool bsp > /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */ > if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS ) > { > - rdmsrl(MSR_IA32_VMX_VMFUNC, _vmx_vmfunc); > + rdmsrl(MSR_IA32_VMX_VMFUNC, caps.vmfunc); > > /* > * VMFUNC leaf 0 (EPTP switching) must be supported. > * > * Or we just don't use VMFUNC. > */ > - if ( !(_vmx_vmfunc & VMX_VMFUNC_EPTP_SWITCHING) ) > + if ( !(caps.vmfunc & VMX_VMFUNC_EPTP_SWITCHING) ) > caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS; > } > > @@ -456,7 +454,6 @@ static int vmx_init_vmcs_config(bool bsp > vmx_caps = caps; > vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) | > vmx_basic_msr_low; > - vmx_vmfunc = _vmx_vmfunc; > > vmx_display_features(); > > @@ -495,7 +492,7 @@ static int vmx_init_vmcs_config(bool bsp > mismatch |= cap_check("VPID Capability", vmx_caps.vpid, caps.vpid); > mismatch |= cap_check( > "VMFUNC Capability", > - vmx_vmfunc, _vmx_vmfunc); > + vmx_caps.vmfunc, caps.vmfunc); > if ( cpu_has_vmx_ins_outs_instr_info != > !!(vmx_basic_msr_high & (VMX_BASIC_INS_OUT_INFO >> 32)) ) > { > @@ -2153,7 +2150,6 @@ int __init vmx_vmcs_init(void) > * Make sure all dependent features are off as well. > */ > memset(&vmx_caps, 0, sizeof(vmx_caps)); > - vmx_vmfunc = 0; > } > > return ret; > --- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h > +++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h > @@ -287,6 +287,7 @@ struct vmx_caps { > uint32_t vmentry_control; > uint32_t ept; > uint32_t vpid; > + uint64_t vmfunc; > }; > extern struct vmx_caps vmx_caps; > > >
--- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -162,7 +162,6 @@ static int cf_check parse_ept_param_runt /* Dynamic (run-time adjusted) execution control flags. */ struct vmx_caps __ro_after_init vmx_caps; -static uint64_t __read_mostly vmx_vmfunc; static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region); static DEFINE_PER_CPU(paddr_t, current_vmcs); @@ -234,7 +233,6 @@ static int vmx_init_vmcs_config(bool bsp u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt; struct vmx_caps caps; u64 _vmx_misc_cap = 0; - u64 _vmx_vmfunc = 0; bool mismatch = false; rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high); @@ -426,14 +424,14 @@ static int vmx_init_vmcs_config(bool bsp /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */ if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS ) { - rdmsrl(MSR_IA32_VMX_VMFUNC, _vmx_vmfunc); + rdmsrl(MSR_IA32_VMX_VMFUNC, caps.vmfunc); /* * VMFUNC leaf 0 (EPTP switching) must be supported. * * Or we just don't use VMFUNC. */ - if ( !(_vmx_vmfunc & VMX_VMFUNC_EPTP_SWITCHING) ) + if ( !(caps.vmfunc & VMX_VMFUNC_EPTP_SWITCHING) ) caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS; } @@ -456,7 +454,6 @@ static int vmx_init_vmcs_config(bool bsp vmx_caps = caps; vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) | vmx_basic_msr_low; - vmx_vmfunc = _vmx_vmfunc; vmx_display_features(); @@ -495,7 +492,7 @@ static int vmx_init_vmcs_config(bool bsp mismatch |= cap_check("VPID Capability", vmx_caps.vpid, caps.vpid); mismatch |= cap_check( "VMFUNC Capability", - vmx_vmfunc, _vmx_vmfunc); + vmx_caps.vmfunc, caps.vmfunc); if ( cpu_has_vmx_ins_outs_instr_info != !!(vmx_basic_msr_high & (VMX_BASIC_INS_OUT_INFO >> 32)) ) { @@ -2153,7 +2150,6 @@ int __init vmx_vmcs_init(void) * Make sure all dependent features are off as well. */ memset(&vmx_caps, 0, sizeof(vmx_caps)); - vmx_vmfunc = 0; } return ret; --- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h @@ -287,6 +287,7 @@ struct vmx_caps { uint32_t vmentry_control; uint32_t ept; uint32_t vpid; + uint64_t vmfunc; }; extern struct vmx_caps vmx_caps;
... to a field in the capability/controls struct. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- v2: New.