aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/utils/irqchip/imsic.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c
index f2a35c6..02e3a33 100644
--- a/lib/utils/irqchip/imsic.c
+++ b/lib/utils/irqchip/imsic.c
@@ -12,6 +12,7 @@
#include <sbi/riscv_io.h>
#include <sbi/riscv_encoding.h>
#include <sbi/sbi_console.h>
+#include <sbi/sbi_csr_detect.h>
#include <sbi/sbi_domain.h>
#include <sbi/sbi_ipi.h>
#include <sbi/sbi_irqchip.h>
@@ -222,6 +223,8 @@ static void imsic_local_eix_update(unsigned long base_id,
void imsic_local_irqchip_init(void)
{
+ struct sbi_trap_info trap = { 0 };
+
/*
* This function is expected to be called from:
* 1) nascent_init() platform callback which is called
@@ -231,6 +234,11 @@ void imsic_local_irqchip_init(void)
* in boot-up path.
*/
+ /* If Smaia not available then do nothing */
+ csr_read_allowed(CSR_MTOPI, (ulong)&trap);
+ if (trap.cause)
+ return;
+
/* Setup threshold to allow all enabled interrupts */
imsic_csr_write(IMSIC_EITHRESHOLD, IMSIC_ENABLE_EITHRESHOLD);