From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNs1R-0007cG-8S for qemu-devel@nongnu.org; Tue, 17 Feb 2015 18:57:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNs1M-0003JG-UF for qemu-devel@nongnu.org; Tue, 17 Feb 2015 18:57:45 -0500 Date: Wed, 18 Feb 2015 10:53:25 +1100 From: David Gibson Message-ID: <20150217235325.GL26645@voom.fritz.box> References: <1422523650-2888-1-git-send-email-aik@ozlabs.ru> <1422523650-2888-9-git-send-email-aik@ozlabs.ru> <20150202070407.GN28703@voom.fritz.box> <54E2A409.5020508@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yaPAUYI/0vT2YKpA" Content-Disposition: inline In-Reply-To: <54E2A409.5020508@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH v4 08/18] vfio: Add DMA memory registering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Alex Williamson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf --yaPAUYI/0vT2YKpA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 17, 2015 at 01:14:33PM +1100, Alexey Kardashevskiy wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > On 02/02/2015 06:04 PM, David Gibson wrote: > > On Thu, Jan 29, 2015 at 08:27:20PM +1100, Alexey Kardashevskiy > wrote: [snip] > >> + vfio_mem_unregister(container, vaddr, end - iova); +} + +const > >> MemoryListener vfio_ram_listener =3D { + .region_add =3D > >> vfio_ram_region_add, + .region_del =3D vfio_ram_region_del, +}; += =20 > >> +static void vfio_spapr_listener_release(VFIOContainer *container)=20 > >> +{ + > >> memory_listener_unregister(&container->iommu_data.type1.listener); + > >> memory_listener_unregister(&container->iommu_data.type1.ramlistener); > > > >>=20 > > Accessing fields within type1 from a function whose name says it's=20 > > spapr specific seems very wrong. >=20 >=20 > Kind of ugly, yes. But we share the common memory listener with Type1 so.= =2E. >=20 >=20 > >> +} + int vfio_mmap_region(Object *obj, VFIORegion *region,=20 > >> MemoryRegion *mem, MemoryRegion *submem, void **map, size_t size, > >> off_t offset, @@ -705,6 +798,10 @@ static int > >> vfio_connect_container(VFIOGroup *group, AddressSpace *as) goto > >> free_container_exit; } > >>=20 > >> + container->iommu_data.type1.ramlistener =3D > >> vfio_ram_listener; + > >> memory_listener_register(&container->iommu_data.type1.ramlistener, + > >> &address_space_memory); > >=20 > > Why two separate listeners, rather than doing both jobs from a single > > listener? >=20 > ... I actually like the idea to have this separated from the rest of the > code. Furthermore, now I think we better have separate memory listeners > for Type1 and SPAPR as the current vfio_listener_region_add()/del() look > quite ugly trying to do different things depending on > memory_region_is_iommu(). >=20 > Any objection to separating SPAPR's listener (and merging it with the one > introduced by this patch)? Not from here, I think that sounds like a good idea. --=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 --yaPAUYI/0vT2YKpA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU49R1AAoJEGw4ysog2bOSw7YQAJfEI2tHKPtVS+PF6VUuO1JM uGpClQAbqb1Mkt5zR/CiVmijYhV1b9Tt7vna1OHkB9psmG5gxIeW6KDbTqs69w36 ZQsLpk6LQW4PVtEuFTmbDxDhVxr3fboRnhEyutR4X0PAOELcfwwoTfKYs44dLpqa hM6QQgRXEZ6geR7ZujdfGFtoQFZHBMjmI/T2IFo6XIWJNujiVku15aTZ/uxIA+Zs IIzHqUy5PXBLdLmu7/dc9mMlQmu4nLKKgdrXlAKniSQUIAzgJ7wGn3JIpH0ocueU yhLiu069PsX9+gSVlvejS4YHgziJSWl8ZwkydjPHZia/HDVE9PJStiS8AneIMrr9 knD858xsCTfMqbSaiMf0FCd5dbBbyOCYasgmTcVawuPdjpf+DCx044GSIp8YBdzI Ve6Gzzv3+IkDfvWsgEquPv0Qb5/0NFu+6kIEHgIwbZkMMrdyW+c2G9T22QS0OH2k d8mTKwaYVA2aVJLt8tPTy1y3Woco0F9C9ALwON3nOFZkvAppCQ9AR2Uo/bJYEThB i8CnQQD8zE68EGfu6C56kw+6tcYIIEsErWjmkddQ55nWYAcDZpDxq3sfhWA0UQnm p+chrD0oCQrAZnaoRBnR0W08sy4jfl1ieFE4Y++3Mm8hQnhvv+sDzoSTApZZT1BG 74cf/5xftzqVRK/0okx9 =fFWC -----END PGP SIGNATURE----- --yaPAUYI/0vT2YKpA--