Skip to content

Commit 9808ce6

Browse files
committed
target/ppc: Big-core scratch register fix
The per-core SCRATCH0-7 registers are shared between big cores, which was missed in the big-core implementation. It is difficult to model well with the big-core == 2xPnvCore scheme we moved to, this fix uses the even PnvCore to store the scrach data. Also remove a stray log message that came in with the same patch that introduced patch. Fixes: c26504a ("ppc/pnv: Add a big-core mode that joins two regular cores") Cc: [email protected] Signed-off-by: Nicholas Piggin <[email protected]>
1 parent dfaecc0 commit 9808ce6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

target/ppc/misc_helper.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ target_ulong helper_load_sprd(CPUPPCState *env)
332332
PnvCore *pc = pnv_cpu_state(cpu)->pnv_core;
333333
target_ulong sprc = env->spr[SPR_POWER_SPRC];
334334

335+
if (pc->big_core) {
336+
pc = pnv_chip_find_core(pc->chip, CPU_CORE(pc)->core_id & ~0x1);
337+
}
338+
335339
switch (sprc & 0x3e0) {
336340
case 0: /* SCRATCH0-3 */
337341
case 1: /* SCRATCH4-7 */
@@ -368,6 +372,10 @@ void helper_store_sprd(CPUPPCState *env, target_ulong val)
368372
PnvCore *pc = pnv_cpu_state(cpu)->pnv_core;
369373
int nr;
370374

375+
if (pc->big_core) {
376+
pc = pnv_chip_find_core(pc->chip, CPU_CORE(pc)->core_id & ~0x1);
377+
}
378+
371379
switch (sprc & 0x3e0) {
372380
case 0: /* SCRATCH0-3 */
373381
case 1: /* SCRATCH4-7 */
@@ -378,7 +386,6 @@ void helper_store_sprd(CPUPPCState *env, target_ulong val)
378386
* information. Could also dump these upon checkstop.
379387
*/
380388
nr = (sprc >> 3) & 0x7;
381-
qemu_log("SPRD write 0x" TARGET_FMT_lx " to SCRATCH%d\n", val, nr);
382389
pc->scratch[nr] = val;
383390
break;
384391
default:

0 commit comments

Comments
 (0)