@@ -145,6 +145,17 @@ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n)
}
}
+void qemu_irq_remove_intercept(qemu_irq *gpio_in, int n)
+{
+ int i;
+ qemu_irq *old_irqs = gpio_in[0]->opaque;
+ for (i = 0; i < n; i++) {
+ gpio_in[i]->handler = old_irqs[i]->handler;
+ gpio_in[i]->opaque = old_irqs[i]->opaque;
+ }
+ qemu_free_irqs(old_irqs, n);
+}
+
static const TypeInfo irq_type_info = {
.name = TYPE_IRQ,
.parent = TYPE_OBJECT,
@@ -56,8 +56,12 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
*/
qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
-/* For internal use in qtest. Similar to qemu_irq_split, but operating
- on an existing vector of qemu_irq. */
+/*
+ * Similar to qemu_irq_split, but operating on an existing vector of qemu_irq.
+ */
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
+/* Restore the irq handler intercepted by qemu_irq_intercept_in() */
+void qemu_irq_remove_intercept(qemu_irq *gpio_in, int n);
+
#endif
We use qemu_irq as the bridge for other qemu modules to switch from irq injection to SDEI event trigger after VM binds the interrupt to SDEI event. We use qemu_irq_intercept_in() to override qemu_irq handler with SDEI event trigger, so we also need a corresponding interface to restore the handler to default one (i.e. ARM GIC). qemu_irq_remove_intercept() is the new interface to do the above job. Signed-off-by: Heyi Guo <guoheyi@huawei.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Dave Martin <Dave.Martin@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: James Morse <james.morse@arm.com> --- hw/core/irq.c | 11 +++++++++++ include/hw/irq.h | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)