diff mbox series

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

Message ID 20210528081417.31474-1-puwen@hygon.cn (mailing list archive)
State Not Applicable, archived
Headers show
Series x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems | expand

Commit Message

Pu Wen May 28, 2021, 8:14 a.m. UTC
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(-)

Comments

Rafael J. Wysocki June 9, 2021, 5:30 p.m. UTC | #1
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!
Rafael J. Wysocki June 9, 2021, 5:39 p.m. UTC | #2
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
diff mbox series

Patch

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