From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKyMi-0006Tp-8L for qemu-devel@nongnu.org; Wed, 06 Jul 2016 21:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKyMf-0006gC-3z for qemu-devel@nongnu.org; Wed, 06 Jul 2016 21:44:32 -0400 Date: Thu, 7 Jul 2016 11:00:40 +1000 From: David Gibson Message-ID: <20160707010040.GF14675@voom.fritz.box> References: <1467795561-1007-1-git-send-email-bharata@linux.vnet.ibm.com> <1467795561-1007-4-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yRA+Bmk8aPhU85Qt" Content-Disposition: inline In-Reply-To: <1467795561-1007-4-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 3/5] spapr: Implement CPUClass::get_migration_id() for PowerPC CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, imammedo@redhat.com, groug@kaod.org, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com --yRA+Bmk8aPhU85Qt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 06, 2016 at 02:29:19PM +0530, Bharata B Rao wrote: > cpu_index is used as migration_id by default. For machine type versions > that set use-migration-id property, cpu_dt_it is returned. >=20 > Signed-off-by: Bharata B Rao This seems ceonceptually wrong. The logic to determine the stable ID is still coming from the CPU code. But kind of the point here is that in most cases the stable IDs really belong to the machine type, not the CPU. Would it make more sense to just have migration-id be a settable property, which the machine type needs to set between init and realize? (or leave as default =3D=3D cpu_index). That way we could have machine version dependent differences without this awkward use_migration_id flag (after all, if it's not always used as the id for migration, 'migration_id' is kind of a bad name...). > --- > target-ppc/translate_init.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index efd6b88..9ca2f5e 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -10359,6 +10359,17 @@ static gchar *ppc_gdb_arch_name(CPUState *cs) > #endif > } > =20 > +static int ppc_cpu_get_migration_id(CPUState *cs) > +{ > + PowerPCCPU *cpu =3D POWERPC_CPU(cs); > + > + if (cs->use_migration_id) { > + return (int) cpu->cpu_dt_id; > + } else { > + return cs->cpu_index; > + } > +} > + > static void ppc_cpu_class_init(ObjectClass *oc, void *data) > { > PowerPCCPUClass *pcc =3D POWERPC_CPU_CLASS(oc); > @@ -10412,6 +10423,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, v= oid *data) > #ifndef CONFIG_USER_ONLY > cc->virtio_is_big_endian =3D ppc_cpu_is_big_endian; > #endif > + cc->get_migration_id =3D ppc_cpu_get_migration_id; > =20 > dc->fw_name =3D "PowerPC,UNKNOWN"; > } --=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 --yRA+Bmk8aPhU85Qt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXfam4AAoJEGw4ysog2bOSxB4P/2+nnkInWST1oWHZltb7lRyU ccwlA1Mx3TuROXx/wxHwx5yLwxhFMYDajetJlsPh24E9ONQpKizcyF7hPexHrm7N Fh5+Lu+4ujh1EgkTS7zInlc5C7Kh29yy6sSEekYivxmjBlYSvddQbkTSvUDxEAB9 aDjKselvH/lsUIls+UNy9+mfUUncyUY02E9M1wa7wjsSbseZSpfGNh/EOduNoJHY ZCsm09MvPBxL3Gil4dmUQbhewY4HzA0FIkAsjH5VaJol6d8WpP9cqZyKOzcYrvQi noXbPDlJ2pkBds9qsDBUqpRelFoZdmDbD18picPzZvpGR476yeRQ8Q6fES7OEiPv yQfOOJYn0px+G7ruy4PpHMFBTga4h+WW98nfLU2FXRKvvRfIg/kb53V4xFCmkD82 n4Ef4SAV4GY2EtwW2RYxJrK2+e8o4nRTfVWjZzHof/cuI0T/tAFNOJAdNIomBTI4 btfHY+Wpz0ZO6fPimTCr2wtnmXhmEzcf4NjbRJP5DhFz0gPAFWijAuVMrsThzPrh r7pUfGw3TssDM8qv3exevOrtM78xuOVOySOhlmVD6RzrN3KRe5K3pGHqr2cdLgAn F46vJpyJ+a2a9+2YBw7gzUsARGJGHUJt+UiHlDGqIKV0Zfqe2sIVUitWYGOD/L0/ a2laFUZbd1AGqIVsyc2m =ODo6 -----END PGP SIGNATURE----- --yRA+Bmk8aPhU85Qt--