From nobody Sat Feb 7 19:41:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9DF8335062; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; cv=none; b=EdZ+HbLIKCrHwD4l3b0xqSbPBcn7QFcShztQmJ4CU0gTn8dtdF5kqbPOx5Vie0lGgbseSmzLGx221IdxltcxbgsDO2coXzWCn4kpyyrpjPasoWB90WKF58JW1PlkxMZTU+qdAvez1OnXwExu87yS/9V6G6qRFjvPIbpNUEgMMm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; c=relaxed/simple; bh=xGfi7N756BFoSPrY0lKVBtD8tN6LRZTUKS0ghi9+B4U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pS9/Sxswxerp/P2NqGS+5aVXUczXTeSWuYNOAbKnOp4x4UEJ4ySGPUBu/QACC/dlvPnWi7VQfoVXdOodyyHyYIhco7EM/FhNDSfdTiR8SVJfIRjeueBFflp7srZ8vZ03DVcb9+bRmC8v4gmkgaT92RuOgS1UYBNE+sXtgQcAkds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RWwoK5zk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RWwoK5zk" Received: by smtp.kernel.org (Postfix) with ESMTPS id 87EB6C4CEFD; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761591316; bh=xGfi7N756BFoSPrY0lKVBtD8tN6LRZTUKS0ghi9+B4U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=RWwoK5zkG1Uk9rjU1eip2EZ4xMwEefhKyd81QEpqldxtSWm34eH2Z9ijioKQcqbEK RQk0ZdZxBH6WPcI8p/6vmLjpBscVqrQUpLt5YIqmGaOKx5gs7VtKiyG7hiZCrmAcAy XqBHK5WdBHGdt0Skk5i1txazGxjdXhl+wtjlb50xMUVRs8fbfYeBYaSpsWJQJyyj3C vR19efLlQvgQLl3GDDCkhO36uXVX9wlndcSYlWicseB/mHzavS9Vs1ood4XHaJhnCI 9CVrVRc4S8ucR95T2/4+63nRXq2LIcapFYdH+ZnZTfSrW92K2fQpPhp9JvTRW/lzvW vaRsPUwQI43aA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71387CCF9E0; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Mon, 27 Oct 2025 13:55:15 -0500 Subject: [PATCH v4 1/5] dt-bindings: memory: tegra186-mc: Add dummy client IDs for Tegra186 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251027-tegra186-icc-p2-v4-1-e4e4f57e2103@gmail.com> References: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> In-Reply-To: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> To: Krzysztof Kozlowski , Rob Herring , Conor Dooley , Thierry Reding , Jonathan Hunter Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, Aaron Kling X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761591315; l=816; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=PmMpfHWG2+f6l6AbTUSHWT7B2d2RhnPduQ58vW6+634=; b=DCAwwKCHzR6IuPhDAK5nK2GwE6NsD/XvQZiVIDxHGKZ9oSdjCJGUfI213KG24/chyyZg4nCuX UR41CgG/sFuAeePi2WuDQxhZj9ZflKFML4Om+Zwkb+JxvdZjcFBrwuK X-Developer-Key: i=webgeek1234@gmail.com; a=ed25519; pk=TQwd6q26txw7bkK7B8qtI/kcAohZc7bHHGSD7domdrU= X-Endpoint-Received: by B4 Relay for webgeek1234@gmail.com/20250217 with auth_id=342 X-Original-From: Aaron Kling Reply-To: webgeek1234@gmail.com From: Aaron Kling Add ICC IDs for dummy software clients representing CCPLEX clusters. Signed-off-by: Aaron Kling --- include/dt-bindings/memory/tegra186-mc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/dt-bindings/memory/tegra186-mc.h b/include/dt-bindings= /memory/tegra186-mc.h index 82a1e27f73576212bc227c74adff28c5f33c6bb1..8abbc26f3123aad2dffaec6be21= f99f8de1ccf89 100644 --- a/include/dt-bindings/memory/tegra186-mc.h +++ b/include/dt-bindings/memory/tegra186-mc.h @@ -247,4 +247,8 @@ #define TEGRA186_MEMORY_CLIENT_VICSRD1 0xa2 #define TEGRA186_MEMORY_CLIENT_NVDECSRD1 0xa3 =20 +/* ICC ID's for dummy MC clients used to represent CPU Clusters */ +#define TEGRA_ICC_MC_CPU_CLUSTER0 1003 +#define TEGRA_ICC_MC_CPU_CLUSTER1 1004 + #endif --=20 2.51.0 From nobody Sat Feb 7 19:41:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B998C2D5412; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; cv=none; b=RcpQVzqE0A908vNDcOZ8n0/P2EaarpDU8GoT4SlxjXi2V3el6LIV1SQA9XzOKPZsp8KHuEyR1+Y/W3MoIMaZtEjdcKsSEmuD0MBbkyDK6BQkUfsgSvnQdpmIldK72v2XhxORiEOJHM0p4bt8pBv4XiYYEG6MUYTrezGbljkmHWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; c=relaxed/simple; bh=/JgzL9VdvfstUomPfZ32E6t/L8VPBz9Fmo+sGuWeS+8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h9gRFL+hb6OGGf2ylBuSAjxAANkLIStIi1NnTrfuS8HA+MAAn6fVeqNpJ6XJSM4D3SOCDIh8nOsYoyECgbGjln8nNYkp3Qsi9CcrInMfhkNBRWmMpc9IzSt1muIqipMvUJfk6bjf0MKM543TfUBux/k6Anev7V2SdIgXNk2OnqI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ubVARB1N; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ubVARB1N" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8E7E4C116C6; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761591316; bh=/JgzL9VdvfstUomPfZ32E6t/L8VPBz9Fmo+sGuWeS+8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ubVARB1N1cC5DCPMes3iFI6FUhFu48KtuLTjdhD+8kC7wRUNqciEECyp+S+f69rtv 8pj9uqO9r9LGQ6yxtfD5Y/mSpUJ0gjPlFdSGTuwj3XAU3KcOby9ZpgX5r+53BVX0nz LpGQNbUAQ+exzXikFFONkrO7aBStVDbhu1e6BaJB0TpEY0aIb1nYj1+hMMXVMOZlIx ez5XZv/mAhxPxgW/TSrXS3wpRDdMUb3cimk0azCWoD80yC7gbiHDyLZv8VUesElSBW mdgZPqB5y0DQOVPqKzbU4KgGPIH7Z1JbWdkUjTRjLHKfkkQ+GyJyPSe0QuCL3QjwPY tDYJzaNkd0XNQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FDD1CCF9EE; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Mon, 27 Oct 2025 13:55:16 -0500 Subject: [PATCH v4 2/5] dt-bindings: memory: tegra194-mc: Add dummy client IDs for Tegra194 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251027-tegra186-icc-p2-v4-2-e4e4f57e2103@gmail.com> References: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> In-Reply-To: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> To: Krzysztof Kozlowski , Rob Herring , Conor Dooley , Thierry Reding , Jonathan Hunter Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, Aaron Kling X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761591315; l=911; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=7znC8jN7FMo0ABLPSWxCMceZ2XZ3qZ4hFMoMP46i7rM=; b=oryh/jK+ksBPgI6VSObtoe4KCUaO7ft7IuD8IPULagCDjjkYuvzb7vyOCDkex8WU5EyIc41mj iFg9Ln6T2s4DScGt58Ju30dSVzFEQtLLIy6zko5QOIkMMMj5S48JXpP X-Developer-Key: i=webgeek1234@gmail.com; a=ed25519; pk=TQwd6q26txw7bkK7B8qtI/kcAohZc7bHHGSD7domdrU= X-Endpoint-Received: by B4 Relay for webgeek1234@gmail.com/20250217 with auth_id=342 X-Original-From: Aaron Kling Reply-To: webgeek1234@gmail.com From: Aaron Kling Add ICC IDs for dummy software clients representing CCPLEX clusters. Signed-off-by: Aaron Kling --- include/dt-bindings/memory/tegra194-mc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/dt-bindings/memory/tegra194-mc.h b/include/dt-bindings= /memory/tegra194-mc.h index eed48b746bc94072a6bd0af7f344dbb6f6618859..a7d97a1a470cd3cfb18c7ef45c4= 21426ea3c7abf 100644 --- a/include/dt-bindings/memory/tegra194-mc.h +++ b/include/dt-bindings/memory/tegra194-mc.h @@ -407,4 +407,10 @@ /* MSS internal memqual MIU6 write clients */ #define TEGRA194_MEMORY_CLIENT_MIU6W 0xff =20 +/* ICC ID's for dummy MC clients used to represent CPU Clusters */ +#define TEGRA_ICC_MC_CPU_CLUSTER0 1003 +#define TEGRA_ICC_MC_CPU_CLUSTER1 1004 +#define TEGRA_ICC_MC_CPU_CLUSTER2 1005 +#define TEGRA_ICC_MC_CPU_CLUSTER3 1006 + #endif --=20 2.51.0 From nobody Sat Feb 7 19:41:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D08893346BB; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; cv=none; b=bfwcQ+BOpFl8zBlD3q1vUzv31uT0GEah04TcGrK5QQKeiq+r85qkUtXm98lTnJoKwbZAHrygDjeDowesMH+C6JHZwCxjk5v926HjRI8P0XuC20H5HdwV9KDIvEBh74aVL/WO6qOlt0mhsQloLCqjPbt7swri9anx3dAymMqgIwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; c=relaxed/simple; bh=GGEvEZvRaoIuFDYNvZvkDj01Ws1uqA3sPZnOQu42VM4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=emaDGZw5QIDDtkSAQhQKIHRInJFvNciuhiYP7sIW2L/4Su4fvQN0S13h80CMQSeqYDs69qVJeOA95EMUyIpo/Xg7rcWNShpty9MPgoVB+7FyihCdFqSWjkW4L4Z9ltFwnxGIxYwuzF6QLVfAUttl5/BH1X9lEo0b/21uDqO0mmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=crH8EmHu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="crH8EmHu" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9B49AC16AAE; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761591316; bh=GGEvEZvRaoIuFDYNvZvkDj01Ws1uqA3sPZnOQu42VM4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=crH8EmHudGPM8e37FU+7DRJ2Dzqog99qvcRmRxP3T5MSA6YbpCD4GyfEh9yWtis2p e0BQ3yC1AqeMAn3yU3Jitw01qRsyU4ieeVue4qx1SsRtidmVL50gqleD9LC3aVvBLr KOck+oFHq/10Bfvfm84Vy7LbOxI+VXfq5yPO1Za4H7CWQeCnY86bD8+XzFAy+epXo/ 1juAgtdSinJkNnjqnr40rQW7SieDo73bbRsJOXynRyECZzr2JD7GgpxTqdfo7EXW/q 3Mbcfh5S8qpcPrrV66pBV8NAohs8v4J8AndwV8SVy7biPjd4U084eJzhi0LJ8ofMpE bWGIBVgYEl15A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E06BCCF9E5; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Mon, 27 Oct 2025 13:55:17 -0500 Subject: [PATCH v4 3/5] memory: tegra186-emc: Support non-bpmp icc scaling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251027-tegra186-icc-p2-v4-3-e4e4f57e2103@gmail.com> References: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> In-Reply-To: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> To: Krzysztof Kozlowski , Rob Herring , Conor Dooley , Thierry Reding , Jonathan Hunter Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, Aaron Kling X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761591315; l=5761; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=222sswwfBJV+dPNMrl15U4Icho4DcSw0wOpJlVxJSao=; b=rjad1WYlJMXjlqBfbvXz79t0Y09Vy5oD0DVu+z9g0hetg9tLLViNkUFiqPoPh1cOQ/qFfC902 M0hEEf1B1FYCLedIam3WsB6d+xmjMG9v+P9RoZRLFJwMQXyKbK9ZCUz X-Developer-Key: i=webgeek1234@gmail.com; a=ed25519; pk=TQwd6q26txw7bkK7B8qtI/kcAohZc7bHHGSD7domdrU= X-Endpoint-Received: by B4 Relay for webgeek1234@gmail.com/20250217 with auth_id=342 X-Original-From: Aaron Kling Reply-To: webgeek1234@gmail.com From: Aaron Kling This adds support for dynamic frequency scaling of external memory on devices with bpmp firmware that does not support bwmgr. Signed-off-by: Aaron Kling --- drivers/memory/tegra/tegra186-emc.c | 132 ++++++++++++++++++++++++++++++++= +++- 1 file changed, 130 insertions(+), 2 deletions(-) diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/teg= ra186-emc.c index 9959ad5804b444b269456d1fbae87b4bc111661b..74be09968baa7a0fbdce4359f47= 0ce56b18acb10 100644 --- a/drivers/memory/tegra/tegra186-emc.c +++ b/drivers/memory/tegra/tegra186-emc.c @@ -18,6 +18,17 @@ struct tegra186_emc_dvfs { unsigned long rate; }; =20 +enum emc_rate_request_type { + EMC_RATE_DEBUG, + EMC_RATE_ICC, + EMC_RATE_TYPE_MAX, +}; + +struct emc_rate_request { + unsigned long min_rate; + unsigned long max_rate; +}; + struct tegra186_emc { struct tegra_bpmp *bpmp; struct device *dev; @@ -33,8 +44,90 @@ struct tegra186_emc { } debugfs; =20 struct icc_provider provider; + + /* + * There are multiple sources in the EMC driver which could request + * a min/max clock rate, these rates are contained in this array. + */ + struct emc_rate_request requested_rate[EMC_RATE_TYPE_MAX]; + + /* protect shared rate-change code path */ + struct mutex rate_lock; }; =20 +static void tegra186_emc_rate_requests_init(struct tegra186_emc *emc) +{ + unsigned int i; + + for (i =3D 0; i < EMC_RATE_TYPE_MAX; i++) { + emc->requested_rate[i].min_rate =3D 0; + emc->requested_rate[i].max_rate =3D ULONG_MAX; + } +} + +static int emc_request_rate(struct tegra186_emc *emc, + unsigned long new_min_rate, + unsigned long new_max_rate, + enum emc_rate_request_type type) +{ + struct emc_rate_request *req =3D emc->requested_rate; + unsigned long min_rate =3D 0, max_rate =3D ULONG_MAX; + unsigned int i; + int err; + + /* select minimum and maximum rates among the requested rates */ + for (i =3D 0; i < EMC_RATE_TYPE_MAX; i++, req++) { + if (i =3D=3D type) { + min_rate =3D max(new_min_rate, min_rate); + max_rate =3D min(new_max_rate, max_rate); + } else { + min_rate =3D max(req->min_rate, min_rate); + max_rate =3D min(req->max_rate, max_rate); + } + } + + if (min_rate > max_rate) { + dev_err_ratelimited(emc->dev, "%s: type %u: out of range: %lu %lu\n", + __func__, type, min_rate, max_rate); + return -ERANGE; + } + + err =3D clk_set_rate(emc->clk, min_rate); + if (err) + return err; + + emc->requested_rate[type].min_rate =3D new_min_rate; + emc->requested_rate[type].max_rate =3D new_max_rate; + + return 0; +} + +static int emc_set_min_rate(struct tegra186_emc *emc, unsigned long rate, + enum emc_rate_request_type type) +{ + struct emc_rate_request *req =3D &emc->requested_rate[type]; + int ret; + + mutex_lock(&emc->rate_lock); + ret =3D emc_request_rate(emc, rate, req->max_rate, type); + mutex_unlock(&emc->rate_lock); + + return ret; +} + +static int emc_set_max_rate(struct tegra186_emc *emc, unsigned long rate, + enum emc_rate_request_type type) +{ + struct emc_rate_request *req =3D &emc->requested_rate[type]; + int ret; + + mutex_lock(&emc->rate_lock); + ret =3D emc_request_rate(emc, req->min_rate, rate, type); + mutex_unlock(&emc->rate_lock); + + return ret; +} + /* * debugfs interface * @@ -107,7 +200,7 @@ static int tegra186_emc_debug_min_rate_set(void *data, = u64 rate) if (!tegra186_emc_validate_rate(emc, rate)) return -EINVAL; =20 - err =3D clk_set_min_rate(emc->clk, rate); + err =3D emc_set_min_rate(emc, rate, EMC_RATE_DEBUG); if (err < 0) return err; =20 @@ -137,7 +230,7 @@ static int tegra186_emc_debug_max_rate_set(void *data, = u64 rate) if (!tegra186_emc_validate_rate(emc, rate)) return -EINVAL; =20 - err =3D clk_set_max_rate(emc->clk, rate); + err =3D emc_set_max_rate(emc, rate, EMC_RATE_DEBUG); if (err < 0) return err; =20 @@ -217,6 +310,12 @@ static int tegra186_emc_get_emc_dvfs_latency(struct te= gra186_emc *emc) return 0; } =20 +static inline struct tegra186_emc * +to_tegra186_emc_provider(struct icc_provider *provider) +{ + return container_of(provider, struct tegra186_emc, provider); +} + /* * tegra186_emc_icc_set_bw() - Set BW api for EMC provider * @src: ICC node for External Memory Controller (EMC) @@ -227,6 +326,33 @@ static int tegra186_emc_get_emc_dvfs_latency(struct te= gra186_emc *emc) */ static int tegra186_emc_icc_set_bw(struct icc_node *src, struct icc_node *= dst) { + struct tegra186_emc *emc =3D to_tegra186_emc_provider(dst->provider); + struct tegra_mc *mc =3D dev_get_drvdata(emc->dev->parent); + unsigned long long peak_bw =3D icc_units_to_bps(dst->peak_bw); + unsigned long long avg_bw =3D icc_units_to_bps(dst->avg_bw); + unsigned long long rate =3D max(avg_bw, peak_bw); + const unsigned int ddr =3D 2; + int err; + + /* + * Do nothing here if bwmgr is supported in BPMP-FW. BPMP-FW sets the fin= al + * Freq based on the passed values. + */ + if (mc->bwmgr_mrq_supported) + return 0; + + /* + * Tegra186 EMC runs on a clock rate of SDRAM bus. This means that + * EMC clock rate is twice smaller than the peak data rate because + * data is sampled on both EMC clock edges. + */ + do_div(rate, ddr); + rate =3D min_t(u64, rate, U32_MAX); + + err =3D emc_set_min_rate(emc, rate, EMC_RATE_ICC); + if (err) + return err; + return 0; } =20 @@ -329,6 +455,8 @@ static int tegra186_emc_probe(struct platform_device *p= dev) platform_set_drvdata(pdev, emc); emc->dev =3D &pdev->dev; =20 + tegra186_emc_rate_requests_init(emc); + if (tegra_bpmp_mrq_is_supported(emc->bpmp, MRQ_EMC_DVFS_LATENCY)) { err =3D tegra186_emc_get_emc_dvfs_latency(emc); if (err) --=20 2.51.0 From nobody Sat Feb 7 19:41:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9975332900; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; cv=none; b=srbadbKbaurzWCyUW4SMDrB2cXrtuncFeILXLK5sPLTrJuX/sVWtF1WRw+ruQ45awPZhix5uCsDiIO+ZK0uqKxqxlWIFHy7P1d4LgIul3uJM18YtP9Adamp95AV0vnISSellcpRD7Chg/MGBXbWM6h6KjYnQYHN2Zoo5zXwIvsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591316; c=relaxed/simple; bh=g2mmajcxbCrl4r+56yYrwyyJINURxPSPFab71xwisCM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uB2TR3e2bOPuWvbNr3w/GwXoo0YruHsKu9ST8ZiZnnb+nAPANSmWcmZKuS/LlNkFK19fLeJBtPXCD6sDDKGhzDOMT47I9iD/CH4Cekea5tBaGcGmiSXMrdn0+oasB0tNM1HExOdaQ+pKgus2tVTBNzoJwRY3EElMnwXZhl2FuAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BxHyn3OR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BxHyn3OR" Received: by smtp.kernel.org (Postfix) with ESMTPS id A7A79C4AF0E; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761591316; bh=g2mmajcxbCrl4r+56yYrwyyJINURxPSPFab71xwisCM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=BxHyn3OR+qtZyHbFPG2LPFJW9DYFlteEyAvD33ZrPuyJKJqgHPgfdpqjBiNWj1mq9 CiKEqqxHKSU/Vd09PapNkGCVf5Jl97GfSJjGeBgBwQO3Ingblm4KN6cVopQyYRgO4W JESBpQnkNMqwB66EF0Hei1M2XLBcQz6j4T+r3xbc4jaXlbjsX+y2BaZ+/VXwhTyTvJ BwzhvfHjVi+5HhLvJVaKKcecVM3Xqm6l+yLTZq1ZL4lkGiRR/FmM6kcHgXU5o2iZ6h 7oQ+XJfF5D01Ta+qvXmxBHc4n3uZYv0x/R7nYjmfUWzubdgYb1X1Z8ZnU3WIJL6FI/ mN0Xbm9x7WR7g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C6F3CCF9EF; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Mon, 27 Oct 2025 13:55:18 -0500 Subject: [PATCH v4 4/5] memory: tegra186: Support icc scaling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251027-tegra186-icc-p2-v4-4-e4e4f57e2103@gmail.com> References: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> In-Reply-To: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> To: Krzysztof Kozlowski , Rob Herring , Conor Dooley , Thierry Reding , Jonathan Hunter Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, Aaron Kling X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761591315; l=2383; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=a/aaiaGuHyMc5nlB9Xe5+rxhKDOKwn8mtxYy/DM7ELQ=; b=sTiZwi1CKAAV0SWUPFee8cPPc6/4LR4iIF4TCTBWzREoSjQSVh+iuY/5/P5da1ERPlGnM+Olh Gi6l1d3fHY0BANgm5dmTyL1R19RlZTrjC2pCDMtEzMTIOJP0WO3mSg0 X-Developer-Key: i=webgeek1234@gmail.com; a=ed25519; pk=TQwd6q26txw7bkK7B8qtI/kcAohZc7bHHGSD7domdrU= X-Endpoint-Received: by B4 Relay for webgeek1234@gmail.com/20250217 with auth_id=342 X-Original-From: Aaron Kling Reply-To: webgeek1234@gmail.com From: Aaron Kling Add Interconnect framework support to dynamically set the DRAM bandwidth from different clients. The MC driver is added as an ICC provider and the EMC driver is already a provider. Signed-off-by: Aaron Kling --- drivers/memory/tegra/tegra186.c | 48 +++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 48 insertions(+) diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra18= 6.c index aee11457bf8e032637d1772affb87da0cac68494..1384164f624af5d4aaccedc8444= 3d203ba3db2c6 100644 --- a/drivers/memory/tegra/tegra186.c +++ b/drivers/memory/tegra/tegra186.c @@ -899,9 +899,56 @@ static const struct tegra_mc_client tegra186_mc_client= s[] =3D { .security =3D 0x51c, }, }, + }, { + .id =3D TEGRA_ICC_MC_CPU_CLUSTER0, + .name =3D "sw_cluster0", + .type =3D TEGRA_ICC_NISO, + }, { + .id =3D TEGRA_ICC_MC_CPU_CLUSTER1, + .name =3D "sw_cluster1", + .type =3D TEGRA_ICC_NISO, }, }; =20 +static int tegra186_mc_icc_set(struct icc_node *src, struct icc_node *dst) +{ + /* TODO: program PTSA */ + return 0; +} + +static int tegra186_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 a= vg_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + struct icc_provider *p =3D node->provider; + struct tegra_mc *mc =3D icc_provider_to_tegra_mc(p); + + if (node->id =3D=3D TEGRA_ICC_MC_CPU_CLUSTER0 || + node->id =3D=3D TEGRA_ICC_MC_CPU_CLUSTER1) { + if (mc) + peak_bw =3D peak_bw * mc->num_channels; + } + + *agg_avg +=3D avg_bw; + *agg_peak =3D max(*agg_peak, peak_bw); + + return 0; +} + +static int tegra186_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u3= 2 *peak) +{ + *avg =3D 0; + *peak =3D 0; + + return 0; +} + +static const struct tegra_mc_icc_ops tegra186_mc_icc_ops =3D { + .xlate =3D tegra_mc_icc_xlate, + .aggregate =3D tegra186_mc_icc_aggregate, + .get_bw =3D tegra186_mc_icc_get_init_bw, + .set =3D tegra186_mc_icc_set, +}; + const struct tegra_mc_soc tegra186_mc_soc =3D { .num_clients =3D ARRAY_SIZE(tegra186_mc_clients), .clients =3D tegra186_mc_clients, @@ -912,6 +959,7 @@ const struct tegra_mc_soc tegra186_mc_soc =3D { MC_INT_SECERR_SEC | MC_INT_DECERR_VPR | MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, .ops =3D &tegra186_mc_ops, + .icc_ops =3D &tegra186_mc_icc_ops, .ch_intmask =3D 0x0000000f, .global_intstatus_channel_shift =3D 0, }; --=20 2.51.0 From nobody Sat Feb 7 19:41:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9892334C36; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591317; cv=none; b=JEareTSN2D6L6ijOPWetIdSyrHWu/OhCxRwpyqsnbmvewhA9RSSLSxjb1no+Ph3JGusVtdb2nZXptaeGRnK7UMAhCL6HG10hHDczToUS/+Avtupl0hyOnxYRfCiPrV5ZMK2WsnmBz+nJiLlLueNkUJAfSxaO2uhJwa0TBxsrzr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591317; c=relaxed/simple; bh=ldF0nGpWAR7TOjezYKVTTUArSP8PCCaKaY6s6ILTcfE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=flIURDXmQUuEFNGNNCtXvy+BY0KANwC8ocA2en/lLU5Fuk0QE7GiWilFzS1KmxujbtgbMLaUmJP0A8huNdklay9JvjktixdwjA8leifhn9vW1aGnOr/pMaRcTjXsIwlj9P1za8lu8usjWQDTzVMYIDiARbz5QZJ/rSDAs17O/e0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B4yjHE8R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B4yjHE8R" Received: by smtp.kernel.org (Postfix) with ESMTPS id B5F4FC19424; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761591316; bh=ldF0nGpWAR7TOjezYKVTTUArSP8PCCaKaY6s6ILTcfE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=B4yjHE8RrmGinVLtwbjFrl0ssco4zQXAZYMG00ya63RvPvciJVXcHxL6Xc822BQsx 2xefYsuYAPacvRZrUr4tPmODoG570hzym1kuX+Gt7q13+PZ2fcapz7wW/EH0EWUn96 sPsTS+Mr72ZdmXcUD/rvvmufPn+fCNmF+tytCV0kVulQUlwvUKFOzVF1QSazP62pi2 4nlu7XYi8I3SJ8FV6QaOjHTYP27Lsdb8If6cZZuqTheTC6ck/D9/1yV8YOwWMS29DC G15n9f+Ct/fj9rs/qHXJ+6jjS6L/Bv0ZRMPBnVl3FsMsY1cieEYW0HJOjDhYYD5Vj/ UIBm20F8WfIiQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC966CCF9EB; Mon, 27 Oct 2025 18:55:16 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Mon, 27 Oct 2025 13:55:19 -0500 Subject: [PATCH v4 5/5] memory: tegra194: Support icc scaling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251027-tegra186-icc-p2-v4-5-e4e4f57e2103@gmail.com> References: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> In-Reply-To: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com> To: Krzysztof Kozlowski , Rob Herring , Conor Dooley , Thierry Reding , Jonathan Hunter Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, Aaron Kling X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761591315; l=2712; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=LQh6Wx9w2ZA6cjZPbhQTpnWCKJr1fmEA9mYm4DrdFjk=; b=Rx3/OKGXqFR0gOR+EgGjdrRz/S3bwge/fsOM5HqFAej3que/1YSMYDFUcFGPL06GDc9/N26BR jWuxSfriEO4D1NrVRKvakafdwycRzo3xsKJUwb2ln7l9+lYpqHQoLEY X-Developer-Key: i=webgeek1234@gmail.com; a=ed25519; pk=TQwd6q26txw7bkK7B8qtI/kcAohZc7bHHGSD7domdrU= X-Endpoint-Received: by B4 Relay for webgeek1234@gmail.com/20250217 with auth_id=342 X-Original-From: Aaron Kling Reply-To: webgeek1234@gmail.com From: Aaron Kling Add Interconnect framework support to dynamically set the DRAM bandwidth from different clients. The MC driver is added as an ICC provider and the EMC driver is already a provider. Signed-off-by: Aaron Kling --- drivers/memory/tegra/tegra194.c | 59 +++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/drivers/memory/tegra/tegra194.c b/drivers/memory/tegra/tegra19= 4.c index 26035ac3a1eb51a3d8ce3830427b4412b48baf3c..e478587586e7f01afd41ff74d26= a9a3f1d881347 100644 --- a/drivers/memory/tegra/tegra194.c +++ b/drivers/memory/tegra/tegra194.c @@ -1340,9 +1340,66 @@ static const struct tegra_mc_client tegra194_mc_clie= nts[] =3D { .security =3D 0x7fc, }, }, + }, { + .id =3D TEGRA_ICC_MC_CPU_CLUSTER0, + .name =3D "sw_cluster0", + .type =3D TEGRA_ICC_NISO, + }, { + .id =3D TEGRA_ICC_MC_CPU_CLUSTER1, + .name =3D "sw_cluster1", + .type =3D TEGRA_ICC_NISO, + }, { + .id =3D TEGRA_ICC_MC_CPU_CLUSTER2, + .name =3D "sw_cluster2", + .type =3D TEGRA_ICC_NISO, + }, { + .id =3D TEGRA_ICC_MC_CPU_CLUSTER3, + .name =3D "sw_cluster3", + .type =3D TEGRA_ICC_NISO, }, }; =20 +static int tegra194_mc_icc_set(struct icc_node *src, struct icc_node *dst) +{ + /* TODO: program PTSA */ + return 0; +} + +static int tegra194_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 a= vg_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + struct icc_provider *p =3D node->provider; + struct tegra_mc *mc =3D icc_provider_to_tegra_mc(p); + + if (node->id =3D=3D TEGRA_ICC_MC_CPU_CLUSTER0 || + node->id =3D=3D TEGRA_ICC_MC_CPU_CLUSTER1 || + node->id =3D=3D TEGRA_ICC_MC_CPU_CLUSTER2 || + node->id =3D=3D TEGRA_ICC_MC_CPU_CLUSTER3) { + if (mc) + peak_bw =3D peak_bw * mc->num_channels; + } + + *agg_avg +=3D avg_bw; + *agg_peak =3D max(*agg_peak, peak_bw); + + return 0; +} + +static int tegra194_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u3= 2 *peak) +{ + *avg =3D 0; + *peak =3D 0; + + return 0; +} + +static const struct tegra_mc_icc_ops tegra194_mc_icc_ops =3D { + .xlate =3D tegra_mc_icc_xlate, + .aggregate =3D tegra194_mc_icc_aggregate, + .get_bw =3D tegra194_mc_icc_get_init_bw, + .set =3D tegra194_mc_icc_set, +}; + const struct tegra_mc_soc tegra194_mc_soc =3D { .num_clients =3D ARRAY_SIZE(tegra194_mc_clients), .clients =3D tegra194_mc_clients, @@ -1355,7 +1412,7 @@ const struct tegra_mc_soc tegra194_mc_soc =3D { MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, .has_addr_hi_reg =3D true, .ops =3D &tegra186_mc_ops, - .icc_ops =3D &tegra_mc_icc_ops, + .icc_ops =3D &tegra194_mc_icc_ops, .ch_intmask =3D 0x00000f00, .global_intstatus_channel_shift =3D 8, }; --=20 2.51.0