aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-11-19 06:58:46 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:03:06 -0400
commit399ec807ddc38ecccf8c06dbde04531cbdc63e11 (patch)
tree75a4e3ee9cfffb4ecf7b4608bb592c89f2b62219 /include/linux/kvm.h
parent193554750441d91e127dd5066b8aebe0f769101c (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 'include/linux/kvm.h')
-rw-r--r--include/linux/kvm.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 73f348066866..7a5d73a8d4fa 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -399,6 +399,38 @@ struct kvm_trace_rec {
399#if defined(CONFIG_X86) 399#if defined(CONFIG_X86)
400#define KVM_CAP_REINJECT_CONTROL 24 400#define KVM_CAP_REINJECT_CONTROL 24
401#endif 401#endif
402#if defined(CONFIG_X86)||defined(CONFIG_IA64)
403#define KVM_CAP_IRQ_ROUTING 25
404#endif
405
406#ifdef KVM_CAP_IRQ_ROUTING
407
408struct kvm_irq_routing_irqchip {
409 __u32 irqchip;
410 __u32 pin;
411};
412
413/* gsi routing entry types */
414#define KVM_IRQ_ROUTING_IRQCHIP 1
415
416struct kvm_irq_routing_entry {
417 __u32 gsi;
418 __u32 type;
419 __u32 flags;
420 __u32 pad;
421 union {
422 struct kvm_irq_routing_irqchip irqchip;
423 __u32 pad[8];
424 } u;
425};
426
427struct kvm_irq_routing {
428 __u32 nr;
429 __u32 flags;
430 struct kvm_irq_routing_entry entries[0];
431};
432
433#endif
402 434
403/* 435/*
404 * ioctls for VM fds 436 * ioctls for VM fds
@@ -430,6 +462,7 @@ struct kvm_trace_rec {
430 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 462 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
431#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ 463#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
432 struct kvm_assigned_pci_dev) 464 struct kvm_assigned_pci_dev)
465#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
433#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ 466#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
434 struct kvm_assigned_irq) 467 struct kvm_assigned_irq)
435#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) 468#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)