[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190805091051.GB59981@iMac.local>
Date: Mon, 5 Aug 2019 10:10:52 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Christoph Hellwig <hch@....de>
Cc: iommu@...ts.linux-foundation.org,
Shawn Anastasio <shawn@...stas.io>,
Michael Ellerman <mpe@...erman.id.au>,
Russell King <linux@...linux.org.uk>,
Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Paul Burton <paul.burton@...s.com>,
James Hogan <jhogan@...nel.org>, linuxppc-dev@...ts.ozlabs.org,
linux-mips@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Gavin Li <git@...gavinli.com>
Subject: Re: [PATCH 1/2] dma-mapping: fix page attributes for dma_mmap_*
On Mon, Aug 05, 2019 at 11:01:44AM +0300, Christoph Hellwig wrote:
> All the way back to introducing dma_common_mmap we've defaulyed to mark
s/defaultyed/defaulted/
> the pages as uncached. But this is wrong for DMA coherent devices.
> Later on DMA_ATTR_WRITE_COMBINE also got incorrect treatment as that
> flag is only treated special on the alloc side for non-coherent devices.
>
> Introduce a new dma_pgprot helper that deals with the check for coherent
> devices so that only the remapping cases even reach arch_dma_mmap_pgprot
s/even/ever/
> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> index 1d3f0b5a9940..bd2b039f43a6 100644
> --- a/arch/arm64/mm/dma-mapping.c
> +++ b/arch/arm64/mm/dma-mapping.c
> @@ -14,9 +14,7 @@
> pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot,
> unsigned long attrs)
> {
> - if (!dev_is_dma_coherent(dev) || (attrs & DMA_ATTR_WRITE_COMBINE))
> - return pgprot_writecombine(prot);
> - return prot;
> + return pgprot_writecombine(prot);
> }
For arm64:
Acked-by: Catalin Marinas <catalin.marinas@....com>
Powered by blists - more mailing lists