mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
kvm: x86: Add user space part for in-kernel IOAPIC
This introduces the KVM-accelerated IOAPIC model 'kvm-ioapic' and extends the IRQ routing setup by the 0->2 redirection when needed. The kvm-ioapic model has a property that allows to define its GSI base for injecting interrupts into the kernel model. This will allow to disentangle PIC and IOAPIC pins for chipsets that support more sophisticated IRQ routes than the PIIX3. So far the base is kept at 0, i.e. PIC and IOAPIC share pins 0..15. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
10b6188275
commit
a39c1d47ac
3 changed files with 129 additions and 2 deletions
15
hw/pc_piix.c
15
hw/pc_piix.c
|
@ -69,6 +69,15 @@ static void kvm_piix3_setup_irq_routing(bool pci_enabled)
|
|||
for (i = 8; i < 16; ++i) {
|
||||
kvm_irqchip_add_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
|
||||
}
|
||||
if (pci_enabled) {
|
||||
for (i = 0; i < 24; ++i) {
|
||||
if (i == 0) {
|
||||
kvm_irqchip_add_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
|
||||
} else if (i != 2) {
|
||||
kvm_irqchip_add_route(s, i, KVM_IRQCHIP_IOAPIC, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = kvm_irqchip_commit_routes(s);
|
||||
if (ret < 0) {
|
||||
hw_error("KVM IRQ routing setup failed");
|
||||
|
@ -95,7 +104,11 @@ static void ioapic_init(GSIState *gsi_state)
|
|||
SysBusDevice *d;
|
||||
unsigned int i;
|
||||
|
||||
dev = qdev_create(NULL, "ioapic");
|
||||
if (kvm_enabled() && kvm_irqchip_in_kernel()) {
|
||||
dev = qdev_create(NULL, "kvm-ioapic");
|
||||
} else {
|
||||
dev = qdev_create(NULL, "ioapic");
|
||||
}
|
||||
qdev_init_nofail(dev);
|
||||
d = sysbus_from_qdev(dev);
|
||||
sysbus_mmio_map(d, 0, 0xfec00000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue