aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2013-05-01 16:50:11 +0100
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:39:54 +0100
commit206c41f433bbbb5763851a2f6df928a66f71193e (patch)
tree72c93ab8cb344d77e7c0881aa1fadf172d1516d8
parentdbfef85064420f1e98d53eb63b17e3162fe0b7e6 (diff)
downloadkvmtool-206c41f433bbbb5763851a2f6df928a66f71193e.tar.gz
kvm tools: ioport: add arch callback to remap IRQ lines for ioport devices
If an architecture other than x86 wants to make use of ioport devices, the interrupt lines will likely need remapping from their fixed values. This patch allows an architecture callback, ioport__map_irq, to map interrupts as appropriate. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r--arm/ioport.c7
-rw-r--r--hw/serial.c1
-rw-r--r--include/kvm/ioport.h1
-rw-r--r--powerpc/ioport.c4
-rw-r--r--x86/ioport.c4
5 files changed, 17 insertions, 0 deletions
diff --git a/arm/ioport.c b/arm/ioport.c
index 3c03fa05..74ee10ec 100644
--- a/arm/ioport.c
+++ b/arm/ioport.c
@@ -1,5 +1,12 @@
#include "kvm/ioport.h"
+#include "arm-common/gic.h"
+
void ioport__setup_arch(struct kvm *kvm)
{
}
+
+void ioport__map_irq(u8 *irq)
+{
+ *irq = gic__alloc_irqnum();
+}
diff --git a/hw/serial.c b/hw/serial.c
index 18bf5691..384ee37b 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -402,6 +402,7 @@ static int serial8250__device_init(struct kvm *kvm, struct serial8250_device *de
{
int r;
+ ioport__map_irq(&dev->irq);
r = ioport__register(kvm, dev->iobase, &serial8250_ops, 8, NULL);
kvm__irq_line(kvm, dev->irq, 0);
diff --git a/include/kvm/ioport.h b/include/kvm/ioport.h
index 6660acb6..1556dd3e 100644
--- a/include/kvm/ioport.h
+++ b/include/kvm/ioport.h
@@ -30,6 +30,7 @@ struct ioport_operations {
};
void ioport__setup_arch(struct kvm *kvm);
+void ioport__map_irq(u8 *irq);
int ioport__register(struct kvm *kvm, u16 port, struct ioport_operations *ops,
int count, void *param);
diff --git a/powerpc/ioport.c b/powerpc/ioport.c
index 264fb7e2..58dc625c 100644
--- a/powerpc/ioport.c
+++ b/powerpc/ioport.c
@@ -16,3 +16,7 @@ void ioport__setup_arch(struct kvm *kvm)
{
/* PPC has no legacy ioports to set up */
}
+
+void ioport__map_irq(u8 *irq)
+{
+}
diff --git a/x86/ioport.c b/x86/ioport.c
index 824ef257..03a1286d 100644
--- a/x86/ioport.c
+++ b/x86/ioport.c
@@ -65,6 +65,10 @@ static struct ioport_operations ps2_control_a_ops = {
.io_out = dummy_io_out,
};
+void ioport__map_irq(u8 *irq)
+{
+}
+
void ioport__setup_arch(struct kvm *kvm)
{
/* Legacy ioport setup */