From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 19/33] dma-mapping: warn when there is no coherent_dma_mask Date: Fri, 12 Jan 2018 08:16:48 -0500 Message-ID: <20180112131646.GA26900__219.70735765553$1515762912$gmane$org@localhost.localdomain> References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-20-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180110080027.13879-20-hch@lst.de> Sender: linux-m68k-owner@vger.kernel.org List-Id: linux-m68k@vger.kernel.org To: Christoph Hellwig Cc: iommu@lists.linux-foundation.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-cris-kernel@axis.com, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-metag@vger.kernel.org, Michal Simek , linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, patches@groups.riscv.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Guan Xuetao , x86@kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org On Wed, Jan 10, 2018 at 09:00:13AM +0100, Christoph Hellwig wrote: > These days all devices should have a DMA coherent mask, and most dma_ops > implementations rely on that fact. But just to be sure add an assert to > ring the warning bell if that is not the case. > > Signed-off-by: Christoph Hellwig Reviewed-by: Konrad Rzeszutek Wilk > --- > include/linux/dma-mapping.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index d84951865be7..9f28b2fa329e 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -513,6 +513,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, > void *cpu_addr; > > BUG_ON(!ops); > + WARN_ON_ONCE(!dev->coherent_dma_mask); > > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > -- > 2.14.2 >