[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210406155004.230790-3-rsaripal@amd.com>
Date: Tue, 6 Apr 2021 10:50:01 -0500
From: Ramakrishna Saripalli <rsaripal@....com>
To: <linux-kernel@...r.kernel.org>, <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>
CC: <rsaripal@....com>
Subject: [PATCH 2/5] x86/speculation: Implement support for PSFD detection and reporting
From: Ramakrishna Saripalli <rk.saripalli@....com>
All AMD processors that support Predictive Store Forwarding (PSF)
provide a CPUID bit to detect support for mitigation of this
feature. This bit is referred to as PSFD (Predictive Store Forwarding
Disable)
If CPU advertises PSFD:
- Advertise a generic feature (X86_FEATURE_PSFD) in Linux capability
flags to indicate PSF mitigation is available.
- Advertise X86_BUG_PSF in Linux bug bits to indicate that CPU is
affected by PSF security risks.
Signed-off-by: Ramakrishna Saripalli<rk.saripalli@....com>
---
arch/x86/kernel/cpu/common.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index ab640abe26b6..4e604d58f3b3 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -893,6 +893,9 @@ static void init_speculation_control(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_MSR_SPEC_CTRL);
clear_cpu_cap(c, X86_FEATURE_VIRT_SSBD);
}
+
+ if (cpu_has(c, X86_FEATURE_AMD_PSFD))
+ set_cpu_cap(c, X86_FEATURE_PSFD);
}
void get_cpu_cap(struct cpuinfo_x86 *c)
@@ -1154,6 +1157,9 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
!cpu_has(c, X86_FEATURE_AMD_SSB_NO))
setup_force_cpu_bug(X86_BUG_SPEC_STORE_BYPASS);
+ if (cpu_has(c, X86_FEATURE_AMD_PSFD))
+ setup_force_cpu_bug(X86_BUG_PSF);
+
if (ia32_cap & ARCH_CAP_IBRS_ALL)
setup_force_cpu_cap(X86_FEATURE_IBRS_ENHANCED);
--
2.25.1
Powered by blists - more mailing lists