Skip to content

Commit

Permalink
KVM: arm/arm64: Check all vcpu redistributors are set on map_resources
Browse files Browse the repository at this point in the history
On vcpu first run, we eventually know the actual number of vcpus.
This is a synchronization point to check all redistributors
were assigned. On kvm_vgic_map_resources() we check both dist and
redist were set, eventually check potential base address inconsistencies.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Christoffer Dall <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
  • Loading branch information
eauger authored and Marc Zyngier committed May 25, 2018
1 parent c011f4e commit c957a6d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions virt/kvm/arm/vgic/vgic-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,16 +493,25 @@ struct vgic_redist_region *vgic_v3_rdist_free_slot(struct list_head *rd_regions)

int vgic_v3_map_resources(struct kvm *kvm)
{
int ret = 0;
struct vgic_dist *dist = &kvm->arch.vgic;
struct vgic_redist_region *rdreg =
list_first_entry(&dist->rd_regions,
struct vgic_redist_region, list);
struct kvm_vcpu *vcpu;
int ret = 0;
int c;

if (vgic_ready(kvm))
goto out;

if (IS_VGIC_ADDR_UNDEF(dist->vgic_dist_base) || !rdreg) {
kvm_for_each_vcpu(c, vcpu, kvm) {
struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;

if (IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr)) {
kvm_debug("vcpu %d redistributor base not set\n", c);
ret = -ENXIO;
goto out;
}
}

if (IS_VGIC_ADDR_UNDEF(dist->vgic_dist_base)) {
kvm_err("Need to set vgic distributor addresses first\n");
ret = -ENXIO;
goto out;
Expand Down

0 comments on commit c957a6d

Please sign in to comment.