Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754392AbeAJJcF (ORCPT + 1 other); Wed, 10 Jan 2018 04:32:05 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38626 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753843AbeAJJb7 (ORCPT ); Wed, 10 Jan 2018 04:31:59 -0500 Subject: Re: [PATCH 11/33] dma-mapping: move swiotlb arch helpers to a new header To: Christoph Hellwig , iommu@lists.linux-foundation.org Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Guan Xuetao , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, x86@kernel.org, Konrad Rzeszutek Wilk , linux-snps-arc@lists.infradead.org, linux-m68k@lists.linux-m68k.org, patches@groups.riscv.org, linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Simek , linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-12-hch@lst.de> From: Vladimir Murzin Message-ID: Date: Wed, 10 Jan 2018 09:31:45 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180110080027.13879-12-hch@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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