From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXjw5-0005aV-V3 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 01:25:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXjw2-00054h-HV for qemu-devel@nongnu.org; Mon, 22 Feb 2016 01:25:33 -0500 Received: from ozlabs.org ([103.22.144.67]:48954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXjw2-00054Q-61 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 01:25:30 -0500 Date: Mon, 22 Feb 2016 17:26:31 +1100 From: David Gibson Message-ID: <20160222062631.GH2808@voom.fritz.box> References: <1456121379-13434-1-git-send-email-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CEUtFxTsmBsHRLs3" Content-Disposition: inline In-Reply-To: <1456121379-13434-1-git-send-email-aik@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH qemu] memory: Fix IOMMU replay base address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-devel@nongnu.org --CEUtFxTsmBsHRLs3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 22, 2016 at 05:09:39PM +1100, Alexey Kardashevskiy wrote: > Since a788f227 "memory: Allow replay of IOMMU mapping notifications" > when new VFIO listener is added, all existing IOMMU mappings are replayed. > However there is a problem that the base address of an IOMMU memory region > (IOMMU MR) is ignored which is not a problem for the existing user (which= is > pseries) with its default 32bit DMA window starting at 0 but it is if the= re is > another DMA window. >=20 > This adjusts the replaying address by mr->addr. Uh.. this doesn't look right to me. AFAICT from the existing implementations the 'addr' parameter to the translate function is an offset within the memory region, which would make the original version correct. > Signed-off-by: Alexey Kardashevskiy > --- > memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/memory.c b/memory.c > index 09041ed..377269b 100644 > --- a/memory.c > +++ b/memory.c > @@ -1436,7 +1436,7 @@ void memory_region_iommu_replay(MemoryRegion *mr, N= otifier *n, > IOMMUTLBEntry iotlb; > =20 > for (addr =3D 0; addr < memory_region_size(mr); addr +=3D granularit= y) { > - iotlb =3D mr->iommu_ops->translate(mr, addr, is_write); > + iotlb =3D mr->iommu_ops->translate(mr, mr->addr + addr, is_write= ); > if (iotlb.perm !=3D IOMMU_NONE) { > n->notify(n, &iotlb); > } --=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 --CEUtFxTsmBsHRLs3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWyqoXAAoJEGw4ysog2bOSiQQQAJ1aVw4yPSrBnIW6Et/h28CF qGGOd3/3rcSnLGJicdTzbkavNDATyhpjstl8zrrTunUBtXlvFjrUiQB42SycN0nL TcThCIVzhKMzlT8JEnciRh4eDmPqximSXGoPz/cCw9LUkHPBAprHL+3MvwRDvln9 NpqAS9kK59gXJyQCv2xxXKxs1ZUZCnMoNBaN6P5DdPU1J/ATSWXkCqQBhjji4AwL jjwDSbQQpQyDbmimTTgUMARw3fV1gEuYsA3vuah855zT2Bg3MnpfCfgtyK6Ch5mP HaO+wkuEHCcExcl6a+PWF6hHzDLf802mPWeNNJcV+d1dIYnFZjTcQ7TRK5Gom/CT 7i3jv7W+4OK14UNdEFonFArxjBeatUiJ7BO+cgt1XeNTpGjPGOUiQw/Ro9acDBLR vXqavsfMCVCpnpKZK3gdUKSvoChgBQXf/lLC35isa9F0YmR9b3a1Il5/1ReOMhqN 0TaObXMXK/C7tdBb5Yocff2m9atEF4X4KlhBg3NQhjJ18q2NWvWKKEzWl1EkSRCL wr3CWvVYHXUOHSZCOOqQrKbis4ztASbDZkqcqTEDb4dym7oYnhs7eY7iYgR18kbU hDn5bQW4TVu81bSF4zsAnKVDNbZBI3biTBIrzNAK81sFdiKASlblqaGvYAjkym41 rXpqZ3L+IIB5/fLWW3TP =FG6c -----END PGP SIGNATURE----- --CEUtFxTsmBsHRLs3--