[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2bd6f4b-a932-5251-517b-83bbccfe7c53@arm.com>
Date: Wed, 10 Jan 2018 09:31:45 +0000
From: Vladimir Murzin <vladimir.murzin@....com>
To: Christoph Hellwig <hch@....de>, iommu@...ts.linux-foundation.org
Cc: linux-mips@...ux-mips.org, linux-ia64@...r.kernel.org,
linux-sh@...r.kernel.org, sparclinux@...r.kernel.org,
Guan Xuetao <gxt@...c.pku.edu.cn>, linux-arch@...r.kernel.org,
linux-s390@...r.kernel.org, linux-c6x-dev@...ux-c6x.org,
linux-hexagon@...r.kernel.org, x86@...nel.org,
Konrad Rzeszutek Wilk <konrad@...nok.org>,
linux-snps-arc@...ts.infradead.org,
linux-m68k@...ts.linux-m68k.org, patches@...ups.riscv.org,
linux-metag@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Michal Simek <monstr@...str.eu>, linux-parisc@...r.kernel.org,
linux-cris-kernel@...s.com, linux-kernel@...r.kernel.org,
linux-alpha@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 11/33] dma-mapping: move swiotlb arch helpers to a new
header
On 10/01/18 08:00, Christoph Hellwig wrote:
> index 9110988b92a1..f00833acb626 100644
> --- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
> +++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
> @@ -61,6 +61,14 @@ static inline void plat_post_dma_flush(struct device *dev)
> {
> }
>
> +static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
> +{
> + if (!dev->dma_mask)
> + return false;
> +
> + return addr + size <= *dev->dma_mask;
> +}
> +
I know it is copy&paste, but it seems it has off by one error and it should be
return addr + size - 1 <= *dev->dma_mask;
> dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
> phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
>
snip...
> diff --git a/arch/mips/include/asm/mach-loongson64/dma-coherence.h b/arch/mips/include/asm/mach-loongson64/dma-coherence.h
> index 1602a9e9e8c2..5cfda8f893e9 100644
> --- a/arch/mips/include/asm/mach-loongson64/dma-coherence.h
> +++ b/arch/mips/include/asm/mach-loongson64/dma-coherence.h
> @@ -17,6 +17,14 @@
>
> struct device;
>
> +static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
> +{
> + if (!dev->dma_mask)
> + return false;
> +
> + return addr + size <= *dev->dma_mask;
ditto
Cheers
Vladimir
Powered by blists - more mailing lists