arm64: topology: Make AMUs work with modular cpufreq drivers
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 8 Jan 2021 11:16:53 +0000 (16:46 +0530)
committerWill Deacon <will@kernel.org>
Wed, 20 Jan 2021 12:49:40 +0000 (12:49 +0000)
commita5f1b187cd24f7da35eb7a48fc50839c554d52a2
tree7d73e563cfd8231df889e1e142514eca4e7d5b43
parent47b10b737c0794c2fa584d7c8103b485e274ed51
arm64: topology: Make AMUs work with modular cpufreq drivers

The AMU counters won't get used today if the cpufreq driver is built as
a module as the amu core requires everything to be ready by late init.

Fix that properly by registering for cpufreq policy notifier. Note that
the amu core don't have any cpufreq dependency after the first time
CPUFREQ_CREATE_POLICY notifier is called for all the CPUs. And so we
don't need to do anything on the CPUFREQ_REMOVE_POLICY notifier. And for
the same reason we check if the CPUs are already parsed in the beginning
of amu_fie_setup() and skip if that is true. Alternatively we can shoot
a work from there to unregister the notifier instead, but that seemed
too much instead of this simple check.

While at it, convert the print message to pr_debug instead of pr_info.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
Tested-by: Ionela Voinescu <ionela.voinescu@arm.com>
Link: https://lore.kernel.org/r/89c1921334443e133c9c8791b4693607d65ed9f5.1610104461.git.viresh.kumar@linaro.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/topology.c