From patchwork Wed Jun 14 16:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13280246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93BD9EB64D8 for ; Wed, 14 Jun 2023 17:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2Ue5r6PDTho4w/E7xDn/Uc1lENkEyyjI96eB0wcvkQc=; b=Zxwvd2NzjmmN4V qXl8TjugT8DfeYeZYhKEG/zerw4vcH5psPfspKuhT9MuBvvJLihgUlxN9yROrDjy/8060YEBbiiYR a8SpHub6SB0sm8RbIKADyc66Cz4LVfaMotUxhMx0INsgSYuvF+mYQBdbiabSOPIfLUFEq1hfRSYmE qSNrZHA5H7oAO+ezLWz4k/Enbhfz87WLuR/Y7cIpELroGxKzMJ7DW1K1XlzFCP9iuQ2mybHdgvp8Y Mhp5mJZpxPcqrVpOVPjXUXfjQ/81GW7XzdQSSRWN8tMiSBa8s1sUlloxW9y4Ki+LYjE6xA7tVvsBQ PGfmD0BlyfPRcRcYuJrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9Twz-00CIe1-1Q; Wed, 14 Jun 2023 17:06:29 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9Twx-00CId7-1g for linux-riscv@lists.infradead.org; Wed, 14 Jun 2023 17:06:28 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DDC4461542; Wed, 14 Jun 2023 17:06:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C92BAC433C9; Wed, 14 Jun 2023 17:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686762386; bh=QeH29Idc/6qrLsvNLxNicZ5LF/IoEKjciGzozuHn9t0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2rZISm1K8SkX1xOX2TLo7PW3cS1O2+YAR3k8M/A7VHYIwyHqnIYBfZHgFZjoHAcU D6TI6td2vGW0/E3u69+d2Zu7PFJ2td8w0NweV8byRIQnpl3T+xRcHQDXzF+Eg/24Kl siFAuXe4IaioC/8Z1rh4+OBr2Q9k+zPGamRaR8KE5Q+3kXXjDS44jOvQ+tiTZhqZWo YGCtd0MSzQSzdydgVrdgOXvuAO+tZb1xla2qNqdK9DMFnKtUXfHygowqSgjC1PS/4z aq3kHPtbo8dEMetGxnDv5izg4t5+r2BOJCxxMQKppXEb7mN2OIBSCx71X/3FFRVeOi wbMRbsRj8hzTA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Conor Dooley Subject: [PATCH 1/3] riscv: errata: thead: only set cbom size & noncoherent during boot Date: Thu, 15 Jun 2023 00:55:02 +0800 Message-Id: <20230614165504.532-2-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230614165504.532-1-jszhang@kernel.org> References: <20230614165504.532-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230614_100627_595241_20D6691A X-CRM114-Status: UNSURE ( 9.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The CBOM size and whether the HW is noncoherent is known and determined during booting and won't change after that. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley --- arch/riscv/errata/thead/errata.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c index c259dc925ec1..be84b14f0118 100644 --- a/arch/riscv/errata/thead/errata.c +++ b/arch/riscv/errata/thead/errata.c @@ -45,8 +45,11 @@ static bool errata_probe_cmo(unsigned int stage, if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) return false; - riscv_cbom_block_size = L1_CACHE_BYTES; - riscv_noncoherent_supported(); + if (stage == RISCV_ALTERNATIVES_BOOT) { + riscv_cbom_block_size = L1_CACHE_BYTES; + riscv_noncoherent_supported(); + } + return true; } From patchwork Wed Jun 14 16:55:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13280244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E79BEB64DC for ; Wed, 14 Jun 2023 17:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t3bUz5mafuTEI+Nhoe7pVoKhqiJz4VnclwMGr4SW1YU=; b=Hww36nJTFNAz+Q 5DZ7JjX7/cX1aoXK6uqMd113P2pTo8v1GVAEyXA5SmNitR21QeBC1CQDEVj7Xv95luyuUAGnbRXmG u8DP1OisUztm8qrR2ITj3Rs6XXqaN8jvhxAX5tCXvRJQaijtNA03f0kMM1rUDsgE0iSPXzrlHLCfp KGDxHjcfhKnUQhb8jrmvezOhZvAuFeOYnlpy05jl/sPEvnWhK1AyPb/COxALbBqBqaC74WZtwOy3+ VXbJVkKNu90LvIY+Qqssj685WmmWIxmvnjEZK/mPoeNqjXzckPDE6V56zUOj8rCEGZwGc2LqiKAJa MnxQcedsA0itvCR1lUdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9Tx2-00CIfF-09; Wed, 14 Jun 2023 17:06:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9Twz-00CIdc-0z for linux-riscv@lists.infradead.org; Wed, 14 Jun 2023 17:06:30 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D36CD638A3; Wed, 14 Jun 2023 17:06:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1B11C433C8; Wed, 14 Jun 2023 17:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686762388; bh=IzRWhdBJbcEgHie+AfmJ1TfzRd1tYjsi5h/A0SNdze8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=smQcIBxnp+uHpcp3B4gZHVTHtsLsPvk7LzPNCHaPHXDdgWQfppJOBbHWv9OiMYr66 u0o41zBEh60PJysSMHJ86S6d/EkB7rB/QOMOe5h7x1qHDgNUqsdaorrRnRbtDtRFJJ QKNUMDnIr91hos/JiBNnRg7o0RdVxQTX4xlOv3q3rj//YrQma9pOrbeW+TBcPLrr0N 7T1CvpFyG+ALpuyiSQGY+zhrEs5ddA/s9K6n6ltPGbEAMaBT3JueCPQBFSVE6FuTDp zFAzI6bjX09kP3Hm1px4uVEvnPaVaOxWIOyzEhUcNPV64MZqSnHYQGeT/WDIq0Lw5m kokFqBXz8U+kA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Conor Dooley Subject: [PATCH 2/3] riscv: mm: mark CBO relate initialization funcs as __init Date: Thu, 15 Jun 2023 00:55:03 +0800 Message-Id: <20230614165504.532-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230614165504.532-1-jszhang@kernel.org> References: <20230614165504.532-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230614_100629_384336_6C3897B1 X-CRM114-Status: UNSURE ( 8.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The two functions cbo_get_block_size() and riscv_init_cbo_blocksizes() are only called during booting, mark them as __init. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley --- arch/riscv/mm/cacheflush.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index fca532ddf3ec..fbc59b3f69f2 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -104,9 +104,9 @@ EXPORT_SYMBOL_GPL(riscv_cbom_block_size); unsigned int riscv_cboz_block_size; EXPORT_SYMBOL_GPL(riscv_cboz_block_size); -static void cbo_get_block_size(struct device_node *node, - const char *name, u32 *block_size, - unsigned long *first_hartid) +static void __init cbo_get_block_size(struct device_node *node, + const char *name, u32 *block_size, + unsigned long *first_hartid) { unsigned long hartid; u32 val; @@ -126,7 +126,7 @@ static void cbo_get_block_size(struct device_node *node, } } -void riscv_init_cbo_blocksizes(void) +void __init riscv_init_cbo_blocksizes(void) { unsigned long cbom_hartid, cboz_hartid; u32 cbom_block_size = 0, cboz_block_size = 0; From patchwork Wed Jun 14 16:55:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13280245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C3E8EB64DB for ; Wed, 14 Jun 2023 17:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lbOKQvHqJsgtuvVBw1Oc8OMoelL/doHyUinBxSDbKSI=; b=RmlPNdwHDGWWUy FS4qL6qz/sULFlbfkMUFgt5UttCf6QVm1pR8eQ7XUh8IQ9oqT/qDH3DO+hTCqzzghhAtkmJSUnD+o o8gtj8QcHRhI94o+ZiLRVM2nEnGbaMUZSB57HudOCuv5Qgo08hm0shW+n0Rz/2phP5iPqooxHRobp wRQ88rZk3/NHYQsCWtevl96cYLtWq3kdshJaD5nKBLrkWfwDsB1oT1EouvBE+YlxkHFuOTRAisQ+W NrlGQYngGDFdss8B9BEEv04T/9iOH1s1x8kBlJifXrlrRndMNH5GOCNMQ5FmiMP84XAA9JNyrzS+i YwmNmjXLMke41J4Oc47A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9Tx3-00CIgF-2U; Wed, 14 Jun 2023 17:06:33 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9Tx1-00CIea-0G for linux-riscv@lists.infradead.org; Wed, 14 Jun 2023 17:06:32 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 936F4644D0; Wed, 14 Jun 2023 17:06:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B95D1C433C0; Wed, 14 Jun 2023 17:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686762390; bh=r6WmK6pN8JZLuhkdUWl3EWEdgWXW6Xnybl6dJtROQn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZaXe/FqPg/6fky/CfXosBUmIW2Noo0nes4r5ymfjKVsNeqFuSRyQAxyHOhicbU4t xguaueQOiZ7lg7LuC9SFyUrh2P0DrP3BRZFk6aEj9nORUFle74Q5tC3e4MSpJGVIf6 iAj3cXwcdUq7gEUrskoIk0W5QGsDA6llLPqkweStT0KmYkBlSmlFQOTLsM/fQ1O0Qk 56pLS9sQSNLyZrPYWsipzdZWhQ0Mv8kFIuGEJ5pgp+58IqvqMeiX8ZtjYPh+F2mr5c RBtDCpKC/7v0rAvStUEsSXbFRMkDH0hhOUcuriJEokWCAD6jTa0Zy7HMREtmJj/CK4 vBbwyiuiVZz3Q== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Conor Dooley Subject: [PATCH 3/3] riscv: mm: mark noncoherent_supported as __ro_after_init Date: Thu, 15 Jun 2023 00:55:04 +0800 Message-Id: <20230614165504.532-4-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230614165504.532-1-jszhang@kernel.org> References: <20230614165504.532-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230614_100631_164655_8616632F X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The noncoherent_supported indicates whether the HW is coherent or not, it won't change after booting, mark it as __ro_after_init. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley --- arch/riscv/mm/dma-noncoherent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/mm/dma-noncoherent.c b/arch/riscv/mm/dma-noncoherent.c index d919efab6eba..d51a75864e53 100644 --- a/arch/riscv/mm/dma-noncoherent.c +++ b/arch/riscv/mm/dma-noncoherent.c @@ -10,7 +10,7 @@ #include #include -static bool noncoherent_supported; +static bool noncoherent_supported __ro_after_init; void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, enum dma_data_direction dir)