Received: from eggs.gnu.org ([2001:4830:134:3::10]:56472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxJbS-0005Be-7f for qemu-devel@nongnu.org; Thu, 20 Oct 2016 16:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxJbO-0001iq-Ua for qemu-devel@nongnu.org; Thu, 20 Oct 2016 16:06:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60162) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxJbO-0001hk-Ok for qemu-devel@nongnu.org; Thu, 20 Oct 2016 16:06:10 -0400 Date: Thu, 20 Oct 2016 14:06:08 -0600 From: Alex Williamson Message-ID: <20161020140608.0f373ea9@t450s.home> In-Reply-To: References: <1476719064-9242-1-git-send-email-bd.aviv@gmail.com> <20161017100736.68a56fd9@t450s.home> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aviv B.D." Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" , Peter Xu , Jan Kiszka , David Gibson [cc +david] On Thu, 20 Oct 2016 22:17:18 +0300 "Aviv B.D." wrote: > On Mon, Oct 17, 2016 at 7:07 PM, Alex Williamson > wrote: > > > On Mon, 17 Oct 2016 18:44:21 +0300 > > "Aviv B.D" wrote: > > > > > From: "Aviv Ben-David" > > > > > > * Advertize Cache Mode capability in iommu cap register. > > > This capability is controlled by "cache-mode" property of intel-iommu > > device. > > > To enable this option call QEMU with "-device > > intel-iommu,cache-mode=true". > > > > > > * On page cache invalidation in intel vIOMMU, check if the domain belong > > to > > > registered notifier, and notify accordingly. > > > > > > Currently this patch still doesn't enabling VFIO devices support with > > vIOMMU > > > present. Current problems: > > > * vfio_iommu_map_notify is not aware about memory range belong to > > specific > > > VFIOGuestIOMMU. > > > > Could you elaborate on why this is an issue? > > > > In my setup the VFIO registered two memory areas with one page of > unregistered memory > between them. > > When I'm calling memory_region_notify_iommu it calls the notifier function > of VFIO twice > when the second time is failing with warning to console as the new mapping > is already present. > > The notifier function of VFIO should ignore IOMMUTLBEntry that is not in > the correct > range. Hmm, right vfio_listener_region_add() is called for a MemoryRegionSection, but then we add an iommu notifier to the MemoryRegion, so we end up with a notifier per MemoryRegionSection regardless of whether they're backed by the same MemoryRegion. Seems like we need a MemoryRegion based list of VFIOGuestIOMMUs so we only register once per MemoryRegion and then sort though the list of VFIOGuestIOMMUs for a given MemoryRegion to find the one affected. David, does that sound right to you? I am curious why you get two regions separated by one page, can you give an example of the ranges for each? Thanks, Alex