From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwM7J-0007Dv-6D for qemu-devel@nongnu.org; Mon, 08 Jul 2013 20:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwM7I-0003OU-57 for qemu-devel@nongnu.org; Mon, 08 Jul 2013 20:49:17 -0400 Received: from mail-oa0-f54.google.com ([209.85.219.54]:39702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwM7I-0003Nu-04 for qemu-devel@nongnu.org; Mon, 08 Jul 2013 20:49:16 -0400 Received: by mail-oa0-f54.google.com with SMTP id o6so7054010oag.41 for ; Mon, 08 Jul 2013 17:49:15 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <51DB5413.8020101@ozlabs.ru> References: <1372315560-5478-1-git-send-email-aik@ozlabs.ru> <1372315560-5478-6-git-send-email-aik@ozlabs.ru> <871u78299c.fsf@codemonkey.ws> <51DB5413.8020101@ozlabs.ru> Date: Mon, 8 Jul 2013 19:49:15 -0500 Message-ID: From: Anthony Liguori Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH 05/17] pseries: savevm support for XICS interrupt controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Anthony Liguori , Alexander Graf , qemu-devel , qemu-ppc@nongnu.org, Paolo Bonzini , Paul Mackerras , David Gibson On Mon, Jul 8, 2013 at 7:06 PM, Alexey Kardashevskiy wrote: >> You should tie the vmstate section to DeviceState::vmsd. You only need >> to do this because you haven't converted everything to QOM yet. >> >> Please do that to avoid these hacks. > > > How? I want to support migration from xics to xics-kvm and vice versa. > vmsd cannot be inherited and even if they could, different device names > would kill that support. Please look at hw/intc/i8259_common.c and then hw/i386/kvm/i8259.c and hw/i386/intc/i8259.c. The vmsd is in the common base class shared between the KVM version and the non-KVM version. As long as the subclasses don't introduce any new state members, you can safely migrate between the two devices. You should consider splitting the implementations up into separate files just like i8259 too. Regards, Anthony Liguori > > >> >> Regards, >> >> Anthony Liguori >> >>> } >>> >>> void xics_common_init(struct icp_state *icp, qemu_irq_handler handler) >>> @@ -555,6 +614,10 @@ static void xics_realize(DeviceState *dev, Error **errp) >>> spapr_rtas_register("ibm,int-off", rtas_int_off); >>> spapr_rtas_register("ibm,int-on", rtas_int_on); >>> >>> + /* We use each the ICS's offset into the global irq number space >>> + * as an instance id. This means we can extend to multiple ICS >>> + * instances without needing to change the savevm format */ >>> + vmstate_register(NULL, icp->ics->offset, &vmstate_ics, icp->ics); >>> } >>> >>> static Property xics_properties[] = { >>> -- >>> 1.7.10.4 >> > > > -- > Alexey >