mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
ppc: Rewrite ppc_get_compat_smt_threads()
To continue consolidation of compatibility mode information, this rewrites the ppc_get_compat_smt_threads() function using the table of compatiblity modes in target-ppc/compat.c. It's not a direct replacement, the new ppc_compat_max_threads() function has simpler semantics - it just returns the number of threads the cpu model has, taking into account any compatiblity mode it is in. This no longer takes into account kvmppc_smt_threads() as the previous version did. That check wasn't useful because we check in ppc_cpu_realizefn() that CPUs aren't instantiated with more threads than kvm allows (or if we didn't things will already be broken and this won't make it any worse). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
parent
9d6f106552
commit
12dbeb16d0
4 changed files with 23 additions and 25 deletions
|
@ -28,6 +28,7 @@
|
|||
typedef struct {
|
||||
uint32_t pvr;
|
||||
uint64_t pcr;
|
||||
int max_threads;
|
||||
} CompatInfo;
|
||||
|
||||
static const CompatInfo compat_table[] = {
|
||||
|
@ -35,18 +36,22 @@ static const CompatInfo compat_table[] = {
|
|||
.pvr = CPU_POWERPC_LOGICAL_2_05,
|
||||
.pcr = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05
|
||||
| PCR_TM_DIS | PCR_VSX_DIS,
|
||||
.max_threads = 2,
|
||||
},
|
||||
{ /* POWER7, ISA2.06 */
|
||||
.pvr = CPU_POWERPC_LOGICAL_2_06,
|
||||
.pcr = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS,
|
||||
.max_threads = 4,
|
||||
},
|
||||
{
|
||||
.pvr = CPU_POWERPC_LOGICAL_2_06_PLUS,
|
||||
.pcr = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS,
|
||||
.max_threads = 4,
|
||||
},
|
||||
{ /* POWER8, ISA2.07 */
|
||||
.pvr = CPU_POWERPC_LOGICAL_2_07,
|
||||
.pcr = PCR_COMPAT_2_07,
|
||||
.max_threads = 8,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -89,3 +94,16 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ppc_compat_max_threads(PowerPCCPU *cpu)
|
||||
{
|
||||
const CompatInfo *compat = compat_by_pvr(cpu->compat_pvr);
|
||||
int n_threads = CPU(cpu)->nr_threads;
|
||||
|
||||
if (cpu->compat_pvr) {
|
||||
g_assert(compat);
|
||||
n_threads = MIN(n_threads, compat->max_threads);
|
||||
}
|
||||
|
||||
return n_threads;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue