2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-09 14:14:00 +08:00
linux-next/virt/kvm/arm/vgic
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
..
trace.h KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
vgic-debug.c KVM: arm/arm64: vgic: Add debugfs vgic-state file 2017-01-25 13:50:03 +01:00
vgic-init.c KVM: arm/arm64: Fix bug when registering redist iodevs 2017-05-18 11:18:12 +02:00
vgic-irqfd.c KVM: arm/arm64: vgic: Stop injecting the MSI occurrence twice 2017-02-08 15:13:14 +00:00
vgic-its.c KVM: arm/arm64: vgic-its: Cleanup after failed ITT restore 2017-05-09 12:19:46 +02:00
vgic-kvm-device.c KVM: arm/arm64: Register iodevs when setting redist base and creating VCPUs 2017-05-09 12:19:36 +02:00
vgic-mmio-v2.c KVM: arm/arm64: vgic: Fix GICC_PMR uaccess on GICv3 and clarify ABI 2017-04-04 14:33:59 +02:00
vgic-mmio-v3.c KVM: arm/arm64: Fix bug when registering redist iodevs 2017-05-18 11:18:12 +02:00
vgic-mmio.c arm/arm64: vgic: turn vgic_find_mmio_region into public 2017-05-08 14:31:48 +02:00
vgic-mmio.h KVM: arm64: vgic-its: Implement vgic_its_has_attr_regs and attr_regs_access 2017-05-08 14:33:54 +02:00
vgic-v2.c KVM: arm/arm64: vgic-v2: Do not use Active+Pending state for a HW interrupt 2017-05-15 11:31:43 +02:00
vgic-v3.c KVM: arm/arm64: vgic-v3: Do not use Active+Pending state for a HW interrupt 2017-05-15 11:31:51 +02:00
vgic.c Second round of KVM/ARM Changes for v4.12. 2017-05-09 12:51:49 +02:00
vgic.h Second round of KVM/ARM Changes for v4.12. 2017-05-09 12:51:49 +02:00