This will be useful for injecting interrupts on behalf of virtual devices, namely ivshmem. It allows to let the hardware do the routing to the target CPU, instead of implementing this in software.
Reuse the existing irqchip_set_pending interface for this, defining GICD-based injection being requested if a NULL target CPU is passed. Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/arm-common/gic-common.c | 6 ++++++ hypervisor/arch/arm-common/include/asm/gic.h | 1 + hypervisor/arch/arm-common/irqchip.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/hypervisor/arch/arm-common/gic-common.c b/hypervisor/arch/arm-common/gic-common.c index db9d647..e2a88c7 100644 --- a/hypervisor/arch/arm-common/gic-common.c +++ b/hypervisor/arch/arm-common/gic-common.c @@ -348,3 +348,9 @@ void gic_handle_irq(struct per_cpu *cpu_data) irqchip_eoi_irq(irq_id, handled); } } + +void gic_set_irq_pending(u16 irq_id) +{ + mmio_write32(gicd_base + GICD_ISPENDR + (irq_id / 32) * 4, + 1 << (irq_id % 32)); +} diff --git a/hypervisor/arch/arm-common/include/asm/gic.h b/hypervisor/arch/arm-common/include/asm/gic.h index 5d385bb..8cc1fac 100644 --- a/hypervisor/arch/arm-common/include/asm/gic.h +++ b/hypervisor/arch/arm-common/include/asm/gic.h @@ -65,6 +65,7 @@ enum mmio_result gic_handle_irq_route(struct mmio_access *mmio, void gic_handle_sgir_write(struct sgi *sgi, bool virt_input); void gic_handle_irq(struct per_cpu *cpu_data); bool gic_targets_in_cell(struct cell *cell, u8 targets); +void gic_set_irq_pending(u16 irq_id); #endif /* !__ASSEMBLY__ */ #endif /* !_JAILHOUSE_ASM_GIC_COMMON_H */ diff --git a/hypervisor/arch/arm-common/irqchip.c b/hypervisor/arch/arm-common/irqchip.c index 2f6bcdc..ed471e3 100644 --- a/hypervisor/arch/arm-common/irqchip.c +++ b/hypervisor/arch/arm-common/irqchip.c @@ -55,6 +55,12 @@ void irqchip_set_pending(struct per_cpu *cpu_data, u16 irq_id) bool local_injection = (this_cpu_data() == cpu_data); unsigned int new_tail; + if (!cpu_data) { + /* Injection via GICD */ + gic_set_irq_pending(irq_id); + return; + } + if (local_injection && irqchip.inject_irq(cpu_data, irq_id) != -EBUSY) return; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
