diff options
author | Avi Kivity <avi@redhat.com> | 2008-11-19 06:58:46 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:03:06 -0400 |
commit | 399ec807ddc38ecccf8c06dbde04531cbdc63e11 (patch) | |
tree | 75a4e3ee9cfffb4ecf7b4608bb592c89f2b62219 /arch | |
parent | 193554750441d91e127dd5066b8aebe0f769101c (diff) |
KVM: Userspace controlled irq routing
Currently KVM has a static routing from GSI numbers to interrupts (namely,
0-15 are mapped 1:1 to both PIC and IOAPIC, and 16:23 are mapped 1:1 to
the IOAPIC). This is insufficient for several reasons:
- HPET requires non 1:1 mapping for the timer interrupt
- MSIs need a new method to assign interrupt numbers and dispatch them
- ACPI APIC mode needs to be able to reassign the PCI LINK interrupts to the
ioapics
This patch implements an interrupt routing table (as a linked list, but this
can be easily changed) and a userspace interface to replace the table. The
routing table is initialized according to the current hardwired mapping.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 5 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 1477f91617a5..dbf527a57341 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -919,6 +919,11 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
919 | r = kvm_ioapic_init(kvm); | 919 | r = kvm_ioapic_init(kvm); |
920 | if (r) | 920 | if (r) |
921 | goto out; | 921 | goto out; |
922 | r = kvm_setup_default_irq_routing(kvm); | ||
923 | if (r) { | ||
924 | kfree(kvm->arch.vioapic); | ||
925 | goto out; | ||
926 | } | ||
922 | break; | 927 | break; |
923 | case KVM_IRQ_LINE: { | 928 | case KVM_IRQ_LINE: { |
924 | struct kvm_irq_level irq_event; | 929 | struct kvm_irq_level irq_event; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 141a0166e51c..32e3a7ec6ad2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1835,6 +1835,12 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
1835 | } | 1835 | } |
1836 | } else | 1836 | } else |
1837 | goto out; | 1837 | goto out; |
1838 | r = kvm_setup_default_irq_routing(kvm); | ||
1839 | if (r) { | ||
1840 | kfree(kvm->arch.vpic); | ||
1841 | kfree(kvm->arch.vioapic); | ||
1842 | goto out; | ||
1843 | } | ||
1838 | break; | 1844 | break; |
1839 | case KVM_CREATE_PIT: | 1845 | case KVM_CREATE_PIT: |
1840 | mutex_lock(&kvm->lock); | 1846 | mutex_lock(&kvm->lock); |