From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0StU-0001oD-V1 for qemu-devel@nongnu.org; Fri, 27 Jun 2014 05:56:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0StN-0004Fy-GP for qemu-devel@nongnu.org; Fri, 27 Jun 2014 05:56:32 -0400 Received: from mout.web.de ([212.227.15.4]:50527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0StN-0004FO-5d for qemu-devel@nongnu.org; Fri, 27 Jun 2014 05:56:25 -0400 Message-ID: <53AD3FA0.7070708@web.de> Date: Fri, 27 Jun 2014 11:55:44 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <53AC2892.6030509@redhat.com> <53ACF94D.20206@redhat.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3DQSHDU4dm4XuIUGSqQaCinNJqa4P3QKQ" Subject: Re: [Qemu-devel] About AddressSpace in intel-iommu emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Le Tan , Paolo Bonzini Cc: qemu-devel This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3DQSHDU4dm4XuIUGSqQaCinNJqa4P3QKQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2014-06-27 07:46, Le Tan wrote: > 2014-06-27 12:55 GMT+08:00 Paolo Bonzini : >> Il 27/06/2014 04:08, Le Tan ha scritto: >> >>> 1. In struct IOMMUTLBEntry, I think the addr_mask field should be the= >>> mask of the page offset, right? But I see different usages of this >>> field. In spapr_tce_translate_iommu(), the addr_mask field is assigne= d >>> with the mask of the page offset. However, in pbm_translate_iommu(), >>> in the passthrough case, the addr_mask field seems to be assigned the= >>> mask of the page number. Is there any problem here? >> >> >> The intended usage is the one of spapr_tce_translate_iommu(). In prac= tice >> it doesn't matter, both work. >> >> >>> 2. For q35, how to identify origination of DMA requests? The VT-d >>> manual says we should use source-id(for PCI-Express devices, it is >>> requester identifier) to map devices to domains. What is the related >>> part in QEMU? Where can I get the source-id of a DMA request? >> >> >> You need to create a different AddressSpace for each PCI bus or device= =2E >=20 > How to create a different AddressSpace for each device? I thought a > AddressSpace just belongs to a PCI bus before. The paging structures > for different functions of the same device can also be different, too. > So maybe we should create a different AddressSpace for each function? > How to achieve it? Could you give me some more hints or is there any > existing example in QEMU? I would suggest to study the apb IOMMU implementation Paolo referenced and the PCI layer functions used by that code. Specifically, pci_setup_iommu takes a callback that is supposed to return an address space to be used for a particular device. For apb, it's the same for all devices on a bus, but that's not required... Jan --3DQSHDU4dm4XuIUGSqQaCinNJqa4P3QKQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlOtP6MACgkQitSsb3rl5xSXYQCfQ30afWoo38LiEsuufG7i7g+h pBoAoMz2shPft33hBswa6emr8MLJNsy/ =GIbY -----END PGP SIGNATURE----- --3DQSHDU4dm4XuIUGSqQaCinNJqa4P3QKQ--