[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v4 10/14] x86/vmx: guard access to cpu_has_vmx_* in common code



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_Kibrik@xxxxxxxx>
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
---
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 <paul@xxxxxxx>




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.