From patchwork Tue Feb 21 12:46:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 60069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1848342wrn; Tue, 21 Feb 2023 05:02:24 -0800 (PST) X-Google-Smtp-Source: AK7set8tQHXoMBkDhnP2kcleCHWJ0fFlqlJyTXmQlYgWP1CGoarXdYAFhRhxesGTkFSe4+Fw/h7K X-Received: by 2002:a17:906:68d3:b0:8b1:7e1f:91c5 with SMTP id y19-20020a17090668d300b008b17e1f91c5mr14773615ejr.35.1676984544325; Tue, 21 Feb 2023 05:02:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984544; cv=none; d=google.com; s=arc-20160816; b=sT+Adocn3YZxKUDbc5A1zPUTeJLtQFhvtcSjhTcYr+4X44vBK4RBNf5DXlpQLvV5iH JgmJ8UdiEOg3e/etWSb8r2rWhSmcWUqvbPdasTZutzSrcvOmlFQqxUcXnhSj7/cV4+6h mX01my08XEznEPmRjnnLUDYzTOrwdBY7bbCwDgAZ5OW0h+zVfdoHdPx6RMxOl61Owqm1 PwF8YnqCFVc0E3FPU8XFxUluU4kSM1FwPwVz5ZpdXfQnND0MrzqmzcU19avkAIJu/FAp TmaXjaqF3BIl5bSYrrWCx6kk4lSRH5+yH24FK4YQpJd7LOuOskXTKpB16OuQkAC109J9 fp2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=HV+pK7weCQwzefnQB2ct/H0NIgIoXkqz3Kzgj5x1/Ec=; b=mloMGWTnCG5EpoCLx+zkHYv3ygGKrKUR4s2S2bcSTsRctK2nqjlI+8Fvad0oC+VXhC vsPap6K3iQvuMGqnGKbxaJhDrtlP4FLwzCKhcIkXrTlMRlG1yAJvFEJNpMuAhR9LsrS9 ZQmpLmr9uX/K+4TuYusUZ512zzTTtuTliXyrQKY5DoQhWU5JLDUNV6Fn4GHPaBpf1Wjn cC1eqpzKHm4RLsE515gg5yhyRRC+5RDXRbHRJLA4zrEiKrQwZ9539fVQXU2Hr6jwM2pX ZHINuPQ3DXnayF8VWkU284R5SoJkuNlxfewoZogUq0YDDP10mdNcwnSeBtdxRCtCP012 55IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=hWuWEixh; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ej6tpM2n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 9-20020a17090600c900b008c25e1c05desi15351422eji.392.2023.02.21.05.02.00; Tue, 21 Feb 2023 05:02:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=hWuWEixh; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ej6tpM2n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234814AbjBUMqd (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233992AbjBUMq0 (ORCPT ); Tue, 21 Feb 2023 07:46:26 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F370F28219; Tue, 21 Feb 2023 04:46:25 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id A87143200927; Tue, 21 Feb 2023 07:46:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 21 Feb 2023 07:46:25 -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=1676983584; x=1677069984; bh=HV +pK7weCQwzefnQB2ct/H0NIgIoXkqz3Kzgj5x1/Ec=; b=hWuWEixhb1PD9+AF3W CJ0UmnfMraBu2//N0+dHFSlNmF+H3ij7pxSBzuLRnW3NyqfQ9Rt2/3WZ3/YHQllC JVX4I4Uw+p0QdK20iiwu9XVU1c6OFTwhPVv47Ctg4r9w0fMct9bocShHM1deZAjU 2t9ZOgKKGFJoxRZtFat1HDdCzt5NtOXS+65+YFFiqCz0Z0NDWE+vuHZlvGN/IHCE B28PNf4G37ehwsLJFHQv+wIZHl7NSuuhLbeyc9zdcTC1VN0DDlZLb9lCHe3H0cuZ KB5nymhc9oKplbra1XBa8gLODF6hfkts0NTUsFJDMDs0X0bH3YeCRau3DTV2sHM4 bHzw== 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=1676983584; x=1677069984; bh=HV+pK7weCQwze fnQB2ct/H0NIgIoXkqz3Kzgj5x1/Ec=; b=ej6tpM2nMZwwgl1SnwhNnU9yh2cxO KrbDXSbXhOYeUi1GIq0THMySUg1DJKevql1jZSJ7l3uMcMZg8vy1o+rSoDjY3qXy naTk2V2xJleFnSUi14Wy2F/aNc2d7QD9TF9Jpi8W/x2P5sYmLILSX+miQcd1wksI Loz5qjkGt+rKSP9txzfAoQbULGQqWFCxjtN98vVSiQV2DVq5l5ShELYqzKTmXnio 2e76o5+Qjj8EghX3ic2e5WN50at5KtNJqweY1805kwdcadHmFx45K7oPYmSS0c09 C89Hadj8TTxijU7NEfUbi9VP/BL6tq6Y8eEitUsY/op2ck3o+txGe80xg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46: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, Jiaxun Yang Subject: [PATCH 1/7] MIPS: Remove DMA_PERDEV_COHERENT Date: Tue, 21 Feb 2023 12:46:07 +0000 Message-Id: <20230221124613.2859-2-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445745567431712?= X-GMAIL-MSGID: =?utf-8?q?1758445745567431712?= As now we are always managing DMA coherence on per dev bias, there is no need to have such option. And it's not selected by any platform. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 15cb692b0a09..c6f3ad51f741 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -134,7 +134,6 @@ choice config MIPS_GENERIC_KERNEL bool "Generic board-agnostic MIPS kernel" - select ARCH_HAS_SETUP_DMA_OPS select MIPS_GENERIC select BOOT_RAW select BUILTIN_DTB @@ -1079,11 +1078,6 @@ config FW_CFE config ARCH_SUPPORTS_UPROBES bool -config DMA_PERDEV_COHERENT - bool - select ARCH_HAS_SETUP_DMA_OPS - select DMA_NONCOHERENT - config DMA_NONCOHERENT bool # @@ -1097,6 +1091,7 @@ config DMA_NONCOHERENT select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_HAS_DMA_SET_UNCACHED + select ARCH_HAS_SETUP_DMA_OPS select DMA_NONCOHERENT_MMAP select NEED_DMA_MAP_STATE From patchwork Tue Feb 21 12:46:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 60078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1849952wrn; Tue, 21 Feb 2023 05:04:56 -0800 (PST) X-Google-Smtp-Source: AK7set//YPVkqalUaeLaUoNR09Zs4A5Zh5H/RIKAmc2tv+PcK8oqgop0DCRD4oQKWjz4e3qVKRIt X-Received: by 2002:a17:907:7f27:b0:819:2756:e090 with SMTP id qf39-20020a1709077f2700b008192756e090mr15047901ejc.50.1676984696824; Tue, 21 Feb 2023 05:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984696; cv=none; d=google.com; s=arc-20160816; b=w3cN6B3AaL9AULeZaipOK4M/EpK13TJwC/fhXhbSM5i96I7Cpg0HTNWS5MqKVtcgDB o5y0csw4kA1gR80v0weFGoysoX0XKFSp/xWyi4YmMiK3Egu+3rPcOVHeuho5umk3Xym1 WcJJEN5InONGh/fUwnNZpnLiN86KbRorTz6kxbOyQnMhdHBWLeslAXhoQLXuoSlxyx+p abCeBmY3zSjohRAvY3OUQhg7p3VEygUQKQO5Z+pMVtvmL1Bwx5ioomQa/HcPtYd6BPUk ct3VZEcJJOKs+fvyijmTQUZxY3YIxpgpdSoZW1uBZOKmXsteti6NLe1RXefdvCADsD3/ bm1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=13TjcRtfoBgYUAonSXqop4Xu1irhLU8jxIGd4/dBxmQ=; b=epsJomzW/6FpmeQ4RUhPclYUWJ0eGVAOH7KifkND/F3kSZ+H7NZWTqXZQtwbjG8iq4 Vr8dOk1TtIoPOGoRlERjIgIDixOmc7g89+GLzexZUZfaaI3P2tsaISbSqDAUbWuLYzE9 N/IiLo+XLeHKwfyQiHtP5Y/HCWqkjHOG6kXSA3woSpF+4VKgjhyZI7Wxx2ReQeAvrSuv n5J8mvIbckQzpYiP/QOxReyXhb9KFgBSRsQzPKXx03+FWi4QB1g95AgEwIX0+hlNRAtb 5XEANXp/fwsT+jrumNx9hjZYNZUhu7UvktjNBFLStHnxM+3v/ZD88hbFY7dkE+NsyQ7c tYhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=q2idsRBq; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=h4uH7u6p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020aa7c599000000b004af59d7aa30si268413edq.541.2023.02.21.05.04.33; Tue, 21 Feb 2023 05:04:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=q2idsRBq; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=h4uH7u6p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233049AbjBUMqk (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234816AbjBUMqc (ORCPT ); Tue, 21 Feb 2023 07:46:32 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 277F3298F7; Tue, 21 Feb 2023 04:46:29 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C17A53200931; Tue, 21 Feb 2023 07:46:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 Feb 2023 07:46:28 -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=1676983587; x=1677069987; bh=13 TjcRtfoBgYUAonSXqop4Xu1irhLU8jxIGd4/dBxmQ=; b=q2idsRBqJazuFn72mE 20jDBSb0qMCAnmvgZQ+5TXd2mmJOmBq7/DJo9wgPMXpfZdkMzC9JY5jjjNJ/aVCC kTlkIVMAdrdBlX0JNhNB3DsN/GUFtqBcoMyWUzi/dYTzzhEReZjdXTPs/SJ9yUsu JdfFov/ubH3yO8fTz+m6l6xa2+HISPeXko9M+6Iwvg+KG24BnkK13hMoZ3ON5Jb5 MXsumUkMEsPSAWiBVtdSUPo15H25awi9wj+17CnsodYAS72xE+p1d600D8xBBiUq wZLjIzbWRevh4Z6tITef2rQlaeOn1Ptlr7/AMXgOCC/BBIkRD2QutXFZnYFqz/TL oT0A== 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=1676983587; x=1677069987; bh=13TjcRtfoBgYU AonSXqop4Xu1irhLU8jxIGd4/dBxmQ=; b=h4uH7u6pzpVpFaAI8C3RnTR87tY7C k8HOnLs5JJ1/43cc3BG9jXbWS9hiwzntd64K1QMa7yXHDub5ue2ppM/sSBW2li0a oTDT7hksncFaYcmYWP3dloIOp1sNpxWn85Mz7Zehhbsl5Fc9JuXDRjaLfj/Iw7cq vaCm2VhXPqs04ypGwzzfJdji1/PVJGLez3bo8RRduhpdgbEWH+whsjFOGyLfsP25 axgoAlmQYaRUmwoq2j4XCRuHjH1IP6g+rkfLdkdEL4SSXSU0sen3NB92zcbY8v3D asWqulMzb9/1AJuLawhhX1BJT+Ab6q7OfU7C0GUA53Icea6xGP62v3ieg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46:25 -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, Jiaxun Yang Subject: [PATCH 2/7] MIPS: Always select ARCH_HAS_SYNC_DMA_FOR_CPU for noncoherent platforms Date: Tue, 21 Feb 2023 12:46:08 +0000 Message-Id: <20230221124613.2859-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445905405297124?= X-GMAIL-MSGID: =?utf-8?q?1758445905405297124?= As now we are telling the necessity of post DMA flush per CPU type, there is no need to select ARCH_HAS_SYNC_DMA_FOR_CPU on per platform bias, just select it unconditionally and we can sort it at runtime. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c6f3ad51f741..8da52863da4e 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -115,7 +115,6 @@ config MACH_INGENIC select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_SUPPORTS_ZBOOT select DMA_NONCOHERENT - select ARCH_HAS_SYNC_DMA_FOR_CPU select IRQ_MIPS_CPU select PINCTRL select GPIOLIB @@ -1089,6 +1088,7 @@ config DMA_NONCOHERENT # select ARCH_HAS_DMA_WRITE_COMBINE select ARCH_HAS_DMA_PREP_COHERENT + select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_HAS_DMA_SET_UNCACHED select ARCH_HAS_SETUP_DMA_OPS @@ -1853,11 +1853,9 @@ config SYS_HAS_CPU_MIPS32_R3_5 config SYS_HAS_CPU_MIPS32_R5 bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT config SYS_HAS_CPU_MIPS32_R6 bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT config SYS_HAS_CPU_MIPS64_R1 bool @@ -1867,15 +1865,12 @@ config SYS_HAS_CPU_MIPS64_R2 config SYS_HAS_CPU_MIPS64_R5 bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT config SYS_HAS_CPU_MIPS64_R6 bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT config SYS_HAS_CPU_P5600 bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT config SYS_HAS_CPU_R3000 bool @@ -1900,7 +1895,6 @@ config SYS_HAS_CPU_NEVADA config SYS_HAS_CPU_R10000 bool - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT config SYS_HAS_CPU_RM7000 bool @@ -1929,7 +1923,6 @@ config SYS_HAS_CPU_BMIPS4380 config SYS_HAS_CPU_BMIPS5000 bool select SYS_HAS_CPU_BMIPS - select ARCH_HAS_SYNC_DMA_FOR_CPU # # CPU may reorder R->R, R->W, W->R, W->W From patchwork Tue Feb 21 12:46:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 60072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1849205wrn; Tue, 21 Feb 2023 05:03:41 -0800 (PST) X-Google-Smtp-Source: AK7set85PVB5u3FUtdidGpDvT7adw3ufbBIzva1TQHqQxCEvy4Jy6nsZYqYW/O8vb5gCIL+oHyCp X-Received: by 2002:a17:907:2ce1:b0:8ae:e30f:4091 with SMTP id hz1-20020a1709072ce100b008aee30f4091mr20800654ejc.30.1676984621051; Tue, 21 Feb 2023 05:03:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984621; cv=none; d=google.com; s=arc-20160816; b=KkUGfHjyBLa1tm4LihVRs1765twFoZzFHuUynYSHT9gNNjVsxUyJCfpVIuVIochzur RO7SNx6LjgtVKXvvJsMSmVlaVlppM328CCLdNCMfclO3CYOH/zDGYmj3OGUYVLrjwTaG BoVxzfg92pFE0n+kIz65a5afBVOFyC6Ae38Qt0ushpFeZcs2Mfo0J0066gTo4ezcr9x4 ypzxTaw78j7SAYV9oXHfcvbkl10HNHTLjx9hjfes5hFnlpcHZ7xizGpWZDuvjYWKXNhO pEXO/OaE6jcHDn1EB4GtnEFqs9pLxuZ6qvpFWH4o3n4xhOteNUVpd4kpatWmwXKzfue9 QzAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=6T1o68vOusF0U/JsH2f0H8DjY8CJLE2Yaxz8jLQ29x0=; b=Or6tDwuUeF3wUwKkooJrzUimeKqMBwtRf0wn6z/LlXvA+qrUcujh0pXit0dXKniG4r HUsXlQ6B2FUxW5afssn3zGf9V6umtpQTcqaUWrec4D+rw/2jB0+309wWwsftRykyrf5Q gx1foPrJlDotJPMbYlusZKIMNncbdrwboGzUFBnZGPzhNl8pZ++WMkwZmin0jbvLkqtI dccR+SNrwkXh5PM0XVJ4hsM3JeJqNYgU4ywmHvtShvt89HVSenKzPwgkheoyoxWxtjel XiQPV3VqMe7gja8u0zYK2xiwcGLqhOA0gfhcQkFBpU7yBZfAAaBX9v9w/kYFFrB5Zlr3 dj3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=WYZ2r8yL; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=N+2nQ+ZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cj19-20020a17090715d300b008e1cbdcd3cesi1067528ejc.930.2023.02.21.05.03.16; Tue, 21 Feb 2023 05:03:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=WYZ2r8yL; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=N+2nQ+ZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbjBUMqn (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233939AbjBUMqd (ORCPT ); Tue, 21 Feb 2023 07:46:33 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D5328219; Tue, 21 Feb 2023 04:46:32 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id D55E832008C3; Tue, 21 Feb 2023 07:46:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 21 Feb 2023 07:46:31 -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=1676983590; x=1677069990; bh=6T 1o68vOusF0U/JsH2f0H8DjY8CJLE2Yaxz8jLQ29x0=; b=WYZ2r8yLERG8PZz33O ZATtuWd5d33QLXSPx3j/jhteDUdurqIOBz891SrqqR91iQevCcqj6U+7R4Z49bGY d2jgibfy0ZH6LVFQz6HkZiJT6KoGcZ8ia/SBT8I1ykeDdnhrMyp9QytH5KQzVaAo qUuT0oFahR0oagpue7LQ6eUUPKo+SC7e89Ik454307YKxaupeC03eBJ6FYtLdbaB dyTMOh/zEvfmx7Y5d0IDJvAhq12jXnfqrPl/6ycEHnLCJEsF1vmliERnxjjtx7Z/ mgalcHl9e9IY+yZpsJTFtBHdCYHKvCycMROzwTI2ynJBPEw4yjhI+6ejrkQ3D7Bb dIkA== 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=1676983590; x=1677069990; bh=6T1o68vOusF0U /JsH2f0H8DjY8CJLE2Yaxz8jLQ29x0=; b=N+2nQ+ZSQuHyDtlrCA6jR15i7BiS5 xCN/wDc5Sw88OHVQznynC9DZVncjtiiWew6jITDLnoNU43Y/MkL/f594ojwVMhZl fl1A3aY45+MogY/op9OydPi4vykMmOXyhtrZ55IW0RIBmGKFkcrK/rATWzQlEBAQ 0kSRhXAvJUxVPY0z3O5Ka34CX+T7TcmHJMrrS8LAyXN0u1LxBZLC/DynuaaGYfpG T1E2LDg6RaUfEaJRNNp/guCkiXLmexfmJ+HEMlyUemhTjqJeajJgUEDVeCLsRWnq jrDJ4JMEXLp+AsjDK76pG2jvnFg9h9dM+NUZULAWCdI0s72ETVpD+xRRA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46:28 -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, Jiaxun Yang Subject: [PATCH 3/7] MIPS: c-r4k: Always install dma flush functions Date: Tue, 21 Feb 2023 12:46:09 +0000 Message-Id: <20230221124613.2859-4-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445825969650433?= X-GMAIL-MSGID: =?utf-8?q?1758445825969650433?= As nowadays DMA coherence is managed per device, it is possible to have a system that is defaulted to coherent dma but still have noncoherent device that needs to use those flush functions. Just install them unconditionally. Signed-off-by: Jiaxun Yang --- arch/mips/mm/c-r4k.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index a549fa98c2f4..7d447050a20b 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c @@ -1867,15 +1867,9 @@ void r4k_cache_init(void) __local_flush_icache_user_range = local_r4k_flush_icache_user_range; #ifdef CONFIG_DMA_NONCOHERENT - if (dma_default_coherent) { - _dma_cache_wback_inv = (void *)cache_noop; - _dma_cache_wback = (void *)cache_noop; - _dma_cache_inv = (void *)cache_noop; - } else { - _dma_cache_wback_inv = r4k_dma_cache_wback_inv; - _dma_cache_wback = r4k_dma_cache_wback_inv; - _dma_cache_inv = r4k_dma_cache_inv; - } + _dma_cache_wback_inv = r4k_dma_cache_wback_inv; + _dma_cache_wback = r4k_dma_cache_wback_inv; + _dma_cache_inv = r4k_dma_cache_inv; #endif /* CONFIG_DMA_NONCOHERENT */ build_clear_page(); From patchwork Tue Feb 21 12:46: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: 60073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1849206wrn; Tue, 21 Feb 2023 05:03:41 -0800 (PST) X-Google-Smtp-Source: AK7set+eL7kbSrLRw+GZQNEWdyhoBLXuhlrtbo3CHzlNHQaCAXlkyePRRvbZtF6BvesWXkmaOysA X-Received: by 2002:a17:907:393:b0:8b1:7aaa:4c25 with SMTP id ss19-20020a170907039300b008b17aaa4c25mr15474399ejb.29.1676984621181; Tue, 21 Feb 2023 05:03:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984621; cv=none; d=google.com; s=arc-20160816; b=o6mMQ0LVML7ePXQHQZ25r/mU88g4DRE1yjeyi822LInJYXbIyLuma8j+Vt4tHd+3sL m1n6HyQEY08VVjk9u0MQaqwsA1DSOjXDHhaS2TxiBESa6ML1aTj57WKphTWIzXIBcDGl YqhPwxAveA7eWdPwrO48o4Op8dW8PsoBpcTqRJHYuCa484/v6bo+amaXkmb9vCcFwtcT qSB/WjDhN6HuZMOZKVYeY+M1ZnNlHPbFdS5vF9eta8tl+k6zTBEmgu/RQ3A6mswjUsWr SI9S8YQLsKKDpEGcr8nTg/OaRKXut775UO+Gdi2gT/frT39XK05RM+2Fv4Sg2V8fr2DN RH/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=clU+1DjEJRpBNFORFKqHyIxdKEVEFhCaiGb/M7QBgCc=; b=U4I2QJ666KhllzGHWoJopVXhKT7lrnabWWG96Of0PZavfTziK6F6YB+4KHxEkDMXty wUZsRDoDePIvr7Ft/njRThpQbpC16hzwMoRV7zSRwXEqEtb8mTlYAF1RZ+sNw4XQWrlK +EXu9xN09gsjIfcQkCIaAadnSsJQ8WHqUj5MPLb7BjFjWBQdHxzCJKJa5Scljc9RMAUw MSJZf6VNPJOvOj4siaJmP6pbQJ4g+VL54HjDBgtWfDCney8nPMvAtYIa3xnDql8Vy/GQ 0ExJgnquTYKF1qKyqXdG7jTmnmLQ9oi6l7aygpDp0Z+Vu4Hgru+NMovQNvXUxDwfu1rl 4wig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=qIn1qV1D; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=jjWvhaLi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v25-20020a17090651d900b008d06906f662si8883101ejk.666.2023.02.21.05.03.17; Tue, 21 Feb 2023 05:03:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=qIn1qV1D; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=jjWvhaLi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234849AbjBUMqq (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233507AbjBUMqi (ORCPT ); Tue, 21 Feb 2023 07:46:38 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99EBE29E28; Tue, 21 Feb 2023 04:46:35 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 4F8D33200920; Tue, 21 Feb 2023 07:46:34 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 21 Feb 2023 07:46:35 -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=1676983593; x=1677069993; bh=cl U+1DjEJRpBNFORFKqHyIxdKEVEFhCaiGb/M7QBgCc=; b=qIn1qV1DkK0on6ZMeP KBnn0OvJCdAF06u3sTwb6TLhhvYwhobazwDY2EatXRU9Fvb3wWcrQwcUFLX7k6ga kbJLA67hp0QVQ+WE95nF9JhdDdHcPmpEoGB1W605thN9DLtXmRSHiuKgriPvjLpz bTSnFh+o803+DVbeRciysdZkn7MW9phSD8PXMLNR3V3HQXcPmlKfUFZlaFGRqQH6 w6Exn7/aAezzhaLbUbrFiahSMH9DvK1KHYgrQ0CbNyVxdGOdHmoANV3FPaX8EVUG HFXDOH6p1EX0QLgoAaXEH9cbrsaFYnpl1XqE6eqOv12CC1mushGx5fqhsNZuYYLf c0zQ== 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=1676983593; x=1677069993; bh=clU+1DjEJRpBN FORFKqHyIxdKEVEFhCaiGb/M7QBgCc=; b=jjWvhaLi+nDY4ruMzqDzgliKeRkUI DzpKMj+qY8IeWqgJJezwBwRyp+CgWnl8cmn29ysRqJGsHwMQXx8BE7l2mTf697hK IxfRZIzf/F7V05uN6wZo/4ystwnI7HyCR/OOUKJoed1wAGFbksDMrBFW86p5Q1aO Fy3aTLeF1bSIrFb4VqYB0Uuw3kqS6ED6qMWE8i+edFWSh8NhjC0Dq3Ry41SNhKCB Sb1rPzThPqjT1lYzFjdv632H1K5bbaRJGPQ68uHDH0m6AO5jhRNNd5Udx2QB34SB L7AdHYdI2nRZgOx/EjeW6IXC58GY4LAkGpVSqI9pxHZr4Z9E1yVF5RTdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46:32 -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, Jiaxun Yang Subject: [PATCH 4/7] dma-mapping: Always provide dma_default_coherent Date: Tue, 21 Feb 2023 12:46:10 +0000 Message-Id: <20230221124613.2859-5-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445826437608437?= X-GMAIL-MSGID: =?utf-8?q?1758445826437608437?= dma_default_coherent can be useful for determine default coherency even on arches without noncoherent support. 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 d678afeb8a13..3c6cd17f87c3 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 c026a5a5e046..e0b005c8ffce 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 Tue Feb 21 12:46: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: 60075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1849475wrn; Tue, 21 Feb 2023 05:04:05 -0800 (PST) X-Google-Smtp-Source: AK7set8pphY+IPWdG1ebYrUlWn+V0oLDjiGHGtn9sxV6jnSkfz99WHIq8Es5pJxX/ZuMZskjQ8eI X-Received: by 2002:a17:902:ea07:b0:19a:9580:74c with SMTP id s7-20020a170902ea0700b0019a9580074cmr4596374plg.7.1676984644750; Tue, 21 Feb 2023 05:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984644; cv=none; d=google.com; s=arc-20160816; b=VfuYGh+hn9iWBwDrP1DHaSnr55aUi9euFTKzkGl8pmNd4pW9yZBM7glKyGCc6jV/Wg dgUot9s1HkMMnnmb9dynRVyQIXYVpfaHPc3SRQPQbPAGx+suK+BJw4a1VUECdsUTbeIo kEYQrF/nnX9TvHwSbdDYSs3Nb61QdFMGpvQeyJydL9FE3ThQIWM7LyHnE6y3mamuwL4S P6nyozNY8nvS0+Wawj/LDKJIuQ2w1zHdIFH+wYhhSKPML86UWh/qVkn/4GuUiHLmTJz+ LZhLoGaAbgsNuGYh67QFWkI/B6jbFP+DjJt5xoCSDAUTBCjAa2OvUBbI5Uq/VWOXTSfO yoiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=EdzOAv/xcw8C660U6AYkHbaD3axiSrIufQWq0klOwqc=; b=B8vW0bUjuN0qpVZqACTMCIqpLFgic1dxUXr0UGh0BGf5BO62mGK+8886TuSQhDafZf c3Z/n9USKlAyK70n3LP/4pWCP5zwZiZSZpHro4psrVDJd4MESaZFqq6XPyZmQF1Emx5R 82qJlbUdaPQIGpqSW9/DKCMaTQuw5472ZUhEL2D0DCUn/G8Ik7VLAXYvM++WrWxjL5BS z4PX9i8lq6n/m8KHRntiw4a2oc6XfM4o0ziVXYY3eZ7YoJJ3jsV78sWcoQ0rFRmPPd3L fKz1JibfXgh/HYxPyTh9ciPRnsQGlb0lJJexCdzgFQ5AuC6joHFUyJ9bIGREqCsjIjOU uuMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=bOjEVdwW; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=TMacjdvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ju19-20020a170903429300b0019b05e5b305si12032286plb.336.2023.02.21.05.03.51; Tue, 21 Feb 2023 05:04:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=bOjEVdwW; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=TMacjdvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234828AbjBUMqx (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234825AbjBUMqn (ORCPT ); Tue, 21 Feb 2023 07:46:43 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91142A152; Tue, 21 Feb 2023 04:46:38 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 7C94B3200932; Tue, 21 Feb 2023 07:46:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 21 Feb 2023 07:46:38 -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=1676983597; x=1677069997; bh=Ed zOAv/xcw8C660U6AYkHbaD3axiSrIufQWq0klOwqc=; b=bOjEVdwW9KvLj+SiA0 RhT7CIkflbcfHDLoMDtvSBSeZ7O5BpriDzw0omfF5x5+F7yUndITdAuoUSuFOcuw B0+FQ7sruAVljv2cFT2HT8ZDrc7ShypCl0Xc8GSpjfxImp8As0GG0TwW26ZuT2l7 lDDJ0sPCU9oAT9caTjR8XALWhi2Xy07k8pB6wA6KrX+gqy42av3oM6HmKfzK9bZ3 ZqBwdnJbGxYLA66GT1/ry8mkXSrCweqgrmMxUJCHuCvEcg/GQPshqxXpLW+F4Pgo rtdPZdzQs8HTdxIOixT2j8rNhkEr0sciVtdTo4mLSASbA4r4CjCMFPVL1bvrH9H6 COiQ== 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=1676983597; x=1677069997; bh=EdzOAv/xcw8C6 60U6AYkHbaD3axiSrIufQWq0klOwqc=; b=TMacjdvBZ7+GF8nhmMYIH/fVDN07x NmC94v8x/x3aIvJpHDAK+yc+KxhfeUH2UtLUpFiDtjMs089AiNq0u1HPcySUf/Ki 2VpR1Eu1VpZdyFCyQoByz7rNwQ10ACxdcBqnjfDNv02dpvwsKbIlHsW1fg3tY3Vi 3c3ILiwnD9LiL+uC3OAkME1bZJngB2PqBkVARAUITOR3ni3A9nAi1VVH1/dUT4Bn kw1Yn6EKPaEM0zJoMROnQfCZ7DSuMkYD86kjHCRe/CsJILRQrqlAbirKyzAyxXi4 BE3zykbS4eImy/BEN9Pv/TKKay2XBEz5fCADVFKZKOQtl3kNy8UOkPYWg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgepudenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46:35 -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, Jiaxun Yang Subject: [PATCH 5/7] dma-mapping: Provide CONFIG_ARCH_DMA_DEFAULT_COHERENT Date: Tue, 21 Feb 2023 12:46:11 +0000 Message-Id: <20230221124613.2859-6-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445850794407586?= X-GMAIL-MSGID: =?utf-8?q?1758445850794407586?= Provide a kconfig option to allow arches to manipulate default value of dma_default_coherent in Kconfig. Signed-off-by: Jiaxun Yang --- kernel/dma/Kconfig | 3 +++ kernel/dma/mapping.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 56866aaa2ae1..968108fdf9bf 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -76,6 +76,9 @@ config ARCH_HAS_DMA_PREP_COHERENT config ARCH_HAS_FORCE_DMA_UNENCRYPTED bool +config ARCH_DMA_DEFAULT_COHERENT + bool + config SWIOTLB bool select NEED_DMA_MAP_STATE diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index e0b005c8ffce..3d4a2ca15b5a 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -20,7 +20,7 @@ #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; +bool dma_default_coherent = IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT); #endif /* From patchwork Tue Feb 21 12:46: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: 60076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1849764wrn; Tue, 21 Feb 2023 05:04:40 -0800 (PST) X-Google-Smtp-Source: AK7set/HwAJolPdG5jur/82mlJOEUdEKJuliof3vb684YvxyWhg6AnqSWL5Oi7elMVaF8dlbVTun X-Received: by 2002:a17:906:ce3c:b0:8b1:7ab0:a462 with SMTP id sd28-20020a170906ce3c00b008b17ab0a462mr15844447ejb.7.1676984679223; Tue, 21 Feb 2023 05:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984679; cv=none; d=google.com; s=arc-20160816; b=RNgHkqk0RWUlXo3fEoYNyG2vBXLw+Ga7VDFJEKiLF1N/Zs8TUqCD6EL24LK6uyvDMI 1lGLlVfhjLlHUvSADHFynKdPbCoJkfRouHZdAM4T0QyxEllqbQAIdulWd+mGmNQrNKNZ o01d00h0oFVsCrDTP7Pe8pP3CnJjYQwl+cX0eNqkp9SVqLL9Vg71X5DYcy9ylzhtsBqf RH2dRKQTWFmb2HLtgnN7YX8Rres0XSHBdajahwbcKHMP0uPPs80xHfvmQepeeQimU9VT QoCNs7yE7166jPLRXr9o0T6NB8SyFDOQniA/buWPmMr/L/AIdy/LIJzebhPRK95BugLZ atAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=hVblcbnQNQnrUYmR42maX841iYbSBNUD5mWumav+q1s=; b=wg2U2iy82Dzc3OXWW12AlY3FUpNhVNyCbGrCTWLqiWYaCrwToScs3nitLl6ENMj1MP C8bKNLR6YdnGuBFUgfy+kFgiMnJGy6/byxm5ORn1eJ9UAfCWPpw8bF+GiVKPfWf+YFIj yvkF2fcNzyyWIWwt8L5Ffm/9rxC8rUDIF3Wo0nzihL0n8pBjUumxmSHEGtQlD5YpfFgn f7V5TwT23rzrfwjsCplsbxEm7zZuSPA0C9XH4k0rhm5EmLS4YjRMgDduu4g1Jg8rcn98 GpdJzqNVWLsHm7vp6v8Q36EowOb2k4Re6xnKD2GQplWJAmuabdylkF/nFUYJIxUatfat n/tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b="j8/j9yp/"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=DJNjAvwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a17090791c600b008c2c9a6fb38si9883661ejz.266.2023.02.21.05.04.14; Tue, 21 Feb 2023 05:04:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b="j8/j9yp/"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=DJNjAvwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbjBUMq5 (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbjBUMqp (ORCPT ); Tue, 21 Feb 2023 07:46:45 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F23DC28D0E; Tue, 21 Feb 2023 04:46:41 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id AD2123200392; Tue, 21 Feb 2023 07:46:40 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 Feb 2023 07:46:41 -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=1676983600; x=1677070000; bh=hV blcbnQNQnrUYmR42maX841iYbSBNUD5mWumav+q1s=; b=j8/j9yp/wQMNo7LXlC 8GDFZxMTHD0uB/Sy7andq8NyyTpgXSQoN/e2cjH0Nsk22VVREnsFDoTqbvQQXOGe U4StaiPSs1d/6l6Lwh/UsiqwtmbhweOPIhTl49bGdYDne6I+VDRbHigxAxEzhm3E Xh97ymVPgKnYDhLivkRDbKxug4hubPXp/XR1x1Ea5Lj2LGVHgPXhjlY8NG8xzrlj Z2PXzpbJV6beOoZSmcZf5hdsEIc8210yJjRLWf53rdglL+GjRPO2V5NBp4vnpWIE ZIfd7VaY5aGNbW1PssK1ZhA9yWAq5jBEMb4heitVMv/w+dwcyac50C7MWYCkK8M7 DMtg== 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=1676983600; x=1677070000; bh=hVblcbnQNQnrU YmR42maX841iYbSBNUD5mWumav+q1s=; b=DJNjAvwyDKZHlxBA/gAxauFhEP52V DDUmJgzGwKHB/gJz2K9Znpstt0ap92MxGDV0jM3R9/sXEs5nbgVHigHu6j0EJ1nQ ziLcOgHcsI9YKxbbmibzF+lOjLGsrppJ9p8ls0bRLdjOMDcmMiVJX6O5oXq/9d0+ r66grgdF6zwYw99glYagz5HUOAyfVNY2AS5qTtd/AtqTXiTRvh0ZM1ZHBiI9ik5f 0i8OsAde28fjYD7n7lKmgx2CITbfjNxmwXXuKPVxOPcRiqXSVPGnOgAAnh7pDGQs l/Ko4XguNZj3CnkzH+jH4YqKSgOOf8uIcHtytI5vZO6DBmvSsJ++2cbAQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgepudenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46:38 -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, Jiaxun Yang Subject: [PATCH 6/7] riscv: Select ARCH_DMA_DEFAULT_COHERENT Date: Tue, 21 Feb 2023 12:46:12 +0000 Message-Id: <20230221124613.2859-7-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758445886980411023?= X-GMAIL-MSGID: =?utf-8?q?1758445886980411023?= For RISCV we always assume devices are DMA coherent. Select ARCH_DMA_DEFAULT_COHERENT to ensure dev->dma_conherent is always initialized to true. Signed-off-by: Jiaxun Yang --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 8b1dbd23dbd6..c1327309e0f6 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -13,6 +13,7 @@ config 32BIT config RISCV def_bool y select ARCH_CLOCKSOURCE_INIT + select ARCH_DMA_DEFAULT_COHERENT select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_HAS_BINFMT_FLAT From patchwork Tue Feb 21 12:46:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 60081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1851096wrn; Tue, 21 Feb 2023 05:06:56 -0800 (PST) X-Google-Smtp-Source: AK7set/SIoNxgk1/BhUhImrx0PLRetBe2PXfS7Eh4yHWJv1f4ry7FbuZ6ZlXFhHX4ZLY/hKejo/c X-Received: by 2002:a50:fc0c:0:b0:4ae:eae1:1109 with SMTP id i12-20020a50fc0c000000b004aeeae11109mr4899319edr.2.1676984816380; Tue, 21 Feb 2023 05:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676984816; cv=none; d=google.com; s=arc-20160816; b=iHEmPXInGx7f4QoIZLdzP1AMWsDa5sUkXY/yvZjpPqXc+VCMXtUu2/9YCJUe+RPu3G fd6lAagYzjU3aIy/p1I2OItsL0YsCFfe4/FvmLTevX02KkAMkeil8vYuMrqsQitQcUyT pzNpj7xJ2lL27e33O5DSk+UqxzPZ1cSCBLGFuew2IZajfXS9podYv48k9I6wC/Ja2TBb vvzZo2Csgx798ox/IsnK8fKKI7a9e2gdrZ6GzHBZM0ff3lb7fVnnzuQkq8PGZGfdsQQp tc2r8ypLxhJzG5iXCmgxMqdPfyhX1FlJvvda36GUsTZsycWoUBzSBUCGvU0xJOsdPjVu FcnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=4PPQjSJNVgwU03Pj5b/L4ZJLYgKGF2yahc105X2h56E=; b=HMfTkQH+L3me2FBYyN45/7Rk7ShFCWnSSV0xuu75hTpcfy7uV5idIheuzCg4fBXwec +BMqZJlg0pz04gruPv6p6clTGvoOTlyp8mrpbtqXFB5HLp4SJKv0It7TJKRZmtNQJ4XG jcpRusvOiEg6FwwNhH64dhv8I13O79qjuyhP1T657imcdwMMwaLb9QjEEUneWlyfjMSo BAUizunID3e4qDDINdpK09zpEPIHCVZ/IapJSvWwf452mTkwNmcFV0c7lEbU0+gE0XjA qBVka2aceKUvd8wty+o+onnJBdQG/UyOaBA0GPIX8dnX9Uh9/kHASeb8EbySJ+mmRKX5 uIcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b="gBZQ/xBK"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="MZMgKI/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020aa7d612000000b004ab2521aed1si18541718edr.293.2023.02.21.05.06.32; Tue, 21 Feb 2023 05:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b="gBZQ/xBK"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="MZMgKI/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234861AbjBUMq7 (ORCPT + 99 others); Tue, 21 Feb 2023 07:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbjBUMqw (ORCPT ); Tue, 21 Feb 2023 07:46:52 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D06D2A98E; Tue, 21 Feb 2023 04:46:45 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id D85E8320093F; Tue, 21 Feb 2023 07:46:43 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 Feb 2023 07:46:44 -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=1676983603; x=1677070003; bh=4P PQjSJNVgwU03Pj5b/L4ZJLYgKGF2yahc105X2h56E=; b=gBZQ/xBKen2MpRDqHP kJP4HpYQo9Y6HqiqgXj9Mkqt/E/w3PwhRLBkE2o+OsS3n2SP9Ng/mPu35D3sV0XG 44kexJZOGcBldDe5iwaHzLuU50gl+ow/vbdFun9T8eu262Wt582T3SGMrheJZZFZ 3jBvE2XmHjtOp42z/17cv1Rfl7ZsStyBqxCG4finf9YocP1WcjhW8Eb6pPNCvZNI GylOw4CO39XLkDwWQI6+alB5FVa5KxxixzE6Uiqk9noV/xrLRZVBRHCHcu5LFdYM UOmUoQYDMw5zb3Xh4tRcy1rKVWGuFIckozYMFJalQV2aNBBknfS4tEdcmRBiXsvl FxKA== 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=1676983603; x=1677070003; bh=4PPQjSJNVgwU0 3Pj5b/L4ZJLYgKGF2yahc105X2h56E=; b=MZMgKI/gl8T1hTzUgKkJMR3mNindB KgWZVIUrLChZ30l55JhNCgYdW3MMIsdwb8GiRKv+NqTDp0pMCAC97JvgBi0NVo1a 59N/OyP1GexGFx0AURQkG//75AKXweo6fJVG5qBuIej14MxNspp7fNzlW0i5f/S7 PzcLbTb2XAl8KHgEFu4A6Obsup/5dipb6urtUkNscFOm2gK85vpRHAMfdwKyzZPC 7iiurARaXXFvV2tzemiTAOgjW4URHiTGQ96+dDpTsoLR5tXecM11Hyd1OvRn/OPo 7XRYI2Pb6tNtv7Q/DbqQttHVn08MlN0NuJVvQ+r4BSARy5JfmtLi5rAVQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejjedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepfeeludefheegvdeuvd dvgeekgfdvtdettdelieeihfegtedugeekhfdvhfejfedtnecuvehluhhsthgvrhfuihii vgepvdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Feb 2023 07:46:41 -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, Jiaxun Yang Subject: [PATCH 7/7] of: address: Use dma_default_coherent to determine default coherency Date: Tue, 21 Feb 2023 12:46:13 +0000 Message-Id: <20230221124613.2859-8-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230221124613.2859-1-jiaxun.yang@flygoat.com> References: <20230221124613.2859-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758446030895559832?= X-GMAIL-MSGID: =?utf-8?q?1758446030895559832?= 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 ture, so we don't need to select CONFIG_ARCH_DMA_DEFAULT_COHERENT for PowerPC. 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 a27fea39413e..2cfee7ba2e6a 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -271,7 +271,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 c1327309e0f6..e69e69b9cfd4 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -120,7 +120,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 80b5fd44ab1c..e040837e5537 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -90,8 +90,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 c34ac33b7338..8e17adb10f20 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1053,7 +1053,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);