[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 06/12] core/irq: add qemu_irq_remove_intercept interface
From: |
Heyi Guo |
Subject: |
[RFC PATCH 06/12] core/irq: add qemu_irq_remove_intercept interface |
Date: |
Tue, 24 Sep 2019 23:21:45 +0800 |
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 <address@hidden>
Cc: Peter Maydell <address@hidden>
Cc: Dave Martin <address@hidden>
Cc: Marc Zyngier <address@hidden>
Cc: Mark Rutland <address@hidden>
Cc: James Morse <address@hidden>
---
hw/core/irq.c | 11 +++++++++++
include/hw/irq.h | 8 ++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/hw/core/irq.c b/hw/core/irq.c
index 7cc0295..114bce6 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -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,
diff --git a/include/hw/irq.h b/include/hw/irq.h
index fe527f6..1af1db9 100644
--- a/include/hw/irq.h
+++ b/include/hw/irq.h
@@ -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
--
1.8.3.1
- [RFC PATCH 00/12] Add SDEI support for arm64, Heyi Guo, 2019/09/24
- [RFC PATCH 01/12] linux-headers: import arm_sdei.h, Heyi Guo, 2019/09/24
- [RFC PATCH 04/12] arm/sdei: add system reset callback, Heyi Guo, 2019/09/24
- [RFC PATCH 06/12] core/irq: add qemu_irq_remove_intercept interface,
Heyi Guo <=
- [RFC PATCH 10/12] arm/sdei: check KVM cap and enable SDEI, Heyi Guo, 2019/09/24
- [RFC PATCH 05/12] arm/sdei: add support to trigger event by GIC interrupt ID, Heyi Guo, 2019/09/24
- [RFC PATCH 02/12] arm/sdei: add virtual device framework, Heyi Guo, 2019/09/24
- [RFC PATCH 07/12] arm/sdei: override qemu_irq handler when binding interrupt, Heyi Guo, 2019/09/24
- [RFC PATCH 11/12] arm/kvm: handle guest exit of hypercall, Heyi Guo, 2019/09/24
- [RFC PATCH 12/12] virt/acpi: add SDEI table if SDEI is enabled, Heyi Guo, 2019/09/24
- [RFC PATCH 09/12] linux-headers/kvm.h: add capability to forward hypercall, Heyi Guo, 2019/09/24
- [RFC PATCH 08/12] arm/sdei: add support to register interrupt bind notifier, Heyi Guo, 2019/09/24
- [RFC PATCH 03/12] arm/sdei: add support to handle SDEI requests from guest, Heyi Guo, 2019/09/24