From patchwork Mon Oct 16 05:47:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422518 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D04DBCDB474 for ; Mon, 16 Oct 2023 05:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231561AbjJPFsP (ORCPT ); Mon, 16 Oct 2023 01:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbjJPFsO (ORCPT ); Mon, 16 Oct 2023 01:48:14 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921C7F4; Sun, 15 Oct 2023 22:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WUNnW2AzudcNr4qo2U1qAYpqA55+BUJ9igvSrFrJsk0=; b=k9gRQmW3KX85+dvAm7SRblzVlF 8yt/+UihM/RmRRmyHk7PBZmtccb2GrfmrT5QymkNnPZTjG6GkUfDtN/+PBwoFbAtc2nTHA1LofGoZ kh1TQEbcNuFER0Y9kUOxeWC1WE5P4Py6NxanrNWyKv0AR3+Udgz+XfDE9DFlZ/B2w/2c8KMYbxZma RpSFh2lh7P5O/gyf+225JI9+v+QQ0TJkz/9EKr3Bjh0UTx8crzMs8TqaTNr2h9IQ5h0U1knAU9VWB CUnV+4VVZ0xZgseUkikX2np0Wpg+R+/8MsNZAeJDEXqdinkkQKFYAh7i+HIfcbEsQgHcg3oI1I1qA FdymHa9g==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSP-008QfY-1h; Mon, 16 Oct 2023 05:48:01 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 01/12] riscv: RISCV_NONSTANDARD_CACHE_OPS shouldn't depend on RISCV_DMA_NONCOHERENT Date: Mon, 16 Oct 2023 07:47:43 +0200 Message-Id: <20231016054755.915155-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org RISCV_NONSTANDARD_CACHE_OPS is also used for the pmem cache maintenance helpers, which are built into the kernel unconditionally. Signed-off-by: Christoph Hellwig Acked-by: Conor Dooley --- arch/riscv/Kconfig | 1 - drivers/cache/Kconfig | 2 +- drivers/soc/renesas/Kconfig | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index d607ab0f7c6daf..0ac0b538379718 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -277,7 +277,6 @@ config RISCV_DMA_NONCOHERENT config RISCV_NONSTANDARD_CACHE_OPS bool - depends on RISCV_DMA_NONCOHERENT help This enables function pointer support for non-standard noncoherent systems to handle cache management. diff --git a/drivers/cache/Kconfig b/drivers/cache/Kconfig index a57677f908f3ba..d6e5e3abaad8af 100644 --- a/drivers/cache/Kconfig +++ b/drivers/cache/Kconfig @@ -3,7 +3,7 @@ menu "Cache Drivers" config AX45MP_L2_CACHE bool "Andes Technology AX45MP L2 Cache controller" - depends on RISCV_DMA_NONCOHERENT + depends on RISCV select RISCV_NONSTANDARD_CACHE_OPS help Support for the L2 cache controller on Andes Technology AX45MP platforms. diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index 12040ce116a551..880c544bb2dfda 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -335,7 +335,7 @@ config ARCH_R9A07G043 bool "RISC-V Platform support for RZ/Five" depends on NONPORTABLE select ARCH_RZG2L - select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT + select AX45MP_L2_CACHE select DMA_GLOBAL_POOL select ERRATA_ANDES if RISCV_SBI select ERRATA_ANDES_CMO if ERRATA_ANDES From patchwork Mon Oct 16 05:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422519 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 469F4C41513 for ; Mon, 16 Oct 2023 05:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbjJPFsR (ORCPT ); Mon, 16 Oct 2023 01:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbjJPFsP (ORCPT ); Mon, 16 Oct 2023 01:48:15 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BF3E4; Sun, 15 Oct 2023 22:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=09OXcjV5LjWtZgzHphgSEOzGoq+sVyJJ1rTh412jyyc=; b=QVxDSiE7PtzcAx7kdTFFhVH1A+ L+vIzroq4ifhL++4BR+7byFq3XULMiKqN5PKahJdNRmuPu1Pyj7hCfo5NDTaQeokmSktZoHBXWSoe YRTw7HBbQPdYgxdcQiDRsQF8STUjdIhbVxhfwckO7PbwvH8Jzax6Tm9U+Rq6IowbFMrSIA/k74Jyg i+N+nuUAC608YRtjWI6rmf8gs7KJVjCkJ2raNCUEDaIHLLvhjHkQV2622tpqOfPaC1c7JDuRUYlix ettTWh6+82c7wQ167i+NhQ5rf6lBudSL8AX0gVpSAn/4s/KEL8ZZ4VBK9lWdWFLzQWCjK2ZlsT3ad 06HD7czg==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSR-008QgM-30; Mon, 16 Oct 2023 05:48:04 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 02/12] riscv: only select DMA_DIRECT_REMAP from RISCV_ISA_ZICBOM Date: Mon, 16 Oct 2023 07:47:44 +0200 Message-Id: <20231016054755.915155-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org RISCV_DMA_NONCOHERENT is also used for whacky non-standard non-coherent ops that use different hooks in dma-direct. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy Reviewed-by: Conor Dooley Reviewed-by: Lad Prabhakar --- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0ac0b538379718..9c48fecc671918 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -273,7 +273,6 @@ config RISCV_DMA_NONCOHERENT select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select DMA_BOUNCE_UNALIGNED_KMALLOC if SWIOTLB - select DMA_DIRECT_REMAP if MMU config RISCV_NONSTANDARD_CACHE_OPS bool @@ -549,6 +548,7 @@ config RISCV_ISA_ZICBOM depends on RISCV_ALTERNATIVE default y select RISCV_DMA_NONCOHERENT + select DMA_DIRECT_REMAP help Adds support to dynamically detect the presence of the ZICBOM extension (Cache Block Management Operations) and enable its From patchwork Mon Oct 16 05:47:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422520 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE17CDB465 for ; Mon, 16 Oct 2023 05:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231679AbjJPFsQ (ORCPT ); Mon, 16 Oct 2023 01:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbjJPFsP (ORCPT ); Mon, 16 Oct 2023 01:48:15 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 877ACA1; Sun, 15 Oct 2023 22:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=z6mlPBQ4mdlVnTNTeM4g6TWg8QEfdqiB3mI+2DaIjVk=; b=YKyyhZdf5dNjANUOyI2HrJCIV0 U1b00I+wKUKo117XL/o4YqG/7CSwo82Nt84ERwS2j6D/6oqFSVy2m0PPuid4ijwkV2mZHWK3cl9qP D+Jxn4qLo5ExWSk9zjUYofh7qHwWin0AJJlg2YFfcQcutwo1YiHX4SlWrbPGG+YrefwgIwRdU4y4H WosBEtbP5BtoiIiEJptDJes47mHRPUXh0Jd+7viXZLEugUD9/zb3usGG16gGmPvxxIpiKUP5bKraI IVLlzXBHJoSGwFbBP2iCWYxryZ5ysqqi8iqmbnnU0d2aeNwazNkhToLQ9umEVkTBCfU1JfSL919FN MfOILygA==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSU-008QhF-0t; Mon, 16 Oct 2023 05:48:06 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 03/12] soc: renesas: ARCH_R9A07G043 depends on !RISCV_ISA_ZICBOM Date: Mon, 16 Oct 2023 07:47:45 +0200 Message-Id: <20231016054755.915155-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org ARCH_R9A07G043 has it's own non-standard global pool based DMA coherent allocator, which conflicts with the remap based RISCV_ISA_ZICBOM version. Add a proper dependency. Signed-off-by: Christoph Hellwig Acked-by: Conor Dooley Reviewed-by: Lad Prabhakar Acked-by: Geert Uytterhoeven --- drivers/soc/renesas/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index 880c544bb2dfda..f1696d3b5018d0 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -334,6 +334,7 @@ if RISCV config ARCH_R9A07G043 bool "RISC-V Platform support for RZ/Five" depends on NONPORTABLE + depends on !RISCV_ISA_ZICBOM select ARCH_RZG2L select AX45MP_L2_CACHE select DMA_GLOBAL_POOL From patchwork Mon Oct 16 05:47:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422521 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2A30CDB482 for ; Mon, 16 Oct 2023 05:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231511AbjJPFsX (ORCPT ); Mon, 16 Oct 2023 01:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231617AbjJPFsQ (ORCPT ); Mon, 16 Oct 2023 01:48:16 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B307EB; Sun, 15 Oct 2023 22:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=gt7hk3btUxEv3Hn2ba+B24UAyMydIMFE5ojTDMGob44=; b=EgsU8LDZqv6jWwuE7cUWy4GNXH m5jsHWvlqMlxek7E72uAnfet+I1jB8tw8EYNK8a9ZWSkJBZh10vmrBixCtQv4xuDpXFd8s9Ab895y NQ4hYGEIV8YEN+5ErOMybwMUqJmUMaaYmNR36VSw3Ud9pCgyEAID8j9gHszxHqCARhgEdE0arELiI V9Eg1YhKrc3o0UmhEhz6i+0kXWYr+tO6h3iEcMl881ka0l9PPkG7WvVkL1JBaQFigDmMu6zJhguTm 6V3cWNTzOLoQtoVaYGMfIAYdE4Vb8Fpjno8bF8A9qby43D+8aGDOxEegDj6KB4H9bhaVuWZMuZZAD OvElTZKQ==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSW-008QiW-2B; Mon, 16 Oct 2023 05:48:09 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 04/12] soc: renesas: select RISCV_DMA_NONCOHERENT from ARCH_R9A07G043 Date: Mon, 16 Oct 2023 07:47:46 +0200 Message-Id: <20231016054755.915155-5-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Selecting DMA_GLOBAL_POOL without the rest of the non-coherent DMA infrastructure does not make sense. Signed-off-by: Christoph Hellwig Acked-by: Conor Dooley Reviewed-by: Lad Prabhakar Acked-by: Geert Uytterhoeven --- drivers/soc/renesas/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index f1696d3b5018d0..ea473b4150dfa8 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -338,6 +338,7 @@ config ARCH_R9A07G043 select ARCH_RZG2L select AX45MP_L2_CACHE select DMA_GLOBAL_POOL + select RISCV_DMA_NONCOHERENT select ERRATA_ANDES if RISCV_SBI select ERRATA_ANDES_CMO if ERRATA_ANDES From patchwork Mon Oct 16 05:47:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422522 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73EC6CDB465 for ; Mon, 16 Oct 2023 05:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjJPFsY (ORCPT ); Mon, 16 Oct 2023 01:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231770AbjJPFsW (ORCPT ); Mon, 16 Oct 2023 01:48:22 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0CE6E4; Sun, 15 Oct 2023 22:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=RPVFtxbF5hQhoqQwe72Q5ekV/Nn+oUkF+V9bnWf8/qY=; b=3s/GQaxhf5T1tV4r1mrt44XKn+ dTjx2MCGBSGDsab9TBZdJjZyROqt2EDb8UGKnk/OXyQRdIoofI0/+NspXKDzFVJtZN7eGmlYUP5HF oa9H2jCtARohOmceDQZqk3T8+lv9SiRnPhQkBOWr9GgXJV2SC2IDlayWLhU2jn/ULNkTDeGwVbs5C +rZT5hmgfahsNr8tVv+s84nnIaLw9HtEfgRsrc+Dk+hlSccNuyhwNF0fPJKdXmlMG4YBSsJSGI+Kj 04hfLqQcgSCNhcTaT/D7aXv9AkF6szmJo08DrcjZ0mupH71J3WElHTdRKEwKyQ6kEG49s+YKRadEw /i1UiYeg==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSZ-008Qjw-0N; Mon, 16 Oct 2023 05:48:11 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 05/12] dma-direct: add depdenencies to CONFIG_DMA_GLOBAL_POOL Date: Mon, 16 Oct 2023 07:47:47 +0200 Message-Id: <20231016054755.915155-6-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org CONFIG_DMA_GLOBAL_POOL can't be combined with other DMA coherent allocators. Add dependencies to Kconfig to document this, and make kconfig complain about unment dependencies if someone tries. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy Reviewed-by: Lad Prabhakar --- kernel/dma/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index f488997b071712..4524db877eba36 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -135,6 +135,8 @@ config DMA_COHERENT_POOL config DMA_GLOBAL_POOL select DMA_DECLARE_COHERENT + depends on !ARCH_HAS_DMA_SET_UNCACHED + depends on !DMA_DIRECT_REMAP bool config DMA_DIRECT_REMAP From patchwork Mon Oct 16 05:47:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422523 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB59CDB484 for ; Mon, 16 Oct 2023 05:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231745AbjJPFs1 (ORCPT ); Mon, 16 Oct 2023 01:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231276AbjJPFsX (ORCPT ); Mon, 16 Oct 2023 01:48:23 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7956BFB; Sun, 15 Oct 2023 22:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=+FPz7Ddw0opVwX7ZO8En7vSHubL/dQg5n7dN1DBxBIs=; b=JaJecFTPI62ol/ujAU6+xzdcS1 xxYEqP903rSRjbZaAaTdgiFl5T2wuyVPVV/SGhnHZ4D2oXimjn1tKzK0urB2sGTYywR0F0qTzvp2l rp6d1g9BRSwlfAkYI2o2vysJl3EX8Yykt+hNFFLZ+9lz3e3PAubXPCAp/k/FpVNfxjALodLVLIL2r v/L1j8fraL8vFKcR+GWCm5dsuWCSzPgXAGE1G7hCazeirfazrLI8YnnJq9rqMUM8KoeW0hGkcmZ1B puIcMPPV517sjRY5xh2DTm/taqP+/hiCQIQIt6xx/jNr2jV9WmLSdBN+qMCjt5AL1P9tESsEzJ9P3 RlzR0oOA==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSb-008QlK-2d; Mon, 16 Oct 2023 05:48:14 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 06/12] dma-direct: add a CONFIG_ARCH_DMA_ALLOC symbol Date: Mon, 16 Oct 2023 07:47:48 +0200 Message-Id: <20231016054755.915155-7-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Instead of using arch_dma_alloc if none of the generic coherent allocators are used, require the architectures to explicitly opt into providing it. This will used to deal with the case of m68knommu and coldfire where we can't do any coherent allocations whatsoever, and also makes it clear that arch_dma_alloc is a last resort. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- arch/arm/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/parisc/Kconfig | 1 + kernel/dma/Kconfig | 9 +++++++++ kernel/dma/direct.c | 12 ++---------- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9557808e8937b1..a3fdf584278f86 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -4,6 +4,7 @@ config ARM default y select ARCH_32BIT_OFF_T select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND + select ARCH_DMA_ALLOC if MMU select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 3e318bf9504c5b..0430b8ba6b5cc6 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -3,6 +3,7 @@ config M68K bool default y select ARCH_32BIT_OFF_T + select ARCH_DMA_ALLOC if !MMU || COLDFIRE select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index a15ab147af2e07..30a4916fa9b0cc 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -3,6 +3,7 @@ config PARISC def_bool y select ALTERNATE_USER_ADDRESS_SPACE select ARCH_32BIT_OFF_T if !64BIT + select ARCH_DMA_ALLOC if PA11 select ARCH_MIGHT_HAVE_PC_PARPORT select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 4524db877eba36..515d2063b509ac 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -144,6 +144,15 @@ config DMA_DIRECT_REMAP select DMA_COHERENT_POOL select DMA_NONCOHERENT_MMAP +# +# Fallback to arch code for DMA allocations. This should eventually go away. +# +config ARCH_DMA_ALLOC + depends on !ARCH_HAS_DMA_SET_UNCACHED + depends on !DMA_DIRECT_REMAP + depends on !DMA_GLOBAL_POOL + bool + config DMA_CMA bool "DMA Contiguous Memory Allocator" depends on HAVE_DMA_CONTIGUOUS && CMA diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 9596ae1aa0dacf..ec410af1d8a14e 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -220,13 +220,7 @@ void *dma_direct_alloc(struct device *dev, size_t size, return dma_direct_alloc_no_mapping(dev, size, dma_handle, gfp); if (!dev_is_dma_coherent(dev)) { - /* - * Fallback to the arch handler if it exists. This should - * eventually go away. - */ - if (!IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED) && - !IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) && - !IS_ENABLED(CONFIG_DMA_GLOBAL_POOL) && + if (IS_ENABLED(CONFIG_ARCH_DMA_ALLOC) && !is_swiotlb_for_alloc(dev)) return arch_dma_alloc(dev, size, dma_handle, gfp, attrs); @@ -330,9 +324,7 @@ void dma_direct_free(struct device *dev, size_t size, return; } - if (!IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED) && - !IS_ENABLED(CONFIG_DMA_DIRECT_REMAP) && - !IS_ENABLED(CONFIG_DMA_GLOBAL_POOL) && + if (IS_ENABLED(CONFIG_ARCH_DMA_ALLOC) && !dev_is_dma_coherent(dev) && !is_swiotlb_for_alloc(dev)) { arch_dma_free(dev, size, cpu_addr, dma_addr, attrs); From patchwork Mon Oct 16 05:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422524 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB157CDB465 for ; Mon, 16 Oct 2023 05:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjJPFs1 (ORCPT ); Mon, 16 Oct 2023 01:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbjJPFsY (ORCPT ); Mon, 16 Oct 2023 01:48:24 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16A14A1; Sun, 15 Oct 2023 22:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=nLXJ74DIlmTyEfUCPxCnxHOKUZ2EbH9X62hrp3In1pc=; b=09FmZ4C/8PRH4IgHw5MMHG02Ny tTIrjcr6BA4ng0RZblTOiQIedflmn/wKbA5qX4pOe3gvVxcol1aSzltYvqgGVP9B4/fqNbKFrwpIS zv4YrACogT+ZSpR4Wg0vSg+b7ADzdLb3VXTZ4fcu5fY+fdJUzK60grBma2GPM+gF08XxQl/WCddP3 tvj/64IYNZvmz7MvVQKsjjHfuZ8ITh3u2Pq8D6doV0Ro0E2OZ9HxI20HOLWwvTLwGce7qd5l3Hm0N V0z3YjmoJZ5/WK13hizinR7du2LzmudVqcK1MlZ+lLUK/IhZPmQ6uipRfKrkLAgfBYVGi5u7CbBuZ tLAWwddQ==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSe-008QoD-1S; Mon, 16 Oct 2023 05:48:16 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 07/12] dma-direct: simplify the use atomic pool logic in dma_direct_alloc Date: Mon, 16 Oct 2023 07:47:49 +0200 Message-Id: <20231016054755.915155-8-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The logic in dma_direct_alloc when to use the atomic pool vs remapping grew a bit unreadable. Consolidate it into a single check, and clean up the set_uncached vs remap logic a bit as well. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- kernel/dma/direct.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index ec410af1d8a14e..1327d04fa32a25 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -234,27 +234,22 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_handle); /* - * Otherwise remap if the architecture is asking for it. But - * given that remapping memory is a blocking operation we'll - * instead have to dip into the atomic pools. + * Otherwise we require the architecture to either be able to + * mark arbitrary parts of the kernel direct mapping uncached, + * or remapped it uncached. */ + set_uncached = IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED); remap = IS_ENABLED(CONFIG_DMA_DIRECT_REMAP); - if (remap) { - if (dma_direct_use_pool(dev, gfp)) - return dma_direct_alloc_from_pool(dev, size, - dma_handle, gfp); - } else { - if (!IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) - return NULL; - set_uncached = true; - } + if (!set_uncached && !remap) + return NULL; } /* - * Decrypting memory may block, so allocate the memory from the atomic - * pools if we can't block. + * Remapping or decrypting memory may block, allocate the memory from + * the atomic pools instead if we aren't allowed block. */ - if (force_dma_unencrypted(dev) && dma_direct_use_pool(dev, gfp)) + if ((remap || force_dma_unencrypted(dev)) && + dma_direct_use_pool(dev, gfp)) return dma_direct_alloc_from_pool(dev, size, dma_handle, gfp); /* we always manually zero the memory once we are done */ From patchwork Mon Oct 16 05:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422525 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77602CDB482 for ; Mon, 16 Oct 2023 05:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230479AbjJPFsf (ORCPT ); Mon, 16 Oct 2023 01:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbjJPFs3 (ORCPT ); Mon, 16 Oct 2023 01:48:29 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7EAED; Sun, 15 Oct 2023 22:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=RfzJ0rmOfGgYG4ZhoNJ82M0rcD99jku72cgM5LPVp6w=; b=reTWTHBfcmdUv9mxw9ih2F8KzH Ul2ZYncNIWm4uRU9zqbmoaOqK+HuJUlnidtr4gO9Tt4JrMr/SBExJmfk2Gb1cTqCH5kBplyeOf4O2 7llMFc9qN4ws/+HK9w+JPPlOJ4DhXx8Jh8SMyoqQhK032lIXBIx+Fa6ZFbD359kb96qqjTFJ8m+85 rG3EUmLTWZtgAkleBaSFOBRPWcDrzoh4UxDfvmzfmvS6Z91gxDZey/nklk6+1S0ju7MoJ8+Pfku1O AtYWsy1J7n1aXqRWzBroseoeRwjCA60UWQhIqAzyLxJFdAZFfNorErvjpcYS2ZiJ7T8ih6YC/V39E ZbxOeCvQ==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSg-008QrU-2t; Mon, 16 Oct 2023 05:48:19 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 08/12] dma-direct: warn when coherent allocations aren't supported Date: Mon, 16 Oct 2023 07:47:50 +0200 Message-Id: <20231016054755.915155-9-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Log a warning once when dma_alloc_coherent fails because the platform does not support coherent allocations at all. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- 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; + } } /* From patchwork Mon Oct 16 05:47:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422526 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0765ACDB474 for ; Mon, 16 Oct 2023 05:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjJPFsf (ORCPT ); Mon, 16 Oct 2023 01:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231770AbjJPFsa (ORCPT ); Mon, 16 Oct 2023 01:48:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B7BAD6; Sun, 15 Oct 2023 22:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Xvh7Q4BkliSXnT7Ag6Or9ECxhuG0z7KZ9ZBBigZbpKk=; b=sXex8CGidA3UYIp/+9bbjcFPx+ pMqiOUbeWagvKBIYUxlfbSzifLi+AoxfLOLyxRUpbIaW0RlerBxsLHobzV54a3U69NmvuIGo6iEM0 48QlWkRmyAF9b3GJ9y294r+C/nLNKehncrQgxYzmiqxYVRM8mbsH2kEgWP483P19hy2pOF32gwafW 7Onn+RGB0EOUXMnvuUTHO2S9tGzXaHQs3xC3fnAcHxb/PUE2PgVuX6YV/DfXwXrCEbt0HXkghIQCB rO3hR3D3Vie8+pOBFxheoh0Ypv5VJ61IZptaCLg1wBKNYzK8jqFuDaazksDZe0EjUOTddFbsU9xw6 pQQne1RQ==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSj-008Qua-13; Mon, 16 Oct 2023 05:48:21 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 09/12] m68k: use the coherent DMA code for coldfire without data cache Date: Mon, 16 Oct 2023 07:47:51 +0200 Message-Id: <20231016054755.915155-10-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Coldfire cores configured without a data cache are DMA coherent and should thus simply use the simple coherent version of dma-direct. Introduce a new COLDFIRE_COHERENT_DMA Kconfig symbol as a convenient short hand for such configurations, and a M68K_NONCOHERENT_DMA symbol for all cases where we need to build non-coherent DMA infrastructure to simplify the Kconfig and code conditionals. Not building the non-coherent DMA code slightly reduces the code size for such configurations. Numers for m5249evb_defconfig below: text data bss dec hex filename 2896158 401052 65392 3362602 334f2a vmlinux.before 2895166 400988 65392 3361546 334b0a vmlinux.after Signed-off-by: Christoph Hellwig Acked-by: Geert Uytterhoeven --- arch/m68k/Kconfig | 8 ++++---- arch/m68k/Kconfig.cpu | 12 ++++++++++++ arch/m68k/kernel/Makefile | 2 +- arch/m68k/kernel/dma.c | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 0430b8ba6b5cc6..6c585eae89f4dc 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -3,19 +3,19 @@ config M68K bool default y select ARCH_32BIT_OFF_T - select ARCH_DMA_ALLOC if !MMU || COLDFIRE + select ARCH_DMA_ALLOC if M68K_NONCOHERENT_DMA && COLDFIRE select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER - select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE - select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA + select ARCH_HAS_DMA_PREP_COHERENT if M68K_NONCOHERENT_DMA && !COLDFIRE + select ARCH_HAS_SYNC_DMA_FOR_DEVICE if M68K_NONCOHERENT_DMA select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS select ARCH_MIGHT_HAVE_PC_PARPORT if ISA select ARCH_NO_PREEMPT if !COLDFIRE select ARCH_USE_MEMTEST if MMU_MOTOROLA select ARCH_WANT_IPC_PARSE_VERSION select BINFMT_FLAT_ARGVP_ENVP_ON_STACK - select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE + select DMA_DIRECT_REMAP if M68K_NONCOHERENT_DMA && !COLDFIRE select GENERIC_ATOMIC64 select GENERIC_CPU_DEVICES select GENERIC_IOMAP diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu index b826e9c677b2ae..e8905d38c714c4 100644 --- a/arch/m68k/Kconfig.cpu +++ b/arch/m68k/Kconfig.cpu @@ -535,3 +535,15 @@ config CACHE_COPYBACK The ColdFire CPU cache is set into Copy-back mode. endchoice endif # HAVE_CACHE_CB + +# Coldfire cores that do not have a data cache configured can do coherent DMA. +config COLDFIRE_COHERENT_DMA + bool + default y + depends on COLDFIRE + depends on !HAVE_CACHE_CB && !CONFIG_CACHE_D && !CONFIG_CACHE_BOTH + +config M68K_NONCOHERENT_DMA + bool + default y + depends on HAS_DMA && !COLDFIRE_COHERENT_DMA diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index af015447dfb4c1..01fb69a5095f43 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile @@ -23,7 +23,7 @@ obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o obj-$(CONFIG_PCI) += pcibios.o -obj-$(CONFIG_HAS_DMA) += dma.o +obj-$(CONFIG_M68K_NONCOHERENT_DMA) += dma.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c index 2e192a5df949bb..f83870cfa79b37 100644 --- a/arch/m68k/kernel/dma.c +++ b/arch/m68k/kernel/dma.c @@ -17,7 +17,7 @@ #include -#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) +#ifndef CONFIG_COLDFIRE void arch_dma_prep_coherent(struct page *page, size_t size) { cache_push(page_to_phys(page), size); From patchwork Mon Oct 16 05:47:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422527 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C07CDB483 for ; Mon, 16 Oct 2023 05:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231719AbjJPFsg (ORCPT ); Mon, 16 Oct 2023 01:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbjJPFsc (ORCPT ); Mon, 16 Oct 2023 01:48:32 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3A5EF2; Sun, 15 Oct 2023 22:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=mtaFs+wzt9HkB0YMSqJ/hXvaBaJHLD/P5gvZvdhiE64=; b=EV+u9l4mk8RQYm/EX2EbeAcc4w ogppRd8bc1GCnEqi8+1QYFO2eN1mWS0182wHGtTsvg2XVGJ06CM195uz13JFmYAf/wAd3zm4gEITP hq6jWIG6lN3s2ZDTHv+JUSOWDam664hqayTVCgBT9j2jOezFFb2BtKfIo6w4fKd82YQ7TmKqKhyIP 1g7zWmPHlRNeOZKUwT8mn1fRNv8Yjukb54nGxgWUGS+81rnhDIPfj1tnuVtB8dooMOtrt5SICiC9I PAUcfJvEu3/R0L7h/lUYz05tL3Ux5f7iVfA3Xz8w9i8gmMFpEexY+FLdi5GjYcu+sHRGWJhxSnvjr JXYs2LgA==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSl-008Qwm-2w; Mon, 16 Oct 2023 05:48:24 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 10/12] net: fec: use dma_alloc_noncoherent for data cache enabled coldfire Date: Mon, 16 Oct 2023 07:47:52 +0200 Message-Id: <20231016054755.915155-11-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Coldfire platforms with data caches can't properly implement dma_alloc_coherent and currently just return noncoherent memory from dma_alloc_coherent. The fec driver than works around this with a flush of all caches in the receive path. Make this hack a little less bad by using the explicit dma_alloc_noncoherent API and documenting the hacky cache flushes so that the DMA API level hack can be removed. Also replace the check for CONFIG_M532x for said hack with a check for COLDFIRE && !COLDFIRE_COHERENT_DMA. While m532x is the only such platform with a fec module, this makes the code more consistent and easier to follow. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/freescale/fec_main.c | 86 ++++++++++++++++++++--- 1 file changed, 76 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 77c8e9cfb44562..3fc3444402622b 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -406,6 +406,70 @@ static void fec_dump(struct net_device *ndev) } while (bdp != txq->bd.base); } +/* + * Coldfire does not support DMA coherent allocations, and has historically used + * a band-aid with a manual flush in fec_enet_rx_queue. + */ +#if defined(CONFIG_COLDFIRE) && !defined(CONFIG_COLDFIRE_COHERENT_DMA) +static void *fec_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, + gfp_t gfp) +{ + return dma_alloc_noncoherent(dev, size, handle, DMA_BIDIRECTIONAL, gfp); +} + +static void fec_dma_free(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t handle) +{ + dma_free_noncoherent(dev, size, cpu_addr, handle, DMA_BIDIRECTIONAL); +} +#else /* CONFIG_COLDFIRE && !CONFIG_COLDFIRE_COHERENT_DMA */ +static void *fec_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, + gfp_t gfp) +{ + return dma_alloc_coherent(dev, size, handle, gfp); +} + +static void fec_dma_free(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t handle) +{ + dma_free_coherent(dev, size, cpu_addr, handle); +} +#endif /* !CONFIG_COLDFIRE && !CONFIG_COLDFIRE_COHERENT_DMA */ + +struct fec_dma_devres { + size_t size; + void *vaddr; + dma_addr_t dma_handle; +}; + +static void fec_dmam_release(struct device *dev, void *res) +{ + struct fec_dma_devres *this = res; + + fec_dma_free(dev, this->size, this->vaddr, this->dma_handle); +} + +static void *fec_dmam_alloc(struct device *dev, size_t size, dma_addr_t *handle, + gfp_t gfp) +{ + struct fec_dma_devres *dr; + void *vaddr; + + dr = devres_alloc(fec_dmam_release, sizeof(*dr), gfp); + if (!dr) + return NULL; + vaddr = fec_dma_alloc(dev, size, handle, gfp); + if (!vaddr) { + devres_free(dr); + return NULL; + } + dr->vaddr = vaddr; + dr->dma_handle = *handle; + dr->size = size; + devres_add(dev, dr); + return vaddr; +} + static inline bool is_ipv4_pkt(struct sk_buff *skb) { return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; @@ -1660,7 +1724,11 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) } #endif -#ifdef CONFIG_M532x +#if defined(CONFIG_COLDFIRE) && !defined(CONFIG_COLDFIRE_COHERENT_DMA) + /* + * Hacky flush of all caches instead of using the DMA API for the TSO + * headers. + */ flush_cache_all(); #endif rxq = fep->rx_queue[queue_id]; @@ -3288,10 +3356,9 @@ static void fec_enet_free_queue(struct net_device *ndev) for (i = 0; i < fep->num_tx_queues; i++) if (fep->tx_queue[i] && fep->tx_queue[i]->tso_hdrs) { txq = fep->tx_queue[i]; - dma_free_coherent(&fep->pdev->dev, - txq->bd.ring_size * TSO_HEADER_SIZE, - txq->tso_hdrs, - txq->tso_hdrs_dma); + fec_dma_free(&fep->pdev->dev, + txq->bd.ring_size * TSO_HEADER_SIZE, + txq->tso_hdrs, txq->tso_hdrs_dma); } for (i = 0; i < fep->num_rx_queues; i++) @@ -3321,10 +3388,9 @@ static int fec_enet_alloc_queue(struct net_device *ndev) txq->tx_stop_threshold = FEC_MAX_SKB_DESCS; txq->tx_wake_threshold = FEC_MAX_SKB_DESCS + 2 * MAX_SKB_FRAGS; - txq->tso_hdrs = dma_alloc_coherent(&fep->pdev->dev, + txq->tso_hdrs = fec_dma_alloc(&fep->pdev->dev, txq->bd.ring_size * TSO_HEADER_SIZE, - &txq->tso_hdrs_dma, - GFP_KERNEL); + &txq->tso_hdrs_dma, GFP_KERNEL); if (!txq->tso_hdrs) { ret = -ENOMEM; goto alloc_failed; @@ -4043,8 +4109,8 @@ static int fec_enet_init(struct net_device *ndev) bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize; /* Allocate memory for buffer descriptors. */ - cbd_base = dmam_alloc_coherent(&fep->pdev->dev, bd_size, &bd_dma, - GFP_KERNEL); + cbd_base = fec_dmam_alloc(&fep->pdev->dev, bd_size, &bd_dma, + GFP_KERNEL); if (!cbd_base) { ret = -ENOMEM; goto free_queue_mem; From patchwork Mon Oct 16 05:47:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422529 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15A46C46CA1 for ; Mon, 16 Oct 2023 05:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjJPFsq (ORCPT ); Mon, 16 Oct 2023 01:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231783AbjJPFsn (ORCPT ); Mon, 16 Oct 2023 01:48:43 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B222F7; Sun, 15 Oct 2023 22:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Y9DUw/dY172Zls+LRmOYmL30GnIrMabtQP9ggTJL0d8=; b=RE1OhfRU8CYhr7JH6VVDgiplTC gjX3zJyGEe0eyRXQO2v84UfNP9kxd+gvBYj5cYvHZT5Hb+C2bWuiL0Eq5T/MRz9Z1X20ZWW/Rj0GD ffAoypglXTNsoXYikcZIoJIoBCqHijes44y3x10ny1i8ygX5UJPTC/XbxlsGIHa+AQ1fZlD73wnj4 fB7uqpCtygxiNMPuHVhF0NHZwH5r9ICNexDt6VFaWcV0KKrhy/Or1+JbMw3ms9w8qvyUOKCKicOc8 gHFF2aJrnlt1sG87jjJdVY2r7Y4x2GdxUDJ70y/AMRNQWEmzwWa7kZpPe3qLM9E60mv5FbBsQF1vv 5gp46UxA==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSo-008Qyh-10; Mon, 16 Oct 2023 05:48:26 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 11/12] m68k: don't provide arch_dma_alloc for nommu/coldfire Date: Mon, 16 Oct 2023 07:47:53 +0200 Message-Id: <20231016054755.915155-12-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Coldfire cores configured with a data cache can't provide coherent DMA allocations at all. Instead of returning non-coherent kernel memory in this case, return NULL and fail the allocation. The only driver that used to rely on the previous behavior (fec) has been switched to use non-coherent allocations for this case recently. Signed-off-by: Christoph Hellwig --- arch/m68k/Kconfig | 1 - arch/m68k/kernel/dma.c | 23 ----------------------- 2 files changed, 24 deletions(-) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 6c585eae89f4dc..c1c0faffb0d413 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -3,7 +3,6 @@ config M68K bool default y select ARCH_32BIT_OFF_T - select ARCH_DMA_ALLOC if M68K_NONCOHERENT_DMA && COLDFIRE select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c index f83870cfa79b37..eef63d032abb53 100644 --- a/arch/m68k/kernel/dma.c +++ b/arch/m68k/kernel/dma.c @@ -33,29 +33,6 @@ pgprot_t pgprot_dmacoherent(pgprot_t prot) } return prot; } -#else -void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t gfp, unsigned long attrs) -{ - void *ret; - - if (dev == NULL || (*dev->dma_mask < 0xffffffff)) - gfp |= GFP_DMA; - ret = (void *)__get_free_pages(gfp, get_order(size)); - - if (ret != NULL) { - memset(ret, 0, size); - *dma_handle = virt_to_phys(ret); - } - return ret; -} - -void arch_dma_free(struct device *dev, size_t size, void *vaddr, - dma_addr_t dma_handle, unsigned long attrs) -{ - free_pages((unsigned long)vaddr, get_order(size)); -} - #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */ void arch_sync_dma_for_device(phys_addr_t handle, size_t size, From patchwork Mon Oct 16 05:47:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13422528 X-Patchwork-Delegate: geert@linux-m68k.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B7E6C41513 for ; Mon, 16 Oct 2023 05:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbjJPFsp (ORCPT ); Mon, 16 Oct 2023 01:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231739AbjJPFsk (ORCPT ); Mon, 16 Oct 2023 01:48:40 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2301AE4; Sun, 15 Oct 2023 22:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=lk2hjH1J0z+vDraZqP1FiMVLedAUOQE0Xu6QSSkdeMA=; b=IkODTfco0inGQHF15O+RlwwVUO uyzV4qCSEoVwBecQK2ZtYgWfG55JGXH4i4m0yYkdWNozPWmlrpmGxjo3844SQlwA1agw0Qud1EH3g wPcOkezghCHw/1fMp1HrZiMKLQyNBJENnYgGrg+qjnTFpNpr6oqEGLfB6c6UEqVLIA0BU0nZ1XI6L O3Mcsr5dvr9V5U/JeSZ6eVdISZ5eokTIVUc5KoPdAGaDZpaoSof5Op3RgnSq6+uv5sBY7PFyXchn7 ZcfqYW9ivyW/BLXe4HSi0ynWkJoZLdYX5UHlOzRuvJzes54o/zmL13LaW7d8PxPBNeeu3wFXkxGq+ OMDVkeww==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qsGSq-008R1r-2l; Mon, 16 Oct 2023 05:48:29 +0000 From: Christoph Hellwig To: Greg Ungerer , iommu@lists.linux.dev Cc: Paul Walmsley , Palmer Dabbelt , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Robin Murphy , 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 Subject: [PATCH 12/12] m68k: remove unused includes from dma.c Date: Mon, 16 Oct 2023 07:47:54 +0200 Message-Id: <20231016054755.915155-13-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016054755.915155-1-hch@lst.de> References: <20231016054755.915155-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org dma.c doesn't need most of the headers it includes. Also there is no point in undefining the DEBUG symbol given that it isn't used anywhere in this small file. Signed-off-by: Christoph Hellwig Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven --- arch/m68k/kernel/dma.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c index eef63d032abb53..16063783aa80c6 100644 --- a/arch/m68k/kernel/dma.c +++ b/arch/m68k/kernel/dma.c @@ -4,17 +4,8 @@ * for more details. */ -#undef DEBUG - #include -#include #include -#include -#include -#include -#include -#include - #include #ifndef CONFIG_COLDFIRE