From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKyMh-0006Tl-4D for qemu-devel@nongnu.org; Wed, 06 Jul 2016 21:44:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKyMg-0006gc-0W for qemu-devel@nongnu.org; Wed, 06 Jul 2016 21:44:31 -0400 Date: Thu, 7 Jul 2016 11:12:42 +1000 From: David Gibson Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0XhtP95kHFp3KGBe" Content-Disposition: inline In-Reply-To: <146780720136.26232.7902445403479806617.stgit@bahia.lab.toulouse-stg.fr.ibm.com> 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: Greg Kurz 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 --0XhtP95kHFp3KGBe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 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. > --- > 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, Er= ror **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 wit= h %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 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 --0XhtP95kHFp3KGBe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXfayKAAoJEGw4ysog2bOS/NMP/0VPvVy5p5I/ncwHJNCUFgWC Q1o9GTgTA/Uk9x9tY7mMTNAHqxwJsNk8EeyNozS+OIE6E9UoPaoU0zI6UKesHL0p ieXuQp0P/7deaAWucRzf5JDilEwTegIP3/JoNkijFWcyKgVKHXkvRiWHmBFEXiPC uFKOBI+HugSK3fzEkh8lmJw9Btkg+kELFJwotwpsOB4FfwNR5+KiVI8AK1ZQSFf4 liWtjPsrJs5ieRntQMBOLAA2rCEgnDCAmwn0NerOc4XhuoKPOlHgwh6RZkFYr4ia QTuAWfpymPIAuTkLhUUP3oULKRGoUhkOC9wx5TcETI/J4UKDn7urNtkHpZPaLjeu Gwu6rTX2xfBTQxBq3soWTZrFsYRPk4dktITz0YIq9p2AoyZ+WMhcJVF/nP3QdXlB iJAGwE3q1T66XKW7vQQcRJck7Eo/so6RfbSVADdd6tptNlDwyD2upL5vThzOdSwZ 9og3pAAcR45rv/UKCzHbYZfAAnU5tObmHhh0oWjpgdSJ9842K20YCfvLhXlZXePX iK3myreLM/f9QZuDNg5Eb1/XV2mzrqFOa7O/4g3rJidmiIM7NMUIYDg0QJlnGFcx /tvnrOYTST7O9C94IOmFnQXEcxsgv3R5apKH3SEm8jTypFSveGFDAzyEDUt0atLO +qk4ovxFKZY4emTnVOR5 =gG3T -----END PGP SIGNATURE----- --0XhtP95kHFp3KGBe--