mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
ppc: Add ppc_set_compat_all()
Once a compatiblity mode is negotiated with the guest, h_client_architecture_support() uses run_on_cpu() to update each CPU to the new mode. We're going to want this logic somewhere else shortly, so make a helper function to do this global update. We put it in target-ppc/compat.c - it makes as much sense at the CPU level as it does at the machine level. We also move the cpu_synchronize_state() into ppc_set_compat(), since it doesn't really make any sense to call that without synchronizing state. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
152ef803ce
commit
f6f242c757
3 changed files with 43 additions and 26 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "sysemu/hw_accel.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "kvm_ppc.h"
|
||||
#include "sysemu/cpus.h"
|
||||
|
@ -124,6 +125,8 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp)
|
|||
pcr = compat->pcr;
|
||||
}
|
||||
|
||||
cpu_synchronize_state(CPU(cpu));
|
||||
|
||||
cpu->compat_pvr = compat_pvr;
|
||||
env->spr[SPR_PCR] = pcr & pcc->pcr_mask;
|
||||
|
||||
|
@ -136,6 +139,38 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint32_t compat_pvr;
|
||||
Error *err;
|
||||
} SetCompatState;
|
||||
|
||||
static void do_set_compat(CPUState *cs, run_on_cpu_data arg)
|
||||
{
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
SetCompatState *s = arg.host_ptr;
|
||||
|
||||
ppc_set_compat(cpu, s->compat_pvr, &s->err);
|
||||
}
|
||||
|
||||
void ppc_set_compat_all(uint32_t compat_pvr, Error **errp)
|
||||
{
|
||||
CPUState *cs;
|
||||
|
||||
CPU_FOREACH(cs) {
|
||||
SetCompatState s = {
|
||||
.compat_pvr = compat_pvr,
|
||||
.err = NULL,
|
||||
};
|
||||
|
||||
run_on_cpu(cs, do_set_compat, RUN_ON_CPU_HOST_PTR(&s));
|
||||
|
||||
if (s.err) {
|
||||
error_propagate(errp, s.err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ppc_compat_max_threads(PowerPCCPU *cpu)
|
||||
{
|
||||
const CompatInfo *compat = compat_by_pvr(cpu->compat_pvr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue