diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2017-06-15 09:35:15 +0100 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2017-06-15 09:35:15 +0100 |
commit | 6f2f10cabe73944488a62df16695c86e20d4c3f9 (patch) | |
tree | 514fa4c6127892ed55d5a00611ce95555c3ce011 /virt/kvm/arm/vgic/vgic-mmio-v3.c | |
parent | ebb127f2d6f32665643165289151bd20929d9931 (diff) | |
parent | 33b5c38852b29736f3b472dd095c9a18ec22746f (diff) | |
download | linux-6f2f10cabe73944488a62df16695c86e20d4c3f9.tar.bz2 |
Merge branch 'kvmarm-master/master' into HEAD
Diffstat (limited to 'virt/kvm/arm/vgic/vgic-mmio-v3.c')
-rw-r--r-- | virt/kvm/arm/vgic/vgic-mmio-v3.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c index e25567a93dd5..714fa3933546 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c @@ -590,7 +590,7 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) if (!vgic_v3_check_base(kvm)) return -EINVAL; - rd_base = vgic->vgic_redist_base + kvm_vcpu_get_idx(vcpu) * SZ_64K * 2; + rd_base = vgic->vgic_redist_base + vgic->vgic_redist_free_offset; sgi_base = rd_base + SZ_64K; kvm_iodevice_init(&rd_dev->dev, &kvm_io_gic_ops); @@ -618,11 +618,15 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) mutex_lock(&kvm->slots_lock); ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base, SZ_64K, &sgi_dev->dev); - mutex_unlock(&kvm->slots_lock); - if (ret) + if (ret) { kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &rd_dev->dev); + goto out; + } + vgic->vgic_redist_free_offset += 2 * SZ_64K; +out: + mutex_unlock(&kvm->slots_lock); return ret; } @@ -648,10 +652,12 @@ static int vgic_register_all_redist_iodevs(struct kvm *kvm) if (ret) { /* The current c failed, so we start with the previous one. */ + mutex_lock(&kvm->slots_lock); for (c--; c >= 0; c--) { vcpu = kvm_get_vcpu(kvm, c); vgic_unregister_redist_iodev(vcpu); } + mutex_unlock(&kvm->slots_lock); } return ret; |