linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/cpu/AMD: Fix CPB bit for more processors
@ 2018-11-20  3:00 Jiaxun Yang
  2019-01-18 15:48 ` [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h tip-bot for Jiaxun Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Jiaxun Yang @ 2018-11-20  3:00 UTC (permalink / raw)
  To: x86; +Cc: bp, sherry.hurwitz, linux-kernel, Jiaxun Yang, stable

CPUID Fn8000_0007_EDX[CPB] is wrongly 0 on some newer F17h
procssors but their revision guide has not been released.

For example,Tesed on AMD "Ryzen 7 2700U with Radeon Vega Mobile Gfx"
and "AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx",
their CPUID Fn0000_0001_EAX is 0x00810f10 and should have
CPB feature according AMD product specifications, however
their Fn8000_0007_EDX is 0x00006599, indicating they don't
support CPB feature.

Since whole F17h should support CPB, we set the cap for all of
them.

Cc: stable@vger.kernel.org
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/x86/kernel/cpu/amd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index eeea634bee0a..37989fa9e620 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -818,12 +818,13 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
 static void init_amd_zn(struct cpuinfo_x86 *c)
 {
 	set_cpu_cap(c, X86_FEATURE_ZEN);
+
 	/*
 	 * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
-	 * all up to and including B1.
+	 * a lot of Family 17h processors and some models are undocumented, since
+	 * whole F17h should support CPB, we set the cap for all of them.
 	 */
-	if (c->x86_model <= 1 && c->x86_stepping <= 1)
-		set_cpu_cap(c, X86_FEATURE_CPB);
+	set_cpu_cap(c, X86_FEATURE_CPB);
 }

 static void init_amd(struct cpuinfo_x86 *c)
--
2.19.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h
  2018-11-20  3:00 [PATCH v2] x86/cpu/AMD: Fix CPB bit for more processors Jiaxun Yang
@ 2019-01-18 15:48 ` tip-bot for Jiaxun Yang
  2019-02-20  8:53   ` Borislav Petkov
  0 siblings, 1 reply; 7+ messages in thread
From: tip-bot for Jiaxun Yang @ 2019-01-18 15:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: suravee.suthikulpanit, jiaxun.yang, tglx, x86, linux-kernel,
	sherry.hurwitz, mingo, bp, mingo, thomas.lendacky, hpa

Commit-ID:  0237199186e7a4aa5310741f0a6498a20c820fd7
Gitweb:     https://git.kernel.org/tip/0237199186e7a4aa5310741f0a6498a20c820fd7
Author:     Jiaxun Yang <jiaxun.yang@flygoat.com>
AuthorDate: Tue, 20 Nov 2018 11:00:18 +0800
Committer:  Borislav Petkov <bp@suse.de>
CommitDate: Fri, 18 Jan 2019 16:44:03 +0100

x86/CPU/AMD: Set the CPB bit unconditionally on F17h

Some F17h models do not have CPB set in CPUID even though the CPU
supports it. Set the feature bit unconditionally on all F17h.

 [ bp: Rewrite commit message and patch. ]

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Sherry Hurwitz <sherry.hurwitz@amd.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20181120030018.5185-1-jiaxun.yang@flygoat.com
---
 arch/x86/kernel/cpu/amd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 69f6bbb41be0..01004bfb1a1b 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -819,11 +819,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
 static void init_amd_zn(struct cpuinfo_x86 *c)
 {
 	set_cpu_cap(c, X86_FEATURE_ZEN);
-	/*
-	 * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
-	 * all up to and including B1.
-	 */
-	if (c->x86_model <= 1 && c->x86_stepping <= 1)
+
+	/* Fix erratum 1076: CPB feature bit not being set in CPUID. */
+	if (!cpu_has(c, X86_FEATURE_CPB))
 		set_cpu_cap(c, X86_FEATURE_CPB);
 }
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h
  2019-01-18 15:48 ` [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h tip-bot for Jiaxun Yang
@ 2019-02-20  8:53   ` Borislav Petkov
  2019-02-21 11:52     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2019-02-20  8:53 UTC (permalink / raw)
  To: stable
  Cc: linux-tip-commits, suravee.suthikulpanit, jiaxun.yang, tglx, x86,
	linux-kernel, sherry.hurwitz, mingo, mingo, thomas.lendacky, hpa,
	Erwan Velu

On Fri, Jan 18, 2019 at 07:48:59AM -0800, tip-bot for Jiaxun Yang wrote:
> Commit-ID:  0237199186e7a4aa5310741f0a6498a20c820fd7
> Gitweb:     https://git.kernel.org/tip/0237199186e7a4aa5310741f0a6498a20c820fd7
> Author:     Jiaxun Yang <jiaxun.yang@flygoat.com>
> AuthorDate: Tue, 20 Nov 2018 11:00:18 +0800
> Committer:  Borislav Petkov <bp@suse.de>
> CommitDate: Fri, 18 Jan 2019 16:44:03 +0100
> 
> x86/CPU/AMD: Set the CPB bit unconditionally on F17h
> 
> Some F17h models do not have CPB set in CPUID even though the CPU
> supports it. Set the feature bit unconditionally on all F17h.
> 
>  [ bp: Rewrite commit message and patch. ]
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Sherry Hurwitz <sherry.hurwitz@amd.com>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: x86-ml <x86@kernel.org>
> Link: https://lkml.kernel.org/r/20181120030018.5185-1-jiaxun.yang@flygoat.com
> ---
>  arch/x86/kernel/cpu/amd.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 69f6bbb41be0..01004bfb1a1b 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -819,11 +819,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
>  static void init_amd_zn(struct cpuinfo_x86 *c)
>  {
>  	set_cpu_cap(c, X86_FEATURE_ZEN);
> -	/*
> -	 * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
> -	 * all up to and including B1.
> -	 */
> -	if (c->x86_model <= 1 && c->x86_stepping <= 1)
> +
> +	/* Fix erratum 1076: CPB feature bit not being set in CPUID. */
> +	if (!cpu_has(c, X86_FEATURE_CPB))
>  		set_cpu_cap(c, X86_FEATURE_CPB);

Stable folks, please take this one above into those stable trees which
have backported

f7f3dc00f612 ("x86/cpu/AMD: Fix erratum 1076 (CPB bit)")

Thx.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h
  2019-02-20  8:53   ` Borislav Petkov
@ 2019-02-21 11:52     ` Greg KH
  2019-02-21 12:25       ` Borislav Petkov
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2019-02-21 11:52 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: stable, linux-tip-commits, suravee.suthikulpanit, jiaxun.yang,
	tglx, x86, linux-kernel, sherry.hurwitz, mingo, mingo,
	thomas.lendacky, hpa, Erwan Velu

On Wed, Feb 20, 2019 at 09:53:34AM +0100, Borislav Petkov wrote:
> On Fri, Jan 18, 2019 at 07:48:59AM -0800, tip-bot for Jiaxun Yang wrote:
> > Commit-ID:  0237199186e7a4aa5310741f0a6498a20c820fd7
> > Gitweb:     https://git.kernel.org/tip/0237199186e7a4aa5310741f0a6498a20c820fd7
> > Author:     Jiaxun Yang <jiaxun.yang@flygoat.com>
> > AuthorDate: Tue, 20 Nov 2018 11:00:18 +0800
> > Committer:  Borislav Petkov <bp@suse.de>
> > CommitDate: Fri, 18 Jan 2019 16:44:03 +0100
> > 
> > x86/CPU/AMD: Set the CPB bit unconditionally on F17h
> > 
> > Some F17h models do not have CPB set in CPUID even though the CPU
> > supports it. Set the feature bit unconditionally on all F17h.
> > 
> >  [ bp: Rewrite commit message and patch. ]
> > 
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Signed-off-by: Borislav Petkov <bp@suse.de>
> > Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Sherry Hurwitz <sherry.hurwitz@amd.com>
> > Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: x86-ml <x86@kernel.org>
> > Link: https://lkml.kernel.org/r/20181120030018.5185-1-jiaxun.yang@flygoat.com
> > ---
> >  arch/x86/kernel/cpu/amd.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> > index 69f6bbb41be0..01004bfb1a1b 100644
> > --- a/arch/x86/kernel/cpu/amd.c
> > +++ b/arch/x86/kernel/cpu/amd.c
> > @@ -819,11 +819,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
> >  static void init_amd_zn(struct cpuinfo_x86 *c)
> >  {
> >  	set_cpu_cap(c, X86_FEATURE_ZEN);
> > -	/*
> > -	 * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
> > -	 * all up to and including B1.
> > -	 */
> > -	if (c->x86_model <= 1 && c->x86_stepping <= 1)
> > +
> > +	/* Fix erratum 1076: CPB feature bit not being set in CPUID. */
> > +	if (!cpu_has(c, X86_FEATURE_CPB))
> >  		set_cpu_cap(c, X86_FEATURE_CPB);
> 
> Stable folks, please take this one above into those stable trees which
> have backported
> 
> f7f3dc00f612 ("x86/cpu/AMD: Fix erratum 1076 (CPB bit)")

I would, but I do not see this patch in Linus's tree yet :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h
  2019-02-21 11:52     ` Greg KH
@ 2019-02-21 12:25       ` Borislav Petkov
  2019-03-08 10:26         ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2019-02-21 12:25 UTC (permalink / raw)
  To: Greg KH
  Cc: stable, linux-tip-commits, suravee.suthikulpanit, jiaxun.yang,
	tglx, x86, linux-kernel, sherry.hurwitz, mingo, mingo,
	thomas.lendacky, hpa, Erwan Velu

On Thu, Feb 21, 2019 at 12:52:30PM +0100, Greg KH wrote:
> I would, but I do not see this patch in Linus's tree yet :)

You will soon :)

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h
  2019-02-21 12:25       ` Borislav Petkov
@ 2019-03-08 10:26         ` Greg KH
  2019-03-11 16:32           ` Erwan Velu
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2019-03-08 10:26 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: stable, linux-tip-commits, suravee.suthikulpanit, jiaxun.yang,
	tglx, x86, linux-kernel, sherry.hurwitz, mingo, mingo,
	thomas.lendacky, hpa, Erwan Velu

On Thu, Feb 21, 2019 at 01:25:23PM +0100, Borislav Petkov wrote:
> On Thu, Feb 21, 2019 at 12:52:30PM +0100, Greg KH wrote:
> > I would, but I do not see this patch in Linus's tree yet :)
> 
> You will soon :)

I see it now, so it's now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h
  2019-03-08 10:26         ` Greg KH
@ 2019-03-11 16:32           ` Erwan Velu
  0 siblings, 0 replies; 7+ messages in thread
From: Erwan Velu @ 2019-03-11 16:32 UTC (permalink / raw)
  To: Greg KH, Borislav Petkov
  Cc: stable, linux-tip-commits, suravee.suthikulpanit, jiaxun.yang,
	tglx, x86, linux-kernel, sherry.hurwitz, mingo, mingo,
	thomas.lendacky, hpa


Le 08/03/2019 à 11:26, Greg KH a écrit :
> On Thu, Feb 21, 2019 at 01:25:23PM +0100, Borislav Petkov wrote:
>> On Thu, Feb 21, 2019 at 12:52:30PM +0100, Greg KH wrote:
>>> I would, but I do not see this patch in Linus's tree yet :)
>> You will soon :)
> I see it now, so it's now queued up, thanks.
>
> greg k-h
Thanks greg !

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-11 16:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20  3:00 [PATCH v2] x86/cpu/AMD: Fix CPB bit for more processors Jiaxun Yang
2019-01-18 15:48 ` [tip:x86/cpu] x86/CPU/AMD: Set the CPB bit unconditionally on F17h tip-bot for Jiaxun Yang
2019-02-20  8:53   ` Borislav Petkov
2019-02-21 11:52     ` Greg KH
2019-02-21 12:25       ` Borislav Petkov
2019-03-08 10:26         ` Greg KH
2019-03-11 16:32           ` Erwan Velu

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).