Skip to content

Commit 8175e5b

Browse files
committed
KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
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>
1 parent c35635e commit 8175e5b

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

arch/x86/include/asm/kvm_host.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define KVM_PIO_PAGE_OFFSET 1
4444
#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
4545

46+
#define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS
47+
4648
#define CR0_RESERVED_BITS \
4749
(~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
4850
| X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \

include/linux/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct kvm_kernel_irq_routing_entry {
307307
#ifdef __KVM_HAVE_IOAPIC
308308

309309
struct kvm_irq_routing_table {
310-
int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS];
310+
int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
311311
struct kvm_kernel_irq_routing_entry *rt_entries;
312312
u32 nr_rt_entries;
313313
/*

virt/kvm/irq_comm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ int kvm_set_irq_routing(struct kvm *kvm,
480480

481481
new->nr_rt_entries = nr_rt_entries;
482482
for (i = 0; i < 3; i++)
483-
for (j = 0; j < KVM_IOAPIC_NUM_PINS; j++)
483+
for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++)
484484
new->chip[i][j] = -1;
485485

486486
for (i = 0; i < nr; ++i) {

0 commit comments

Comments
 (0)