From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1C31266CD for ; Mon, 16 Oct 2023 11:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE9648E; Mon, 16 Oct 2023 04:59:52 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B8461FB; Mon, 16 Oct 2023 05:00:33 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DA1E43F5A1; Mon, 16 Oct 2023 04:59:49 -0700 (PDT) Message-ID: <4f709c6d-0635-4136-9cfa-717484f47fde@arm.com> Date: Mon, 16 Oct 2023 12:59:49 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 08/12] dma-direct: warn when coherent allocations aren't supported Content-Language: en-GB To: Christoph Hellwig , Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Marek Szyprowski , Geert Uytterhoeven , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , linux-m68k@lists.linux-m68k.org, netdev@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Jim Quinlan References: <20231016054755.915155-1-hch@lst.de> <20231016054755.915155-9-hch@lst.de> From: Robin Murphy In-Reply-To: <20231016054755.915155-9-hch@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On 16/10/2023 6:47 am, Christoph Hellwig wrote: > Log a warning once when dma_alloc_coherent fails because the platform > does not support coherent allocations at all. Reviewed-by: Robin Murphy > Signed-off-by: Christoph Hellwig > --- > kernel/dma/direct.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c > index 1327d04fa32a25..fddfea3b2fe173 100644 > --- a/kernel/dma/direct.c > +++ b/kernel/dma/direct.c > @@ -240,8 +240,10 @@ void *dma_direct_alloc(struct device *dev, size_t size, > */ > set_uncached = IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED); > remap = IS_ENABLED(CONFIG_DMA_DIRECT_REMAP); > - if (!set_uncached && !remap) > + if (!set_uncached && !remap) { > + pr_warn_once("coherent DMA allocations not supported on this platform.\n"); > return NULL; > + } > } > > /*