Re: [RFC PATCH v4 8/8] acpi_idle: Disallow play_dead with FFH cstate on AMD platforms

From: Rafael J. Wysocki
Date: Mon Nov 25 2024 - 08:47:05 EST


On Mon, Nov 25, 2024 at 2:21 PM Patryk Wlazlyn
<patryk.wlazlyn@xxxxxxxxxxxxxxx> wrote:
>
> Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@xxxxxxxxxxxxxxx>
> Suggested-by: Gautham R. Shenoy <gautham.shenoy@xxxxxxx>
> ---
> drivers/acpi/processor_idle.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 586cc7d1d8aa..4b4ac8d55b55 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -803,7 +803,11 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
>
> state->flags = 0;
>
> - state->enter_dead = acpi_idle_play_dead;
> + /* AMD doesn't want to use mwait for play dead. */
> + bool amd_or_hygon = boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
> + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON;
> + if (!(cx->entry_method == ACPI_CSTATE_FFH && amd_or_hygon))
> + state->enter_dead = acpi_idle_play_dead;
>
> if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
> drv->safe_state_index = count;
> --

I don't think this is needed.

There is a vendor check in mwait_play_dead() already, no need to
duplicate it in the otherwise arch-agnostic ACPI code.