All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramakrishna Saripalli <rsaripal@amd.com>
To: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>
Cc: <rsaripal@amd.com>
Subject: [PATCH 2/5] x86/speculation: Implement support for PSFD detection and reporting
Date: Tue, 6 Apr 2021 10:50:01 -0500	[thread overview]
Message-ID: <20210406155004.230790-3-rsaripal@amd.com> (raw)
In-Reply-To: <20210406155004.230790-1-rsaripal@amd.com>

From: Ramakrishna Saripalli <rk.saripalli@amd.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@amd.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


  parent reply	other threads:[~2021-04-06 15:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 15:49 [PATCH 0/5] Introduce support for PSF mitigation Ramakrishna Saripalli
2021-04-06 15:50 ` [PATCH 1/5] x86/cpufeatures: Define feature bits to support mitigation of PSF Ramakrishna Saripalli
2021-04-09 17:41   ` Borislav Petkov
2021-04-09 18:22     ` Saripalli, RK
2021-04-09 19:39       ` Borislav Petkov
2021-04-09 19:45         ` Saripalli, RK
2021-04-09 20:19           ` Borislav Petkov
2021-04-09 20:29             ` Saripalli, RK
2021-04-06 15:50 ` Ramakrishna Saripalli [this message]
2021-04-06 15:50 ` [PATCH 3/5] x86/speculation: Introduce SPEC_CTRL_MSR bit for PSFD Ramakrishna Saripalli
2021-04-06 15:50 ` [PATCH 4/5] x86/speculation: Implement PSF mitigation support Ramakrishna Saripalli
2021-04-06 15:50 ` [PATCH 5/5] x86/speculation: Add PSF mitigation kernel parameters Ramakrishna Saripalli
2021-04-06 17:26 ` [PATCH 0/5] Introduce support for PSF mitigation Borislav Petkov
2021-04-07 22:39 ` Josh Poimboeuf
2021-04-08 14:56   ` Saripalli, RK
2021-04-09  9:07     ` Borislav Petkov
2021-04-09 16:45     ` Josh Poimboeuf
2021-04-09 16:50       ` Saripalli, RK

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210406155004.230790-3-rsaripal@amd.com \
    --to=rsaripal@amd.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.