From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXjpc-0007zF-1E for qemu-devel@nongnu.org; Wed, 01 May 2013 23:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXjpX-0005KQ-UG for qemu-devel@nongnu.org; Wed, 01 May 2013 23:05:15 -0400 Received: from ozlabs.org ([203.10.76.45]:57561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXjpX-0005KD-Js for qemu-devel@nongnu.org; Wed, 01 May 2013 23:05:11 -0400 Date: Thu, 2 May 2013 13:05:08 +1000 From: David Gibson Message-ID: <20130502030508.GG13041@truffula.fritz.box> References: <20130501043524.GO20202@truffula.fritz.box> <51813E87.2030704@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7J16OGEJ/mt06A90" Content-Disposition: inline In-Reply-To: <51813E87.2030704@redhat.com> Subject: Re: [Qemu-devel] [PATCH 09/17] memory: iommu support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aik@truffula.fritz.box, qemu-devel@nongnu.org --7J16OGEJ/mt06A90 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 01, 2013 at 06:10:47PM +0200, Paolo Bonzini wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > Il 01/05/2013 06:35, David Gibson ha scritto: > >> From: Avi Kivity > >>=20 > >> Add a new memory region type that translates addresses it is > >> given, then forwards them to a target address space. This is > >> similar to an alias, except that the mapping is more flexible > >> than a linear translation and trucation, and also less efficient > >> since the translation happens at runtime. > >>=20 > >> The implementation uses an AddressSpace mapping the target region > >> to avoid hierarchical dispatch all the way to the resolved > >> region; only iommu regions are looked up dynamically. > >>=20 > >> Signed-off-by: Avi Kivity [Modified to put > >> translation in address_space_translate - Paolo] Signed-off-by: > >> Paolo Bonzini --- exec.c | > >> 35 +++++++++++++++++++++++++++++------ include/exec/memory.h | > >> 44 ++++++++++++++++++++++++++++++++++++++++++++ memory.c > >> | 28 ++++++++++++++++++++++++++++ 3 files changed, 101 > >> insertions(+), 6 deletions(-) > >=20 > > [snip] > >> +void memory_region_init_iommu(MemoryRegion *mr, + > >> MemoryRegionIOMMUOps *ops, + > >> MemoryRegion *target, + const char > >> *name, + uint64_t size) +{ + > >> memory_region_init(mr, name, size); + mr->ops =3D NULL; + > >> mr->iommu_ops =3D ops, + mr->opaque =3D mr; + mr->terminates =3D > >> true; /* then re-forwards */ + mr->destructor =3D > >> memory_region_destructor_iommu; + mr->iommu_target_as =3D > >> g_new(AddressSpace, 1); + > >> address_space_init(mr->iommu_target_as, target); > >=20 > > Since IOMMUs are very likely to share a target AS (in fact, it > > will nearly always be system memory), it seems odd to me to > > construct new AddressSpace objects for each one, rather than just > > giving the AddressSpace as the parameter to > > memory_region_init_iommu. > >=20 >=20 > I think the problem is that we do not have reference counting, and > this makes it simpler to manage the lifetime. It can be changed later. I don't really follow this logic. In the existing case, the iommu target is always system memory, and there's already address_space_memory which always exists. --=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 --7J16OGEJ/mt06A90 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlGB1+QACgkQaILKxv3ab8ZCnQCfWDTiGnCNKqfXPcKX49l2M2hv wYEAnR7V0PVeFVzSlKcfZmQibfsV1QPm =VUUX -----END PGP SIGNATURE----- --7J16OGEJ/mt06A90--