Commit fc675e35 authored by Marc Zyngier's avatar Marc Zyngier Committed by Christoffer Dall

arm/arm64: KVM: vgic: kill VGIC_MAX_CPUS

We now have the information about the number of CPU interfaces in
the distributor itself. Let's get rid of VGIC_MAX_CPUS, and just
rely on KVM_MAX_VCPUS where we don't have the choice. Yet.
Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent fb65ab63
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
#define VGIC_NR_SGIS 16 #define VGIC_NR_SGIS 16
#define VGIC_NR_PPIS 16 #define VGIC_NR_PPIS 16
#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS) #define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS)
#define VGIC_MAX_CPUS KVM_MAX_VCPUS
#define VGIC_V2_MAX_LRS (1 << 6) #define VGIC_V2_MAX_LRS (1 << 6)
#define VGIC_V3_MAX_LRS 16 #define VGIC_V3_MAX_LRS 16
/* Sanity checks... */ /* Sanity checks... */
#if (VGIC_MAX_CPUS > 8) #if (KVM_MAX_VCPUS > 8)
#error Invalid number of CPU interfaces #error Invalid number of CPU interfaces
#endif #endif
......
...@@ -1297,7 +1297,7 @@ static bool vgic_queue_sgi(struct kvm_vcpu *vcpu, int irq) ...@@ -1297,7 +1297,7 @@ static bool vgic_queue_sgi(struct kvm_vcpu *vcpu, int irq)
sources = *vgic_get_sgi_sources(dist, vcpu_id, irq); sources = *vgic_get_sgi_sources(dist, vcpu_id, irq);
for_each_set_bit(c, &sources, VGIC_MAX_CPUS) { for_each_set_bit(c, &sources, dist->nr_cpus) {
if (vgic_queue_irq(vcpu, c, irq)) if (vgic_queue_irq(vcpu, c, irq))
clear_bit(c, &sources); clear_bit(c, &sources);
} }
...@@ -1700,7 +1700,7 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) ...@@ -1700,7 +1700,7 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
struct vgic_dist *dist = &vcpu->kvm->arch.vgic; struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
int i; int i;
if (vcpu->vcpu_id >= VGIC_MAX_CPUS) if (vcpu->vcpu_id >= dist->nr_cpus)
return -EBUSY; return -EBUSY;
for (i = 0; i < VGIC_NR_IRQS; i++) { for (i = 0; i < VGIC_NR_IRQS; i++) {
...@@ -1767,7 +1767,7 @@ static int vgic_init_maps(struct kvm *kvm) ...@@ -1767,7 +1767,7 @@ static int vgic_init_maps(struct kvm *kvm)
int nr_cpus, nr_irqs; int nr_cpus, nr_irqs;
int ret, i; int ret, i;
nr_cpus = dist->nr_cpus = VGIC_MAX_CPUS; nr_cpus = dist->nr_cpus = KVM_MAX_VCPUS;
nr_irqs = dist->nr_irqs = VGIC_NR_IRQS; nr_irqs = dist->nr_irqs = VGIC_NR_IRQS;
ret = vgic_init_bitmap(&dist->irq_enabled, nr_cpus, nr_irqs); ret = vgic_init_bitmap(&dist->irq_enabled, nr_cpus, nr_irqs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment