From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwUHM-0005kW-Ld for qemu-devel@nongnu.org; Tue, 09 Jul 2013 05:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwUHI-0000Ef-BH for qemu-devel@nongnu.org; Tue, 09 Jul 2013 05:32:12 -0400 Date: Tue, 9 Jul 2013 17:20:35 +1000 From: David Gibson Message-ID: <20130709072035.GH2696@voom.redhat.com> References: <1372315560-5478-1-git-send-email-aik@ozlabs.ru> <1372315560-5478-9-git-send-email-aik@ozlabs.ru> <87sizozyjl.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bpVaumkpfGNUagdU" Content-Disposition: inline In-Reply-To: <87sizozyjl.fsf@codemonkey.ws> Subject: Re: [Qemu-devel] [PATCH 08/17] pseries: savevm support for PAPR TCE tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Alexey Kardashevskiy , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Paolo Bonzini , Paul Mackerras --bpVaumkpfGNUagdU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 08, 2013 at 01:39:26PM -0500, Anthony Liguori wrote: > Alexey Kardashevskiy writes: >=20 > > From: David Gibson > > > > This patch adds the necessary VMStateDescription information to save the > > state of PAPR TCE tables (that is, the PAPR specified IOMMU). > > > > Signed-off-by: David Gibson > > Signed-off-by: Alexey Kardashevskiy > > --- > > hw/ppc/spapr_iommu.c | 25 +++++++++++++++++++++++++ > > 1 file changed, 25 insertions(+) > > > > diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c > > index 91bc8e4..ba1f7b6 100644 > > --- a/hw/ppc/spapr_iommu.c > > +++ b/hw/ppc/spapr_iommu.c > > @@ -112,6 +112,25 @@ static IOMMUTLBEntry spapr_tce_translate_iommu(Mem= oryRegion *iommu, hwaddr addr) > > }; > > } > > =20 > > +static const VMStateDescription vmstate_spapr_tce_table =3D { > > + .name =3D "spapr_iommu", > > + .version_id =3D 1, > > + .minimum_version_id =3D 1, > > + .minimum_version_id_old =3D 1, > > + .fields =3D (VMStateField []) { > > + /* Sanity check */ > > + VMSTATE_UINT32_EQUAL(liobn, sPAPRTCETable), > > + VMSTATE_UINT32_EQUAL(window_size, sPAPRTCETable), > > + > > + /* IOMMU state */ > > + VMSTATE_BOOL(bypass, sPAPRTCETable), > > + VMSTATE_VBUFFER_DIVIDE(table, sPAPRTCETable, 0, NULL, 0, windo= w_size, > > + SPAPR_TCE_PAGE_SIZE / > > sizeof(sPAPRTCE)), >=20 > Not endian safe. I really don't get the divide bit at all either. So, the actual bug is that we're currently storing the TCE table native endian, whereas it should be stored big endan always. =20 > > + > > + VMSTATE_END_OF_LIST() > > + }, > > +}; > > + > > static MemoryRegionIOMMUOps spapr_iommu_ops =3D { > > .translate =3D spapr_tce_translate_iommu, > > }; > > @@ -156,6 +175,8 @@ sPAPRTCETable *spapr_tce_new_table(uint32_t liobn, = size_t window_size) > > =20 > > QLIST_INSERT_HEAD(&spapr_tce_tables, tcet, list); > > =20 > > + vmstate_register(NULL, tcet->liobn, &vmstate_spapr_tce_table, tcet= ); > > + >=20 > If you need to add these, then you need to do more QOM conversion. Again, it's not clear how this should be QOMed. Child of the device constructing the TCE table? But since that can often be a bus bridge, wouldn't the TCE table instances get confused with the real bus devices. --=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 --bpVaumkpfGNUagdU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) iEYEARECAAYFAlHbucMACgkQaILKxv3ab8bFEgCggMuD2rqEY+jXhsoXSYI5qAd0 o7YAoIhtSrUlpgjTRRwlJZ+1IkEkjMGR =I2cQ -----END PGP SIGNATURE----- --bpVaumkpfGNUagdU--