[PATCH v9 17/22] KVM: x86: Advertise support for FRED

Xin Li (Intel) posted 22 patches 1 month, 2 weeks ago
[PATCH v9 17/22] KVM: x86: Advertise support for FRED
Posted by Xin Li (Intel) 1 month, 2 weeks ago
From: Xin Li <xin3.li@intel.com>

Advertise support for FRED to userspace after changes required to enable
FRED in a KVM guest are in place.

Signed-off-by: Xin Li <xin3.li@intel.com>
Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Tested-by: Shan Kang <shan.kang@intel.com>
Tested-by: Xuelian Guo <xuelian.guo@intel.com>
---

Change in v5:
* Don't advertise FRED/LKGS together, LKGS can be advertised as an
  independent feature (Sean).
* Add TB from Xuelian Guo.
---
 arch/x86/kvm/cpuid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index d563a948318b..0bf97b8a3216 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -1014,6 +1014,7 @@ void kvm_set_cpu_caps(void)
 		F(FSRS),
 		F(FSRC),
 		F(WRMSRNS),
+		X86_64_F(FRED),
 		X86_64_F(LKGS),
 		F(AMX_FP16),
 		F(AVX_IFMA),
-- 
2.51.0
Re: [PATCH v9 17/22] KVM: x86: Advertise support for FRED
Posted by Chao Gao 1 month ago
On Sun, Oct 26, 2025 at 01:19:05PM -0700, Xin Li (Intel) wrote:
>From: Xin Li <xin3.li@intel.com>
>
>Advertise support for FRED to userspace after changes required to enable
>FRED in a KVM guest are in place.

I'm not sure if AMD CPUs support FRED, but just in case, we can clear FRED
i.e., kvm_cpu_cap_clear(X86_FEATURE_FRED) in svm_set_cpu_caps().

With this fixed:

Reviewed-by: Chao Gao <chao.gao@intel.com>

>
>Signed-off-by: Xin Li <xin3.li@intel.com>
>Signed-off-by: Xin Li (Intel) <xin@zytor.com>
>Tested-by: Shan Kang <shan.kang@intel.com>
>Tested-by: Xuelian Guo <xuelian.guo@intel.com>
>---
>
>Change in v5:
>* Don't advertise FRED/LKGS together, LKGS can be advertised as an
>  independent feature (Sean).
>* Add TB from Xuelian Guo.
>---
> arch/x86/kvm/cpuid.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>index d563a948318b..0bf97b8a3216 100644
>--- a/arch/x86/kvm/cpuid.c
>+++ b/arch/x86/kvm/cpuid.c
>@@ -1014,6 +1014,7 @@ void kvm_set_cpu_caps(void)
> 		F(FSRS),
> 		F(FSRC),
> 		F(WRMSRNS),
>+		X86_64_F(FRED),
> 		X86_64_F(LKGS),
> 		F(AMX_FP16),
> 		F(AVX_IFMA),
>-- 
>2.51.0
>