From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> To: speck@linutronix.de Subject: [MODERATED] [PATCH 2/9] TAA v2 2 Date: Wed, 23 Oct 2019 10:52:35 +0200 [thread overview] Message-ID: <760b742eae3b18d6a21ff0e395b259ecf0d8a6c7.1572168937.git.bp@suse.de> (raw) In-Reply-To: <cover.1572168937.git.bp@suse.de> From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Subject: [PATCH 2/9] x86/cpu: Add a helper function x86_read_arch_cap_msr() Add a helper function to read the IA32_ARCH_CAPABILITIES MSR. Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Mark Gross <mgross@linux.intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Tested-by: Neelima Krishnan <neelima.krishnan@intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: x86-ml <x86@kernel.org> --- arch/x86/kernel/cpu/common.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 9ae7d1bcd4f4..897c8302d982 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1092,19 +1092,26 @@ static bool __init cpu_matches(unsigned long which) return m && !!(m->driver_data & which); } -static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) +u64 x86_read_arch_cap_msr(void) { u64 ia32_cap = 0; + if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) + rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap); + + return ia32_cap; +} + +static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) +{ + u64 ia32_cap = x86_read_arch_cap_msr(); + if (cpu_matches(NO_SPECULATION)) return; setup_force_cpu_bug(X86_BUG_SPECTRE_V1); setup_force_cpu_bug(X86_BUG_SPECTRE_V2); - if (cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES)) - rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap); - if (!cpu_matches(NO_SSB) && !(ia32_cap & ARCH_CAP_SSB_NO) && !cpu_has(c, X86_FEATURE_AMD_SSB_NO)) setup_force_cpu_bug(X86_BUG_SPEC_STORE_BYPASS); -- 2.21.0
next prev parent reply other threads:[~2019-10-27 9:42 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-27 9:35 [MODERATED] [PATCH 0/9] TAA v2 0 Borislav Petkov 2019-10-23 8:45 ` [MODERATED] [PATCH 1/9] TAA v2 1 Pawan Gupta 2019-10-23 8:52 ` Pawan Gupta [this message] 2019-10-28 7:36 ` [PATCH 2/9] TAA v2 2 Thomas Gleixner 2019-10-23 9:01 ` [MODERATED] [PATCH 3/9] TAA v2 3 Pawan Gupta 2019-10-23 9:30 ` [MODERATED] [PATCH 4/9] TAA v2 4 Pawan Gupta 2019-10-23 10:19 ` [MODERATED] [PATCH 5/9] TAA v2 5 Pawan Gupta 2019-10-23 10:23 ` [MODERATED] [PATCH 6/9] TAA v2 6 Pawan Gupta 2019-10-23 10:28 ` [MODERATED] [PATCH 7/9] TAA v2 7 Pawan Gupta 2019-10-23 10:32 ` [MODERATED] [PATCH 8/9] TAA v2 8 Pawan Gupta 2019-10-23 10:35 ` [MODERATED] [PATCH 9/9] TAA v2 9 Michal Hocko
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=760b742eae3b18d6a21ff0e395b259ecf0d8a6c7.1572168937.git.bp@suse.de \ --to=pawan.kumar.gupta@linux.intel.com \ --cc=speck@linutronix.de \ --subject='Re: [MODERATED] [PATCH 2/9] TAA v2 2' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).