diff options
-rw-r--r-- | include/kvm/arm_vgic.h | 3 | ||||
-rw-r--r-- | virt/kvm/arm/vgic.c | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index b2f9936df319..3b73d7845124 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
@@ -29,13 +29,12 @@ | |||
29 | #define VGIC_NR_SGIS 16 | 29 | #define VGIC_NR_SGIS 16 |
30 | #define VGIC_NR_PPIS 16 | 30 | #define VGIC_NR_PPIS 16 |
31 | #define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS) | 31 | #define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS) |
32 | #define VGIC_MAX_CPUS KVM_MAX_VCPUS | ||
33 | 32 | ||
34 | #define VGIC_V2_MAX_LRS (1 << 6) | 33 | #define VGIC_V2_MAX_LRS (1 << 6) |
35 | #define VGIC_V3_MAX_LRS 16 | 34 | #define VGIC_V3_MAX_LRS 16 |
36 | 35 | ||
37 | /* Sanity checks... */ | 36 | /* Sanity checks... */ |
38 | #if (VGIC_MAX_CPUS > 8) | 37 | #if (KVM_MAX_VCPUS > 8) |
39 | #error Invalid number of CPU interfaces | 38 | #error Invalid number of CPU interfaces |
40 | #endif | 39 | #endif |
41 | 40 | ||
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 7d64dc242afc..599ad17e5436 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -1297,7 +1297,7 @@ static bool vgic_queue_sgi(struct kvm_vcpu *vcpu, int irq) | |||
1297 | 1297 | ||
1298 | sources = *vgic_get_sgi_sources(dist, vcpu_id, irq); | 1298 | sources = *vgic_get_sgi_sources(dist, vcpu_id, irq); |
1299 | 1299 | ||
1300 | for_each_set_bit(c, &sources, VGIC_MAX_CPUS) { | 1300 | for_each_set_bit(c, &sources, dist->nr_cpus) { |
1301 | if (vgic_queue_irq(vcpu, c, irq)) | 1301 | if (vgic_queue_irq(vcpu, c, irq)) |
1302 | clear_bit(c, &sources); | 1302 | clear_bit(c, &sources); |
1303 | } | 1303 | } |
@@ -1700,7 +1700,7 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) | |||
1700 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; | 1700 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; |
1701 | int i; | 1701 | int i; |
1702 | 1702 | ||
1703 | if (vcpu->vcpu_id >= VGIC_MAX_CPUS) | 1703 | if (vcpu->vcpu_id >= dist->nr_cpus) |
1704 | return -EBUSY; | 1704 | return -EBUSY; |
1705 | 1705 | ||
1706 | for (i = 0; i < VGIC_NR_IRQS; i++) { | 1706 | for (i = 0; i < VGIC_NR_IRQS; i++) { |
@@ -1767,7 +1767,7 @@ static int vgic_init_maps(struct kvm *kvm) | |||
1767 | int nr_cpus, nr_irqs; | 1767 | int nr_cpus, nr_irqs; |
1768 | int ret, i; | 1768 | int ret, i; |
1769 | 1769 | ||
1770 | nr_cpus = dist->nr_cpus = VGIC_MAX_CPUS; | 1770 | nr_cpus = dist->nr_cpus = KVM_MAX_VCPUS; |
1771 | nr_irqs = dist->nr_irqs = VGIC_NR_IRQS; | 1771 | nr_irqs = dist->nr_irqs = VGIC_NR_IRQS; |
1772 | 1772 | ||
1773 | ret = vgic_init_bitmap(&dist->irq_enabled, nr_cpus, nr_irqs); | 1773 | ret = vgic_init_bitmap(&dist->irq_enabled, nr_cpus, nr_irqs); |