All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 11/30] KVM: PPC: Book3S PR: implement RFID TM behavior to suppress change from S0 to N0
@ 2018-02-27 17:52 ` wei.guo.simon
  0 siblings, 0 replies; 78+ messages in thread
From: wei.guo.simon @ 2018-02-27 17:52 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Simon Guo, kvm-ppc, kvm

From: Simon Guo <wei.guo.simon@gmail.com>

Accordingly 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 make RFID emulation of PR KVM to be consistent with this.

Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Reviewed-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/kvm/book3s_emulate.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 68d6898..2eb457b 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,
 	case 19:
 		switch (get_xop(inst)) {
 		case OP_19_XOP_RFID:
-		case OP_19_XOP_RFI:
+		case OP_19_XOP_RFI: {
+			unsigned long srr1 = kvmppc_get_srr1(vcpu);
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+			unsigned long cur_msr = kvmppc_get_msr(vcpu);
+
+			/*
+			 * add rules to fit in ISA specification regarding TM
+			 * state transistion in TM disable/Suspended state,
+			 * and target TM state is TM inactive(00) state. (the
+			 * change should be suppressed).
+			 */
+			if (((cur_msr & MSR_TM) == 0) &&
+				((srr1 & MSR_TM) == 0) &&
+				MSR_TM_SUSPENDED(cur_msr) &&
+				!MSR_TM_ACTIVE(srr1))
+				srr1 |= MSR_TS_S;
+#endif
 			kvmppc_set_pc(vcpu, kvmppc_get_srr0(vcpu));
-			kvmppc_set_msr(vcpu, kvmppc_get_srr1(vcpu));
+			kvmppc_set_msr(vcpu, srr1);
 			*advance = 0;
 			break;
+		}
 
 		default:
 			emulated = EMULATE_FAIL;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2018-05-16  2:13 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 17:52 [PATCH v2 11/30] KVM: PPC: Book3S PR: implement RFID TM behavior to suppress change from S0 to N0 wei.guo.simon
2018-02-27 17:52 ` wei.guo.simon
2018-02-27 17:52 ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 12/30] KVM: PPC: Book3S PR: prevent TS bits change in kvmppc_interrupt_pr() wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 13/30] KVM: PPC: Book3S PR: adds new kvmppc_copyto_vcpu_tm/kvmppc_copyfrom_vcpu_tm API for PR KVM wei.guo.simon
2018-02-27 17:52   ` [PATCH v2 13/30] KVM: PPC: Book3S PR: adds new kvmppc_copyto_vcpu_tm/kvmppc_copyfrom_vcpu_tm API for wei.guo.simon
2018-02-27 17:52   ` [PATCH v2 13/30] KVM: PPC: Book3S PR: adds new kvmppc_copyto_vcpu_tm/kvmppc_copyfrom_vcpu_tm API for PR KVM wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 14/30] KVM: PPC: Book3S PR: add kvmppc_save/restore_tm_sprs() APIs wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 15/30] KVM: PPC: Book3S PR: add transaction memory save/restore skeleton for PR KVM wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 16/30] KVM: PPC: Book3S PR: add math support for PR KVM HTM wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 17/30] KVM: PPC: Book3S PR: make mtspr/mfspr emulation behavior based on active TM SPRs wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-05-15  6:07   ` Paul Mackerras
2018-05-15  6:07     ` [PATCH v2 17/30] KVM: PPC: Book3S PR: make mtspr/mfspr emulation behavior based on active TM SPR Paul Mackerras
2018-05-15  6:07     ` [PATCH v2 17/30] KVM: PPC: Book3S PR: make mtspr/mfspr emulation behavior based on active TM SPRs Paul Mackerras
2018-05-15 12:58     ` Simon Guo
2018-05-15 12:58       ` [PATCH v2 17/30] KVM: PPC: Book3S PR: make mtspr/mfspr emulation behavior based on active TM SPR Simon Guo
2018-05-15 12:58       ` [PATCH v2 17/30] KVM: PPC: Book3S PR: make mtspr/mfspr emulation behavior based on active TM SPRs Simon Guo
2018-02-27 17:52 ` [PATCH v2 18/30] KVM: PPC: Book3S PR: always fail transaction in guest privilege state wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-05-15  6:07   ` Paul Mackerras
2018-05-15  6:07     ` Paul Mackerras
2018-05-15  6:07     ` Paul Mackerras
2018-05-16  1:35     ` Simon Guo
2018-05-16  1:35       ` Simon Guo
2018-05-16  1:35       ` Simon Guo
2018-02-27 17:52 ` [PATCH v2 19/30] KVM: PPC: Book3S PR: enable NV reg restore for reading TM SPR at " wei.guo.simon
2018-02-27 17:52   ` [PATCH v2 19/30] KVM: PPC: Book3S PR: enable NV reg restore for reading TM SPR at guest privilege st wei.guo.simon
2018-02-27 17:52   ` [PATCH v2 19/30] KVM: PPC: Book3S PR: enable NV reg restore for reading TM SPR at guest privilege state wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 20/30] KVM: PPC: Book3S PR: adds emulation for treclaim wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 21/30] KVM: PPC: Book3S PR: add emulation for trechkpt in PR KVM wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 22/30] KVM: PPC: Book3S PR: add emulation for tabort. for privilege guest wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 23/30] KVM: PPC: Book3S PR: add guard code to prevent returning to guest with PR=0 and Transactional state wei.guo.simon
2018-02-27 17:52   ` [PATCH v2 23/30] KVM: PPC: Book3S PR: add guard code to prevent returning to guest with PR=0 and Tra wei.guo.simon
2018-02-27 17:52   ` [PATCH v2 23/30] KVM: PPC: Book3S PR: add guard code to prevent returning to guest with PR=0 and Transactional state wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 24/30] KVM: PPC: Book3S PR: Support TAR handling for PR KVM HTM wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 25/30] KVM: PPC: Book3S PR: enable HTM for PR KVM for KVM_CHECK_EXTENSION ioctl wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 26/30] KVM: PPC: move vcpu_load/vcpu_put down to each ioctl case in kvm_arch_vcpu_ioctl wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 27/30] KVM: PPC: remove load/put vcpu for KVM_GET/SET_ONE_REG ioctl wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 28/30] KVM: PPC: remove load/put vcpu for KVM_GET_REGS/KVM_SET_REGS wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52 ` [PATCH v2 29/30] KVM: PPC: add KVM_SET_ONE_REG/KVM_GET_ONE_REG to async ioctl wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-05-15  6:15   ` Paul Mackerras
2018-05-15  6:15     ` Paul Mackerras
2018-05-15  6:15     ` Paul Mackerras
2018-05-16  2:13     ` Simon Guo
2018-05-16  2:13       ` Simon Guo
2018-05-16  2:13       ` Simon Guo
2018-02-27 17:52 ` [PATCH v2 30/30] KVM: PPC: Book3S PR: enable kvmppc_get/set_one_reg_pr() for HTM registers wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon
2018-02-27 17:52   ` wei.guo.simon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.