Message ID | 20220708144223.610080-4-vkuznets@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: VMX: Support updated eVMCSv1 revision + use vmcs_config for L1 VMX MSRs | expand |
On Fri, 2022-07-08 at 16:42 +0200, Vitaly Kuznetsov wrote: > Updated Hyper-V Enlightened VMCS specification lists several new > fields for the following features: > > - PerfGlobalCtrl > - EnclsExitingBitmap > - Tsc Scaling > - GuestLbrCtl > - CET > - SSP > > Update the definition. The updated definition is available only when > CPUID.0x4000000A.EBX BIT(0) is '1'. Add a define for it as well. > > Note: The latest TLFS is available at > https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/tlfs > > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> > --- > arch/x86/include/asm/hyperv-tlfs.h | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h > index 6f0acc45e67a..6f2c3cdacdf4 100644 > --- a/arch/x86/include/asm/hyperv-tlfs.h > +++ b/arch/x86/include/asm/hyperv-tlfs.h > @@ -138,6 +138,9 @@ > #define HV_X64_NESTED_GUEST_MAPPING_FLUSH BIT(18) > #define HV_X64_NESTED_MSR_BITMAP BIT(19) > Maybe add a comment that this is undocumented + what that cpuid bit does? > +/* Nested quirks. These are HYPERV_CPUID_NESTED_FEATURES.EBX bits. */ > +#define HV_X64_NESTED_EVMCS1_2022_UPDATE BIT(0) > + > /* > * This is specific to AMD and specifies that enlightened TLB flush is > * supported. If guest opts in to this feature, ASID invalidations only > @@ -559,9 +562,20 @@ struct hv_enlightened_vmcs { > u64 partition_assist_page; > u64 padding64_4[4]; > u64 guest_bndcfgs; > - u64 padding64_5[7]; > + u64 guest_ia32_perf_global_ctrl; > + u64 guest_ia32_s_cet; > + u64 guest_ssp; > + u64 guest_ia32_int_ssp_table_addr; > + u64 guest_ia32_lbr_ctl; > + u64 padding64_5[2]; This change looks OK > u64 xss_exit_bitmap; > - u64 padding64_6[7]; > + u64 host_ia32_perf_global_ctrl; > + u64 encls_exiting_bitmap; > + u64 tsc_multiplier; > + u64 host_ia32_s_cet; > + u64 host_ssp; > + u64 host_ia32_int_ssp_table_addr; > + u64 padding64_6; I think we have a mistake here: UINT64 XssExitingBitmap; UINT64 EnclsExitingBitmap; UINT64 HostPerfGlobalCtrl; UINT64 TscMultiplier; UINT64 HostSCet; UINT64 HostSsp; UINT64 HostInterruptSspTableAddr; UINT64 Rsvd8; I think you need to swap encls_exiting_bitmap and host_ia32_perf_global_ctrl I used https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/datatypes/hv_vmx_enlightened_vmcs as the reference. Best regards, Maxim Levitsky > } __packed; > > #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0
Maxim Levitsky <mlevitsk@redhat.com> writes: > On Fri, 2022-07-08 at 16:42 +0200, Vitaly Kuznetsov wrote: >> Updated Hyper-V Enlightened VMCS specification lists several new >> fields for the following features: >> >> - PerfGlobalCtrl >> - EnclsExitingBitmap >> - Tsc Scaling >> - GuestLbrCtl >> - CET >> - SSP >> >> Update the definition. The updated definition is available only when >> CPUID.0x4000000A.EBX BIT(0) is '1'. Add a define for it as well. >> >> Note: The latest TLFS is available at >> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/tlfs >> >> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> >> --- >> arch/x86/include/asm/hyperv-tlfs.h | 18 ++++++++++++++++-- >> 1 file changed, 16 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h >> index 6f0acc45e67a..6f2c3cdacdf4 100644 >> --- a/arch/x86/include/asm/hyperv-tlfs.h >> +++ b/arch/x86/include/asm/hyperv-tlfs.h >> @@ -138,6 +138,9 @@ >> #define HV_X64_NESTED_GUEST_MAPPING_FLUSH BIT(18) >> #define HV_X64_NESTED_MSR_BITMAP BIT(19) >> > > Maybe add a comment that this is undocumented + what that cpuid bit does? > >> +/* Nested quirks. These are HYPERV_CPUID_NESTED_FEATURES.EBX bits. */ >> +#define HV_X64_NESTED_EVMCS1_2022_UPDATE BIT(0) >> + >> /* >> * This is specific to AMD and specifies that enlightened TLB flush is >> * supported. If guest opts in to this feature, ASID invalidations only >> @@ -559,9 +562,20 @@ struct hv_enlightened_vmcs { >> u64 partition_assist_page; >> u64 padding64_4[4]; >> u64 guest_bndcfgs; >> - u64 padding64_5[7]; >> + u64 guest_ia32_perf_global_ctrl; >> + u64 guest_ia32_s_cet; >> + u64 guest_ssp; >> + u64 guest_ia32_int_ssp_table_addr; >> + u64 guest_ia32_lbr_ctl; >> + u64 padding64_5[2]; > > This change looks OK > >> u64 xss_exit_bitmap; >> - u64 padding64_6[7]; >> + u64 host_ia32_perf_global_ctrl; >> + u64 encls_exiting_bitmap; >> + u64 tsc_multiplier; >> + u64 host_ia32_s_cet; >> + u64 host_ssp; >> + u64 host_ia32_int_ssp_table_addr; >> + u64 padding64_6; > > I think we have a mistake here: > > UINT64 XssExitingBitmap; > UINT64 EnclsExitingBitmap; > UINT64 HostPerfGlobalCtrl; > UINT64 TscMultiplier; > UINT64 HostSCet; > UINT64 HostSsp; > UINT64 HostInterruptSspTableAddr; > UINT64 Rsvd8; > > > I think you need to swap encls_exiting_bitmap and host_ia32_perf_global_ctrl > > I used https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/datatypes/hv_vmx_enlightened_vmcs > as the reference. Oh, nice catch, thanks! I have no idea how this mistake crept in. A conspiracy theory: maybe the online version of TLFS was updated under our feet? :-) v4 is coming to rescue. > > > Best regards, > Maxim Levitsky > > >> } __packed; >> >> #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0 > >
diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 6f0acc45e67a..6f2c3cdacdf4 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -138,6 +138,9 @@ #define HV_X64_NESTED_GUEST_MAPPING_FLUSH BIT(18) #define HV_X64_NESTED_MSR_BITMAP BIT(19) +/* Nested quirks. These are HYPERV_CPUID_NESTED_FEATURES.EBX bits. */ +#define HV_X64_NESTED_EVMCS1_2022_UPDATE BIT(0) + /* * This is specific to AMD and specifies that enlightened TLB flush is * supported. If guest opts in to this feature, ASID invalidations only @@ -559,9 +562,20 @@ struct hv_enlightened_vmcs { u64 partition_assist_page; u64 padding64_4[4]; u64 guest_bndcfgs; - u64 padding64_5[7]; + u64 guest_ia32_perf_global_ctrl; + u64 guest_ia32_s_cet; + u64 guest_ssp; + u64 guest_ia32_int_ssp_table_addr; + u64 guest_ia32_lbr_ctl; + u64 padding64_5[2]; u64 xss_exit_bitmap; - u64 padding64_6[7]; + u64 host_ia32_perf_global_ctrl; + u64 encls_exiting_bitmap; + u64 tsc_multiplier; + u64 host_ia32_s_cet; + u64 host_ssp; + u64 host_ia32_int_ssp_table_addr; + u64 padding64_6; } __packed; #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0
Updated Hyper-V Enlightened VMCS specification lists several new fields for the following features: - PerfGlobalCtrl - EnclsExitingBitmap - Tsc Scaling - GuestLbrCtl - CET - SSP Update the definition. The updated definition is available only when CPUID.0x4000000A.EBX BIT(0) is '1'. Add a define for it as well. Note: The latest TLFS is available at https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/tlfs Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- arch/x86/include/asm/hyperv-tlfs.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)