From patchwork Wed Feb 22 13:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13149174 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 9A386C636D6 for ; Wed, 22 Feb 2023 13:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Jlvr5EGe/MwZPBLy1uTM+F2GYhBdhlNOxsOn3FV6dBk=; b=4dNXgodUIDu26p hk7GJ9jYqG9JEHMfOZS+Bh5X3uMzGn+5yag1fgpkFmXf3AAw6LOcSjGWbp9oLK7k6HNpHa23x2thV I+vvAFABKziFoz4up6MwxfGoVE4VzLl4FYNxNzAhOtrAvKCciLd8mMRaR9hI1sdLnX6INAeiPWd8m Gx7yfmmGzwWnJeOquGh5HasvrfY0qaK4y0VZFAH8iGbNqEK9uCy5CYibR1JGHKU280qPX6TZ/2L29 3XVgiKe5AT8Xassn0C8UEi/KPjkgp0wvUAkl2BaNJu/sBygUwelDFeCCMwB574wtHmEJaLw0RVVVc DDAPdrSiZPGfeGFmlRKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUpJG-00CXiQ-ST; Wed, 22 Feb 2023 13:37:26 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUpJE-00CXgV-7W for linux-riscv@lists.infradead.org; Wed, 22 Feb 2023 13:37:25 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 2EDC35C0121; Wed, 22 Feb 2023 08:37:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 22 Feb 2023 08:37:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1677073040; x=1677159440; bh=w9 MPuL3xvzlmyepaLfzNP3Yd6NyYPIjuZVV4oO83i4c=; b=Z9k/56ZNql9SmQjH8z KTyQCSI1IZ1NM2Yj9JWpAzAz3hnbjCpGdshk3Ra8L0dbAefCWwUgoJrZlvDfu5T1 K/L+D9sZ59n7AAk/yBR0zWYCFsxF+2h6jUuu798ERAg4iafehLBk1vvv5BkKxSZR T0WfKFm788ARSFTH+p39Ly6DMFpnvTP0M6waFf5vedhgMtuvRQ+L/PwnSP03bX5H 8tkfMxiTlHLBHSe3bfLkOIIYFCEsz9uCx9wkgOEnPd39wOYMRpFeqXPnfuR5S+AJ bU7mWQssr0Pvse4r6RXHikUPkwQzEeO3X/UYeCCYPM53JxkqwgUmtyo9lP1Dmgd+ ZC8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1677073040; x=1677159440; bh=w9MPuL3xvzlmy epaLfzNP3Yd6NyYPIjuZVV4oO83i4c=; b=t0+fpHEADym4UyAXwv8RABDiQxR2Q 4gr8wHJZ/37eH4oUG/xTdRNgRlf1o62QDvSv/LE8AUm4DxFsmz28+PSxKycYCmt3 BgYtnw9uQFmqOLw9Mrz1XGlXRWR8T9OCRktL4UUFb07DJOe1giUUnt740OEhNoEn 1UrMK+67Ean0yYV0Nz80kffJMD7kPvijn5HeBxEdFN1nmA6tfQP8mw5PpMbgWabU xaqwtrhLyYKPB7p/Lpdb+i7FQ06zm9ihVR/oN5F1KHXWIgVwUjTpENj+jEBUwfa0 4l10PZDnOlS1lDOR3ssdXABDUnXL1sxi8eFIZUlEdwv5VKIKABV7BR82w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejledghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Feb 2023 08:37:18 -0500 (EST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, tsbogend@alpha.franken.de, mpe@ellerman.id.au, paul.walmsley@sifive.com, palmer@dabbelt.com, robh+dt@kernel.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-riscv@lists.infradead.org, Jiaxun Yang Subject: [PATCH 1/3] dma-mapping: Provide a fallback dma_default_coherent Date: Wed, 22 Feb 2023 13:37:10 +0000 Message-Id: <20230222133712.8079-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230222133712.8079-1-jiaxun.yang@flygoat.com> References: <20230222133712.8079-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230222_053724_384243_11BA3B1D X-CRM114-Status: UNSURE ( 7.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org dma_default_coherent was decleared unconditionally at kernel/dma/mapping.c but only decleared when any of non-coherent options is enabled in dma-map-ops.h. Guard the declaration in mapping.c with non-coherent options and provide a fallback definition. Signed-off-by: Jiaxun Yang --- include/linux/dma-map-ops.h | 1 + kernel/dma/mapping.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h index 41bf4bdb117a..0a1aaf7163b3 100644 --- a/include/linux/dma-map-ops.h +++ b/include/linux/dma-map-ops.h @@ -269,6 +269,7 @@ static inline bool dev_is_dma_coherent(struct device *dev) return dev->dma_coherent; } #else +#define dma_default_coherent true static inline bool dev_is_dma_coherent(struct device *dev) { return true; diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index 68106e3791f6..80f9663ffe26 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -17,7 +17,11 @@ #include "debug.h" #include "direct.h" +#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ + defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ + defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) bool dma_default_coherent; +#endif /* * Managed DMA API From patchwork Wed Feb 22 13:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13149176 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 16E90C6379F for ; Wed, 22 Feb 2023 13:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xm5lVM8EDKgT+3YpLIFNGAHmLw8NNlG2njBdeacGkBA=; b=xpE8lpGnHpt8Z9 lJYuiXVGRn7a9zxMtkmxHAN1/2rkxxx4NO9iZOVcSdZIEt4h6OS22kpFPHUnnhOtQNNukJEgvZ8qZ EB/khzRNS3g93g/qk/hNMFZeuWO4a4JTF1URhINPlR9tYlhbINau98EuRer/Pq7aH9YimtPKLnltG IdRnFbsXFPU8yTWlo1OTRM9f/iddOKfy90q7+jUqehbb4RQHxny9CX0qshuhTtqTXhksECg9C/IAm RxRa/ibZ09QyPKgiPwDlRAjLejE0I2afDFNuT3TLXtXzCwUg5WvmqpH+LScn+6xR832X7sr1cTBUk 3CshZ7eNzZ18Ydk4miZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUpJL-00CXkP-B4; Wed, 22 Feb 2023 13:37:31 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUpJE-00CXgf-Mg for linux-riscv@lists.infradead.org; Wed, 22 Feb 2023 13:37:26 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3E9195C0114; Wed, 22 Feb 2023 08:37:22 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 22 Feb 2023 08:37:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1677073042; x=1677159442; bh=+/ 4foVkx/AAkjDoTO2qfVYMQOOmzfm5uV10l4tbGnOM=; b=bEC+HUAWsEqXDeJF4X MA1wqXCKJ3T2WcwxsnS4elTB0VjWbYBje7oacXsnUgnACmBeeGTB67w8FzAYkqV+ aXedw+fQrbk6Ch9T0UKEN/g9k8wqPAwrVmUGF6RBg0n1ZCzXlTU322qudJoDORSP gQ4KCCvuPkpvkGjZcVxXEQZKXoPedwlWjlt+3P0OBw30xeOQ8NtrDPb27k4vMhbB AnKak+Ybarxu4f5rTHMwmzj8cbrKbCd+y3tu2Su51ZDh4AaRLO1XLDK//BcIZmod P8vSn6rQzRWQFrph3P0YiywCRCfaLgV4RpxIQXvdpe/oiDwkAaoQdHl/s8uKAUdu BL9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1677073042; x=1677159442; bh=+/4foVkx/AAkj DoTO2qfVYMQOOmzfm5uV10l4tbGnOM=; b=lDTx8Fqm9+4FFLw32LKkKiTLwmjsn l0mUUxPCKnaLpsBBiYnHOJHUH0TF7ZblTTeqK6mJ0R2v3St5xbF2tbhe6vXGPjkr K3Q0GCn2kau2vIzfTDF/MA8F2CleyTwjfKDBICORHF+kr+373Y0Un07s5/EXt2iP sSLw1qR8QIO8ERnP2ikmBv+6d4jBge/anOebCHV+i0oLFB/ftSXv0nS5HftxAtbX ni4HtVZDoxtf6OPwBt/wvJF/DW4zkh20/yAbILyE+3KFe4hUMrwA7ZrgjQQ76jH1 S/sIFdtmfMVTWJGVMWoqV+lwwHsuNMrb68d1F3826n6W1sczGsZW4OnOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejledghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Feb 2023 08:37:20 -0500 (EST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, tsbogend@alpha.franken.de, mpe@ellerman.id.au, paul.walmsley@sifive.com, palmer@dabbelt.com, robh+dt@kernel.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-riscv@lists.infradead.org, Jiaxun Yang Subject: [PATCH 2/3] riscv: Set dma_default_coherent to true Date: Wed, 22 Feb 2023 13:37:11 +0000 Message-Id: <20230222133712.8079-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230222133712.8079-1-jiaxun.yang@flygoat.com> References: <20230222133712.8079-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230222_053724_847889_CA7B4C70 X-CRM114-Status: UNSURE ( 7.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org For riscv our assumption is unless a device states it is non-coherent, we take it to be DMA coherent. For devicetree probed devices that have been true since very begining with OF_DMA_DEFAULT_COHERENT selected. Signed-off-by: Jiaxun Yang --- arch/riscv/kernel/setup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 376d2827e736..34b371180976 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -300,6 +300,9 @@ void __init setup_arch(char **cmdline_p) riscv_init_cbom_blocksize(); riscv_fill_hwcap(); apply_boot_alternatives(); +#ifdef CONFIG_RISCV_DMA_NONCOHERENT + dma_default_coherent = true; +#endif if (IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM) && riscv_isa_extension_available(NULL, ZICBOM)) riscv_noncoherent_supported(); From patchwork Wed Feb 22 13:37:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13149177 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 882B1C636D6 for ; Wed, 22 Feb 2023 13:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s+Thy0wCDjbctcKMWvBu6L7XM/2Un2of2KL6NTrLDJg=; b=sNc8h3GuNpBzTt 5pPyhMgOV28cVVoWETJKU5XDvM0vrDGn2V70T3Wts7gXDXHM3Nxr9ZqcjyWBDPV5tcNq2VsuHe+Yh VjWd15n0TVnGcTL+lHmQAr32H4U6GiFlYI/0tlWUe3iK62a6IltQyKRckczynrb2146rm15Wvuvyy LO7Qc+XNadvuYBH1521niBxyx2j+7mwVaLjypxWp4tIzGQ0C2lLYrBJN6fEjxg5G062RcmEHE1Zo/ CbgAjdfkaPazUaDPIjhlxhHZT5AZcTODMyjmnOCAvodbJ6pfOKdimxsCDkdzg2CQ8m+61r/OfpSP7 H2GGoCO3b7LyKCAfweDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUpJM-00CXlH-HU; Wed, 22 Feb 2023 13:37:32 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUpJE-00CXhA-Qt for linux-riscv@lists.infradead.org; Wed, 22 Feb 2023 13:37:27 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3EC025C005D; Wed, 22 Feb 2023 08:37:24 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 22 Feb 2023 08:37:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1677073044; x=1677159444; bh=5z jeAJ2ng0uc67KhUvTeOlPjTfztQbBqYYqvTXy2dRg=; b=CnrFptuFsGKJRUfj22 eCJvIHR1rJ4rKKwuCSdvEU+t9keMUDYPlDxrKcdqiW0vC5egsutD5g7hoY5HP4i7 HMkxMbTWzCvonUHl+cEPckRAYx9ZmgvBYs2nTFAyLcI3uiAuukwtflA0h+n2BMtX D4c4H29o/Biee/U8QEwpNnT81CSqOzpHNXdTD4PuyxAFkqEbEnSY7rkqI4Zv/IBO lZQhHbZED7ZdPdCJW2zwOxN+gyQ0kfwifvdgTVupijeB/M1YFFTKGMxH8T7/XBY8 s0ryQ9kNXOEtaL17+KH3VNxIVNIK3CaT5rB/phV5snAiLpuwPiJ7jysU0003Jk0t hpFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1677073044; x=1677159444; bh=5zjeAJ2ng0uc6 7KhUvTeOlPjTfztQbBqYYqvTXy2dRg=; b=VzXR1xbEz1IC9r9+uv9wPm7aP/JYm taOclHyTm8DhAhbYsRGnFHa5ifieabUyklQVcAaMOmmh1jOttMTuNN64yGb1pkJo ZN9lsKeIetM7xEYG3zU2Ko30dMLs29mKeKRZdqM1lTWf/1XFEHmBtRTEwPh1yNwO IFHfS6W/kMf3DxmGvR562tP06uxyuItekl0iqQQfMxtQNa+vRe+uhaE8Xv3mvxVV SDLkEfgUkGrH+CXQwWdFMh2tLYm3h/pl3/VehpFL/z8ibRv1fFD+mKzD+MxQZgeD mgHThGHB/4Z7OYCzCdRgQojveVgnaSKqfFMvRK5cQm1DKvyqOIPdeJ8xQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejledgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Feb 2023 08:37:22 -0500 (EST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, tsbogend@alpha.franken.de, mpe@ellerman.id.au, paul.walmsley@sifive.com, palmer@dabbelt.com, robh+dt@kernel.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, linux-riscv@lists.infradead.org, Jiaxun Yang Subject: [PATCH 3/3] of: address: Use dma_default_coherent to determine default coherency Date: Wed, 22 Feb 2023 13:37:12 +0000 Message-Id: <20230222133712.8079-4-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230222133712.8079-1-jiaxun.yang@flygoat.com> References: <20230222133712.8079-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230222_053724_955810_61C88B3E X-CRM114-Status: GOOD ( 12.32 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org As for now all arches have dma_default_coherent matched with default DMA coherency for of devices, so there is no need to have a standalone config option. This also fixes a case that for some MIPS platforms, coherency information is not carried in devicetree and kernel will override dma_default_coherent at early boot. Note for PowerPC: CONFIG_OF_DMA_DEFUALT_COHERENT was only selected when CONFIG_NOT_COHERENT_CACHE is false, in this case dma_default_coherent will be true, so it still matches present behavior. Note for RISC-V: dma_default_coherent is set to true at init code in this series. Signed-off-by: Jiaxun Yang --- arch/powerpc/Kconfig | 1 - arch/riscv/Kconfig | 1 - drivers/of/Kconfig | 4 ---- drivers/of/address.c | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 2c9cdf1d8761..c67e5da714f7 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -272,7 +272,6 @@ config PPC select NEED_PER_CPU_PAGE_FIRST_CHUNK if PPC64 select NEED_SG_DMA_LENGTH select OF - select OF_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE select OF_EARLY_FLATTREE select OLD_SIGACTION if PPC32 select OLD_SIGSUSPEND diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 1d46a268ce16..406c6816d289 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -119,7 +119,6 @@ config RISCV select MODULES_USE_ELF_RELA if MODULES select MODULE_SECTIONS if MODULES select OF - select OF_DMA_DEFAULT_COHERENT select OF_EARLY_FLATTREE select OF_IRQ select PCI_DOMAINS_GENERIC if PCI diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 644386833a7b..e40f10bf2ba4 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -102,8 +102,4 @@ config OF_OVERLAY config OF_NUMA bool -config OF_DMA_DEFAULT_COHERENT - # arches should select this if DMA is coherent by default for OF devices - bool - endif # OF diff --git a/drivers/of/address.c b/drivers/of/address.c index 4c0b169ef9bf..23ade4919853 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1103,7 +1103,7 @@ phys_addr_t __init of_dma_get_max_cpu_address(struct device_node *np) bool of_dma_is_coherent(struct device_node *np) { struct device_node *node; - bool is_coherent = IS_ENABLED(CONFIG_OF_DMA_DEFAULT_COHERENT); + bool is_coherent = dma_default_coherent; node = of_node_get(np);