target/ppc: Add helpers to check for SMT sibling threads

Add helpers for TCG code to determine if there are SMT siblings
sharing per-core and per-lpar registers. This simplifies the
callers and makes SMT register topology simpler to modify with
later changes.

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
Nicholas Piggin 2024-05-24 17:49:52 +10:00
parent feb37fdc82
commit 50d8cfb949
5 changed files with 30 additions and 47 deletions

View file

@ -1512,6 +1512,17 @@ struct PowerPCCPUClass {
int (*check_attn)(CPUPPCState *env);
};
static inline bool ppc_cpu_core_single_threaded(CPUState *cs)
{
return cs->nr_threads == 1;
}
static inline bool ppc_cpu_lpar_single_threaded(CPUState *cs)
{
return !(POWERPC_CPU(cs)->env.flags & POWERPC_FLAG_SMT_1LPAR) ||
ppc_cpu_core_single_threaded(cs);
}
ObjectClass *ppc_cpu_class_by_name(const char *name);
PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr);