From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGd0b-0000ew-Lc for qemu-devel@nongnu.org; Wed, 28 Jan 2015 19:31:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGd0W-00080v-6r for qemu-devel@nongnu.org; Wed, 28 Jan 2015 19:30:57 -0500 Date: Thu, 29 Jan 2015 11:31:09 +1100 From: David Gibson Message-ID: <20150129003109.GI14681@voom> References: <1422339213-23426-1-git-send-email-aik@ozlabs.ru> <54C8015E.6070801@ozlabs.ru> <54C8A2AC.9020203@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="g3RkK9jYN81zD2N+" Content-Disposition: inline In-Reply-To: <54C8A2AC.9020203@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH v2] spapr_vio/spapr_iommu: Move VIO bypass where it belongs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf --g3RkK9jYN81zD2N+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 28, 2015 at 07:49:48PM +1100, Alexey Kardashevskiy wrote: > On 01/28/2015 08:21 AM, Alexey Kardashevskiy wrote: > > On 01/27/2015 05:13 PM, Alexey Kardashevskiy wrote: [snip] > >> diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h > >> index 46edc2a..6ad55d1 100644 > >> --- a/include/hw/ppc/spapr_vio.h > >> +++ b/include/hw/ppc/spapr_vio.h > >> @@ -64,6 +64,8 @@ struct VIOsPAPRDevice { > >> target_ulong signal_state; > >> VIOsPAPR_CRQ crq; > >> AddressSpace as; > >> + MemoryRegion mrroot; > >> + MemoryRegion mrbypass; > >> sPAPRTCETable *tcet; > >> }; > >> =20 > >> > >=20 > >=20 >=20 >=20 > I believe doing something like this is way too disguising because of > tobj->parent? It's kinda ugly, but it's the best way I can think of. So, I think this is a reasonable approach, but it does need a comment saying why the hack is necessary. >=20 >=20 >=20 > --- a/hw/ppc/spapr_iommu.c > +++ b/hw/ppc/spapr_iommu.c > @@ -25,6 +25,7 @@ > #include "trace.h" >=20 > #include "hw/ppc/spapr.h" > +#include "hw/ppc/spapr_vio.h" >=20 > #include >=20 > @@ -88,10 +89,26 @@ static IOMMUTLBEntry > spapr_tce_translate_iommu(MemoryRegion *iommu, hwaddr addr, > return ret; > } >=20 > +static int spapr_tce_table_post_load(void *opaque, int version_id) > +{ > + sPAPRTCETable *tcet =3D SPAPR_TCE_TABLE(opaque); > + Object *tobj =3D OBJECT(tcet); > + Object *vobj =3D object_dynamic_cast(tobj->parent, TYPE_VIO_SPAPR_DE= VICE); > + > + if (!vobj) { > + return 0; > + } > + > + spapr_vio_set_bypass((VIOsPAPRDevice *) vobj, tcet->bypass); > + > + return 0; > +} > + > static const VMStateDescription vmstate_spapr_tce_table =3D { > .name =3D "spapr_iommu", > .version_id =3D 2, > .minimum_version_id =3D 2, > + .post_load =3D spapr_tce_table_post_load, > .fields =3D (VMStateField []) { > /* Sanity check */ > VMSTATE_UINT32_EQUAL(liobn, sPAPRTCETable), >=20 >=20 >=20 --=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 --g3RkK9jYN81zD2N+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUyX9NAAoJEGw4ysog2bOS0AgP/RkzafizmNdD1er1xNxvQGDT fqfbW29pY+NPGqokLPtYNaVA3Fjc+EZ6D2nMKiZMUZUjf9uGmBlN/d3KunJJ2lKM 3n6Hjltp1HyXRjcyY95mxZ/oVM3Np6zOg8GvFixmdjLxK1rV0Rkjz0kiQjtc3G5B jjwPyC0LQQ2QaxP1bkf8dnfTopbwoky2CVe4494+sfipT6i7w4pLCHdEEpUCnl8B dXjN0NzsBZF0N1f6U9DQnYwR2nBh1xC1PiLAvIuHCHD3JyWKB8cWzSUorMLSZ5Rj 1cErkilOkSkjhqQjWzw7GqR3hKW9JbgzH48NabHQtBgy/2/MFMV70NT5ps/sP6iL XRuyChtVekWj4cRFToKkYYttGVyeBysRVt9Njjh9yh0IixDT2DGNZpw8NhI0HNwZ YpNUHzKN/9JPdr9PFKoltww8W5J44ewzW8pH1o8lnoohHH0nsoDWTy9muvdzEYYT UtTxJWHXrS00Zj6GeUnNy0ZRIhkl+D5ZWaPu0wvvkt6ygG1wnhsniOkU4v2ke/3y p/YGiw6t8mo7mR7XP+gpScFYPgKe4kF+FW1/BdxAgQHZA1naz8DrJkKjm5bnAG78 Kl9ixemoUUdztMhA2dhr5ktLq5TifpiWt5L801wsVBut7bZQDlP92dyfTpywvuI4 Q3rvBAFOYzmzF4uhML/E =Dqun -----END PGP SIGNATURE----- --g3RkK9jYN81zD2N+--