On 09/07/2024 08:05, 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 <sergiy_kib...@epam.com>
CC: Andrew Cooper <andrew.coop...@citrix.com>
CC: Jan Beulich <jbeul...@suse.com>
---
changes in v4:
- use IS_ENABLED(CONFIG_VMX) instead of using_vmx
changes in v3:
- using_vmx instead of cpu_has_vmx
- clarify description on why this change needed
changes in v2:
- do not touch SVM code and macros
- drop vmx_ctrl_has_feature()
- guard cpu_has_vmx_* macros in common code instead
---
xen/arch/x86/hvm/hvm.c | 2 +-
xen/arch/x86/hvm/viridian/viridian.c | 4 ++--
xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 17 +++++++++++------
xen/arch/x86/traps.c | 5 +++--
4 files changed, 17 insertions(+), 11 deletions(-)
Viridian changes...
Acked-by: Paul Durrant <p...@xen.org>