[PATCH v2 2/7] ACPI: processor: idle: Mark the state as invalid when get lpi_state->arch_flags failed

Huisong Li posted 7 patches 1 month, 2 weeks ago
[PATCH v2 2/7] ACPI: processor: idle: Mark the state as invalid when get lpi_state->arch_flags failed
Posted by Huisong Li 1 month, 2 weeks ago
The architecture specific context loss flags is important for ARM.
And this flag is used to control the execution of different code
flows in acpi_processor_ffh_lpi_enter().

So mark the state as invalid when get lpi_state->arch_flags of this
state failed.

Fixes: a36a7fecfe60 ("ACPI / processor_idle: Add support for Low Power Idle(LPI) states")
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 drivers/acpi/processor_idle.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 9f1040eac051..5213a545fa78 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -983,8 +983,12 @@ static int acpi_processor_evaluate_lpi(acpi_handle handle,
 		if (obj_get_integer(pkg_elem + 2, &lpi_state->flags))
 			lpi_state->flags = 0;
 
-		if (obj_get_integer(pkg_elem + 3, &lpi_state->arch_flags))
-			lpi_state->arch_flags = 0;
+		if (obj_get_integer(pkg_elem + 3, &lpi_state->arch_flags)) {
+			pr_err("Get state-%d architecture specific context loss flags failed, disable it.\n",
+			       state_idx);
+			lpi_state->flags = 0;
+			continue;
+		}
 
 		if (obj_get_integer(pkg_elem + 4, &lpi_state->res_cnt_freq))
 			lpi_state->res_cnt_freq = 1;
-- 
2.33.0
Re: [PATCH v2 2/7] ACPI: processor: idle: Mark the state as invalid when get lpi_state->arch_flags failed
Posted by Rafael J. Wysocki 1 month, 2 weeks ago
On Mon, Nov 3, 2025 at 9:42 AM Huisong Li <lihuisong@huawei.com> wrote:
>
> The architecture specific context loss flags is important for ARM.
> And this flag is used to control the execution of different code
> flows in acpi_processor_ffh_lpi_enter().
>
> So mark the state as invalid when get lpi_state->arch_flags of this
> state failed.
>
> Fixes: a36a7fecfe60 ("ACPI / processor_idle: Add support for Low Power Idle(LPI) states")
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
>  drivers/acpi/processor_idle.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 9f1040eac051..5213a545fa78 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -983,8 +983,12 @@ static int acpi_processor_evaluate_lpi(acpi_handle handle,
>                 if (obj_get_integer(pkg_elem + 2, &lpi_state->flags))
>                         lpi_state->flags = 0;
>
> -               if (obj_get_integer(pkg_elem + 3, &lpi_state->arch_flags))
> -                       lpi_state->arch_flags = 0;
> +               if (obj_get_integer(pkg_elem + 3, &lpi_state->arch_flags)) {
> +                       pr_err("Get state-%d architecture specific context loss flags failed, disable it.\n",
> +                              state_idx);
> +                       lpi_state->flags = 0;
> +                       continue;

This is ARM-specific behavior you want to put into generic code.

I'm not going to apply this.

> +               }
>
>                 if (obj_get_integer(pkg_elem + 4, &lpi_state->res_cnt_freq))
>                         lpi_state->res_cnt_freq = 1;
> --
> 2.33.0
>