From nobody Fri Oct 3 14:34:21 2025 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 5FFDA2063E7; Fri, 29 Aug 2025 02:48:14 +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=1756435696; cv=none; b=jAlRY6xBOJDFzxjYdn1IJHZPVhOJ73TWC95Q6evVlgMVmA9s0ItnRUt5/loJYqv2LgfExittZdpmtI3d7EVxwjendWzbEGVHfz4XQVKuDnSP2HHL3VH5whkCUcBitgIH4SGqdoLhck1hDLKQGKAbw5Je+zeoPhgIlE8lSty1rqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756435696; c=relaxed/simple; bh=qYSyZU0PA0XW8kSg/t1otLbzZhDMJW98vrjp/AywmYY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h10BEoXZUOndcDGM83MIIbzCAxNKLBnN4erMSca5xO72CtGeDKqd6RH7afJ8NiAq+QLD5AR9lAFM1SJ56cWMsmssQTEYBwzOFtALPbtkva6pHiJSMdFtUvm4C5a8gBuW8hzfLNOLOWwEIGv4PWKENWEykCemTwd0KllzlpJl6MM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sowRI7hP; 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="sowRI7hP" Received: by smtp.kernel.org (Postfix) with ESMTPS id C2E63C4CEF4; Fri, 29 Aug 2025 02:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756435694; bh=qYSyZU0PA0XW8kSg/t1otLbzZhDMJW98vrjp/AywmYY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=sowRI7hP+x2FxYgxDFIeoLZIvrvGkiNI49PwYBcaIeFYqGkbImg/eUp6pno/XoSY7 88e0qrlddeMcxeO9kumSfn59rebBc8fTyzlBp68FkseTSZiNlkIZpO7QTRdm0VJ1Bm fniXPFgOtX/KmZTCu0zTCQe+CROay+mfC7waw86dF3vkMgtk5qXpTxGiNKTjL8EUpr y0ow1nFUTfYuD1xLcVWBix53S3t0QJnMEv7+hH219+fDhQUb/maBmSKu14on+B6/PO 0Bld6iqpucGxbE04VZsERJJnrYaOT9SHATDDiAv5PvklVV4YK8oo6oA2NPfDq1FFfW Scl62u6tyUyXA== 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 B1449CA0FF2; Fri, 29 Aug 2025 02:48:14 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Thu, 28 Aug 2025 21:48:12 -0500 Subject: [PATCH v3 1/2] cpufreq: tegra186: Set target frequency for all cpus in policy 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: <20250828-tegra186-cpufreq-fixes-v3-1-23a7341db254@gmail.com> References: <20250828-tegra186-cpufreq-fixes-v3-0-23a7341db254@gmail.com> In-Reply-To: <20250828-tegra186-cpufreq-fixes-v3-0-23a7341db254@gmail.com> To: "Rafael J. Wysocki" , Viresh Kumar , Thierry Reding , Jonathan Hunter , Aaron Kling , Sumit Gupta Cc: Thierry Reding , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Aaron Kling X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756435694; l=1316; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=WE4FtNYlrqayHn8j1oFAZqsXZWGEdS20pQxJDsMXhig=; b=eX63CknQru1S9ScBVAAvE2jn9EMqUnwPIR3trdgDZRJ42UBJNtMQWNBfnnKUI+Bqv82BOfKWW +B/pO7FaNXqDPYDRtV/qzv2i3sHVPyHgMBPX5N71Y+YICOH4MvhikEl 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 The original commit set all cores in a cluster to a shared policy, but did not update set_target to apply a frequency change to all cores for the policy. This caused most cores to remain stuck at their boot frequency. Fixes: be4ae8c19492 ("cpufreq: tegra186: Share policy per cluster") Signed-off-by: Aaron Kling Acked-by: Viresh Kumar Reviewed-by: Mikko Perttunen --- drivers/cpufreq/tegra186-cpufreq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-= cpufreq.c index cbabb726c6645d2e5f1857a47e5643c8552d1933..6c394b429b6182faffabf222e5a= f501393dbbba9 100644 --- a/drivers/cpufreq/tegra186-cpufreq.c +++ b/drivers/cpufreq/tegra186-cpufreq.c @@ -93,10 +93,14 @@ static int tegra186_cpufreq_set_target(struct cpufreq_p= olicy *policy, { struct tegra186_cpufreq_data *data =3D cpufreq_get_driver_data(); struct cpufreq_frequency_table *tbl =3D policy->freq_table + index; - unsigned int edvd_offset =3D data->cpus[policy->cpu].edvd_offset; + unsigned int edvd_offset; u32 edvd_val =3D tbl->driver_data; + u32 cpu; =20 - writel(edvd_val, data->regs + edvd_offset); + for_each_cpu(cpu, policy->cpus) { + edvd_offset =3D data->cpus[cpu].edvd_offset; + writel(edvd_val, data->regs + edvd_offset); + } =20 return 0; } --=20 2.50.1 From nobody Fri Oct 3 14:34:21 2025 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 622BE212B0A; Fri, 29 Aug 2025 02:48:15 +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=1756435696; cv=none; b=A5uBwgmtAaq8Hcg/ONds4Z1Y8HAIs1h8Ndk2kHuyi2vWSze3/gsT4F7O5w+w6oSul+sEjwcS4yTZnm72jEubbi7GK+kWdRKS4jHSWBFNiTCLwydcsIbnH6Zo2dH/1xAL3VwU8kFwSJ52nBq80V4HQTtTgXrAOl8bdXRtR2bRMwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756435696; c=relaxed/simple; bh=GnJwClUxMWgMLpJm4CE+0XiogVWIkUx6AZPEqH60IBs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QMclrAGZ165XnC6AKRdNd3lAGbk9IsdQTVZcLL6dCVRM4LW3lr3BGYzbH5bfIgYNHiN8GX8+9tsa8vpNH0RqD8f/9RATa/xjgrJ7gEFGj/bNQBsJGVlX9tJ0imjO4Km1U3zW3kB+gPXb6c3COm9fTpGwczG08Lg24EdKdCxbkhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m7TeKyS1; 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="m7TeKyS1" Received: by smtp.kernel.org (Postfix) with ESMTPS id D0732C4CEED; Fri, 29 Aug 2025 02:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756435694; bh=GnJwClUxMWgMLpJm4CE+0XiogVWIkUx6AZPEqH60IBs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=m7TeKyS1pbTDlTAQzi986/MgfPdzbtmHcInF6csSJFt71BTr7ArILTWlgEDAUhvNq E+sCYCyEfMwczhwBGVvJZK9SEbIgsdKhZywNEt34eVre4UrJSAmhNiPW7DZsVTQXF6 q0VdJWevJoVkTKs3tqe5gasTRvxfuwzhaMopwnd2tP0g5yDkGyjhocPgwm/yxXQKsv 3K5lBffO9Vlt5Utz/FRYN7L4GM2CC/J6clW/tv0dgbzGkJJ9QrLmSCromOQc6RkQEI Hgo+Wyt3s4XnfvoN4g8xfuF21PcRzZGDRckzqy1Y2xY9EcC2SacN9Z01nP+G03D3eW NSfrW743NlQEg== 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 C1D2FCA0FF6; Fri, 29 Aug 2025 02:48:14 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Thu, 28 Aug 2025 21:48:13 -0500 Subject: [PATCH v3 2/2] cpufreq: tegra186: Initialize all cores to max frequencies 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: <20250828-tegra186-cpufreq-fixes-v3-2-23a7341db254@gmail.com> References: <20250828-tegra186-cpufreq-fixes-v3-0-23a7341db254@gmail.com> In-Reply-To: <20250828-tegra186-cpufreq-fixes-v3-0-23a7341db254@gmail.com> To: "Rafael J. Wysocki" , Viresh Kumar , Thierry Reding , Jonathan Hunter , Aaron Kling , Sumit Gupta Cc: Thierry Reding , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Aaron Kling , Mikko Perttunen X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756435694; l=3164; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=Cee7AliwERvbB7wKaI7YwL2ggH/0vhQ+XE9hO86NkEY=; b=HeiRL5v18eMEMdGOnHaqyKruV+NWZaMq9DEOZL+rad/fbdGREpgpd56SZYuM31CexSZoLwlAb 64G6dPnq1uzDAMXzNyNyD8K5JXE46E3JMQvSLBUolq1UMEmuURTmdOE 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 During initialization, the EDVD_COREx_VOLT_FREQ registers for some cores are still at reset values and not reflecting the actual frequency. This causes get calls to fail. Set all cores to their respective max frequency during probe to initialize the registers to working values. Suggested-by: Mikko Perttunen Signed-off-by: Aaron Kling Acked-by: Viresh Kumar Reviewed-by: Mikko Perttunen --- drivers/cpufreq/tegra186-cpufreq.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-= cpufreq.c index 6c394b429b6182faffabf222e5af501393dbbba9..bd94beebc4cc2fe6870e13ca553= 43cedb9729e99 100644 --- a/drivers/cpufreq/tegra186-cpufreq.c +++ b/drivers/cpufreq/tegra186-cpufreq.c @@ -138,13 +138,14 @@ static struct cpufreq_driver tegra186_cpufreq_driver = =3D { =20 static struct cpufreq_frequency_table *init_vhint_table( struct platform_device *pdev, struct tegra_bpmp *bpmp, - struct tegra186_cpufreq_cluster *cluster, unsigned int cluster_id) + struct tegra186_cpufreq_cluster *cluster, unsigned int cluster_id, + int *num_rates) { struct cpufreq_frequency_table *table; struct mrq_cpu_vhint_request req; struct tegra_bpmp_message msg; struct cpu_vhint_data *data; - int err, i, j, num_rates =3D 0; + int err, i, j; dma_addr_t phys; void *virt; =20 @@ -174,6 +175,7 @@ static struct cpufreq_frequency_table *init_vhint_table( goto free; } =20 + *num_rates =3D 0; for (i =3D data->vfloor; i <=3D data->vceil; i++) { u16 ndiv =3D data->ndiv[i]; =20 @@ -184,10 +186,10 @@ static struct cpufreq_frequency_table *init_vhint_tab= le( if (i > 0 && ndiv =3D=3D data->ndiv[i - 1]) continue; =20 - num_rates++; + (*num_rates)++; } =20 - table =3D devm_kcalloc(&pdev->dev, num_rates + 1, sizeof(*table), + table =3D devm_kcalloc(&pdev->dev, *num_rates + 1, sizeof(*table), GFP_KERNEL); if (!table) { table =3D ERR_PTR(-ENOMEM); @@ -229,7 +231,9 @@ static int tegra186_cpufreq_probe(struct platform_devic= e *pdev) { struct tegra186_cpufreq_data *data; struct tegra_bpmp *bpmp; - unsigned int i =3D 0, err; + unsigned int i =3D 0, err, edvd_offset; + int num_rates =3D 0; + u32 edvd_val, cpu; =20 data =3D devm_kzalloc(&pdev->dev, struct_size(data, clusters, TEGRA186_NUM_CLUSTERS), @@ -252,10 +256,21 @@ static int tegra186_cpufreq_probe(struct platform_dev= ice *pdev) for (i =3D 0; i < TEGRA186_NUM_CLUSTERS; i++) { struct tegra186_cpufreq_cluster *cluster =3D &data->clusters[i]; =20 - cluster->table =3D init_vhint_table(pdev, bpmp, cluster, i); + cluster->table =3D init_vhint_table(pdev, bpmp, cluster, i, &num_rates); if (IS_ERR(cluster->table)) { err =3D PTR_ERR(cluster->table); goto put_bpmp; + } else if (!num_rates) { + err =3D -EINVAL; + goto put_bpmp; + } + + for (cpu =3D 0; cpu < ARRAY_SIZE(tegra186_cpus); cpu++) { + if (data->cpus[cpu].bpmp_cluster_id =3D=3D i) { + edvd_val =3D cluster->table[num_rates - 1].driver_data; + edvd_offset =3D data->cpus[cpu].edvd_offset; + writel(edvd_val, data->regs + edvd_offset); + } } } =20 --=20 2.50.1