From: Christoph Hellwig Subject: Re: [PATCH] iommu/vt-d: Implement dma_[un]map_resource() Date: Sat, 19 Jan 2019 10:40:02 +0100 Message-ID: <20190119094002.GA21653@lst.de> References: <20190119000559.12784-1-logang@deltatee.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20190119000559.12784-1-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Logan Gunthorpe Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, David Woodhouse , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Christoph Hellwig List-Id: iommu@lists.linux-foundation.org On Fri, Jan 18, 2019 at 05:05:59PM -0700, Logan Gunthorpe wrote: > However, this doesn't create the IOVA entries necessary for addresses > mapped this way to work when the IOMMU is enabled. Thus, when the > IOMMU is enabled, drivers relying on dma_map_resource() will trigger > DMAR errors. We see this when running ntb_transport with the IOMMU > enabled, DMA, and switchtec hardware. Which resources do you plan to map? At least for PCIe P2P adding an address translation seems wrong to me. > > The implementation for intel_map_resource() is nearly identical to > intel_map_page(), we just have to re-create __intel_map_single(). > dma_unmap_resource() uses intel_unmap_page() directly as the > functions are identical. Instead of having two tiny wrappers I'd just revert 964f2311a6862f1fbcc044d0828ad90030928b7f if we need to pass a real physical address now.