From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuPiW-0000Ug-AD for qemu-devel@nongnu.org; Wed, 03 Jul 2013 12:15:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuPiU-0007Lx-S3 for qemu-devel@nongnu.org; Wed, 03 Jul 2013 12:15:40 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40095 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuPiU-0007Lq-J3 for qemu-devel@nongnu.org; Wed, 03 Jul 2013 12:15:38 -0400 Message-ID: <51D44E24.7000304@suse.de> Date: Wed, 03 Jul 2013 18:15:32 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1372863856-19860-1-git-send-email-dkoch@terremark.com> In-Reply-To: <1372863856-19860-1-git-send-email-dkoch@terremark.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Bug 1187529] [PATCH] Update mappings after PCI bridge live migration or save-restore. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Don Koch Cc: Peter Crosthwaite , qemu-devel@nongnu.org, mst@redhat.com Am 03.07.2013 17:04, schrieb Don Koch: > From: Don Koch >=20 > Update mappings for PCI bridge after live migration. >=20 > Signed-off-by: Don Koch > --- > This fixes bug 1187529: devices on a PCI bridge stop working after migr= ation. Feel free to reference this as LP#1187529 in the commit message if this is from QEMU's Launchpad bug tracker. >=20 > hw/pci-bridge/pci_bridge_dev.c | 9 +++++++++ > hw/pci/pci_bridge.c | 2 +- > include/hw/pci/pci_bridge.h | 1 + > 3 files changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_= dev.c > index 971b432..9e5062e 100644 > --- a/hw/pci-bridge/pci_bridge_dev.c > +++ b/hw/pci-bridge/pci_bridge_dev.c > @@ -110,6 +110,14 @@ static void qdev_pci_bridge_dev_reset(DeviceState = *qdev) > shpc_reset(dev); > } > =20 > +static int pci_bridge_dev_post_load(void *opaque, int ver) { > + PCIDevice *d =3D opaque; > + PCIBridge *s =3D container_of(d, PCIBridge, dev); Casting should no longer be done that way. It seems there is no PCI_BRIDGE() cast macro in upstream yet, but it doesn't seem necessary either. You can just use: PCIBridge *s =3D opaque; for simplicity. Functional change looks sensible to me. Regards, Andreas > + > + pci_bridge_update_mappings(s); > + return 0; > +} > + > static Property pci_bridge_dev_properties[] =3D { > /* Note: 0 is not a legal chassis number. */ > DEFINE_PROP_UINT8("chassis_nr", PCIBridgeDev, chassis_nr, 0), > @@ -119,6 +127,7 @@ static Property pci_bridge_dev_properties[] =3D { > =20 > static const VMStateDescription pci_bridge_dev_vmstate =3D { > .name =3D "pci_bridge", > + .post_load =3D pci_bridge_dev_post_load, > .fields =3D (VMStateField[]) { > VMSTATE_PCI_DEVICE(bridge.dev, PCIBridgeDev), > SHPC_VMSTATE(bridge.dev.shpc, PCIBridgeDev), > diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c > index 24be6c5..3897bd8 100644 > --- a/hw/pci/pci_bridge.c > +++ b/hw/pci/pci_bridge.c > @@ -224,7 +224,7 @@ static void pci_bridge_region_cleanup(PCIBridge *br= , PCIBridgeWindows *w) > g_free(w); > } > =20 > -static void pci_bridge_update_mappings(PCIBridge *br) > +void pci_bridge_update_mappings(PCIBridge *br) > { > PCIBridgeWindows *w =3D br->windows; > =20 > diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h > index 1868f7a..1d8f997 100644 > --- a/include/hw/pci/pci_bridge.h > +++ b/include/hw/pci/pci_bridge.h > @@ -37,6 +37,7 @@ PCIBus *pci_bridge_get_sec_bus(PCIBridge *br); > pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type); > pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type); > =20 > +void pci_bridge_update_mappings(PCIBridge *br); > void pci_bridge_write_config(PCIDevice *d, > uint32_t address, uint32_t val, int len); > void pci_bridge_disable_base_limit(PCIDevice *dev); >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg