mirror of https://github.com/xemu-project/xemu.git
target-ppc: Reset SPRs on CPU reset
This resets SPR values to defaults on CPU reset. This should help with little-endian guests reboot issues. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
7aaf4957ef
commit
d197fdbc3b
|
@ -334,6 +334,7 @@ struct ppc_spr_t {
|
||||||
void (*hea_write)(void *opaque, int spr_num, int gpr_num);
|
void (*hea_write)(void *opaque, int spr_num, int gpr_num);
|
||||||
#endif
|
#endif
|
||||||
const char *name;
|
const char *name;
|
||||||
|
target_ulong default_value;
|
||||||
#ifdef CONFIG_KVM
|
#ifdef CONFIG_KVM
|
||||||
/* We (ab)use the fact that all the SPRs will have ids for the
|
/* We (ab)use the fact that all the SPRs will have ids for the
|
||||||
* ONE_REG interface will have KVM_REG_PPC to use 0 as meaning,
|
* ONE_REG interface will have KVM_REG_PPC to use 0 as meaning,
|
||||||
|
|
|
@ -631,7 +631,7 @@ static inline void _spr_register(CPUPPCState *env, int num,
|
||||||
#if defined(CONFIG_KVM)
|
#if defined(CONFIG_KVM)
|
||||||
spr->one_reg_id = one_reg_id,
|
spr->one_reg_id = one_reg_id,
|
||||||
#endif
|
#endif
|
||||||
env->spr[num] = initial_value;
|
env->spr[num] = spr->default_value = initial_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic PowerPC SPRs */
|
/* Generic PowerPC SPRs */
|
||||||
|
@ -8381,6 +8381,7 @@ static void ppc_cpu_reset(CPUState *s)
|
||||||
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
|
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
|
||||||
CPUPPCState *env = &cpu->env;
|
CPUPPCState *env = &cpu->env;
|
||||||
target_ulong msr;
|
target_ulong msr;
|
||||||
|
int i;
|
||||||
|
|
||||||
pcc->parent_reset(s);
|
pcc->parent_reset(s);
|
||||||
|
|
||||||
|
@ -8434,6 +8435,15 @@ static void ppc_cpu_reset(CPUState *s)
|
||||||
env->dtl_size = 0;
|
env->dtl_size = 0;
|
||||||
#endif /* TARGET_PPC64 */
|
#endif /* TARGET_PPC64 */
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
|
||||||
|
ppc_spr_t *spr = &env->spr_cb[i];
|
||||||
|
|
||||||
|
if (!spr->name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
env->spr[i] = spr->default_value;
|
||||||
|
}
|
||||||
|
|
||||||
/* Flush all TLBs */
|
/* Flush all TLBs */
|
||||||
tlb_flush(s, 1);
|
tlb_flush(s, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue