Return-path: Received: from mx2.suse.de ([195.135.220.15]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1f9onX-0000dI-9I for speck@linutronix.de; Sat, 21 Apr 2018 11:27:11 +0200 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B15B8ABF9 for ; Sat, 21 Apr 2018 09:27:05 +0000 (UTC) Date: Sat, 21 Apr 2018 11:27:01 +0200 From: Borislav Petkov Subject: [MODERATED] Re: [patch 09/11] [PATCH v2 09/10] Linux Patch #9 Message-ID: <20180421092701.GC18575@pd.tnic> References: <20180420022613.409383282@localhost.localdomain> MIME-Version: 1.0 In-Reply-To: <20180420022613.409383282@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: speck@linutronix.de List-ID: On Thu, Apr 19, 2018 at 10:25:49PM -0400, speck for konrad.wilk_at_oracle.com= wrote: > x86/ssb/AMD: Add support to disable MD on Fam[15,16,17]h. >=20 > AMD does not need the memory disambiguation to be disabled. > But the parameters for this are already available and > can be done via MSR C001_1020. Each family uses a different > bit in that MSR for this. >=20 > XXX-Suggested-by: Borislav Petkov > Signed-off-by: Konrad Rzeszutek Wilk > --- > v2: New patch > --- > arch/x86/kernel/cpu/amd.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > arch/x86/kernel/cpu/bugs.c | 11 +++++++++-- > 2 files changed, 51 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c > index f0e6456ca7d3..e207eb2e8011 100644 > --- a/arch/x86/kernel/cpu/amd.c > +++ b/arch/x86/kernel/cpu/amd.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -32,6 +33,8 @@ static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, = const int *erratum); > */ > static u32 nodes_per_socket =3D 1; > =20 > +static unsigned long long msr_MSR_AMD64_LS_CFG_val; > + > static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) > { > u32 gprs[8] =3D { 0 }; > @@ -787,6 +790,8 @@ static void init_amd_bd(struct cpuinfo_x86 *c) > wrmsrl_safe(MSR_F15H_IC_CFG, value); > } > } > + if (!rdmsrl_safe(MSR_AMD64_LS_CFG, &msr_MSR_AMD64_LS_CFG_val)) > + set_cpu_cap(c, X86_FEATURE_MDD); This is not needed since you'll be setting X86_FEATURE_MDD in the early function early_init_amd() now. The only thing you need to do then in those functions is: if (cpu_has(c, X86_FEATURE_USE_MDD)) msr_set_bit(MSR_AMD64_LS_CFG, 54); with the respective bits used in each function. And then drop that ad-hoc ssb_mitigation_needed() thing. --=20 Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton, HR= B 21284 (AG N=C3=BCrnberg) --=20