mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
ppc: Add has_smt_siblings property to CPUPPCState
The decision to branch out to a slower SMT path in instruction emulation will become a bit more complicated with the way that "big-core" topology that will be implemented in subsequent changes. Hide these details from the wider CPU emulation code with a bool has_smt_siblings flag that can be set by machine initialisation. Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
50d8cfb949
commit
59c921f229
3 changed files with 14 additions and 4 deletions
|
@ -288,6 +288,9 @@ static void pnv_core_realize(DeviceState *dev, Error **errp)
|
||||||
cpu = POWERPC_CPU(obj);
|
cpu = POWERPC_CPU(obj);
|
||||||
|
|
||||||
pc->threads[i] = POWERPC_CPU(obj);
|
pc->threads[i] = POWERPC_CPU(obj);
|
||||||
|
if (cc->nr_threads > 1) {
|
||||||
|
cpu->env.has_smt_siblings = true;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "thread[%d]", i);
|
snprintf(name, sizeof(name), "thread[%d]", i);
|
||||||
object_property_add_child(OBJECT(pc), name, obj);
|
object_property_add_child(OBJECT(pc), name, obj);
|
||||||
|
|
|
@ -349,9 +349,15 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
|
||||||
qemu_register_reset(spapr_cpu_core_reset_handler, sc);
|
qemu_register_reset(spapr_cpu_core_reset_handler, sc);
|
||||||
sc->threads = g_new0(PowerPCCPU *, cc->nr_threads);
|
sc->threads = g_new0(PowerPCCPU *, cc->nr_threads);
|
||||||
for (i = 0; i < cc->nr_threads; i++) {
|
for (i = 0; i < cc->nr_threads; i++) {
|
||||||
sc->threads[i] = spapr_create_vcpu(sc, i, errp);
|
PowerPCCPU *cpu;
|
||||||
if (!sc->threads[i] ||
|
|
||||||
!spapr_realize_vcpu(sc->threads[i], spapr, sc, i, errp)) {
|
cpu = spapr_create_vcpu(sc, i, errp);
|
||||||
|
sc->threads[i] = cpu;
|
||||||
|
if (cpu && cc->nr_threads > 1) {
|
||||||
|
cpu->env.has_smt_siblings = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cpu || !spapr_realize_vcpu(cpu, spapr, sc, i, errp)) {
|
||||||
spapr_cpu_core_unrealize(dev);
|
spapr_cpu_core_unrealize(dev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1248,6 +1248,7 @@ struct CPUArchState {
|
||||||
int access_type;
|
int access_type;
|
||||||
|
|
||||||
/* For SMT processors */
|
/* For SMT processors */
|
||||||
|
bool has_smt_siblings;
|
||||||
int core_index;
|
int core_index;
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
@ -1514,7 +1515,7 @@ struct PowerPCCPUClass {
|
||||||
|
|
||||||
static inline bool ppc_cpu_core_single_threaded(CPUState *cs)
|
static inline bool ppc_cpu_core_single_threaded(CPUState *cs)
|
||||||
{
|
{
|
||||||
return cs->nr_threads == 1;
|
return !POWERPC_CPU(cs)->env.has_smt_siblings;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool ppc_cpu_lpar_single_threaded(CPUState *cs)
|
static inline bool ppc_cpu_lpar_single_threaded(CPUState *cs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue