Skip to contentSkip to conversation

cpufreq: replace cpu_logical_map with read_cpuid_mpir

PATCH Applied Sumit Gupta 4 participants 5 messages Aug 11, 2020 – Aug 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: replace cpu_logical_map with read_cpuid_mpir

Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") fixes the issue with building tegra194 cpufreq driver as module. But the fix might cause problem while supporting physical cpu hotplug[1].

This patch fixes the original problem by avoiding use of cpu_logical_map(). Instead calling read_cpuid_mpidr() to get MPIDR on target cpu.

[1] https://lore.kernel.org/linux-arm-kernel/20200724131059.GB6521@bogus/

---
 drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/cpufreq/tegra194-cpufreq.c +7 -3
index bae527e..e1d931c 100644
@@ -56,9 +56,11 @@ struct read_counters_work {
 
 static struct workqueue_struct *read_counters_wq;
 
-static enum cluster get_cpu_cluster(u8 cpu)
+static void get_cpu_cluster(void *cluster)
 {
-	return MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
+	u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
+
+	*((uint32_t *)cluster) = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 }
 
 /*
@@ -186,8 +188,10 @@ static unsigned int tegra194_get_speed(u32 cpu)
 static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
 {
 	struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
-	int cl = get_cpu_cluster(policy->cpu);
 	u32 cpu;
+	u32 cl;
+
+	smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
 
 	if (cl >= data->num_clusters)
 		return -EINVAL;
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 7 lines · Sumit Gupta

Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") fixes the issue with building tegra194 cpufreq driver as module. But the fix might cause problem while supporting physical cpu hotplug[1].

This patch fixes the original problem by avoiding use of cpu_logical_map(). Instead calling read_cpuid_mpidr() to get MPIDR on target cpu.

Quoted 7 lines

[1] https://lore.kernel.org/linux-arm-kernel/20200724131059.GB6521@bogus/

---
 drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Applied. Thanks.

Signature · 1 line
viresh
#2 lore raw
Quoted 10 lines · Viresh Kumar
Quoted 9 lines · Sumit Gupta

Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") fixes the issue with building tegra194 cpufreq driver as module. But the fix might cause problem while supporting physical cpu hotplug[1].

This patch fixes the original problem by avoiding use of cpu_logical_map(). Instead calling read_cpuid_mpidr() to get MPIDR on target cpu.

[1] https://lore.kernel.org/linux-arm-kernel/20200724131059.GB6521@bogus/

Quoted 7 lines
Quoted 5 lines
---
 drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Applied. Thanks.

Just to confirm, is this going as a fix ? We want to drop exporting cpu_logical_map in v5.9 so this needs to go as fix. I missed it earlier, actually,

Fixes df320f89359c ("cpufreq: Add Tegra194 cpufreq driver")

is appropriate here so that we can drop export symbol which was part of Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") as a workaround to fix the build.

Signature · 2 lines
Regards,
Sudeep
maintainer Acked-by
#3 lore raw
Quoted 19 lines · Sudeep Holla
Quoted 10 lines · Viresh Kumar
Quoted 9 lines · Sumit Gupta

Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") fixes the issue with building tegra194 cpufreq driver as module. But the fix might cause problem while supporting physical cpu hotplug[1].

This patch fixes the original problem by avoiding use of cpu_logical_map(). Instead calling read_cpuid_mpidr() to get MPIDR on target cpu.

[1] https://lore.kernel.org/linux-arm-kernel/20200724131059.GB6521@bogus/

Quoted 7 lines
Quoted 5 lines
---
 drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Applied. Thanks.

Quoted 8 lines

Just to confirm, is this going as a fix ? We want to drop exporting cpu_logical_map in v5.9 so this needs to go as fix. I missed it earlier, actually,

Fixes df320f89359c ("cpufreq: Add Tegra194 cpufreq driver")

is appropriate here so that we can drop export symbol which was part of Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") as a workaround to fix the build.

Okay.

Rafael: Please pick this patch directly for next rc with

Signature · 1 line
viresh
maintainer Applied
#4 lore raw
Quoted 30 lines · Viresh Kumar
Quoted 19 lines · Sudeep Holla
Quoted 10 lines · Viresh Kumar
Quoted 9 lines · Sumit Gupta

Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") fixes the issue with building tegra194 cpufreq driver as module. But the fix might cause problem while supporting physical cpu hotplug[1].

This patch fixes the original problem by avoiding use of cpu_logical_map(). Instead calling read_cpuid_mpidr() to get MPIDR on target cpu.

[1] https://lore.kernel.org/linux-arm-kernel/20200724131059.GB6521@bogus/

Quoted 7 lines
Quoted 5 lines
---
 drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Applied. Thanks.

Quoted 8 lines

Just to confirm, is this going as a fix ? We want to drop exporting cpu_logical_map in v5.9 so this needs to go as fix. I missed it earlier, actually,

Fixes df320f89359c ("cpufreq: Add Tegra194 cpufreq driver")

is appropriate here so that we can drop export symbol which was part of Commit eaecca9e7710 ("arm64: Fix __cpu_logical_map undefined issue") as a workaround to fix the build.

Quoted 5 lines

Okay.

Rafael: Please pick this patch directly for next rc with

Applied as 5.9-rc3 material with a couple of minor edits in the subject and changelog, thanks!