diff options
author | Eric Auger <eric.auger@redhat.com> | 2018-05-22 03:55:15 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-05-25 07:29:27 -0400 |
commit | c957a6d63e176e1ca068f935ca1efc439581aa6c (patch) | |
tree | d2ee4910879b265531e715c4cc3ef0b4ae303d16 | |
parent | c011f4ea106b94e5499358b62d8c2d74f7e184f9 (diff) |
KVM: arm/arm64: Check all vcpu redistributors are set on map_resources
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 <eric.auger@redhat.com>
Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | virt/kvm/arm/vgic/vgic-v3.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index ce4476a08f5b..eb32b213f600 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c | |||
@@ -493,16 +493,25 @@ struct vgic_redist_region *vgic_v3_rdist_free_slot(struct list_head *rd_regions) | |||
493 | 493 | ||
494 | int vgic_v3_map_resources(struct kvm *kvm) | 494 | int vgic_v3_map_resources(struct kvm *kvm) |
495 | { | 495 | { |
496 | int ret = 0; | ||
497 | struct vgic_dist *dist = &kvm->arch.vgic; | 496 | struct vgic_dist *dist = &kvm->arch.vgic; |
498 | struct vgic_redist_region *rdreg = | 497 | struct kvm_vcpu *vcpu; |
499 | list_first_entry(&dist->rd_regions, | 498 | int ret = 0; |
500 | struct vgic_redist_region, list); | 499 | int c; |
501 | 500 | ||
502 | if (vgic_ready(kvm)) | 501 | if (vgic_ready(kvm)) |
503 | goto out; | 502 | goto out; |
504 | 503 | ||
505 | if (IS_VGIC_ADDR_UNDEF(dist->vgic_dist_base) || !rdreg) { | 504 | kvm_for_each_vcpu(c, vcpu, kvm) { |
505 | struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; | ||
506 | |||
507 | if (IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr)) { | ||
508 | kvm_debug("vcpu %d redistributor base not set\n", c); | ||
509 | ret = -ENXIO; | ||
510 | goto out; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | if (IS_VGIC_ADDR_UNDEF(dist->vgic_dist_base)) { | ||
506 | kvm_err("Need to set vgic distributor addresses first\n"); | 515 | kvm_err("Need to set vgic distributor addresses first\n"); |
507 | ret = -ENXIO; | 516 | ret = -ENXIO; |
508 | goto out; | 517 | goto out; |