diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2018-01-15 16:40:23 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-01-17 09:35:24 +1100 |
commit | abbc124753896f72e3715813ea20dd1924202ff0 (patch) | |
tree | 19068e4bd8f9f2ab9ab16368659681eec4cfc196 /target/ppc/compat.c | |
parent | 03ee51d3548f5f553a3089f466483c1c6d5c666b (diff) | |
download | qemu-abbc124753896f72e3715813ea20dd1924202ff0.zip qemu-abbc124753896f72e3715813ea20dd1924202ff0.tar.gz qemu-abbc124753896f72e3715813ea20dd1924202ff0.tar.bz2 |
target/ppc: Clarify compat mode max_threads value
We recently had some discussions that were sidetracked for a while, because
nearly everyone misapprehended the purpose of the 'max_threads' field in
the compatiblity modes table. It's all about guest expectations, not host
expectations or support (that's handled elsewhere).
In an attempt to avoid a repeat of that confusion, rename the field to
'max_vthreads' and add an explanatory comment.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Diffstat (limited to 'target/ppc/compat.c')
-rw-r--r-- | target/ppc/compat.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/target/ppc/compat.c b/target/ppc/compat.c index 276b5b5..807c906 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -32,7 +32,16 @@ typedef struct { uint32_t pvr; uint64_t pcr; uint64_t pcr_level; - int max_threads; + + /* + * Maximum allowed virtual threads per virtual core + * + * This is to stop older guests getting confused by seeing more + * threads than they think the cpu can support. Usually it's + * equal to the number of threads supported on bare metal + * hardware, but not always (see POWER9). + */ + int max_vthreads; } CompatInfo; static const CompatInfo compat_table[] = { @@ -45,28 +54,28 @@ static const CompatInfo compat_table[] = { .pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05 | PCR_TM_DIS | PCR_VSX_DIS, .pcr_level = PCR_COMPAT_2_05, - .max_threads = 2, + .max_vthreads = 2, }, { /* POWER7, ISA2.06 */ .name = "power7", .pvr = CPU_POWERPC_LOGICAL_2_06, .pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, .pcr_level = PCR_COMPAT_2_06, - .max_threads = 4, + .max_vthreads = 4, }, { .name = "power7+", .pvr = CPU_POWERPC_LOGICAL_2_06_PLUS, .pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, .pcr_level = PCR_COMPAT_2_06, - .max_threads = 4, + .max_vthreads = 4, }, { /* POWER8, ISA2.07 */ .name = "power8", .pvr = CPU_POWERPC_LOGICAL_2_07, .pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07, .pcr_level = PCR_COMPAT_2_07, - .max_threads = 8, + .max_vthreads = 8, }, { /* POWER9, ISA3.00 */ .name = "power9", @@ -80,7 +89,7 @@ static const CompatInfo compat_table[] = { * confusing if half of the threads disappear from the guest * if it announces it's POWER9 aware at CAS time. */ - .max_threads = 8, + .max_vthreads = 8, }, }; @@ -192,14 +201,14 @@ void ppc_set_compat_all(uint32_t compat_pvr, Error **errp) } } -int ppc_compat_max_threads(PowerPCCPU *cpu) +int ppc_compat_max_vthreads(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); + n_threads = MIN(n_threads, compat->max_vthreads); } return n_threads; |