From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bY1Bl-0004ya-02 for qemu-devel@nongnu.org; Thu, 11 Aug 2016 21:23:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bY1Bf-0006ZS-TP for qemu-devel@nongnu.org; Thu, 11 Aug 2016 21:23:07 -0400 Date: Thu, 11 Aug 2016 17:14:29 +1000 From: David Gibson Message-ID: <20160811071429.GF16493@voom.fritz.box> References: <1470856081-28168-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="O98KdSgI27dgYlM5" Content-Disposition: inline In-Reply-To: <1470856081-28168-1-git-send-email-clg@kaod.org> Subject: Re: [Qemu-devel] [PATCH for 2.7] ppc: parse cpu features once List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: qemu-ppc@nongnu.org, Bharata B Rao , qemu-devel@nongnu.org, Eduardo Habkost , Greg Kurz --O98KdSgI27dgYlM5 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 10, 2016 at 09:08:01PM +0200, C=E9dric Le Goater wrote: > From: Greg Kurz >=20 > Considering that features are converted to global properties and > global properties are automatically applied to every new instance > of created CPU (at object_new() time), there is no point in > parsing cpu_model string every time a CPU created. So move > parsing outside CPU creation loop and do it only once. >=20 > Parsing also should be done before any CPU is created so that > features would affect the first CPU a well. >=20 > This patch does that for all PowerPC machine types. >=20 > It is based on previous work from Bharata: >=20 > https://lists.nongnu.org/archive/html/qemu-devel/2016-06/msg07564.html >=20 > Signed-off-by: Greg Kurz > [clg: only kept the fix for the spapr platform. support for other > platform will be added in 2.8 ] > Signed-off-by: C=E9dric Le Goater >=20 > --- >=20 > This is a standalone version of patch 2 from my latest series: >=20 > https://lists.nongnu.org/archive/html/qemu-devel/2016-07/msg02433.html >=20 > The only changes are trivial conflict fixes caused by the introduction > of ppc_cpu_init by patch 1. >=20 > --- > hw/ppc/ppc.c | 26 ++++++++++++++++++++++++++ > hw/ppc/spapr.c | 2 ++ > include/hw/ppc/ppc.h | 1 + > 3 files changed, 29 insertions(+) Applied to ppc-for-2.7. >=20 > Index: qemu-dgibson-for-2.8.git/hw/ppc/ppc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- qemu-dgibson-for-2.8.git.orig/hw/ppc/ppc.c > +++ qemu-dgibson-for-2.8.git/hw/ppc/ppc.c > @@ -33,6 +33,7 @@ > #include "hw/timer/m48t59.h" > #include "qemu/log.h" > #include "qemu/error-report.h" > +#include "qapi/error.h" > #include "hw/loader.h" > #include "sysemu/kvm.h" > #include "kvm_ppc.h" > @@ -1350,3 +1351,28 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cp > =20 > return NULL; > } > + > +void ppc_cpu_parse_features(const char *cpu_model) > +{ > + CPUClass *cc; > + ObjectClass *oc; > + const char *typename; > + gchar **model_pieces; > + > + model_pieces =3D g_strsplit(cpu_model, ",", 2); > + if (!model_pieces[0]) { > + error_report("Invalid/empty CPU model name"); > + exit(1); > + } > + > + oc =3D cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]); > + if (oc =3D=3D NULL) { > + error_report("Unable to find CPU definition: %s", model_pieces[0= ]); > + exit(1); > + } > + > + typename =3D object_class_get_name(oc); > + cc =3D CPU_CLASS(oc); > + cc->parse_features(typename, model_pieces[1], &error_fatal); > + g_strfreev(model_pieces); > +} > Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr.c > +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr.c > @@ -1769,6 +1769,8 @@ static void ppc_spapr_init(MachineState > machine->cpu_model =3D kvm_enabled() ? "host" : "POWER7"; > } > =20 > + ppc_cpu_parse_features(machine->cpu_model); > + > if (mc->query_hotpluggable_cpus) { > char *type =3D spapr_get_cpu_core_type(machine->cpu_model); > =20 > Index: qemu-dgibson-for-2.8.git/include/hw/ppc/ppc.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- qemu-dgibson-for-2.8.git.orig/include/hw/ppc/ppc.h > +++ qemu-dgibson-for-2.8.git/include/hw/ppc/ppc.h > @@ -106,4 +106,5 @@ enum { > /* ppc_booke.c */ > void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flag= s); > =20 > +void ppc_cpu_parse_features(const char *cpu_model); > #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 --O98KdSgI27dgYlM5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXrCXVAAoJEGw4ysog2bOSjCUQAJMVVcnvqkneSWMDCC4kWo9m UFZKpXb9wFZU8INpgcN84cFcqUqQ51wf2G9qMYRQ0IAtVzFrdF4oZ8I77m8VaaOH zmVsuGBdWMwcTWuL907YGwHzJQxCYoKLBKzmjrt80lT4+VkDrsnVaYx0G+v0cH6l pf3k7HYFN3LWNI9uv+RyJB7DeEI5KunI4x9HU8cHiV/tSDeO4t5fAn7XwYVtZUKg dVMt8tfZg6CaVFEb+MvY5XytdZIIBJ/TV16CYwSFC5PccR8U9o3924PYiM5byrzo MU2uT3Ba89zPu+PvtkNcUvTP5BwiOA7poi3A9VYDPNQJ89wFgFzOPHy8/yHIhE/r XwTcwugltKfT+1kycMK+1/ERMbOTd/5bapqRfbG0TZ9VkeEv86c0dvZR/5NxCXcB twRX7VxNxvVRnrNRx0k+7D9yC5ma2aFY1u0c4yY9Sd41N54l0bQua7EcE2oXYl3u nV+HhRQ32z71C1m9p3fOYaqK4KuerkklDZs4h+8vnv7zzjC8nYuVs500/0qgoxHa 4Gy0ZtHRBFfWq4uZQZVxBE9UUk676jD73QG8cjMt8/++nT0xPdb9GFBOZuGX9iRK nNyRfFBQs3kupVKfmBaIW1TSC9DXhC94MiLkGbWzhLmoeNkrZlzuok4RxPidYKfQ FVLeCYpGnwZNAKz/buJD =9TgT -----END PGP SIGNATURE----- --O98KdSgI27dgYlM5--