[PATCH] x86/cstate: Add Zhaoxin ACPI Cx FFH MWAIT support

Tony W Wang-oc posted 1 patch 3 years, 10 months ago
arch/x86/kernel/acpi/cstate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] x86/cstate: Add Zhaoxin ACPI Cx FFH MWAIT support
Posted by Tony W Wang-oc 3 years, 10 months ago
Recent Zhaoxin CPUs support X86_FEATURE_MWAIT that implies the
MONITOR/MWAIT instructions can be used for ACPI Cx state. The BIOS
declares Cx state in _CST object to use FFH on Zhaoxin systems. So
let function ffh_cstate_init() support Zhaoxin too.

Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
---
  arch/x86/kernel/acpi/cstate.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 7945eae..d4185e1 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -213,7 +213,9 @@ static int __init ffh_cstate_init(void)

  	if (c->x86_vendor != X86_VENDOR_INTEL &&
  	    c->x86_vendor != X86_VENDOR_AMD &&
-	    c->x86_vendor != X86_VENDOR_HYGON)
+	    c->x86_vendor != X86_VENDOR_HYGON &&
+	    c->x86_vendor != X86_VENDOR_CENTAUR &&
+	    c->x86_vendor != X86_VENDOR_ZHAOXIN)
  		return -1;

  	cpu_cstate_entry = alloc_percpu(struct cstate_entry);
-- 
2.7.4
Re: [PATCH] x86/cstate: Add Zhaoxin ACPI Cx FFH MWAIT support
Posted by Rafael J. Wysocki 3 years, 10 months ago
Please CC linux-acpi@vger.kernel.org on ACPI-related changes (added now).

On Wed, Jun 22, 2022 at 5:29 AM Tony W Wang-oc <TonyWWang-oc@zhaoxin.com> wrote:
>
> Recent Zhaoxin CPUs support X86_FEATURE_MWAIT that implies the
> MONITOR/MWAIT instructions can be used for ACPI Cx state. The BIOS
> declares Cx state in _CST object to use FFH on Zhaoxin systems. So
> let function ffh_cstate_init() support Zhaoxin too.
>
> Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
> ---
>   arch/x86/kernel/acpi/cstate.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
> index 7945eae..d4185e1 100644
> --- a/arch/x86/kernel/acpi/cstate.c
> +++ b/arch/x86/kernel/acpi/cstate.c
> @@ -213,7 +213,9 @@ static int __init ffh_cstate_init(void)
>
>         if (c->x86_vendor != X86_VENDOR_INTEL &&
>             c->x86_vendor != X86_VENDOR_AMD &&
> -           c->x86_vendor != X86_VENDOR_HYGON)
> +           c->x86_vendor != X86_VENDOR_HYGON &&
> +           c->x86_vendor != X86_VENDOR_CENTAUR &&
> +           c->x86_vendor != X86_VENDOR_ZHAOXIN)

Centaur is not mentioned in the changelog and it should be.

>                 return -1;
>
>         cpu_cstate_entry = alloc_percpu(struct cstate_entry);
> --
Re: [PATCH] x86/cstate: Add Zhaoxin ACPI Cx FFH MWAIT support
Posted by Tony W Wang-oc 3 years, 10 months ago

On 22/6/2022 21:38, Rafael J. Wysocki wrote:
> Please CC linux-acpi@vger.kernel.org on ACPI-related changes (added now).

Ok.

> 
> On Wed, Jun 22, 2022 at 5:29 AM Tony W Wang-oc <TonyWWang-oc@zhaoxin.com> wrote:
>>
>> Recent Zhaoxin CPUs support X86_FEATURE_MWAIT that implies the
>> MONITOR/MWAIT instructions can be used for ACPI Cx state. The BIOS
>> declares Cx state in _CST object to use FFH on Zhaoxin systems. So
>> let function ffh_cstate_init() support Zhaoxin too.
>>
>> Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
>> ---
>>    arch/x86/kernel/acpi/cstate.c | 4 +++-
>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
>> index 7945eae..d4185e1 100644
>> --- a/arch/x86/kernel/acpi/cstate.c
>> +++ b/arch/x86/kernel/acpi/cstate.c
>> @@ -213,7 +213,9 @@ static int __init ffh_cstate_init(void)
>>
>>          if (c->x86_vendor != X86_VENDOR_INTEL &&
>>              c->x86_vendor != X86_VENDOR_AMD &&
>> -           c->x86_vendor != X86_VENDOR_HYGON)
>> +           c->x86_vendor != X86_VENDOR_HYGON &&
>> +           c->x86_vendor != X86_VENDOR_CENTAUR &&
>> +           c->x86_vendor != X86_VENDOR_ZHAOXIN)
> 
> Centaur is not mentioned in the changelog and it should be.

Will add Centaur in the changelog. Thanks a lot.

> 
>>                  return -1;
>>
>>          cpu_cstate_entry = alloc_percpu(struct cstate_entry);
>> --
> .
> 

-- 
Sincerely
TonyWWang-oc