Commit 206c41f4 authored by Will Deacon's avatar Will Deacon
Browse files

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: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent dbfef850
#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();
}
......@@ -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);
......
......@@ -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);
......
......@@ -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)
{
}
......@@ -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 */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment