On 08.08.2024 12:08, Sergiy Kibrik wrote: > There're several places in common code, outside of arch/x86/hvm/vmx, > where cpu_has_vmx_* get accessed without checking whether VMX supported first. > These macros rely on global variables defined in vmx code, so when VMX support > is disabled accesses to these variables turn into build failures. > > To overcome these failures, build-time check is done before accessing global > variables, so that DCE would remove these variables. > > Signed-off-by: Sergiy Kibrik <[email protected]> > Acked-by: Paul Durrant <[email protected]>
I can accept this is being kind of complete, so Acked-by: Jan Beulich <[email protected]> Howver, ... > --- > changes in v6: > - guard all of cpu_has_vmx_* macros ... this clearly isn't the case. For one ... > --- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h > +++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h > @@ -298,69 +298,99 @@ extern u64 vmx_ept_vpid_cap; > #define VMX_TSC_MULTIPLIER_MAX 0xffffffffffffffffULL > > #define cpu_has_wbinvd_exiting \ > - (vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING) > + (IS_ENABLED(CONFIG_INTEL_VMX) && \ > + vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING) ... a few lines up from here there is cpu_has_vmx_virt_spec_ctrl. And there are quite a few more in vmx.h (don't ask me why things are split like this). Yet on the grounds that at least this one block of code now is consistent, I think we can leave further adjustments to possible later commits. Jan
