From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [patch 08/15] Hidden 8
Date: Tue, 15 May 2018 23:31:11 -0400 [thread overview]
Message-ID: <20180516033111.GI18660@char.us.oracle.com> (raw)
In-Reply-To: <20180513140538.883795088@linutronix.de>
On Sun, May 13, 2018 at 04:00:56PM +0200, speck for Thomas Gleixner wrote:
> Subject: [patch 08/15] x86/speculation: Add virtualized speculative store bypass disable support
> From: Tom Lendacky <thomas.lendacky@amd.com>
>
> Some AMD processors only support a non-architectural means of enabling
> speculative store bypass disable (SSBD). To allow a simplified view of
> this to a guest, an architectural definition has been created through a new
> CPUID bit, 0x80000008_EBX[25], and a new MSR, 0xc001011f. With this, a
> hypervisor can virtualize the existence of this definition and provide an
> architectural method for using SSBD to a guest.
Which would imply you should be able to use this on Intel. That is an
'software' and 'virtualized' MSR should be CPU vendor agnostic.
Why have it on 0x80000008_EBX instead of the virtualized CPUID leafs?
Oh wait, future AMD chips will do the right thing in the microcode.
And it may be that Intel will do it too? In which case see below..
>
> Add the new CPUID feature, the new MSR and update the existing SSBD
> support to use this MSR when present.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> arch/x86/include/asm/cpufeatures.h | 1 +
> arch/x86/include/asm/msr-index.h | 2 ++
> arch/x86/kernel/cpu/bugs.c | 4 +++-
> arch/x86/kernel/process.c | 13 ++++++++++++-
> 4 files changed, 18 insertions(+), 2 deletions(-)
>
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -282,6 +282,7 @@
> #define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */
> #define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */
> #define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */
> +#define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */
>
> /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */
> #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */
> --- a/arch/x86/include/asm/msr-index.h
> +++ b/arch/x86/include/asm/msr-index.h
> @@ -347,6 +347,8 @@
> #define MSR_AMD64_SEV_ENABLED_BIT 0
> #define MSR_AMD64_SEV_ENABLED BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT)
>
> +#define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f
/me scratches his head. this looks off, but it is probably my editor.
> +
> /* Fam 17h MSRs */
> #define MSR_F17H_IRPERF 0xc00000e9
>
..snip..
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -366,6 +366,15 @@ static __always_inline void amd_set_core
> }
> #endif
>
> +static __always_inline void amd_set_ssb_virt_state(unsigned long tifn)
s/amd_// ?
> +{
> + /*
> + * SSBD has the same definition in SPEC_CTRL and VIRT_SPEC_CTRL,
> + * so ssbd_tif_to_spec_ctrl() just works.
> + */
> + wrmsrl(MSR_AMD64_VIRT_SPEC_CTRL, ssbd_tif_to_spec_ctrl(tifn));
> +}
> +
> static __always_inline void intel_set_ssb_state(unsigned long tifn)
> {
> u64 msr = x86_spec_ctrl_base | ssbd_tif_to_spec_ctrl(tifn);
> @@ -375,7 +384,9 @@ static __always_inline void intel_set_ss
>
> static __always_inline void __speculative_store_bypass_update(unsigned long tifn)
> {
> - if (static_cpu_has(X86_FEATURE_LS_CFG_SSBD))
> + if (static_cpu_has(X86_FEATURE_VIRT_SSBD))
> + amd_set_ssb_virt_state(tifn);
and here too obviously..
> + else if (static_cpu_has(X86_FEATURE_LS_CFG_SSBD))
> amd_set_core_ssb_state(tifn);
> else
> intel_set_ssb_state(tifn);
>
next prev parent reply other threads:[~2018-05-16 3:31 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-13 14:00 [patch 00/15] Hidden 0 Thomas Gleixner
2018-05-13 14:00 ` [patch 01/15] Hidden 1 Thomas Gleixner
2018-05-13 22:17 ` [MODERATED] " Borislav Petkov
2018-05-15 9:30 ` Paolo Bonzini
2018-05-16 2:32 ` Konrad Rzeszutek Wilk
2018-05-16 7:51 ` Thomas Gleixner
2018-05-13 14:00 ` [patch 02/15] Hidden 2 Thomas Gleixner
2018-05-16 2:39 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-13 14:00 ` [patch 03/15] Hidden 3 Thomas Gleixner
2018-05-14 10:02 ` [MODERATED] " Borislav Petkov
2018-05-16 2:49 ` Konrad Rzeszutek Wilk
2018-05-16 8:07 ` Thomas Gleixner
2018-05-16 8:53 ` [MODERATED] Re: " Borislav Petkov
2018-05-13 14:00 ` [patch 04/15] Hidden 4 Thomas Gleixner
2018-05-14 11:11 ` [MODERATED] " Borislav Petkov
2018-05-16 2:53 ` Konrad Rzeszutek Wilk
2018-05-13 14:00 ` [patch 05/15] Hidden 5 Thomas Gleixner
2018-05-14 11:18 ` [MODERATED] " Borislav Petkov
2018-05-16 3:24 ` Konrad Rzeszutek Wilk
2018-05-16 9:09 ` Thomas Gleixner
2018-05-13 14:00 ` [patch 06/15] Hidden 6 Thomas Gleixner
2018-05-14 12:01 ` [MODERATED] " Borislav Petkov
2018-05-14 12:09 ` Peter Zijlstra
2018-05-14 12:46 ` Thomas Gleixner
2018-05-16 3:15 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 8:44 ` Thomas Gleixner
2018-05-13 14:00 ` [patch 07/15] Hidden 7 Thomas Gleixner
2018-05-14 17:07 ` [MODERATED] " Borislav Petkov
2018-05-16 3:22 ` Konrad Rzeszutek Wilk
2018-05-16 8:46 ` Thomas Gleixner
2018-05-16 12:15 ` Thomas Gleixner
2018-05-13 14:00 ` [patch 08/15] Hidden 8 Thomas Gleixner
2018-05-14 17:58 ` [MODERATED] " Borislav Petkov
2018-05-16 3:31 ` Konrad Rzeszutek Wilk [this message]
2018-05-16 12:22 ` Thomas Gleixner
2018-05-16 13:48 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-13 14:00 ` [patch 09/15] Hidden 9 Thomas Gleixner
2018-05-14 19:49 ` [MODERATED] " Borislav Petkov
2018-05-13 14:00 ` [patch 10/15] Hidden 10 Thomas Gleixner
2018-05-16 3:38 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-05-16 8:51 ` Thomas Gleixner
2018-05-13 14:00 ` [patch 11/15] Hidden 11 Thomas Gleixner
2018-05-14 20:02 ` [MODERATED] " Borislav Petkov
2018-05-16 3:35 ` Konrad Rzeszutek Wilk
2018-05-16 8:50 ` Thomas Gleixner
2018-05-13 14:01 ` [patch 12/15] Hidden 12 Thomas Gleixner
2018-05-14 20:18 ` [MODERATED] " Borislav Petkov
2018-05-16 3:40 ` Konrad Rzeszutek Wilk
2018-05-13 14:01 ` [patch 13/15] Hidden 13 Thomas Gleixner
2018-05-15 9:27 ` [MODERATED] " Borislav Petkov
2018-05-16 3:42 ` Konrad Rzeszutek Wilk
2018-05-16 8:56 ` Thomas Gleixner
2018-05-13 14:01 ` [patch 14/15] Hidden 14 Thomas Gleixner
2018-05-15 15:35 ` [MODERATED] " Borislav Petkov
2018-05-16 3:44 ` Konrad Rzeszutek Wilk
2018-05-13 14:01 ` [patch 15/15] Hidden 15 Thomas Gleixner
2018-05-13 14:22 ` [patch 00/15] Hidden 0 Thomas Gleixner
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=20180516033111.GI18660@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=speck@linutronix.de \
/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.