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@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" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=S2VrLKhJHAh0dKuEQzWxiXtDw8x8Tb9LRCIrg9P3Uaw=; b=P/wxkDz2beGylQBR9RyNJ9PnCii8w3iBPW0P9Q6NNegs/ZWGGxytI0Ja23Knak7C8p Q9/I7HxiNIIZ9Urt/OLEqB+zzs34hFHPHl7cw9kKKe66avfcDtXySQncdqrgDFhnqs6J cd9gfnosdYAhg3J4HRhncgDCm0HOlDQRAw92wEeusfZGBRrVWXSPfxxcHJU+DeU/3Cun elKEbYpnCCS+4DNph1sZVxYzunlcENYa8ormU+wTSloKbVb2v89y/U29ykC026WT/DEo 4XKBhrrEgJk9oWLmxLryNOzV854BsYZQfr+s7LfkfPW2r9/yLSefjVvsMb/AFp0EqU1Y R2Jw== Content-Disposition: inline In-Reply-To: <20180110080027.13879-20-hch-jcswGhMUV9g@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Christoph Hellwig Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Guan Xuetao , linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, linux-hexagon-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org, patches-q3qR2WxjNRFS9aJRtSZj7A@public.gmane.org, linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Michal Simek , linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-cris-kernel-VrBV9hrLPhE@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.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 >