All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems
@ 2021-05-28  8:14 Pu Wen
  2021-05-31  8:55 ` [tip: x86/cpu] " tip-bot2 for Pu Wen
  2021-06-09 17:30 ` [PATCH] " Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Pu Wen @ 2021-05-28  8:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, rafael, len.brown, pavel, tglx, mingo, bp, hpa, puwen, x86,
	linux-pm

Hygon systems support the Monitor/Mwait instructions and these can be used
for ACPI C1 in the same way as on AMD and Intel systems.

The BIOS declares a C1 state in _CST to use FFH and CPUID_Fn00000005_EDX
is non-zero on Hygon systems.

Allow ffh_cstate_init() to succeed on Hygon systems to default using FFH
MWAIT instead of HALT for ACPI C1.

Tested successfully on Hygon Fam18h systems.

Signed-off-by: Pu Wen <puwen@hygon.cn>
---
 arch/x86/kernel/acpi/cstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 49ae4e1ac9cd..7de599eba7f0 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -197,7 +197,8 @@ static int __init ffh_cstate_init(void)
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_INTEL &&
-	    c->x86_vendor != X86_VENDOR_AMD)
+	    c->x86_vendor != X86_VENDOR_AMD &&
+	    c->x86_vendor != X86_VENDOR_HYGON)
 		return -1;
 
 	cpu_cstate_entry = alloc_percpu(struct cstate_entry);
-- 
2.23.0


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

* [tip: x86/cpu] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems
  2021-05-28  8:14 [PATCH] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems Pu Wen
@ 2021-05-31  8:55 ` tip-bot2 for Pu Wen
  2021-06-09 17:30 ` [PATCH] " Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Pu Wen @ 2021-05-31  8:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Pu Wen, Borislav Petkov, x86, linux-kernel

The following commit has been merged into the x86/cpu branch of tip:

Commit-ID:     280b68a3b3b96b027fcdeb5a3916a8e2aaf84d03
Gitweb:        https://git.kernel.org/tip/280b68a3b3b96b027fcdeb5a3916a8e2aaf84d03
Author:        Pu Wen <puwen@hygon.cn>
AuthorDate:    Fri, 28 May 2021 16:14:17 +08:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 31 May 2021 10:47:04 +02:00

x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems

Hygon systems support the MONITOR/MWAIT instructions and these can be
used for ACPI C1 in the same way as on AMD and Intel systems.

The BIOS declares a C1 state in _CST to use FFH and CPUID_Fn00000005_EDX
is non-zero on Hygon systems.

Allow ffh_cstate_init() to succeed on Hygon systems to default using FFH
MWAIT instead of HALT for ACPI C1.

Signed-off-by: Pu Wen <puwen@hygon.cn>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210528081417.31474-1-puwen@hygon.cn
---
 arch/x86/kernel/acpi/cstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 49ae4e1..7de599e 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -197,7 +197,8 @@ static int __init ffh_cstate_init(void)
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_INTEL &&
-	    c->x86_vendor != X86_VENDOR_AMD)
+	    c->x86_vendor != X86_VENDOR_AMD &&
+	    c->x86_vendor != X86_VENDOR_HYGON)
 		return -1;
 
 	cpu_cstate_entry = alloc_percpu(struct cstate_entry);

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

* Re: [PATCH] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems
  2021-05-28  8:14 [PATCH] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems Pu Wen
  2021-05-31  8:55 ` [tip: x86/cpu] " tip-bot2 for Pu Wen
@ 2021-06-09 17:30 ` Rafael J. Wysocki
  2021-06-09 17:39   ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-06-09 17:30 UTC (permalink / raw)
  To: Pu Wen
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Rafael J. Wysocki,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, the arch/x86 maintainers,
	Linux PM

On Fri, May 28, 2021 at 10:44 AM Pu Wen <puwen@hygon.cn> wrote:
>
> Hygon systems support the Monitor/Mwait instructions and these can be used
> for ACPI C1 in the same way as on AMD and Intel systems.
>
> The BIOS declares a C1 state in _CST to use FFH and CPUID_Fn00000005_EDX
> is non-zero on Hygon systems.
>
> Allow ffh_cstate_init() to succeed on Hygon systems to default using FFH
> MWAIT instead of HALT for ACPI C1.
>
> Tested successfully on Hygon Fam18h systems.
>
> Signed-off-by: Pu Wen <puwen@hygon.cn>
> ---
>  arch/x86/kernel/acpi/cstate.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
> index 49ae4e1ac9cd..7de599eba7f0 100644
> --- a/arch/x86/kernel/acpi/cstate.c
> +++ b/arch/x86/kernel/acpi/cstate.c
> @@ -197,7 +197,8 @@ static int __init ffh_cstate_init(void)
>         struct cpuinfo_x86 *c = &boot_cpu_data;
>
>         if (c->x86_vendor != X86_VENDOR_INTEL &&
> -           c->x86_vendor != X86_VENDOR_AMD)
> +           c->x86_vendor != X86_VENDOR_AMD &&
> +           c->x86_vendor != X86_VENDOR_HYGON)
>                 return -1;
>
>         cpu_cstate_entry = alloc_percpu(struct cstate_entry);
> --

Applied as 5.14 material, thanks!

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

* Re: [PATCH] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems
  2021-06-09 17:30 ` [PATCH] " Rafael J. Wysocki
@ 2021-06-09 17:39   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-06-09 17:39 UTC (permalink / raw)
  To: Pu Wen
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Rafael J. Wysocki,
	Len Brown, Pavel Machek, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, the arch/x86 maintainers,
	Linux PM

On Wed, Jun 9, 2021 at 7:30 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Fri, May 28, 2021 at 10:44 AM Pu Wen <puwen@hygon.cn> wrote:
> >
> > Hygon systems support the Monitor/Mwait instructions and these can be used
> > for ACPI C1 in the same way as on AMD and Intel systems.
> >
> > The BIOS declares a C1 state in _CST to use FFH and CPUID_Fn00000005_EDX
> > is non-zero on Hygon systems.
> >
> > Allow ffh_cstate_init() to succeed on Hygon systems to default using FFH
> > MWAIT instead of HALT for ACPI C1.
> >
> > Tested successfully on Hygon Fam18h systems.
> >
> > Signed-off-by: Pu Wen <puwen@hygon.cn>
> > ---
> >  arch/x86/kernel/acpi/cstate.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
> > index 49ae4e1ac9cd..7de599eba7f0 100644
> > --- a/arch/x86/kernel/acpi/cstate.c
> > +++ b/arch/x86/kernel/acpi/cstate.c
> > @@ -197,7 +197,8 @@ static int __init ffh_cstate_init(void)
> >         struct cpuinfo_x86 *c = &boot_cpu_data;
> >
> >         if (c->x86_vendor != X86_VENDOR_INTEL &&
> > -           c->x86_vendor != X86_VENDOR_AMD)
> > +           c->x86_vendor != X86_VENDOR_AMD &&
> > +           c->x86_vendor != X86_VENDOR_HYGON)
> >                 return -1;
> >
> >         cpu_cstate_entry = alloc_percpu(struct cstate_entry);
> > --
>
> Applied as 5.14 material, thanks!

And dropped, because it has been applied already by Boris:
https://git.kernel.org/tip/280b68a3b3b96b027fcdeb5a3916a8e2aaf84d03

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

end of thread, other threads:[~2021-06-09 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28  8:14 [PATCH] x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems Pu Wen
2021-05-31  8:55 ` [tip: x86/cpu] " tip-bot2 for Pu Wen
2021-06-09 17:30 ` [PATCH] " Rafael J. Wysocki
2021-06-09 17:39   ` Rafael J. Wysocki

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.