Received: from eggs.gnu.org ([2001:4830:134:3::10]:43527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKnvW-0001OU-3E for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:35:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKnvP-0005T3-TQ for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:35:44 -0400 Received: from 3.mo7.mail-out.ovh.net ([46.105.34.113]:38466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKnvP-0005SK-GT for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:35:39 -0400 Received: from player739.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id 88F0B100029A for ; Wed, 6 Jul 2016 16:35:36 +0200 (CEST) Date: Wed, 6 Jul 2016 16:35:28 +0200 From: Greg Kurz Message-ID: <20160706163528.25382183@bahia.lan> In-Reply-To: <1467795561-1007-4-git-send-email-bharata@linux.vnet.ibm.com> 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: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, david@gibson.dropbear.id.au, imammedo@redhat.com, nikunj@linux.vnet.ibm.com, pbonzini@redhat.com On Wed, 6 Jul 2016 14:29:19 +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. > It looks wrong to hijack cpu_dt_id to fix migration. For pseries-2.7, you need to pass the sum of the index of the core in spapr->cores and the index of the thread in sc->threads. All other machines just need to pass the index of the cpu in their respective arrays, which happens to be equal to cs->cpu_index. > Signed-off-by: Bharata B Rao > --- > target-ppc/translate_init.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > 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 > } > > +static int ppc_cpu_get_migration_id(CPUState *cs) > +{ > + PowerPCCPU *cpu = 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 = POWERPC_CPU_CLASS(oc); > @@ -10412,6 +10423,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) > #ifndef CONFIG_USER_ONLY > cc->virtio_is_big_endian = ppc_cpu_is_big_endian; > #endif > + cc->get_migration_id = ppc_cpu_get_migration_id; > > dc->fw_name = "PowerPC,UNKNOWN"; > }