From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyCYi-0007mc-EF for qemu-devel@nongnu.org; Mon, 16 Nov 2015 00:42:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyCYg-0007s1-Gu for qemu-devel@nongnu.org; Mon, 16 Nov 2015 00:42:32 -0500 Date: Mon, 16 Nov 2015 16:16:21 +1100 From: David Gibson Message-ID: <20151116051621.GF2747@voom.fritz.box> References: <1447201710-10229-1-git-send-email-benh@kernel.crashing.org> <1447201710-10229-9-git-send-email-benh@kernel.crashing.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6v9BRtpmy+umdQlo" Content-Disposition: inline In-Reply-To: <1447201710-10229-9-git-send-email-benh@kernel.crashing.org> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/77] ppc: Add number of threads per core to the processor definition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --6v9BRtpmy+umdQlo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 11, 2015 at 11:27:21AM +1100, Benjamin Herrenschmidt wrote: > Also use it to clamp the max SMT mode and ensure that the cpu_dt_id > are offset by that value in order to preserve consistency with the > HW implementations. >=20 > Signed-off-by: Benjamin Herrenschmidt Reviewed-by: David Gibson > --- > target-ppc/cpu-qom.h | 1 + > target-ppc/translate_init.c | 8 +++++++- > 2 files changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h > index 6967a80..fef23fd 100644 > --- a/target-ppc/cpu-qom.h > +++ b/target-ppc/cpu-qom.h > @@ -68,6 +68,7 @@ typedef struct PowerPCCPUClass { > uint32_t flags; > int bfd_mach; > uint32_t l1_dcache_size, l1_icache_size; > + uint32_t threads_per_core; > #if defined(TARGET_PPC64) > const struct ppc_segment_page_sizes *sps; > #endif > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index c743eb1..1d402e1 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -8193,6 +8193,7 @@ POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data) > POWERPC_FLAG_BUS_CLK; > pcc->l1_dcache_size =3D 0x8000; > pcc->l1_icache_size =3D 0x10000; > + pcc->threads_per_core =3D 2; > } > =20 > static void powerpc_get_compat(Object *obj, Visitor *v, > @@ -8339,6 +8340,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) > pcc->l1_dcache_size =3D 0x8000; > pcc->l1_icache_size =3D 0x8000; > pcc->interrupts_big_endian =3D ppc_cpu_interrupts_big_endian_lpcr; > + pcc->threads_per_core =3D 4; > } > =20 > static void init_proc_POWER8(CPUPPCState *env) > @@ -8419,6 +8421,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) > pcc->l1_dcache_size =3D 0x8000; > pcc->l1_icache_size =3D 0x8000; > pcc->interrupts_big_endian =3D ppc_cpu_interrupts_big_endian_lpcr; > + pcc->threads_per_core =3D 8; > } > #endif /* defined (TARGET_PPC64) */ > =20 > @@ -9074,6 +9077,9 @@ static void ppc_cpu_realizefn(DeviceState *dev, Err= or **errp) > #endif > =20 > #if !defined(CONFIG_USER_ONLY) > + if (max_smt > pcc->threads_per_core) { > + max_smt =3D pcc->threads_per_core; > + } > if (smp_threads > max_smt) { > error_setg(errp, "Cannot support more than %d threads on PPC wit= h %s", > max_smt, kvm_enabled() ? "KVM" : "TCG"); > @@ -9094,7 +9100,7 @@ static void ppc_cpu_realizefn(DeviceState *dev, Err= or **errp) > } > =20 > #if !defined(CONFIG_USER_ONLY) > - cpu->cpu_dt_id =3D (cs->cpu_index / smp_threads) * max_smt > + cpu->cpu_dt_id =3D (cs->cpu_index / smp_threads) * pcc->threads_per_= core > + (cs->cpu_index % smp_threads); > #endif > =20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --6v9BRtpmy+umdQlo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWSWakAAoJEGw4ysog2bOSB4AQAK21IXJXIt3k5XUcf2PICjaS /RdHH3ftxYNtl0sBmCU3ue0tiAl7h/enwgYhDS13kJsZgMgQHWOk1Pv4dBPVZKiK DGxPKUb8Fzuw9K5EOem7IrdmO4Ei7abyFbw8Tx2KgBlx4SvCCucPCoHnsDl68Pbj dEqx4WNC/v+HhzGMA5deTO5haOscoPUD7X9dngiX1zuoIF6tJkRniSMyuRu0GZHu 4zGLaeHJGhCLcp9Qwt/w0QzsFr9iporBE+DUQYxRHtIoANrnlB++OS8kjCdPg0K1 MzjDpin2jZL1V+sGT1bPeO7DCC3LqB54tvlSpDdbycVWF7poa4ApZ4GjI8tPNIVm wu5CVyhP8UtTxiHimfAslO8nqTrk/lblQf6GBPMiPhezc2KHO2ZufUt1D4U0ABCX 7S64mK82sKakPpbAb+zOzIWSHJ26uys1tevRSImZT/EvMF0/c8/RxnZOBZQmbGnC VGxnbbG73EMT4rLteeB5n01bCnGVJkQLhKfin9SMhAQyGR23OUmzfSIvKGHRIl2/ fFx9NWHgKC0Tiol8148H1uVgw/xcury10P/mFr33cCBLS9qaEoQ7lZxM/1VcYx1d bFG4ipIg8uoRg5WEBFirG0WhSDGW9AuDj9+kXn+HIRP4IClEdamo+Av+xyz2vhQR 3SU+dx3u7dEEO+p2p0ve =8FA6 -----END PGP SIGNATURE----- --6v9BRtpmy+umdQlo--