diff options
-rw-r--r-- | target-ppc/translate_init.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 5eacd46a52..48177ed0a0 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -9098,29 +9098,21 @@ static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp) int ppc_get_compat_smt_threads(PowerPCCPU *cpu) { - int ret = smp_threads; - PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); + int ret = MIN(smp_threads, kvmppc_smt_threads()); switch (cpu->cpu_version) { case CPU_POWERPC_LOGICAL_2_05: - ret = 2; + ret = MIN(ret, 2); break; case CPU_POWERPC_LOGICAL_2_06: - ret = 4; + ret = MIN(ret, 4); break; case CPU_POWERPC_LOGICAL_2_07: - ret = 8; - break; - default: - if (pcc->pcr_mask & PCR_COMPAT_2_06) { - ret = 4; - } else if (pcc->pcr_mask & PCR_COMPAT_2_05) { - ret = 2; - } + ret = MIN(ret, 8); break; } - return MIN(ret, smp_threads); + return ret; } int ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version) |