Skip to contentSkip to conversation

target/ppc: Let mtmsr set MSR[ME] on 32-bit PowerPC

PATCH New Eric DeVolder 1 participant 2 messages Nov 10 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 target/ppc: Let mtmsr set MSR[ME] on 32-bit PowerPC

On the 32-bit processors (601, 603, 604, 750, 74xx) mtmsr does set ME, and permits machine checks, otherwise machine check ends in a checkstop.

---
 target/ppc/translate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
target/ppc/translate.c +6 -2
index 06ed2adf10..808f913aa2 100644
@@ -4282,8 +4282,12 @@ static void gen_mtmsr(DisasContext *ctx)
         mask &= (1ULL << MSR_RI) | (1ULL << MSR_EE);
     } else {
         if (likely(!(ctx->insns_flags2 & PPC2_PPE42))) {
-            /* mtmsr does not alter S, ME, or LE */
-            mask &= ~((1ULL << MSR_LE) | (1ULL << MSR_ME) | (1ULL << MSR_S));
+            /* mtmsr does not alter S or LE */
+            mask &= ~((1ULL << MSR_LE) | (1ULL << MSR_S));
+            /* nor ME, on the 64-bit server processors; the 6xx can */
+            if (is_book3s_arch2x(ctx)) {
+                mask &= ~(1ULL << MSR_ME);
+            }
         }
 
         /*
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/2 target/ppc: Raise a machine check on a failed bus access on 6xx

For 6XX, enable ppc_cpu_do_transaction_failed() to take the machine check.

---
 target/ppc/tcg-excp_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)
target/ppc/tcg-excp_helper.c +6 -0
index b04f07a637..29fd1d371d 100644
@@ -297,6 +297,12 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
         }
         break;
 #endif
+    case POWERPC_EXCP_6xx:
+        /*
+         * A bus error (TEA) takes a machine check, if MSR[ME] is set. The
+         * 603 and 604 have no DAR or DSISR update for it.
+         */
+        break;
     default:
         /*
          * TODO: Check behaviour for other CPUs, for now do nothing.
Signature · 1 line
2.53.0