From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVgsI-0000my-TE for qemu-devel@nongnu.org; Fri, 26 Apr 2013 07:31:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVgsB-0004uZ-94 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 07:31:34 -0400 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:55963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVgsA-0004uJ-R6 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 07:31:27 -0400 Date: Fri, 26 Apr 2013 21:31:21 +1000 From: David Gibson Message-ID: <20130426113121.GB4360@truffula.fritz.box> References: <1366956141-2066-1-git-send-email-david@gibson.dropbear.id.au> <1366956141-2066-4-git-send-email-david@gibson.dropbear.id.au> <517A398C.6030104@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+pHx0qQiF2pBVqBT" Content-Disposition: inline In-Reply-To: <517A398C.6030104@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/4] vfio: Move container list to iommu MemoryRegion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aik@ozlabs.ru, alex.williamson@redhat.com, qemu-devel@nongnu.org --+pHx0qQiF2pBVqBT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2013 at 10:23:40AM +0200, Paolo Bonzini wrote: > Il 26/04/2013 08:02, David Gibson ha scritto: > > At the moment, vfio maintains a global list of containers that are assu= med > > to be more or less interchangeable, since they are all set up with a > > MemoryListener to have all of system memory mapped. However, that only > > makes sense if all the containers are used on devices which really do > > expect a dma address space identical to system memory. > >=20 > > This patch moves towards that by making the list of containers per > > MemoryRegion (which corresponds to a dma address space) instead of glob= al. >=20 > This is the same violation of encapsulation that Alex pointed out in > v1. As I said in response to that, I can't see any way to avoid this that isn't much uglier. Fundamentally we need to associate the in-kernel notion of an address space (the vfio container) with the qemu object. Adding a opaque pointer to the MemoryRegion seems a lot cleaner than having some data structure in the vfio code that's indexed by MemoryRegion. > You need to add this capability to VFIO's MemoryListener (either the > one that's already there, or a new one), looking for IOMMU regions in > the region_add callback. Putting it in the MemoryListener doesn't work. First, there could be multiple listeners if there are multiple containers attached to the MemoryRegion - the information we have here needs to be per MemoryRegion. More importantly, what I'm working towards here is vfio support for guest visible IOMMUs that don't have all of guest RAM mapped into them initially. In that case there won't (and can't) be any MemoryListener at all. --=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 --+pHx0qQiF2pBVqBT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlF6ZYkACgkQaILKxv3ab8bL4QCcDQeB2aMAqkBqn2OkQWaQfMxh EMIAnipD1Qz7VOvXqUtt7AEm4iRrTDLZ =Tl2w -----END PGP SIGNATURE----- --+pHx0qQiF2pBVqBT--