On 21.03.2025 10:26, Sergiy Kibrik wrote:
> Add config option HVM_VIRIDIAN that covers viridian code within HVM.
> Calls to viridian functions guarded by is_viridian_domain() and related 
> macros.
> Having this option may be beneficial by reducing code footprint for systems
> that are not using Hyper-V.
> 
> Signed-off-by: Sergiy Kibrik <sergiy_kib...@epam.com>
> CC: Alejandro Vallejo <alejandro.vall...@cloud.com>
> CC: Jan Beulich <jbeul...@suse.com>
> ---
> changes in v2:
>  - changed title in Kconfig & add help text
>  - moved Kconfig changes to arch/x86/hvm/Kconfig
>  - address review comments
> ---
>  xen/arch/x86/hvm/Kconfig              | 10 ++++++++++
>  xen/arch/x86/hvm/Makefile             |  2 +-
>  xen/arch/x86/hvm/hvm.c                | 27 ++++++++++++++++++---------
>  xen/arch/x86/hvm/vlapic.c             | 11 +++++++----
>  xen/arch/x86/include/asm/hvm/domain.h |  2 ++
>  xen/arch/x86/include/asm/hvm/hvm.h    |  3 ++-
>  xen/arch/x86/include/asm/hvm/vcpu.h   |  2 ++
>  7 files changed, 42 insertions(+), 15 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
> index 2def0f98e2..9cdcc0d3cd 100644
> --- a/xen/arch/x86/hvm/Kconfig
> +++ b/xen/arch/x86/hvm/Kconfig
> @@ -63,6 +63,16 @@ config ALTP2M
>  
>         If unsure, stay with defaults.
>  
> +config HVM_VIRIDIAN
> +     bool "Hyper-V enlighnments for guests" if EXPERT

Nit: "enlightenments"

> --- a/xen/arch/x86/include/asm/hvm/hvm.h
> +++ b/xen/arch/x86/include/asm/hvm/hvm.h
> @@ -507,7 +507,8 @@ hvm_get_cpl(struct vcpu *v)
>      (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
>  
>  #define is_viridian_domain(d) \
> -    (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
> +    (IS_ENABLED(CONFIG_HVM_VIRIDIAN) && \
> +    is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))

Nit: Missing an indenting blank on the latter line.

Will adjust while committing.

Jan

Reply via email to