Message ID | 20230719144131.29052-10-binbin.wu@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Linear Address Masking (LAM) KVM Enabling | expand |
s/Expose/Advertise And I would add an "enable" in there somehwere, because to Kai's point earlier in the series about kvm_cpu_cap_has(), the guest can't actually use LAM until this patch. Sometimes we do just say "Advertise", but typically only for features where there's not virtualization support, e.g. AVX instructions where the guest can use them irrespective of what KVM says it supports. This? KVM: x86: Advertise and enable LAM (user and supervisor) On Wed, Jul 19, 2023, Binbin Wu wrote: > From: Robert Hoo <robert.hu@linux.intel.com> > > LAM feature is enumerated by CPUID.7.1:EAX.LAM[bit 26]. > Expose the feature to userspace as the final step after the following > supports: > - CR4.LAM_SUP virtualization > - CR3.LAM_U48 and CR3.LAM_U57 virtualization > - Check and untag 64-bit linear address when LAM applies in instruction > emulations and VMExit handlers. > > Exposing SGX LAM support is not supported yet. SGX LAM support is enumerated > in SGX's own CPUID and there's no hard requirement that it must be supported > when LAM is reported in CPUID leaf 0x7. > > Signed-off-by: Robert Hoo <robert.hu@linux.intel.com> > Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com> > Reviewed-by: Jingqi Liu <jingqi.liu@intel.com> > Reviewed-by: Chao Gao <chao.gao@intel.com> > Reviewed-by: Kai Huang <kai.huang@intel.com> > Tested-by: Xuelian Guo <xuelian.guo@intel.com> > --- > arch/x86/kvm/cpuid.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 7ebf3ce1bb5f..21d525b01d45 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -645,7 +645,7 @@ void kvm_set_cpu_caps(void) > kvm_cpu_cap_mask(CPUID_7_1_EAX, > F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | > F(FZRM) | F(FSRS) | F(FSRC) | > - F(AMX_FP16) | F(AVX_IFMA) > + F(AMX_FP16) | F(AVX_IFMA) | F(LAM) > ); > > kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX, > -- > 2.25.1 >
On 8/17/2023 5:53 AM, Sean Christopherson wrote: > s/Expose/Advertise > > And I would add an "enable" in there somehwere, because to Kai's point earlier in > the series about kvm_cpu_cap_has(), the guest can't actually use LAM until this > patch. Sometimes we do just say "Advertise", but typically only for features > where there's not virtualization support, e.g. AVX instructions where the guest > can use them irrespective of what KVM says it supports. > > This? > > KVM: x86: Advertise and enable LAM (user and supervisor) It looks good to me. Thanks. > > On Wed, Jul 19, 2023, Binbin Wu wrote: >> From: Robert Hoo <robert.hu@linux.intel.com> >> >> LAM feature is enumerated by CPUID.7.1:EAX.LAM[bit 26]. >> Expose the feature to userspace as the final step after the following >> supports: >> - CR4.LAM_SUP virtualization >> - CR3.LAM_U48 and CR3.LAM_U57 virtualization >> - Check and untag 64-bit linear address when LAM applies in instruction >> emulations and VMExit handlers. >> >> Exposing SGX LAM support is not supported yet. SGX LAM support is enumerated >> in SGX's own CPUID and there's no hard requirement that it must be supported >> when LAM is reported in CPUID leaf 0x7. >> >> Signed-off-by: Robert Hoo <robert.hu@linux.intel.com> >> Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com> >> Reviewed-by: Jingqi Liu <jingqi.liu@intel.com> >> Reviewed-by: Chao Gao <chao.gao@intel.com> >> Reviewed-by: Kai Huang <kai.huang@intel.com> >> Tested-by: Xuelian Guo <xuelian.guo@intel.com> >> --- >> arch/x86/kvm/cpuid.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c >> index 7ebf3ce1bb5f..21d525b01d45 100644 >> --- a/arch/x86/kvm/cpuid.c >> +++ b/arch/x86/kvm/cpuid.c >> @@ -645,7 +645,7 @@ void kvm_set_cpu_caps(void) >> kvm_cpu_cap_mask(CPUID_7_1_EAX, >> F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | >> F(FZRM) | F(FSRS) | F(FSRC) | >> - F(AMX_FP16) | F(AVX_IFMA) >> + F(AMX_FP16) | F(AVX_IFMA) | F(LAM) >> ); >> >> kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX, >> -- >> 2.25.1 >>
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 7ebf3ce1bb5f..21d525b01d45 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -645,7 +645,7 @@ void kvm_set_cpu_caps(void) kvm_cpu_cap_mask(CPUID_7_1_EAX, F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | F(FZRM) | F(FSRS) | F(FSRC) | - F(AMX_FP16) | F(AVX_IFMA) + F(AMX_FP16) | F(AVX_IFMA) | F(LAM) ); kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX,