[PATCH] lib: utils/irqchip: Avoid redundant writes to APLIC CLRIE register

Atish Patra atishp at atishpatra.org
Thu Nov 23 08:34:20 PST 2023


On Tue, Nov 21, 2023 at 7:03 AM Anup Patel <apatel at ventanamicro.com> wrote:
>
> Each APLIC CLRIE register allows disabling 32 interrupt sources at
> a time by writing -1 so no need to write CLRIE register separately
> for each interrupt source.
>
> Fixes: 99792653de29 ("lib: utils/irqchip: Add APLIC initialization
> library")
> Signed-off-by: Anup Patel <apatel at ventanamicro.com>
> ---
>  lib/utils/irqchip/aplic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/utils/irqchip/aplic.c b/lib/utils/irqchip/aplic.c
> index d7fd992..10236e7 100644
> --- a/lib/utils/irqchip/aplic.c
> +++ b/lib/utils/irqchip/aplic.c
> @@ -193,7 +193,7 @@ int aplic_cold_irqchip_init(struct aplic_data *aplic)
>         writel(0, (void *)(aplic->addr + APLIC_DOMAINCFG));
>
>         /* Disable all interrupts */
> -       for (i = 0; i <= aplic->num_source; i++)
> +       for (i = 0; i <= aplic->num_source; i += 32)
>                 writel(-1U, (void *)(aplic->addr + APLIC_CLRIE_BASE +
>                                      (i / 32) * sizeof(u32)));
>
> --
> 2.34.1
>


Reviewed-by: Atish Patra <atishp at rivosinc.com>
-- 
Regards,
Atish



More information about the opensbi mailing list