From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9tMh-0006Ly-2V for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:42:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9tMe-0006ye-06 for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:42:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c9tMd-0006yF-QL for qemu-devel@nongnu.org; Thu, 24 Nov 2016 07:42:55 -0500 Date: Thu, 24 Nov 2016 20:42:51 +0800 From: Peter Xu Message-ID: <20161124124251.GB25010@pxdev.xzpeter.org> References: <1479892858-4218-1-git-send-email-peterx@redhat.com> <20161124040435.GA23872@umbus.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161124040435.GA23872@umbus.fritz.box> Subject: Re: [Qemu-devel] [PATCH] memory: add section range info for IOMMU notifier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, alex.williamson@redhat.com On Thu, Nov 24, 2016 at 03:04:35PM +1100, David Gibson wrote: [...] > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > > index 801578b..c3db115 100644 > > --- a/hw/vfio/common.c > > +++ b/hw/vfio/common.c > > @@ -455,6 +455,10 @@ static void vfio_listener_region_add(MemoryListener *listener, > > giommu->container = container; > > giommu->n.notify = vfio_iommu_map_notify; > > giommu->n.notifier_flags = IOMMU_NOTIFIER_ALL; > > + giommu->n.start = section->offset_within_address_space; > > I think this needs to be offset_within_region rather than > offset_within_address_space. The IOVAs used in the IOMMUTLBEntry are > relative to the MR, not the enclosing AS (in fact there could be > several enclosing ASes with the right aliasing). See for example > put_tce_emu() - the (ioba - tcet->bus_offset) expression is > effectively converting the AS relative ioba into an MR relative > address. Thanks for the pointer. Will fix (and the other place). -- peterx