[RFC 42/48] RISC-V: Allow host to inject any ext interrupt id to a CoVE guest.

From: Atish Patra
Date: Wed Apr 19 2023 - 18:29:30 EST


From: Rajnesh Kanwal <rkanwal@xxxxxxxxxxxx>

Ideally, host must not inject any external interrupt until explicitly
allowed by the guest. This should be done per interrupt id but currently
adding allow-all call in init_IRQ. In future, it will be modified
to allow specific interrupts only.

Signed-off-by: Rajnesh Kanwal <rkanwal@xxxxxxxxxxxx>
Signed-off-by: Atish Patra <atishp@xxxxxxxxxxxx>
---
arch/riscv/kernel/irq.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c
index eb9a68a..b5e0fd8 100644
--- a/arch/riscv/kernel/irq.c
+++ b/arch/riscv/kernel/irq.c
@@ -11,6 +11,8 @@
#include <linux/module.h>
#include <linux/seq_file.h>
#include <asm/sbi.h>
+#include <asm/covg_sbi.h>
+#include <asm/cove.h>

static struct fwnode_handle *(*__get_intc_node)(void);

@@ -36,8 +38,18 @@ int arch_show_interrupts(struct seq_file *p, int prec)

void __init init_IRQ(void)
{
+ int ret;
+
irqchip_init();
if (!handle_arch_irq)
panic("No interrupt controller found.");
sbi_ipi_init();
+
+ if (is_cove_guest()) {
+ /* FIXME: For now just allow all interrupts. */
+ ret = sbi_covg_allow_all_external_interrupt();
+
+ if (ret)
+ pr_err("Failed to allow external interrupts.\n");
+ }
}
--
2.25.1