1
0
Fork 0
alistair23-linux/include/kvm
Christoffer Dall 552c9f47f8 KVM: arm/arm64: Fix bug when registering redist iodevs
If userspace creates the VCPUs after initializing the VGIC, then we end
up in a situation where we trigger a bug in kvm_vcpu_get_idx(), because
it is called prior to adding the VCPU into the vcpus array on the VM.

There is no tight coupling between the VCPU index and the area of the
redistributor region used for the VCPU, so we can simply ensure that all
creations of redistributors are serialized per VM, and increment an
offset when we successfully add a redistributor.

The vgic_register_redist_iodev() function can be called from two paths:
vgic_redister_all_redist_iodev() which is called via the kvm_vgic_addr()
device attribute handler.  This patch already holds the kvm->lock mutex.

The other path is via kvm_vgic_vcpu_init, which is called through a
longer chain from kvm_vm_ioctl_create_vcpu(), which releases the
kvm->lock mutex just before calling kvm_arch_vcpu_create(), so we can
simply take this mutex again later for our purposes.

Fixes: ab6f468c10 ("KVM: arm/arm64: Register iodevs when setting redist base and creating VCPUs")
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Tested-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
2017-05-18 11:18:12 +02:00
..
arm_arch_timer.h KVM: arm/arm64: Support arch timers with a userspace gic 2017-04-09 07:49:38 -07:00
arm_pmu.h KVM: arm/arm64: Report PMU overflow interrupts to userspace irqchip 2017-04-09 07:49:39 -07:00
arm_vgic.h KVM: arm/arm64: Fix bug when registering redist iodevs 2017-05-18 11:18:12 +02:00
iodev.h KVM: move iodev.h from virt/kvm/ to include/kvm 2015-03-26 21:43:12 +00:00