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

Anup Patel apatel at ventanamicro.com
Tue Nov 21 07:02:59 PST 2023


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




More information about the opensbi mailing list