diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-04-25 11:48:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-04-25 12:34:48 +0200 |
commit | eec09d7b9edc8f740c78d545d918ecd8f6efba4f (patch) | |
tree | b4d91cf974500ccec63abeea59c995b5a881a44b /arch | |
parent | 8194c6a8aab370fe38a9b9ca41a9965ad9de4c57 (diff) | |
download | barebox-eec09d7b9edc8f740c78d545d918ecd8f6efba4f.tar.gz barebox-eec09d7b9edc8f740c78d545d918ecd8f6efba4f.tar.xz |
clocksource: assign non-zero priorities to all clocksources
Most barebox clocksources have a zero priority and if multiple of them
exist, but no higher priority ones, the first to call init_clock wins.
Some supported boards like the Raspberry Pi additionally depended on
initcall ordering to favor one zero-priority clocksource over another.
With the move to deep probe and with Commit b641580deb8c ("of: platform:
Ensure timers are probed early"), device tree blob iteration order could
now dictate which clocksource is ultimately used. This led to a 20 times
slower clock source being chosen on the Raspberry Pi, because the ARM
architected timer was taken instead of the bcm2835 timer.
Fix the root cause by assigning priorities to all clocksource drivers.
Priorities chosen are:
50: device_initcall
60: coredevice_initcall
70: postcore_initcall
80: core_initcall
These priorities are all below 100, which was previously the lowest
positive priority and as they are positive, they win against the dummy
clocksource. This should ensure no priority inversion happens.
Fixes: b641580deb8c ("of: platform: Ensure timers are probed early")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220425094857.674044-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_time.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-davinci/time.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/clocksource.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/clocksource-imx23.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/clocksource-imx28.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/clocksource.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-samsung/s3c-timer.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra20-timer.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-versatile/core.c | 1 | ||||
-rw-r--r-- | arch/mips/lib/csrc-r4k.c | 1 | ||||
-rw-r--r-- | arch/mips/mach-xburst/csrc-jz4750.c | 1 | ||||
-rw-r--r-- | arch/openrisc/lib/clock.c | 1 | ||||
-rw-r--r-- | arch/powerpc/mach-mpc5xxx/time.c | 1 | ||||
-rw-r--r-- | arch/powerpc/mach-mpc85xx/time.c | 1 | ||||
-rw-r--r-- | arch/sandbox/board/clock.c | 1 |
15 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index ccbefbbc33..110d770881 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c @@ -35,6 +35,7 @@ static struct clocksource cs = { .mask = CLOCKSOURCE_MASK(20), .read = at91rm9200_clocksource_read, .shift = 10, + .priority = 80, }; static int clocksource_init (void) diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 52b3ac3e68..c54e49470b 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c @@ -96,6 +96,7 @@ static uint64_t davinci_cs_read(void) static struct clocksource davinci_cs = { .read = davinci_cs_read, .mask = CLOCKSOURCE_MASK(32), + .priority = 80, }; static int timer32_config(struct timer_s *t) diff --git a/arch/arm/mach-ep93xx/clocksource.c b/arch/arm/mach-ep93xx/clocksource.c index 1f3ff7f8f2..e2a3a39780 100644 --- a/arch/arm/mach-ep93xx/clocksource.c +++ b/arch/arm/mach-ep93xx/clocksource.c @@ -37,6 +37,7 @@ static struct clocksource cs = { .read = ep93xx_clocksource_read, .mask = CLOCKSOURCE_MASK(32), .shift = 10, + .priority = 80, }; static int clocksource_init(void) diff --git a/arch/arm/mach-mxs/clocksource-imx23.c b/arch/arm/mach-mxs/clocksource-imx23.c index 0a6716f879..ba5aad9f30 100644 --- a/arch/arm/mach-mxs/clocksource-imx23.c +++ b/arch/arm/mach-mxs/clocksource-imx23.c @@ -34,6 +34,7 @@ static struct clocksource cs = { .read = imx23_clocksource_read, .mask = CLOCKSOURCE_MASK(16), .shift = 10, + .priority = 80, }; static int imx23_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data) diff --git a/arch/arm/mach-mxs/clocksource-imx28.c b/arch/arm/mach-mxs/clocksource-imx28.c index ea6d4b5146..65d8155ad2 100644 --- a/arch/arm/mach-mxs/clocksource-imx28.c +++ b/arch/arm/mach-mxs/clocksource-imx28.c @@ -39,6 +39,7 @@ static struct clocksource imx28_cs = { .read = imx28_clocksource_read, .mask = CLOCKSOURCE_MASK(32), .shift = 17, + .priority = 80, }; static int imx28_clocksource_init(void) diff --git a/arch/arm/mach-pxa/clocksource.c b/arch/arm/mach-pxa/clocksource.c index ebfe6f1c33..3bc95827d8 100644 --- a/arch/arm/mach-pxa/clocksource.c +++ b/arch/arm/mach-pxa/clocksource.c @@ -28,6 +28,7 @@ static struct clocksource cs = { .read = pxa_clocksource_read, .mask = 0xffffffff, .shift = 20, + .priority = 80, }; static int clocksource_init(void) diff --git a/arch/arm/mach-samsung/s3c-timer.c b/arch/arm/mach-samsung/s3c-timer.c index 6f38df3958..38bcebc7c4 100644 --- a/arch/arm/mach-samsung/s3c-timer.c +++ b/arch/arm/mach-samsung/s3c-timer.c @@ -101,6 +101,7 @@ static struct clocksource cs = { .read = s3c_clocksource_read, .mask = CLOCKSOURCE_MASK(TIMER_WIDTH), .shift = TIMER_SHIFT, + .priority = 80, }; static int s3c_clk_src_init(void) diff --git a/arch/arm/mach-tegra/tegra20-timer.c b/arch/arm/mach-tegra/tegra20-timer.c index 34d34f7723..8ca8cb24fa 100644 --- a/arch/arm/mach-tegra/tegra20-timer.c +++ b/arch/arm/mach-tegra/tegra20-timer.c @@ -41,6 +41,7 @@ static uint64_t tegra20_timer_cs_read(void) static struct clocksource cs = { .read = tegra20_timer_cs_read, .mask = CLOCKSOURCE_MASK(32), + .priority = 80, }; static int tegra20_timer_probe(struct device_d *dev) diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index eb94a07dc9..9a2a9cad80 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c @@ -92,6 +92,7 @@ static struct clocksource vpb_cs = { .read = vpb_clocksource_read, .mask = CLOCKSOURCE_MASK(32), .shift = 10, + .priority = 80, }; /* From Linux v2.6.35 diff --git a/arch/mips/lib/csrc-r4k.c b/arch/mips/lib/csrc-r4k.c index 9facf04bd3..35fba3a29c 100644 --- a/arch/mips/lib/csrc-r4k.c +++ b/arch/mips/lib/csrc-r4k.c @@ -23,6 +23,7 @@ static uint64_t c0_hpt_read(void) static struct clocksource cs = { .read = c0_hpt_read, .mask = CLOCKSOURCE_MASK(32), + .priority = 70, }; static int clocksource_init(void) diff --git a/arch/mips/mach-xburst/csrc-jz4750.c b/arch/mips/mach-xburst/csrc-jz4750.c index 302709e597..43135ac498 100644 --- a/arch/mips/mach-xburst/csrc-jz4750.c +++ b/arch/mips/mach-xburst/csrc-jz4750.c @@ -23,6 +23,7 @@ static uint64_t jz4750_cs_read(void) static struct clocksource jz4750_cs = { .read = jz4750_cs_read, .mask = CLOCKSOURCE_MASK(32), + .priority = 80, }; static int clocksource_init(void) diff --git a/arch/openrisc/lib/clock.c b/arch/openrisc/lib/clock.c index 5ff978e841..651b163f13 100644 --- a/arch/openrisc/lib/clock.c +++ b/arch/openrisc/lib/clock.c @@ -28,6 +28,7 @@ static struct clocksource cs = { .read = openrisc_clocksource_read, .mask = 0xffffffff, .shift = 12, + .priority = 80, }; static int clocksource_init(void) diff --git a/arch/powerpc/mach-mpc5xxx/time.c b/arch/powerpc/mach-mpc5xxx/time.c index 8981b14eeb..d690d50f0d 100644 --- a/arch/powerpc/mach-mpc5xxx/time.c +++ b/arch/powerpc/mach-mpc5xxx/time.c @@ -29,6 +29,7 @@ static struct clocksource cs = { .read = ppc_clocksource_read, .mask = CLOCKSOURCE_MASK(32), .shift = 15, + .priority = 80, }; static int clocksource_init(void) diff --git a/arch/powerpc/mach-mpc85xx/time.c b/arch/powerpc/mach-mpc85xx/time.c index 067bce8ea6..5981995ac2 100644 --- a/arch/powerpc/mach-mpc85xx/time.c +++ b/arch/powerpc/mach-mpc85xx/time.c @@ -28,6 +28,7 @@ static uint64_t ppc_clocksource_read(void) static struct clocksource cs = { .read = ppc_clocksource_read, .mask = CLOCKSOURCE_MASK(64), + .priority = 80, }; static int clocksource_init(void) diff --git a/arch/sandbox/board/clock.c b/arch/sandbox/board/clock.c index b005e71633..1787fb5786 100644 --- a/arch/sandbox/board/clock.c +++ b/arch/sandbox/board/clock.c @@ -28,6 +28,7 @@ static struct clocksource cs = { .read = linux_clocksource_read, .mask = CLOCKSOURCE_MASK(32), .shift = 10, + .priority = 80, }; static int clocksource_init (void) |