aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2014-07-19 03:59:35 -0400
committerAlexander Graf <agraf@suse.de>2014-07-28 09:23:16 -0400
commitef1af2e29622ff3403926ae801a2b10da075a2de (patch)
treeeace6cec47bc537474d93986f5f33d136aeb29c9 /arch
parenta0840240c0c6bcbac8f0f5db11f95c19aaf9b52f (diff)
KVM: PPC: Book3S PR: Take SRCU read lock around RTAS kvm_read_guest() call
This does for PR KVM what c9438092cae4 ("KVM: PPC: Book3S HV: Take SRCU read lock around kvm_read_guest() call") did for HV KVM, that is, eliminate a "suspicious rcu_dereference_check() usage!" warning by taking the SRCU lock around the call to kvmppc_rtas_hcall(). It also fixes a return of RESUME_HOST to return EMULATE_FAIL instead, since kvmppc_h_pr() is supposed to return EMULATE_* values. Signed-off-by: Paul Mackerras <paulus@samba.org> Cc: stable@vger.kernel.org Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/book3s_pr_papr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c
index 6d0143fbeb63..ce3c893d509b 100644
--- a/arch/powerpc/kvm/book3s_pr_papr.c
+++ b/arch/powerpc/kvm/book3s_pr_papr.c
@@ -267,6 +267,8 @@ static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
267 267
268int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd) 268int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
269{ 269{
270 int rc, idx;
271
270 if (cmd <= MAX_HCALL_OPCODE && 272 if (cmd <= MAX_HCALL_OPCODE &&
271 !test_bit(cmd/4, vcpu->kvm->arch.enabled_hcalls)) 273 !test_bit(cmd/4, vcpu->kvm->arch.enabled_hcalls))
272 return EMULATE_FAIL; 274 return EMULATE_FAIL;
@@ -299,8 +301,11 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
299 break; 301 break;
300 case H_RTAS: 302 case H_RTAS:
301 if (list_empty(&vcpu->kvm->arch.rtas_tokens)) 303 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
302 return RESUME_HOST; 304 break;
303 if (kvmppc_rtas_hcall(vcpu)) 305 idx = srcu_read_lock(&vcpu->kvm->srcu);
306 rc = kvmppc_rtas_hcall(vcpu);
307 srcu_read_unlock(&vcpu->kvm->srcu, idx);
308 if (rc)
304 break; 309 break;
305 kvmppc_set_gpr(vcpu, 3, 0); 310 kvmppc_set_gpr(vcpu, 3, 0);
306 return EMULATE_DONE; 311 return EMULATE_DONE;