|
|
9bac43 |
From b25ff3cd5a8b561f58b0245115d61cde0572cbdc Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
Date: Fri, 19 Jan 2018 04:04:56 +0100
|
|
|
9bac43 |
Subject: [PATCH 16/21] target/ppc: Clarify compat mode max_threads value
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
Message-id: <20180119040458.5629-3-dgibson@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78676
|
|
|
9bac43 |
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH 2/4] target/ppc: Clarify compat mode max_threads value
|
|
|
9bac43 |
Bugzilla: 1529243
|
|
|
9bac43 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: David Gibson <david@gibson.dropbear.id.au>
|
|
|
9bac43 |
|
|
|
9bac43 |
We recently had some discussions that were sidetracked for a while, because
|
|
|
9bac43 |
nearly everyone misapprehended the purpose of the 'max_threads' field in
|
|
|
9bac43 |
the compatiblity modes table. It's all about guest expectations, not host
|
|
|
9bac43 |
expectations or support (that's handled elsewhere).
|
|
|
9bac43 |
|
|
|
9bac43 |
In an attempt to avoid a repeat of that confusion, rename the field to
|
|
|
9bac43 |
'max_vthreads' and add an explanatory comment.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
9bac43 |
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
9bac43 |
Reviewed-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
|
|
|
9bac43 |
(cherry picked from commit abbc124753896f72e3715813ea20dd1924202ff0)
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Conflicts:
|
|
|
9bac43 |
hw/ppc/spapr.c
|
|
|
9bac43 |
|
|
|
9bac43 |
Contextual conflict.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
hw/ppc/spapr.c | 4 ++--
|
|
|
9bac43 |
target/ppc/compat.c | 25 +++++++++++++++++--------
|
|
|
9bac43 |
target/ppc/cpu.h | 2 +-
|
|
|
9bac43 |
3 files changed, 20 insertions(+), 11 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
|
|
9bac43 |
index 66227c3..5233366 100644
|
|
|
9bac43 |
--- a/hw/ppc/spapr.c
|
|
|
9bac43 |
+++ b/hw/ppc/spapr.c
|
|
|
9bac43 |
@@ -345,7 +345,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)
|
|
|
9bac43 |
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
|
|
9bac43 |
DeviceClass *dc = DEVICE_GET_CLASS(cs);
|
|
|
9bac43 |
int index = ppc_get_vcpu_dt_id(cpu);
|
|
|
9bac43 |
- int compat_smt = MIN(smp_threads, ppc_compat_max_threads(cpu));
|
|
|
9bac43 |
+ int compat_smt = MIN(smp_threads, ppc_compat_max_vthreads(cpu));
|
|
|
9bac43 |
|
|
|
9bac43 |
if ((index % smt) != 0) {
|
|
|
9bac43 |
continue;
|
|
|
9bac43 |
@@ -506,7 +506,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,
|
|
|
9bac43 |
size_t page_sizes_prop_size;
|
|
|
9bac43 |
uint32_t vcpus_per_socket = smp_threads * smp_cores;
|
|
|
9bac43 |
uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)};
|
|
|
9bac43 |
- int compat_smt = MIN(smp_threads, ppc_compat_max_threads(cpu));
|
|
|
9bac43 |
+ int compat_smt = MIN(smp_threads, ppc_compat_max_vthreads(cpu));
|
|
|
9bac43 |
sPAPRDRConnector *drc;
|
|
|
9bac43 |
int drc_index;
|
|
|
9bac43 |
uint32_t radix_AP_encodings[PPC_PAGE_SIZES_MAX_SZ];
|
|
|
9bac43 |
diff --git a/target/ppc/compat.c b/target/ppc/compat.c
|
|
|
9bac43 |
index 94ff14a..33658fb 100644
|
|
|
9bac43 |
--- a/target/ppc/compat.c
|
|
|
9bac43 |
+++ b/target/ppc/compat.c
|
|
|
9bac43 |
@@ -32,7 +32,16 @@ typedef struct {
|
|
|
9bac43 |
uint32_t pvr;
|
|
|
9bac43 |
uint64_t pcr;
|
|
|
9bac43 |
uint64_t pcr_level;
|
|
|
9bac43 |
- int max_threads;
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ /*
|
|
|
9bac43 |
+ * Maximum allowed virtual threads per virtual core
|
|
|
9bac43 |
+ *
|
|
|
9bac43 |
+ * This is to stop older guests getting confused by seeing more
|
|
|
9bac43 |
+ * threads than they think the cpu can support. Usually it's
|
|
|
9bac43 |
+ * equal to the number of threads supported on bare metal
|
|
|
9bac43 |
+ * hardware, but not always (see POWER9).
|
|
|
9bac43 |
+ */
|
|
|
9bac43 |
+ int max_vthreads;
|
|
|
9bac43 |
} CompatInfo;
|
|
|
9bac43 |
|
|
|
9bac43 |
static const CompatInfo compat_table[] = {
|
|
|
9bac43 |
@@ -45,28 +54,28 @@ static const CompatInfo compat_table[] = {
|
|
|
9bac43 |
.pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 |
|
|
|
9bac43 |
PCR_COMPAT_2_05 | PCR_TM_DIS | PCR_VSX_DIS,
|
|
|
9bac43 |
.pcr_level = PCR_COMPAT_2_05,
|
|
|
9bac43 |
- .max_threads = 2,
|
|
|
9bac43 |
+ .max_vthreads = 2,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
{ /* POWER7, ISA2.06 */
|
|
|
9bac43 |
.name = "power7",
|
|
|
9bac43 |
.pvr = CPU_POWERPC_LOGICAL_2_06,
|
|
|
9bac43 |
.pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS,
|
|
|
9bac43 |
.pcr_level = PCR_COMPAT_2_06,
|
|
|
9bac43 |
- .max_threads = 4,
|
|
|
9bac43 |
+ .max_vthreads = 4,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
{
|
|
|
9bac43 |
.name = "power7+",
|
|
|
9bac43 |
.pvr = CPU_POWERPC_LOGICAL_2_06_PLUS,
|
|
|
9bac43 |
.pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS,
|
|
|
9bac43 |
.pcr_level = PCR_COMPAT_2_06,
|
|
|
9bac43 |
- .max_threads = 4,
|
|
|
9bac43 |
+ .max_vthreads = 4,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
{ /* POWER8, ISA2.07 */
|
|
|
9bac43 |
.name = "power8",
|
|
|
9bac43 |
.pvr = CPU_POWERPC_LOGICAL_2_07,
|
|
|
9bac43 |
.pcr = PCR_COMPAT_3_00 | PCR_COMPAT_2_07,
|
|
|
9bac43 |
.pcr_level = PCR_COMPAT_2_07,
|
|
|
9bac43 |
- .max_threads = 8,
|
|
|
9bac43 |
+ .max_vthreads = 8,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
{ /* POWER9, ISA3.00 */
|
|
|
9bac43 |
.name = "power9",
|
|
|
9bac43 |
@@ -80,7 +89,7 @@ static const CompatInfo compat_table[] = {
|
|
|
9bac43 |
* confusing if half of the threads disappear from the guest
|
|
|
9bac43 |
* if it announces it's POWER9 aware at CAS time.
|
|
|
9bac43 |
*/
|
|
|
9bac43 |
- .max_threads = 8,
|
|
|
9bac43 |
+ .max_vthreads = 8,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
};
|
|
|
9bac43 |
|
|
|
9bac43 |
@@ -203,14 +212,14 @@ void ppc_set_compat_all(uint32_t compat_pvr, Error **errp)
|
|
|
9bac43 |
}
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
-int ppc_compat_max_threads(PowerPCCPU *cpu)
|
|
|
9bac43 |
+int ppc_compat_max_vthreads(PowerPCCPU *cpu)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
const CompatInfo *compat = compat_by_pvr(cpu->compat_pvr);
|
|
|
9bac43 |
int n_threads = CPU(cpu)->nr_threads;
|
|
|
9bac43 |
|
|
|
9bac43 |
if (cpu->compat_pvr) {
|
|
|
9bac43 |
g_assert(compat);
|
|
|
9bac43 |
- n_threads = MIN(n_threads, compat->max_threads);
|
|
|
9bac43 |
+ n_threads = MIN(n_threads, compat->max_vthreads);
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
return n_threads;
|
|
|
9bac43 |
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
|
|
|
9bac43 |
index 6c770a2..9b107e4 100644
|
|
|
9bac43 |
--- a/target/ppc/cpu.h
|
|
|
9bac43 |
+++ b/target/ppc/cpu.h
|
|
|
9bac43 |
@@ -1374,7 +1374,7 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp);
|
|
|
9bac43 |
#if !defined(CONFIG_USER_ONLY)
|
|
|
9bac43 |
void ppc_set_compat_all(uint32_t compat_pvr, Error **errp);
|
|
|
9bac43 |
#endif
|
|
|
9bac43 |
-int ppc_compat_max_threads(PowerPCCPU *cpu);
|
|
|
9bac43 |
+int ppc_compat_max_vthreads(PowerPCCPU *cpu);
|
|
|
9bac43 |
void ppc_compat_add_property(Object *obj, const char *name,
|
|
|
9bac43 |
uint32_t *compat_pvr, const char *basedesc,
|
|
|
9bac43 |
Error **errp);
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|