From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwpAC-00054w-QZ for qemu-devel@nongnu.org; Wed, 10 Jul 2013 03:50:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwpA2-0000Rv-N9 for qemu-devel@nongnu.org; Wed, 10 Jul 2013 03:50:12 -0400 Date: Wed, 10 Jul 2013 17:42:22 +1000 From: David Gibson Message-ID: <20130710074222.GN2696@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> <20130709072035.GH2696@voom.redhat.com> <87a9lv92rk.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="D9sZ58tf58331Q5M" Content-Disposition: inline In-Reply-To: <87a9lv92rk.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 --D9sZ58tf58331Q5M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 09, 2013 at 10:22:39AM -0500, Anthony Liguori wrote: > David Gibson writes: >=20 > > 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(= MemoryRegion *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, wi= ndow_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 > Why? There are no guest visible byte accesses done to the table > AFAICT. Everything is done as words and there's quite a lot of math > done to the entries. >=20 > It seems like native endian is the right internal representation. Hrm. I suppose it could be fixed at either end. The idea was that the table array would contain exactly the same bytes as would be present in physical memory on a real bare-metal system, which seems like a generally nice property. --=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 --D9sZ58tf58331Q5M Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) iEYEARECAAYFAlHdEF4ACgkQaILKxv3ab8a1zgCcD3Ndic4JbUBxxDjpD90GSrY7 fXQAn11+rDtGO3LL3OcgCCG01lrU8epV =gjr0 -----END PGP SIGNATURE----- --D9sZ58tf58331Q5M--