summaryrefslogtreecommitdiff
path: root/arch/powerpc/kvm/e500_mmu.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2013-06-07 04:16:31 +0400
committerGleb Natapov <gleb@redhat.com>2013-06-11 12:10:59 +0400
commitf1e89028f020ca982bf51be6eaba0d462ba0f7fa (patch)
treeb6d06ea63e61d1f93037f1f9ff76fe19358dfd52 /arch/powerpc/kvm/e500_mmu.c
parent2b6398fcf2831f52a8ad9f01c123b3ce2ea31277 (diff)
downloadlinux-f1e89028f020ca982bf51be6eaba0d462ba0f7fa.tar.xz
kvm/ppc/booke: Hold srcu lock when calling gfn functions
KVM core expects arch code to acquire the srcu lock when calling gfn_to_memslot and similar functions. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/e500_mmu.c')
-rw-r--r--arch/powerpc/kvm/e500_mmu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c
index c41a5a96b558..6d6f153b6c1d 100644
--- a/arch/powerpc/kvm/e500_mmu.c
+++ b/arch/powerpc/kvm/e500_mmu.c
@@ -396,6 +396,7 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
struct kvm_book3e_206_tlb_entry *gtlbe;
int tlbsel, esel;
int recal = 0;
+ int idx;
tlbsel = get_tlb_tlbsel(vcpu);
esel = get_tlb_esel(vcpu, tlbsel);
@@ -430,6 +431,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
kvmppc_set_tlb1map_range(vcpu, gtlbe);
}
+ idx = srcu_read_lock(&vcpu->kvm->srcu);
+
/* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */
if (tlbe_is_host_safe(vcpu, gtlbe)) {
u64 eaddr = get_tlb_eaddr(gtlbe);
@@ -444,6 +447,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
kvmppc_mmu_map(vcpu, eaddr, raddr, index_of(tlbsel, esel));
}
+ srcu_read_unlock(&vcpu->kvm->srcu, idx);
+
kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS);
return EMULATE_DONE;
}