From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL380-0003wC-1F for qemu-devel@nongnu.org; Thu, 07 Jul 2016 02:49:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bL37v-00052C-Uz for qemu-devel@nongnu.org; Thu, 07 Jul 2016 02:49:39 -0400 Received: from 10.mo1.mail-out.ovh.net ([178.32.96.102]:35065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL37v-00051e-Ka for qemu-devel@nongnu.org; Thu, 07 Jul 2016 02:49:35 -0400 Received: from player770.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 3E021FF882C for ; Thu, 7 Jul 2016 08:49:31 +0200 (CEST) Date: Thu, 7 Jul 2016 08:49:15 +0200 From: Greg Kurz Message-ID: <20160707084915.2117d556@bahia.lan> In-Reply-To: <20160707011242.GH14675@voom.fritz.box> References: <146780713904.26232.12351310667258006783.stgit@bahia.lab.toulouse-stg.fr.ibm.com> <146780720136.26232.7902445403479806617.stgit@bahia.lab.toulouse-stg.fr.ibm.com> <20160707011242.GH14675@voom.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/ytfUQBT/.50i4aNCtYMTd9o"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH v3 2/7] ppc: move smp_threads sanity checks to spapr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: Eduardo Habkost , Benjamin Herrenschmidt , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Cedric Le Goater , Bharata B Rao , Scott Wood , Igor Mammedov --Sig_/ytfUQBT/.50i4aNCtYMTd9o Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 7 Jul 2016 11:12:42 +1000 David Gibson wrote: > On Wed, Jul 06, 2016 at 02:13:30PM +0200, Greg Kurz wrote: > > Only POWER5 and newer PowerPC cpus from IBM have SMT capabilities. > > Since they are only supported by pseries, let's move the checks to > > ppc_spapr_init(). > >=20 > > Signed-off-by: Greg Kurz =20 >=20 > I'm not comfortable with this. SMT may only be used for pseries at > the moment, but the SMT possibilities are absolutely a constraint of > the CPU itself, not the machine type. It seems more logical to me to > check this in the CPU code. >=20 Yes, you're right. Ans since this isn't a prerequisite to compute cpu_dt_id, it can stay in ppc_cpu_realizefn(). I'll drop this patch in v4. > > --- > > hw/ppc/spapr.c | 12 ++++++++++++ > > target-ppc/translate_init.c | 14 -------------- > > 2 files changed, 12 insertions(+), 14 deletions(-) > >=20 > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index d134eb2f338e..09600fee19b2 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -1739,6 +1739,18 @@ static void ppc_spapr_init(MachineState *machine) > > } > > } > > =20 > > + if (smp_threads > smt) { > > + error_report("Cannot support more than %d threads on PPC with = %s", > > + smt, kvm_enabled() ? "KVM" : "TCG"); > > + exit(1); > > + } > > + if (!is_power_of_2(smp_threads)) { > > + error_report("Cannot support %d threads on PPC with %s, " > > + "threads count must be a power of 2.", > > + smp_threads, kvm_enabled() ? "KVM" : "TCG"); > > + exit(1); > > + } > > + > > msi_nonbroken =3D true; > > =20 > > QLIST_INIT(&spapr->phbs); > > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > > index 31120a5aaf33..775df72cf6c2 100644 > > --- a/target-ppc/translate_init.c > > +++ b/target-ppc/translate_init.c > > @@ -9531,20 +9531,6 @@ static void ppc_cpu_realizefn(DeviceState *dev, = Error **errp) > > int max_smt =3D kvmppc_smt_threads(); > > #endif > > =20 > > -#if !defined(CONFIG_USER_ONLY) > > - if (smp_threads > max_smt) { > > - error_setg(errp, "Cannot support more than %d threads on PPC w= ith %s", > > - max_smt, kvm_enabled() ? "KVM" : "TCG"); > > - return; > > - } > > - if (!is_power_of_2(smp_threads)) { > > - error_setg(errp, "Cannot support %d threads on PPC with %s, " > > - "threads count must be a power of 2.", > > - smp_threads, kvm_enabled() ? "KVM" : "TCG"); > > - return; > > - } > > -#endif > > - > > cpu_exec_init(cs, &local_err); > > if (local_err !=3D NULL) { > > error_propagate(errp, local_err); > > =20 >=20 --Sig_/ytfUQBT/.50i4aNCtYMTd9o Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAld9+2sACgkQAvw66wEB28ITLQCgkKfGrPp+5ptN+lQpkDy7iy1j uikAoIU/3jfqyL1usYh7/JlyRDBVa6Ql =qvtN -----END PGP SIGNATURE----- --Sig_/ytfUQBT/.50i4aNCtYMTd9o--