Message ID | 20180316142220.32506-7-vkuznets@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 16 Mar 2018, Vitaly Kuznetsov wrote: > > + if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) > + ms_hyperv.nested_features = > + cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); Please add curly braces. Rationale: https://marc.info/?l=linux-kernel&m=148467980905537 I know it's a pet pieve, ... Thanks, tglx
On Sun, 18 Mar 2018, Thomas Gleixner wrote: > On Fri, 16 Mar 2018, Vitaly Kuznetsov wrote: > > > > + if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) > > + ms_hyperv.nested_features = > > + cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); > > Please add curly braces. Rationale: > > https://marc.info/?l=linux-kernel&m=148467980905537 > > I know it's a pet pieve, ... Other than that: Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 07e0547ae8b8..99139c8e952b 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -21,6 +21,7 @@ #define HYPERV_CPUID_FEATURES 0x40000003 #define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004 #define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 +#define HYPERV_CPUID_NESTED_FEATURES 0x4000000A #define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 #define HYPERV_CPUID_MIN 0x40000005 @@ -339,6 +340,9 @@ struct hv_tsc_emulation_status { #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_MASK \ (~((1ull << HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT) - 1)) +/* Hyper-V Enlightened VMCS version mask in nested features CPUID */ +#define HV_X64_ENLIGHTENED_VMCS_VERSION 0xff + #define HV_X64_MSR_TSC_REFERENCE_ENABLE 0x00000001 #define HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT 12 diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 3f162353f180..57c65315b60b 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -13,6 +13,7 @@ struct ms_hyperv_info { u32 features; u32 misc_features; u32 hints; + u32 nested_features; u32 max_vp_index; u32 max_lp_index; }; diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 0dfc568c110c..8432bf215e30 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -208,6 +208,10 @@ static void __init ms_hyperv_init_platform(void) x86_platform.calibrate_cpu = hv_get_tsc_khz; } + if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) + ms_hyperv.nested_features = + cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); + #ifdef CONFIG_X86_LOCAL_APIC if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS && ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {