Re: [PATCH 1/7] hyperv: Detect Nested virtualization support for SVM

From: Borislav Petkov
Date: Wed Apr 07 2021 - 12:10:01 EST


On Wed, Apr 07, 2021 at 02:41:22PM +0000, Vineeth Pillai wrote:
> Detect nested features exposed by Hyper-V if SVM is enabled.
>
> Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/mshyperv.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 3546d3e21787..4d364acfe95d 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -325,9 +325,17 @@ static void __init ms_hyperv_init_platform(void)
> ms_hyperv.isolation_config_a, ms_hyperv.isolation_config_b);
> }
>
> - if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) {
> + /*
> + * AMD does not need enlightened VMCS as VMCB is already a
> + * datastructure in memory. We need to get the nested
> + * features if SVM is enabled.
> + */
> + if (boot_cpu_has(X86_FEATURE_SVM) ||

Pls use:

cpu_feature_enabled

here.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette