aboutsummaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2024-12-24 13:29:17 +0530
committerAnup Patel <anup@brainfault.org>2024-12-24 14:06:09 +0530
commit7150db29d7186808cc0df66b54dde1cb0ffe3535 (patch)
tree350cb759a6e138799035ef0e94ab4520092fb4ee /lib/utils
parent551ac0f2d431a7aac260aa1b4612dfceedb2318c (diff)
downloadopensbi-7150db29d7186808cc0df66b54dde1cb0ffe3535.zip
opensbi-7150db29d7186808cc0df66b54dde1cb0ffe3535.tar.gz
opensbi-7150db29d7186808cc0df66b54dde1cb0ffe3535.tar.bz2
lib: utils: Fix irqchip registration for PLIC and APLIC
Currently, the same irqchip instance is registered for multiple PLIC and APLIC instances which causes the sbi_list_for_each_entry() loop in the sbi_irqchip_init() to hang at boot-time. To address the above issue, register a separate irqchip instance for each PLIC and APLIC instance. Fixes: 2dd6eaf68055 ("lib: sbi_irqchip: Call driver warm_init from SBI core") Reported-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Himanshu Chauhan <hchauhan@ventanamicro.com>
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/irqchip/aplic.c6
-rw-r--r--lib/utils/irqchip/plic.c8
2 files changed, 3 insertions, 11 deletions
diff --git a/lib/utils/irqchip/aplic.c b/lib/utils/irqchip/aplic.c
index 2737184..72906d5 100644
--- a/lib/utils/irqchip/aplic.c
+++ b/lib/utils/irqchip/aplic.c
@@ -12,7 +12,6 @@
#include <sbi/sbi_console.h>
#include <sbi/sbi_domain.h>
#include <sbi/sbi_error.h>
-#include <sbi/sbi_irqchip.h>
#include <sbi_utils/irqchip/aplic.h>
#define APLIC_MAX_IDC (1UL << 14)
@@ -166,9 +165,6 @@ static int aplic_check_msicfg(struct aplic_msicfg_data *msicfg)
return 0;
}
-static struct sbi_irqchip_device aplic_device = {
-};
-
int aplic_cold_irqchip_init(struct aplic_data *aplic)
{
int rc;
@@ -280,7 +276,7 @@ int aplic_cold_irqchip_init(struct aplic_data *aplic)
}
/* Register irqchip device */
- sbi_irqchip_add_device(&aplic_device);
+ sbi_irqchip_add_device(&aplic->irqchip);
return 0;
}
diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c
index 7761ae9..8b2190f 100644
--- a/lib/utils/irqchip/plic.c
+++ b/lib/utils/irqchip/plic.c
@@ -15,7 +15,6 @@
#include <sbi/sbi_domain.h>
#include <sbi/sbi_error.h>
#include <sbi/sbi_heap.h>
-#include <sbi/sbi_irqchip.h>
#include <sbi/sbi_string.h>
#include <sbi_utils/irqchip/plic.h>
@@ -221,10 +220,6 @@ static int plic_warm_irqchip_init(struct sbi_irqchip_device *dev)
return 0;
}
-static struct sbi_irqchip_device plic_device = {
- .warm_init = plic_warm_irqchip_init,
-};
-
int plic_cold_irqchip_init(struct plic_data *plic)
{
int i, ret;
@@ -284,7 +279,8 @@ int plic_cold_irqchip_init(struct plic_data *plic)
}
/* Register irqchip device */
- sbi_irqchip_add_device(&plic_device);
+ plic->irqchip.warm_init = plic_warm_irqchip_init;
+ sbi_irqchip_add_device(&plic->irqchip);
return 0;
}