From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D109AC433EF for ; Mon, 6 Dec 2021 16:33:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 82D8280DA8; Mon, 6 Dec 2021 16:33:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P2jKxTatnDuz; Mon, 6 Dec 2021 16:33:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id C825580CD0; Mon, 6 Dec 2021 16:33:35 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B2ACBC001E; Mon, 6 Dec 2021 16:33:35 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 55FABC0012 for ; Mon, 6 Dec 2021 16:33:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 434594022D for ; Mon, 6 Dec 2021 16:33:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w6Md9MGbKO3X for ; Mon, 6 Dec 2021 16:33:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp2.osuosl.org (Postfix) with ESMTP id 82F71400FB for ; Mon, 6 Dec 2021 16:33:33 +0000 (UTC) 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 E4C661042; Mon, 6 Dec 2021 08:33:32 -0800 (PST) Received: from [10.57.34.58] (unknown [10.57.34.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 51D9C3F73B; Mon, 6 Dec 2021 08:33:32 -0800 (PST) Message-ID: Date: Mon, 6 Dec 2021 16:33:28 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 07/11] dma-direct: fail allocations that can't be made coherent Content-Language: en-GB To: Christoph Hellwig , iommu@lists.linux-foundation.org References: <20211111065028.32761-1-hch@lst.de> <20211111065028.32761-8-hch@lst.de> From: Robin Murphy In-Reply-To: <20211111065028.32761-8-hch@lst.de> Cc: David Rientjes X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2021-11-11 06:50, Christoph Hellwig wrote: > If the architecture can't remap or set an address uncached there is no way > to fullfill a request for a coherent allocation. Return NULL in that case. > Note that this case currently does not happen, so this is a theoretical > fixup and/or a preparation for eventually supporting platforms that > can't support coherent allocations with the generic code. Reviewed-by: Robin Murphy > Signed-off-by: Christoph Hellwig > --- > kernel/dma/direct.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c > index f9658fe18498c..a13017656ecae 100644 > --- a/kernel/dma/direct.c > +++ b/kernel/dma/direct.c > @@ -233,8 +233,9 @@ void *dma_direct_alloc(struct device *dev, size_t size, > return dma_direct_alloc_from_pool(dev, size, > dma_handle, gfp); > } else { > - if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) > - set_uncached = true; > + if (!IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) > + return NULL; > + set_uncached = true; > } > } > > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu