[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190415063317.GC1377@infradead.org>
Date: Sun, 14 Apr 2019 23:33:17 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Tom Murphy <tmurphy@...sta.com>
Cc: iommu@...ts.linux-foundation.org, Heiko Stuebner <heiko@...ech.de>,
Will Deacon <will.deacon@....com>,
David Brown <david.brown@...aro.org>,
linux-samsung-soc@...r.kernel.org, dima@...sta.com,
Krzysztof Kozlowski <krzk@...nel.org>,
linux-rockchip@...ts.infradead.org, Kukjin Kim <kgene@...nel.org>,
Andy Gross <andy.gross@...aro.org>,
Marc Zyngier <marc.zyngier@....com>,
linux-arm-msm@...r.kernel.org, linux-mediatek@...ts.infradead.org,
Matthias Brugger <matthias.bgg@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
murphyt7@....ie, Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH 4/9] iommu/dma-iommu: Add iommu_dma_map_page_coherent
> @@ -693,7 +694,19 @@ dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
> unsigned long offset, size_t size, int prot)
> {
> return __iommu_dma_map(dev, page_to_phys(page) + offset, size, prot,
> - iommu_get_dma_domain(dev));
> + iommu_get_dma_domain(dev), dma_get_mask(dev));
> +}
> +
> +dma_addr_t iommu_dma_map_page_coherent(struct device *dev, struct page *page,
> + unsigned long offset, size_t size, int prot)
> +{
Note that my tree pointed to above removes the iommu_dma_map_page
wrapper. I think for the coherent mappign we should also just
call __iommu_dma_map directly and not introduce another wrapper.
> + dma_addr_t dma_mask = dev->coherent_dma_mask;
> +
> + if (!dma_mask)
> + dma_mask = dma_get_mask(dev);
> +
> + return __iommu_dma_map(dev, page_to_phys(page) + offset, size, prot,
> + iommu_get_dma_domain(dev), dma_mask);
> }
In the DMA API there is no fallback when the coherent_dma_mask is not
set. While various bits of legacy code do that we should not copy it
to new code.
Powered by blists - more mailing lists