Hi guys, On Tuesday 12 Jan 2021 at 19:19:29 (+0800), Shawn Guo wrote: > On Tue, Jan 12, 2021 at 03:44:49PM +0530, Viresh Kumar wrote: > > On 12-01-21, 17:52, Shawn Guo wrote: > > > On SDM845/850, running the following commands to put all cores in > > > freq-domain1 offline and then get one core back online, there will be > > > a request region error seen from qcom-hw driver. > > > > > > $ echo 0 > /sys/devices/system/cpu/cpu4/online > > > $ echo 0 > /sys/devices/system/cpu/cpu5/online > > > $ echo 0 > /sys/devices/system/cpu/cpu6/online > > > $ echo 0 > /sys/devices/system/cpu/cpu7/online > > > $ echo 1 > /sys/devices/system/cpu/cpu4/online > > > > > > [ 3395.915416] CPU4: shutdown > > > [ 3395.938185] psci: CPU4 killed (polled 0 ms) > > > [ 3399.071424] CPU5: shutdown > > > [ 3399.094316] psci: CPU5 killed (polled 0 ms) > > > [ 3402.139358] CPU6: shutdown > > > [ 3402.161705] psci: CPU6 killed (polled 0 ms) > > > [ 3404.742939] CPU7: shutdown > > > [ 3404.765592] psci: CPU7 killed (polled 0 ms) > > > [ 3411.492274] Detected VIPT I-cache on CPU4 > > > [ 3411.492337] GICv3: CPU4: found redistributor 400 region 0:0x0000000017ae0000 > > > [ 3411.492448] CPU4: Booted secondary processor 0x0000000400 [0x516f802d] > > > [ 3411.503654] qcom-cpufreq-hw 17d43000.cpufreq: can't request region for resource [mem 0x17d45800-0x17d46bff] > > > > > > The cause is that the memory region requested in .init hook doesn't get > > > released in .exit hook, and the subsequent call to .init will always fail > > > on this error. Let's break down the devm_platform_ioremap_resource() > > > call a bit, so that we can have the resource pointer to release memory > > > region from .exit hook. > > > > > > Signed-off-by: Shawn Guo <shawn.guo@xxxxxxxxxx> > > > --- > > > drivers/cpufreq/qcom-cpufreq-hw.c | 8 +++++++- > > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > FWIW, Ionela also sent a fix though I like this one better for the > > obvious reasons. > > > > https://lore.kernel.org/lkml/20210108151406.23595-1-ionela.voinescu@xxxxxxx/ > > Ha, thanks for the pointer. So the original code was tricky and skipped > the region request call intentionally. > As long as the problem is fixed, I'm happy :). For this patch: Tested-by: Ionela Voinescu <ionela.voinescu@xxxxxxx> The patch probably deserves: Fixes: f17b3e44320b ("cpufreq: qcom-hw: Use devm_platform_ioremap_resource() to simplify code") Thanks, Ionela. > Shawn