From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc3tm-0006zR-Vo for qemu-devel@nongnu.org; Mon, 13 May 2013 21:19:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uc3ti-0000Il-KC for qemu-devel@nongnu.org; Mon, 13 May 2013 21:19:26 -0400 Received: from ozlabs.org ([203.10.76.45]:56340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc3ti-0000Ic-1T for qemu-devel@nongnu.org; Mon, 13 May 2013 21:19:22 -0400 Date: Tue, 14 May 2013 11:00:44 +1000 From: David Gibson Message-ID: <20130514010044.GE14944@truffula.fritz.box> References: <1368442465-14363-1-git-send-email-david@gibson.dropbear.id.au> <1368442465-14363-8-git-send-email-david@gibson.dropbear.id.au> <1368480779.5520.80.camel@ul30vt.home> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u5E4XgoOPWr4PD9E" Content-Disposition: inline In-Reply-To: <1368480779.5520.80.camel@ul30vt.home> Subject: Re: [Qemu-devel] [PATCH 7/8] vfio: Introduce VFIO address spaces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: aik@ozlabs.ru, pbonzini@redhat.com, qemu-devel@nongnu.org, agraf@suse.de, mst@redhat.com --u5E4XgoOPWr4PD9E Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 13, 2013 at 03:32:59PM -0600, Alex Williamson wrote: > On Mon, 2013-05-13 at 20:54 +1000, David Gibson wrote: > > The only model so far supported for VFIO passthrough devices is the mod= el > > usually used on x86, where all of the guest's RAM is mapped into the > > (host) IOMMU and there is no IOMMU visible in the guest. > >=20 > > This patch begins to relax this model, introducing the notion of a > > VFIOAddressSpace. This represents a logical DMA address space which wi= ll > > be visible to one or more VFIO devices by appropriate mapping in the (h= ost) > > IOMMU. Thus the currently global list of containers becomes local to > > a VFIOAddressSpace, and we verify that we don't attempt to add a VFIO > > group to multiple address spaces. > >=20 > > For now, only one VFIOAddressSpace is created and used, corresponding to > > main system memory, that will change in future patches. > >=20 > > Signed-off-by: David Gibson > > --- > > hw/misc/vfio.c | 67 ++++++++++++++++++++++++++++++++++++++++++------= -------- > > 1 file changed, 50 insertions(+), 17 deletions(-) > >=20 > > diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c > > index c4a8853..b1e9220 100644 > > --- a/hw/misc/vfio.c > > +++ b/hw/misc/vfio.c > > @@ -113,9 +113,17 @@ enum { > > VFIO_INT_MSIX =3D 3, > > }; > > =20 > > +typedef struct VFIOAddressSpace { > > + AddressSpace *as; > > + QLIST_HEAD(, VFIOContainer) containers; > > +} VFIOAddressSpace; > > + > > +static VFIOAddressSpace vfio_address_space_memory; > > + > > struct VFIOGroup; > > =20 > > typedef struct VFIOContainer { > > + VFIOAddressSpace *vas; >=20 > "space" maybe? Ok, "space" it is. > > int fd; /* /dev/vfio/vfio, empowered by the attached groups */ > > struct { > > /* enable abstraction to support various iommu backends */ > > @@ -178,9 +186,6 @@ typedef struct VFIOGroup { > > =20 > > #define MSIX_CAP_LENGTH 12 > > =20 > > -static QLIST_HEAD(, VFIOContainer) > > - container_list =3D QLIST_HEAD_INITIALIZER(container_list); > > - > > static QLIST_HEAD(, VFIOGroup) > > group_list =3D QLIST_HEAD_INITIALIZER(group_list); > > =20 > > @@ -2624,16 +2629,28 @@ static int vfio_load_rom(VFIODevice *vdev) > > return 0; > > } > > =20 > > -static int vfio_connect_container(VFIOGroup *group) > > +static void vfio_address_space_init(VFIOAddressSpace *vas, AddressSpac= e *as) > > +{ > > + vas->as =3D as; > > + QLIST_INIT(&vas->containers); > > +} > > + > > +static int vfio_connect(VFIOGroup *group, VFIOAddressSpace *vas) >=20 > Connect what? Verb, no object. This is still trying to attach a group > to an existing container or create a new container, the address space is > just a parameter in that matching. So I'm not sure why this isn't still > vfio_connect_container. Uh, yeah, fair enough. I've reverted to connect_container in the next version. --=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 --u5E4XgoOPWr4PD9E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlGRjLwACgkQaILKxv3ab8al7gCfYydrCV/bliYbVC1C3vcZOklr IccAmwRBFa3/zXCOGOuyPG12fa8Sdygg =HqLs -----END PGP SIGNATURE----- --u5E4XgoOPWr4PD9E--