public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Kling via B4 Relay <devnull+webgeek1234.gmail.com@kernel.org>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Thierry Reding <thierry.reding@gmail.com>,
	 Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-tegra@vger.kernel.org, Aaron Kling <webgeek1234@gmail.com>
Subject: [PATCH v4 4/5] memory: tegra186: Support icc scaling
Date: Mon, 27 Oct 2025 13:55:18 -0500	[thread overview]
Message-ID: <20251027-tegra186-icc-p2-v4-4-e4e4f57e2103@gmail.com> (raw)
In-Reply-To: <20251027-tegra186-icc-p2-v4-0-e4e4f57e2103@gmail.com>

From: Aaron Kling <webgeek1234@gmail.com>

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 <webgeek1234@gmail.com>
---
 drivers/memory/tegra/tegra186.c | 48 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index aee11457bf8e032637d1772affb87da0cac68494..1384164f624af5d4aaccedc84443d203ba3db2c6 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_clients[] = {
 				.security = 0x51c,
 			},
 		},
+	}, {
+		.id = TEGRA_ICC_MC_CPU_CLUSTER0,
+		.name = "sw_cluster0",
+		.type = TEGRA_ICC_NISO,
+	}, {
+		.id = TEGRA_ICC_MC_CPU_CLUSTER1,
+		.name = "sw_cluster1",
+		.type = TEGRA_ICC_NISO,
 	},
 };
 
+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 avg_bw,
+				     u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
+{
+	struct icc_provider *p = node->provider;
+	struct tegra_mc *mc = icc_provider_to_tegra_mc(p);
+
+	if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 ||
+	    node->id == TEGRA_ICC_MC_CPU_CLUSTER1) {
+		if (mc)
+			peak_bw = peak_bw * mc->num_channels;
+	}
+
+	*agg_avg += avg_bw;
+	*agg_peak = max(*agg_peak, peak_bw);
+
+	return 0;
+}
+
+static int tegra186_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak)
+{
+	*avg = 0;
+	*peak = 0;
+
+	return 0;
+}
+
+static const struct tegra_mc_icc_ops tegra186_mc_icc_ops = {
+	.xlate = tegra_mc_icc_xlate,
+	.aggregate = tegra186_mc_icc_aggregate,
+	.get_bw = tegra186_mc_icc_get_init_bw,
+	.set = tegra186_mc_icc_set,
+};
+
 const struct tegra_mc_soc tegra186_mc_soc = {
 	.num_clients = ARRAY_SIZE(tegra186_mc_clients),
 	.clients = tegra186_mc_clients,
@@ -912,6 +959,7 @@ const struct tegra_mc_soc tegra186_mc_soc = {
 		   MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
 		   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
 	.ops = &tegra186_mc_ops,
+	.icc_ops = &tegra186_mc_icc_ops,
 	.ch_intmask = 0x0000000f,
 	.global_intstatus_channel_shift = 0,
 };

-- 
2.51.0



  parent reply	other threads:[~2025-10-27 18:55 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 18:55 [PATCH v4 0/5] memory: tegra: Support EMC dfs on Tegra186/Tegra194 Aaron Kling via B4 Relay
2025-10-27 18:55 ` [PATCH v4 1/5] dt-bindings: memory: tegra186-mc: Add dummy client IDs for Tegra186 Aaron Kling via B4 Relay
2025-10-27 18:55 ` [PATCH v4 2/5] dt-bindings: memory: tegra194-mc: Add dummy client IDs for Tegra194 Aaron Kling via B4 Relay
2025-10-27 18:55 ` [PATCH v4 3/5] memory: tegra186-emc: Support non-bpmp icc scaling Aaron Kling via B4 Relay
2025-11-10 21:25   ` Jon Hunter
2025-11-10 21:55     ` Aaron Kling
2025-11-11  1:39       ` Aaron Kling
2025-11-11 11:13         ` Jon Hunter
2025-11-11 11:16           ` Krzysztof Kozlowski
2025-11-11 12:05             ` Jon Hunter
2025-11-11 14:35               ` Jon Hunter
2025-11-11 17:04                 ` Aaron Kling
2025-11-11 21:29                   ` Jon Hunter
2025-11-11 23:17                     ` Aaron Kling
2025-11-12  6:18                       ` Jon Hunter
2025-11-12  7:21                         ` Aaron Kling
2025-11-12  7:31                           ` Krzysztof Kozlowski
2025-11-21 11:21                           ` Jon Hunter
2025-11-21 18:17                             ` Aaron Kling
2025-12-10  4:08                               ` Jon Hunter
2025-12-10  5:06                                 ` Aaron Kling
2025-12-10 15:03                                   ` Jon Hunter
2025-12-10 18:32                                     ` Aaron Kling
2025-12-10 21:24                                       ` Jon Hunter
2025-12-10 22:41                                         ` Aaron Kling
2025-12-11  7:46                                           ` Jon Hunter
2025-12-11 17:39                                             ` Aaron Kling
2025-12-17 18:39                                               ` Aaron Kling
2025-12-17 18:59                                                 ` Jon Hunter
2025-12-17 20:29                                                   ` Aaron Kling
2025-12-17 21:53                                                     ` Jon Hunter
2025-12-17 22:44                                                       ` Aaron Kling
2025-12-18 11:12                                                         ` Jon Hunter
2025-12-18 19:25                                                           ` Aaron Kling
2025-12-18 21:20                                                             ` Aaron Kling
2025-12-19 11:05                                                               ` Jon Hunter
2025-11-22 12:01                             ` Krzysztof Kozlowski
2025-12-09  4:26                               ` Aaron Kling
2025-12-09  5:53                                 ` Krzysztof Kozlowski
2025-12-10  4:08                                   ` Jon Hunter
2025-11-12  7:26                         ` Krzysztof Kozlowski
2025-11-12 10:59                           ` Jon Hunter
2025-11-12 11:42                             ` Krzysztof Kozlowski
2025-11-12 12:29                               ` Jon Hunter
2025-11-12  7:26                       ` Krzysztof Kozlowski
2025-10-27 18:55 ` Aaron Kling via B4 Relay [this message]
2025-10-27 18:55 ` [PATCH v4 5/5] memory: tegra194: Support " Aaron Kling via B4 Relay
2025-10-31 13:21 ` [PATCH v4 0/5] memory: tegra: Support EMC dfs on Tegra186/Tegra194 Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251027-tegra186-icc-p2-v4-4-e4e4f57e2103@gmail.com \
    --to=devnull+webgeek1234.gmail.com@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=webgeek1234@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox