aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Guo <wei.guo.simon@gmail.com>2018-05-23 03:01:54 -0400
committerPaul Mackerras <paulus@ozlabs.org>2018-05-31 20:29:38 -0400
commit401a89e9375c011de4e3271d50f27648b734a7cb (patch)
tree53c0d063a9321787bbe75445ae617077254197cc
parent95757bfc72e9f08905bf6b68d5b8903db205e681 (diff)
KVM: PPC: Book3S PR: Implement RFID TM behavior to suppress change from S0 to N0
According to ISA specification for RFID, in MSR TM disabled and TS suspended state (S0), if the target MSR is TM disabled and TS state is inactive (N0), rfid should suppress this update. This patch makes the RFID emulation of PR KVM consistent with this. Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 68d68983948e..2eb457bc7b6e 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -117,11 +117,28 @@ int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
117 case 19: 117 case 19:
118 switch (get_xop(inst)) { 118 switch (get_xop(inst)) {
119 case OP_19_XOP_RFID: 119 case OP_19_XOP_RFID:
120 case OP_19_XOP_RFI: 120 case OP_19_XOP_RFI: {
121 unsigned long srr1 = kvmppc_get_srr1(vcpu);
122#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
123 unsigned long cur_msr = kvmppc_get_msr(vcpu);
124
125 /*
126 * add rules to fit in ISA specification regarding TM
127 * state transistion in TM disable/Suspended state,
128 * and target TM state is TM inactive(00) state. (the
129 * change should be suppressed).
130 */
131 if (((cur_msr & MSR_TM) == 0) &&
132 ((srr1 & MSR_TM) == 0) &&
133 MSR_TM_SUSPENDED(cur_msr) &&
134 !MSR_TM_ACTIVE(srr1))
135 srr1 |= MSR_TS_S;
136#endif
121 kvmppc_set_pc(vcpu, kvmppc_get_srr0(vcpu)); 137 kvmppc_set_pc(vcpu, kvmppc_get_srr0(vcpu));
122 kvmppc_set_msr(vcpu, kvmppc_get_srr1(vcpu)); 138 kvmppc_set_msr(vcpu, srr1);
123 *advance = 0; 139 *advance = 0;
124 break; 140 break;
141 }
125 142
126 default: 143 default:
127 emulated = EMULATE_FAIL; 144 emulated = EMULATE_FAIL;