Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource: mips-gic-timer: Enable counter when CPUs start

In multi-cluster MIPS I6500 systems there is a GIC in each cluster,
each with its own counter. When a cluster powers up the counter will
be stopped, with the COUNTSTOP bit set in the GIC_CONFIG register.

In single cluster systems, it has been fine to clear COUNTSTOP once
in gic_clocksource_of_init() to start the counter. In multi-cluster
systems, this will only have started the counter in the boot cluster,
and any CPUs in other clusters will find their counter stopped which
will break the GIC clock_event_device.

Resolve this by having CPUs clear the COUNTSTOP bit when they come
online, using the existing gic_starting_cpu() CPU hotplug callback. This
will allow CPUs in secondary clusters to ensure that the cluster's GIC
counter is running as expected.

Signed-off-by: Paul Burton <paulburton@kernel.org>
Signed-off-by: Chao-ying Fu <cfu@wavecomp.com>
Signed-off-by: Dragan Mladjenovic <dragan.mladjenovic@syrmia.com>
Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Paul Burton and committed by
Thomas Bogendoerfer
3128b0a2 0ad2507d

+3 -3
+3 -3
drivers/clocksource/mips-gic-timer.c
··· 115 115 116 116 static int gic_starting_cpu(unsigned int cpu) 117 117 { 118 + /* Ensure the GIC counter is running */ 119 + clear_gic_config(GIC_CONFIG_COUNTSTOP); 120 + 118 121 gic_clockevent_cpu_init(cpu, this_cpu_ptr(&gic_clockevent_device)); 119 122 return 0; 120 123 } ··· 290 287 if (clk_notifier_register(clk, &gic_clk_nb) < 0) 291 288 pr_warn("Unable to register clock notifier\n"); 292 289 } 293 - 294 - /* And finally start the counter */ 295 - clear_gic_config(GIC_CONFIG_COUNTSTOP); 296 290 297 291 /* 298 292 * It's safe to use the MIPS GIC timer as a sched clock source only if