[PATCH v2 1/6] ACPI: RISC-V: Fix riscv_acpi_irq_get_dep() loop termination

Sunil V L sunilvl at oss.qualcomm.com
Mon Jun 8 09:24:28 PDT 2026


Hi Lorenzo,

On Wed, Jun 3, 2026 at 1:51 PM Lorenzo Pieralisi <lpieralisi at kernel.org> wrote:
>
> In riscv_acpi_add_irq_dep() the main loop condition would currently stop
> the loop if an interrupt descriptor contains an interrupt for which the
> respective GSI handle is NULL, which is not correct because subsequent
> interrupts in the interrupt descriptor might still have a GSI dependency
> that must not be skipped.
>
> Rework riscv_acpi_add_irq_dep() and the riscv_acpi_irq_get_dep() call chain
> to fix it - by not forcing the loop to stop in order to guarantee
> dependency detection for all the interrupt entries in the CRS descriptor.
>
> Signed-off-by: Lorenzo Pieralisi <lpieralisi at kernel.org>
> Cc: "Rafael J. Wysocki" <rafael at kernel.org>
> Cc: Sunil V L <sunilvl at ventanamicro.com>
> ---
>  drivers/acpi/riscv/irq.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/riscv/irq.c b/drivers/acpi/riscv/irq.c
> index 9b88d0993e88..cd83c3035cf6 100644
> --- a/drivers/acpi/riscv/irq.c
> +++ b/drivers/acpi/riscv/irq.c
> @@ -299,6 +299,7 @@ static acpi_status riscv_acpi_irq_get_parent(struct acpi_resource *ares, void *c
>                         return AE_OK;
>
>                 ctx->handle = riscv_acpi_get_gsi_handle(eirq->interrupts[ctx->index]);
> +               ctx->rc = 0;
>                 return AE_CTRL_TERMINATE;
>         }
>
> @@ -314,10 +315,8 @@ static int riscv_acpi_irq_get_dep(acpi_handle handle, unsigned int index, acpi_h
>
>         acpi_walk_resources(handle, METHOD_NAME__CRS, riscv_acpi_irq_get_parent, &ctx);
>         *gsi_handle = ctx.handle;
> -       if (*gsi_handle)
> -               return 1;
>
> -       return 0;
> +       return ctx.rc;
>  }
>
>  static u32 riscv_acpi_add_prt_dep(acpi_handle handle)
> @@ -381,8 +380,11 @@ static u32 riscv_acpi_add_irq_dep(acpi_handle handle)
>         int i;
>
>         for (i = 0;
> -            riscv_acpi_irq_get_dep(handle, i, &gsi_handle);
> +            !riscv_acpi_irq_get_dep(handle, i, &gsi_handle);
>              i++) {
> +               if (!gsi_handle)
> +                       continue;
> +
>                 dep_devices.count = 1;
>                 dep_devices.handles = kzalloc_objs(*dep_devices.handles, 1);
>                 if (!dep_devices.handles) {
>
Do these fixes need the Fixes tag?

Otherwise, LGTM.
Reviewed-by: Sunil V L <sunilvl at oss.qualcomm.com>

Thanks!
Sunil



More information about the linux-arm-kernel mailing list