path: root/arch/powerpc/kvm/book3s_xics.c
diff options
authorLinus Torvalds <>2016-08-13 10:11:14 -0700
committerLinus Torvalds <>2016-08-13 10:11:14 -0700
commit329f4152911c276b074bec75a0443f88821afdb7 (patch)
treef7c9cd285a4513379b56a78bc65aac8b34c1d35d /arch/powerpc/kvm/book3s_xics.c
parenta1e210331bbc69511898cd46dd09625ddeee5af8 (diff)
parent89a1d43ead15902b1f15768aa1121a2e2d5935af (diff)
Merge tag 'for-linus' of git://
Pull KVM fixes from Radim Krčmář: "KVM: - lock kvm_device list to prevent corruption on device creation. PPC: - split debugfs initialization from creation of the xics device to unlock the newly taken kvm lock earlier. s390: - prevent userspace from triggering two WARN_ON_ONCE. MIPS: - fix several issues in the management of TLB faults (Cc: stable)" * tag 'for-linus' of git:// MIPS: KVM: Propagate kseg0/mapped tlb fault errors MIPS: KVM: Fix gfn range check in kseg0 tlb faults MIPS: KVM: Add missing gfn range check MIPS: KVM: Fix mapped fault broken commpage handling KVM: Protect device ops->create and list_add with kvm->lock KVM: PPC: Move xics_debugfs_init out of create KVM: s390: reset KVM_REQ_MMU_RELOAD if mapping the prefix failed KVM: s390: set the prefix initially properly
Diffstat (limited to 'arch/powerpc/kvm/book3s_xics.c')
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index a75ba38a2d81..05aa11399a78 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1329,20 +1329,16 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
xics->kvm = kvm;
/* Already there ? */
- mutex_lock(&kvm->lock);
if (kvm->arch.xics)
ret = -EEXIST;
kvm->arch.xics = xics;
- mutex_unlock(&kvm->lock);
if (ret) {
return ret;
- xics_debugfs_init(xics);
if (cpu_has_feature(CPU_FTR_ARCH_206)) {
/* Enable real mode support */
@@ -1354,9 +1350,17 @@ static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
return 0;
+static void kvmppc_xics_init(struct kvm_device *dev)
+ struct kvmppc_xics *xics = (struct kvmppc_xics *)dev->private;
+ xics_debugfs_init(xics);
struct kvm_device_ops kvm_xics_ops = {
.name = "kvm-xics",
.create = kvmppc_xics_create,
+ .init = kvmppc_xics_init,
.destroy = kvmppc_xics_free,
.set_attr = xics_set_attr,
.get_attr = xics_get_attr,