Re: [PATCH v10 19/28] KVM: x86: Advertise support for FRED

From: Binbin Wu

Date: Mon Nov 02 2026 - 02:36:15 EST


On 9/12/2026 5:36 AM, Sohil Mehta wrote:
> From: "Xin Li (Intel)" <xin@xxxxxxxxx>
>
> Advertise support for FRED to userspace after changes required to enable
> FRED in a KVM guest are in place.
>
> Signed-off-by: Xin Li (Intel) <xin@xxxxxxxxx>
> Signed-off-by: Sohil Mehta <sohil.mehta@xxxxxxxxx>
> Reviewed-by: Chao Gao <chao.gao@xxxxxxxxx>

The code change itself looks good to me.
But this patch should be moved after patch 25.

X86_CR4_FRED is added to nested.msrs.cr4_fixed1 in patch 25, before that
if the L1 guest enables FRED, it will break the nested case when do VMXON,
which checks nested_host_cr4_valid() and it will fail during the bisect
window before patch 25.

> ---
> v10:
> - kvm_cpu_cap_clear(X86_FEATURE_FRED) in svm_set_cpu_caps() (Chao).
> ---
> arch/x86/kvm/cpuid.c | 1 +
> arch/x86/kvm/svm/svm.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index ddb022cb203a..5682bacdfd32 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1034,6 +1034,7 @@ void kvm_initialize_cpu_caps(void)
> F(FSRS),
> F(FSRC),
> F(WRMSRNS),
> + X86_64_F(FRED),
> X86_64_F(LKGS),
> F(AMX_FP16),
> F(AVX_IFMA),
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index f254a5ff570d..dd19c7b4e904 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -5518,6 +5518,9 @@ static __init void svm_set_cpu_caps(void)
>
> kvm_cpu_cap_clear(X86_FEATURE_IBT);
>
> + /* SVM FRED virtualization not implemented yet */
> + kvm_cpu_cap_clear(X86_FEATURE_FRED);
> +
> /* CPUID 0x80000001 and 0x8000000A (SVM features) */
> if (nested) {
> kvm_cpu_cap_set(X86_FEATURE_SVM);