aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2024-09-06 08:13:51 +1000
committerNicholas Piggin <npiggin@gmail.com>2025-04-08 20:52:43 +1000
commit9808ce6d5cb75a4f9db76a3d9b508560efdf5ac2 (patch)
tree0c95018cfaaf9f423054e453a806a461b14e4efc
parentdfaecc04c46d298e9ee81bd0ca96d8754f1c27ed (diff)
downloadqemu-9808ce6d5cb75a4f9db76a3d9b508560efdf5ac2.zip
qemu-9808ce6d5cb75a4f9db76a3d9b508560efdf5ac2.tar.gz
qemu-9808ce6d5cb75a4f9db76a3d9b508560efdf5ac2.tar.bz2
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: c26504afd5f5c ("ppc/pnv: Add a big-core mode that joins two regular cores") Cc: qemu-stable@nongnu.org Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
-rw-r--r--target/ppc/misc_helper.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c
index 2d9512c..46ae454 100644
--- a/target/ppc/misc_helper.c
+++ b/target/ppc/misc_helper.c
@@ -332,6 +332,10 @@ target_ulong helper_load_sprd(CPUPPCState *env)
PnvCore *pc = pnv_cpu_state(cpu)->pnv_core;
target_ulong sprc = env->spr[SPR_POWER_SPRC];
+ if (pc->big_core) {
+ pc = pnv_chip_find_core(pc->chip, CPU_CORE(pc)->core_id & ~0x1);
+ }
+
switch (sprc & 0x3e0) {
case 0: /* SCRATCH0-3 */
case 1: /* SCRATCH4-7 */
@@ -368,6 +372,10 @@ void helper_store_sprd(CPUPPCState *env, target_ulong val)
PnvCore *pc = pnv_cpu_state(cpu)->pnv_core;
int nr;
+ if (pc->big_core) {
+ pc = pnv_chip_find_core(pc->chip, CPU_CORE(pc)->core_id & ~0x1);
+ }
+
switch (sprc & 0x3e0) {
case 0: /* SCRATCH0-3 */
case 1: /* SCRATCH4-7 */
@@ -378,7 +386,6 @@ void helper_store_sprd(CPUPPCState *env, target_ulong val)
* information. Could also dump these upon checkstop.
*/
nr = (sprc >> 3) & 0x7;
- qemu_log("SPRD write 0x" TARGET_FMT_lx " to SCRATCH%d\n", val, nr);
pc->scratch[nr] = val;
break;
default: