From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH v3 7/9] spapr: Limit threads per core according to current compatibility mode
Date: Fri, 23 May 2014 12:26:56 +1000 [thread overview]
Message-ID: <1400812018-23430-8-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1400812018-23430-1-git-send-email-aik@ozlabs.ru>
This puts a limit to the number of threads per core based on the current
compatibility mode. Although PowerISA specs do not specify the maximum
threads per core number, the linux guest still expects that
PowerISA2.05-compatible CPU supports only 2 threads per core as this
is what POWER6 (2.05 compliant CPU) implements, the same is for
POWER7 (2.06, 4 threads) and POWER8 (2.07, 8 threads).
This calls spapr_fixup_cpu_smt_dt() with the maximum allowed number of
threads which affects ibm,ppc-interrupt-server#s and
ibm,ppc-interrupt-gserver#s properties.
The number of CPU nodesremains unchanged.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
hw/ppc/spapr.c | 2 +-
target-ppc/cpu.h | 1 +
target-ppc/translate_init.c | 27 +++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7082237..14c72d9 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -293,7 +293,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr)
}
ret = spapr_fixup_cpu_smt_dt(fdt, offset, cpu,
- smp_threads);
+ ppc_get_compat_smt_threads(cpu));
if (ret < 0) {
return ret;
}
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index d3b8236..7b465b8 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1122,6 +1122,7 @@ void ppc_store_sdr1 (CPUPPCState *env, target_ulong value);
void ppc_store_msr (CPUPPCState *env, target_ulong value);
void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf);
+int ppc_get_compat_smt_threads(PowerPCCPU *cpu);
int ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version);
/* Time-base and decrementer management */
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index faac74a..56d3b97 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8921,6 +8921,33 @@ 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);
+
+ switch (cpu->cpu_version) {
+ case CPU_POWERPC_LOGICAL_2_05:
+ ret = 2;
+ break;
+ case CPU_POWERPC_LOGICAL_2_06:
+ 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;
+ }
+ break;
+ }
+
+ return MIN(ret, smp_threads);
+}
+
int ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version)
{
int ret = 0;
--
1.9.rc0
next prev parent reply other threads:[~2014-05-23 2:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 2:26 [Qemu-devel] [PATCH v3 0/9] spapr: Enable ibm, client-architecture-support Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 1/9] target-ppc: Add "compat" CPU option Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 2/9] spapr: Move SMT-related properties out of skeleton fdt Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 3/9] target-ppc: Implement "compat" CPU option Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 4/9] target-ppc: Define Processor Compatibility Masks Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 5/9] spapr: Add ibm, client-architecture-support call Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 6/9] spapr: Rework spapr_fixup_cpu_dt() Alexey Kardashevskiy
2014-05-23 2:26 ` Alexey Kardashevskiy [this message]
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 8/9] spapr: Implement processor compatibility in ibm, client-architecture-support Alexey Kardashevskiy
2014-05-23 2:26 ` [Qemu-devel] [PATCH v3 9/9] KVM: PPC: Enable compatibility mode Alexey Kardashevskiy
2014-05-23 12:34 ` Alexander Graf
2014-05-23 11:19 ` [Qemu-devel] [PATCH v3 0/9] spapr: Enable ibm, client-architecture-support Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400812018-23430-8-git-send-email-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).