linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir
@ 2020-08-11 19:43 Sumit Gupta
  2020-08-20  5:39 ` Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Sumit Gupta @ 2020-08-11 19:43 UTC (permalink / raw)
  To: sudeep.holla, rjw, viresh.kumar, catalin.marinas, thierry.reding,
	jonathanh, linux-pm, linux-tegra, linux-arm-kernel, linux-kernel
  Cc: bbasu, sumitg, wangkefeng.wang

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/

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index bae527e..e1d931c 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -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;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir
  2020-08-11 19:43 [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir Sumit Gupta
@ 2020-08-20  5:39 ` Viresh Kumar
  2020-08-20 12:37   ` Sudeep Holla
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2020-08-20  5:39 UTC (permalink / raw)
  To: Sumit Gupta
  Cc: sudeep.holla, rjw, catalin.marinas, thierry.reding, jonathanh,
	linux-pm, linux-tegra, linux-arm-kernel, linux-kernel, bbasu,
	wangkefeng.wang

On 12-08-20, 01:13, Sumit Gupta wrote:
> 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/
> 
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
>  drivers/cpufreq/tegra194-cpufreq.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir
  2020-08-20  5:39 ` Viresh Kumar
@ 2020-08-20 12:37   ` Sudeep Holla
  2020-08-21  5:22     ` Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Sudeep Holla @ 2020-08-20 12:37 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Sumit Gupta, rjw, catalin.marinas, thierry.reding, jonathanh,
	linux-pm, linux-tegra, linux-arm-kernel, linux-kernel, bbasu,
	wangkefeng.wang, Sudeep Holla

On Thu, Aug 20, 2020 at 11:09:45AM +0530, Viresh Kumar wrote:
> On 12-08-20, 01:13, Sumit Gupta wrote:
> > 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/
> > 
> > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> > ---
> >  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.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir
  2020-08-20 12:37   ` Sudeep Holla
@ 2020-08-21  5:22     ` Viresh Kumar
  2020-08-21 18:18       ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2020-08-21  5:22 UTC (permalink / raw)
  To: rjw, Sudeep Holla
  Cc: Sumit Gupta, catalin.marinas, thierry.reding, jonathanh,
	linux-pm, linux-tegra, linux-arm-kernel, linux-kernel, bbasu,
	wangkefeng.wang

On 20-08-20, 13:37, Sudeep Holla wrote:
> On Thu, Aug 20, 2020 at 11:09:45AM +0530, Viresh Kumar wrote:
> > On 12-08-20, 01:13, Sumit Gupta wrote:
> > > 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/
> > > 
> > > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > > Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> > > ---
> > >  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.

Okay.

Rafael: Please pick this patch directly for next rc with 

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir
  2020-08-21  5:22     ` Viresh Kumar
@ 2020-08-21 18:18       ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2020-08-21 18:18 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Sudeep Holla, Sumit Gupta, Catalin Marinas,
	Thierry Reding, Jon Hunter, Linux PM, linux-tegra, Linux ARM,
	Linux Kernel Mailing List, bbasu, Kefeng Wang

On Fri, Aug 21, 2020 at 7:22 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 20-08-20, 13:37, Sudeep Holla wrote:
> > On Thu, Aug 20, 2020 at 11:09:45AM +0530, Viresh Kumar wrote:
> > > On 12-08-20, 01:13, Sumit Gupta wrote:
> > > > 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/
> > > >
> > > > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> > > > Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> > > > ---
> > > >  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.
>
> Okay.
>
> Rafael: Please pick this patch directly for next rc with
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-21 18:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 19:43 [Patch] cpufreq: replace cpu_logical_map with read_cpuid_mpir Sumit Gupta
2020-08-20  5:39 ` Viresh Kumar
2020-08-20 12:37   ` Sudeep Holla
2020-08-21  5:22     ` Viresh Kumar
2020-08-21 18:18       ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).