From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmFIK-0005fK-BQ for qemu-devel@nongnu.org; Tue, 20 Sep 2016 03:16:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmFIF-0004Uh-Vl for qemu-devel@nongnu.org; Tue, 20 Sep 2016 03:16:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmFIF-0004UK-PP for qemu-devel@nongnu.org; Tue, 20 Sep 2016 03:16:39 -0400 Date: Tue, 20 Sep 2016 15:16:33 +0800 From: Peter Xu Message-ID: <20160920071633.GD5134@pxdev.xzpeter.org> References: <1473841548-26742-1-git-send-email-peterx@redhat.com> <1473841548-26742-2-git-send-email-peterx@redhat.com> <20160920061205.GV20488@umbus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160920061205.GV20488@umbus> Subject: Re: [Qemu-devel] [PATCH v5 1/3] memory: introduce IOMMUNotifier and its caps List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-devel@nongnu.org, mst@redhat.com, jasowang@redhat.com, vkaplans@redhat.com, alex.williamson@redhat.com, wexu@redhat.com, pbonzini@redhat.com, cornelia.huck@de.ibm.com, dgibson@redhat.com On Tue, Sep 20, 2016 at 04:12:05PM +1000, David Gibson wrote: > On Wed, Sep 14, 2016 at 04:25:46PM +0800, Peter Xu wrote: > > IOMMU Notifier list is used for notifying IO address mapping changes. > > Currently VFIO is the only user. > > > > However it is possible that future consumer like vhost would like to > > only listen to part of its notifications (e.g., cache invalidations). > > > > This patch introduced IOMMUNotifier and IOMMUNotfierFlag bits for a > > finer grained control of it. > > > > IOMMUNotifier contains a bitfield for the notify consumer describing > > what kind of notification it is interested in. Currently two kinds of > > notifications are defined: > > > > - IOMMU_NOTIFIER_MAP: for newly mapped entries (additions) > > - IOMMU_NOTIFIER_UNMAP: for entries to be removed (cache invalidates) > > > > When registering the IOMMU notifier, we need to specify one or multiple > > types of messages to listen to. > > > > When notifications are triggered, its type will be checked against the > > notifier's type bits, and only notifiers with registered bits will be > > notified. > > > > Signed-off-by: Peter Xu > > I still don't see the big fat comment saying that in-place changes to > an IOMMU mapping aren't permitted. IMHO if we are using MAP and UNMAP here then it's fairly clear even we will support in-place change in the future. I can add one more paragraph for in-place change like: For any IOMMU implementation, an in-place mapping change should be notified with an UNMAP following a MAP. Do you think this works? [...] > > +struct IOMMUNotifier { > > + void (*notify)(struct IOMMUNotifier *notifier, void *data); > > Given that we now have a special notifier type for this purpose, we > could actually type this to take an IOMMUTLBEntry instead of a void *. Yep. I can fix that. Thanks! -- peterx