Currently, the RISC-V kernel provides arch specific hooks (i.e. struct riscv_ipi_ops) to register IPI handling methods. The stats gathering of IPIs is also arch specific in the RISC-V kernel. Other architectures (such as ARM, ARM64, and MIPS) have moved away from custom arch specific IPI handling methods. Currently, these architectures have Linux irqchip drivers providing a range of Linux IRQ numbers to be used as IPIs and IPI triggering is done using generic IPI APIs. This approach allows architectures to treat IPIs as normal Linux IRQs and IPI stats gathering is done by the generic Linux IRQ subsystem. We extend the RISC-V IPI handling as-per above approach so that arch specific IPI handling methods (struct riscv_ipi_ops) can be removed and the IPI handling is done through the Linux IRQ subsystem. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230328035223.1480939-4-apatel@ventanamicro.com
44 lines
875 B
C
44 lines
875 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2012 Regents of the University of California
|
|
* Copyright (C) 2017 SiFive
|
|
* Copyright (C) 2018 Christoph Hellwig
|
|
*/
|
|
|
|
#include <linux/interrupt.h>
|
|
#include <linux/irqchip.h>
|
|
#include <linux/irqdomain.h>
|
|
#include <linux/module.h>
|
|
#include <linux/seq_file.h>
|
|
#include <asm/sbi.h>
|
|
|
|
static struct fwnode_handle *(*__get_intc_node)(void);
|
|
|
|
void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void))
|
|
{
|
|
__get_intc_node = fn;
|
|
}
|
|
|
|
struct fwnode_handle *riscv_get_intc_hwnode(void)
|
|
{
|
|
if (__get_intc_node)
|
|
return __get_intc_node();
|
|
|
|
return NULL;
|
|
}
|
|
EXPORT_SYMBOL_GPL(riscv_get_intc_hwnode);
|
|
|
|
int arch_show_interrupts(struct seq_file *p, int prec)
|
|
{
|
|
show_ipi_stats(p, prec);
|
|
return 0;
|
|
}
|
|
|
|
void __init init_IRQ(void)
|
|
{
|
|
irqchip_init();
|
|
if (!handle_arch_irq)
|
|
panic("No interrupt controller found.");
|
|
sbi_ipi_init();
|
|
}
|