Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1441252

Re: [PATCH 07/20] iommu/amd: Remove special mapping code for dma_ops path

From Joerg Roedel <joro@8bytes.org>
Newsgroups linux.kernel
Subject Re: [PATCH 07/20] iommu/amd: Remove special mapping code for dma_ops path
Date 2016-07-12 13:10 +0200
Message-ID <rU3JE-44Q-9@gated-at.bofh.it> (permalink)
References <rSCs9-4e3-3@gated-at.bofh.it> <rSCs9-4e3-21@gated-at.bofh.it> <rU3zY-3Mz-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Robin,

On Tue, Jul 12, 2016 at 11:55:39AM +0100, Robin Murphy wrote:
> >  	start = address;
> >  	for (i = 0; i < pages; ++i) {
> > -		ret = dma_ops_domain_map(dma_dom, start, paddr, dir);
> > -		if (ret == DMA_ERROR_CODE)
> > +		ret = iommu_map_page(&dma_dom->domain, start, paddr,
> > +				     PAGE_SIZE, prot, GFP_ATOMIC);
> 
> I see that amd_iommu_map/unmap() takes a lock around calling
> iommu_map/unmap_page(), but we don't appear to do that here. That seems
> to suggest that either one is unsafe or the other is unnecessary.

At this point no locking is required, because in this code path we know
that we own the memory range and that nobody else is mapping that range.

In the IOMMU-API path we can't make that assumption, so locking is
required there. Both code-path use different types of domains, so there
is also no chance that a domain is used in both code-paths (except when
a dma-ops domain is set up).


	Joerg

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 07/20] iommu/amd: Remove special mapping code for dma_ops  path Robin Murphy <robin.murphy@arm.com> - 2016-07-12 13:00 +0200
  Re: [PATCH 07/20] iommu/amd: Remove special mapping code for dma_ops  path Joerg Roedel <joro@8bytes.org> - 2016-07-12 13:10 +0200
    Re: [PATCH 07/20] iommu/amd: Remove special mapping code for dma_ops  path Joerg Roedel <jroedel@suse.de> - 2016-07-12 13:50 +0200
    Re: [PATCH 07/20] iommu/amd: Remove special mapping code for dma_ops  path Robin Murphy <robin.murphy@arm.com> - 2016-07-12 13:50 +0200

csiph-web