KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
authorAlexander Graf <agraf@suse.de>
Mon, 15 Apr 2013 08:42:33 +0000 (10:42 +0200)
committerAlexander Graf <agraf@suse.de>
Fri, 26 Apr 2013 18:27:13 +0000 (20:27 +0200)
The concept of routing interrupt lines to an irqchip is nothing
that is IOAPIC specific. Every irqchip has a maximum number of pins
that can be linked to irq lines.

So let's add a new define that allows us to reuse generic code for
non-IOAPIC platforms.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
arch/x86/include/asm/kvm_host.h
include/linux/kvm_host.h
virt/kvm/irq_comm.c

index 18635ae42a8e2eaa1e265c2efc74bb5a2c651348..14337fa464bcbd5d1893423f492217c503286a2f 100644 (file)
@@ -43,6 +43,8 @@
 #define KVM_PIO_PAGE_OFFSET 1
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 2
 
+#define KVM_IRQCHIP_NUM_PINS  KVM_IOAPIC_NUM_PINS
+
 #define CR0_RESERVED_BITS                                               \
        (~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
                          | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \
index 93a50054d46c6f4e94fcfbf6f8a2f1b02fab4ec8..bf3b1dcb8b3dfbbf3ca7175c5cab28e0622a3a41 100644 (file)
@@ -307,7 +307,7 @@ struct kvm_kernel_irq_routing_entry {
 #ifdef __KVM_HAVE_IOAPIC
 
 struct kvm_irq_routing_table {
-       int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS];
+       int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
        struct kvm_kernel_irq_routing_entry *rt_entries;
        u32 nr_rt_entries;
        /*
index 25ab48007adb91a6a5c34e1912a99e1771212de1..7c0071de9e8530feb78279daae0ec59b9de428d9 100644 (file)
@@ -480,7 +480,7 @@ int kvm_set_irq_routing(struct kvm *kvm,
 
        new->nr_rt_entries = nr_rt_entries;
        for (i = 0; i < 3; i++)
-               for (j = 0; j < KVM_IOAPIC_NUM_PINS; j++)
+               for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++)
                        new->chip[i][j] = -1;
 
        for (i = 0; i < nr; ++i) {