clocksource: Add driver for the Ingenic JZ47xx OST
PATCH 1/1 clocksource: Add driver for the Ingenic JZ47xx OST
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a sched_clock to the system.
---
Hi,
This patch comes from a bigger patchset that was cut in smaller pieces for easier integration to mainline.
(The patchset was https://lkml.org/lkml/2019/3/27/1837)
The only change is the use of device_node_to_regmap(), which was added in a prior patchset now merged in the MIPS tree.
For that reason this patch is based on the ingenic-tcu-v5.4 branch of the MIPS tree
(git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git).
Thanks,
-Paul
drivers/clocksource/Kconfig | 8 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/ingenic-ost.c | 221 ++++++++++++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 drivers/clocksource/ingenic-ost.c
drivers/clocksource/Kconfig +8 -0
@@ -696,4 +696,12 @@ config INGENIC_TIMER help Support for the timer/counter unit of the Ingenic JZ SoCs. +config INGENIC_OST + bool "Ingenic JZ47xx Operating System Timer" + depends on MIPS || COMPILE_TEST + depends on COMMON_CLK + select MFD_SYSCON + help + Support for the OS Timer of the Ingenic JZ4770 or similar SoC. + endmenu
drivers/clocksource/Makefile +1 -0
@@ -80,6 +80,7 @@ obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o obj-$(CONFIG_H8300_TMR8) += h8300_timer8.o obj-$(CONFIG_H8300_TMR16) += h8300_timer16.o obj-$(CONFIG_H8300_TPU) += h8300_tpu.o +obj-$(CONFIG_INGENIC_OST) += ingenic-ost.o obj-$(CONFIG_INGENIC_TIMER) += ingenic-timer.o obj-$(CONFIG_CLKSRC_ST_LPC) += clksrc_st_lpc.o obj-$(CONFIG_X86_NUMACHIP) += numachip.o
drivers/clocksource/ingenic-ost.c new file +221 -0
221 lines not on this page · raw message
Signature · 1 line
2.21.0.593.g511ec345e18
Quoted 16 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a
sched_clockto the system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
drivers/clocksource/ingenic-ost.c line 165
Quoted 8 lines
drivers/clocksource/ingenic-ost.c new file +8
-0+ err =clocksource_register_hz (cs, rate); +if (err) { +dev_err (dev,"clocksource registration failed: %d\n" , err); +clk_disable_unprepare (ost->clk); +return err; + } + +/* Cannot register a sched_clock with interrupts on */
Aren't they already disabled?
Quoted 10 lines
drivers/clocksource/ingenic-ost.c new file +10
-0+local_irq_save (flags); +if (soc_info->is64bit) +sched_clock_register (ingenic_ost_read_cntl,32 , rate); +else +sched_clock_register (ingenic_ost_read_cnth,32 , rate); +local_irq_restore (flags); + +return 0 ; +} +
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Hi Daniel,
Quoted 20 lines · Daniel Lezcano
Quoted 16 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a
sched_clockto the system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
Quoted 10 lines
drivers/clocksource/ingenic-ost.c line 165
Quoted 8 lines
drivers/clocksource/ingenic-ost.c new file +8
-0+ err =clocksource_register_hz (cs, rate); +if (err) { +dev_err (dev,"clocksource registration failed: %d\n" , err); +clk_disable_unprepare (ost->clk); +return err; + } + +/* Cannot register a sched_clock with interrupts on */ Aren't they already disabled?
Sorry for the late reply.
No, they are not already disabled; this is what I get if I comment out the local_irq_save()/local_irq_restore():
[ 0.361014] clocksource: ingenic-ost: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 159271703898 ns [ 0.361515] clocksource: Switched to clocksource ingenic-ost [ 0.361686] ------------[ cut here ]------------ [ 0.361893] WARNING: CPU: 0 PID: 1 at kernel/time/sched_clock.c:179 sched_clock_register+0x7c/0x2e4 [ 0.362174] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-rc5+ #461 [ 0.362330] Stack : 80744558 80069b44 80770000 00000000 00000000 00dfd7a7 806e6db4 8106bb74 [ 0.362619] 806f0000 81067ca4 806f31c7 80769478 00000020 10000400 8106bb20 00dfd7a7 [ 0.362906] 00000000 00000000 80780000 00000000 00000007 00000001 00000049 3563722d [ 0.363191] 8106ba61 00000000 ffffffff 00000010 806f0000 00000000 00000000 806f0000 [ 0.363477] 00000020 00000000 80714534 80770000 00000002 80319154 00000000 80770000 [ 0.363762] ... [ 0.363906] Call Trace: [ 0.364087] [<8001af14>] show_stack+0x40/0x128 [ 0.364289] [<8002fd88>] __warn+0xb8/0xe0 [ 0.364478] [<8002fe14>] warn_slowpath_fmt+0x64/0xc0 [ 0.364678] [<8072b1c8>] sched_clock_register+0x7c/0x2e4 [ 0.364895] [<8073c874>] ingenic_ost_probe+0x224/0x248 [ 0.365090] [<803d5394>] platform_drv_probe+0x40/0x94 [ 0.365526] [<803d362c>] really_probe+0x104/0x374 [ 0.365743] [<803d3ff0>] device_driver_attach+0x78/0x80 [ 0.365938] [<803d4070>] __driver_attach+0x78/0x118 [ 0.366129] [<803d1700>] bus_for_each_dev+0x7c/0xc8 [ 0.366318] [<803d226c>] bus_add_driver+0x1bc/0x204 [ 0.366513] [<803d4878>] driver_register+0x84/0x14c [ 0.366717] [<8073a144>] __platform_driver_probe+0x98/0x140 [ 0.366931] [<80724e38>] do_one_initcall+0x84/0x1b4 [ 0.367126] [<807250cc>] kernel_init_freeable+0x164/0x240 [ 0.367318] [<805df75c>] kernel_init+0x10/0xf8 [ 0.367510] [<8001542c>] ret_from_kernel_thread+0x14/0x1c [ 0.367722] ---[ end trace 7fedf00408fa3bed ]--- [ 0.367985] sched_clock: 32 bits at 12MHz, resolution 83ns, wraps every 178956970966ns
At kernel/time/sched_clock.c:179 there is:
WARN_ON(!irqs_disabled());
Quoted 10 lines
Quoted 10 lines
drivers/clocksource/ingenic-ost.c new file +10
-0+local_irq_save (flags); +if (soc_info->is64bit) +sched_clock_register (ingenic_ost_read_cntl,32 , rate); +else +sched_clock_register (ingenic_ost_read_cnth,32 , rate); +local_irq_restore (flags); + +return 0 ; +} +
Quoted 79 lines · Paul Cercueil
Hi Daniel,
Quoted 29 lines · Daniel Lezcano
Quoted 16 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a
sched_clockto the system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
Quoted 8 lines
+ err =
clocksource_register_hz(cs, rate);
+ if (err) {
+dev_err(dev, "clocksource registration failed: %d\n", err); +clk_disable_unprepare(ost->clk);
+ return err;
+ }
+
+ /* Cannot register asched_clockwith interrupts on */Quoted 1 line
Aren't they already disabled?
Sorry for the late reply.
No, they are not already disabled; this is what I get if I comment out the local_irq_save()/local_irq_restore():
[ 0.361014] clocksource: ingenic-ost: mask:
0xffffffffmax_cycles:0xffffffff,max_idle_ns: 159271703898 ns
[ 0.361515] clocksource: Switched to clocksource ingenic-ost [ 0.361686] ------------[ cut here ]------------
[ 0.361893] WARNING: CPU: 0 PID: 1 atkernel/time/sched_clock.c:179sched_clock_register+0x7c/0x2e4
[ 0.362174] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-rc5+ #461 [ 0.362330] Stack : 8074455880069b4480770000 00000000 0000000000dfd7a7806e6db48106bb74
[ 0.362619]806f000081067ca4806f31c780769478 00000020 100004008106bb2000dfd7a7
[ 0.362906] 00000000 00000000 80780000 00000000 00000007 00000001 000000493563722d
[ 0.363191]8106ba6100000000 ffffffff 00000010806f000000000000 00000000806f0000
[ 0.363477] 00000020 00000000 80714534 80770000 00000002 80319154 00000000 80770000
[ 0.363762] ...
[ 0.363906] Call Trace:
[ 0.364087] [<8001af14>]show_stack+0x40/0x128
[ 0.364289] [<8002fd88>]__warn+0xb8/0xe0
[ 0.364478] [<8002fe14>]warn_slowpath_fmt+0x64/0xc0
[ 0.364678] [<8072b1c8>]sched_clock_register+0x7c/0x2e4[ 0.364895] [<8073c874>]ingenic_ost_probe+0x224/0x248
[ 0.365090] [<803d5394>]platform_drv_probe+0x40/0x94
[ 0.365526] [<803d362c>]really_probe+0x104/0x374
[ 0.365743] [<803d3ff0>]device_driver_attach+0x78/0x80[ 0.365938] [<803d4070>]__driver_attach+0x78/0x118
[ 0.366129] [<803d1700>]bus_for_each_dev+0x7c/0xc8
[ 0.366318] [<803d226c>]bus_add_driver+0x1bc/0x204
[ 0.366513] [<803d4878>]driver_register+0x84/0x14c
[ 0.366717] [<8073a144>]__platform_driver_probe+0x98/0x140[ 0.366931] [<80724e38>]do_one_initcall+0x84/0x1b4
[ 0.367126] [<807250cc>]kernel_init_freeable+0x164/0x240[ 0.367318] [<805df75c>]kernel_init+0x10/0xf8
[ 0.367510] [<8001542c>]ret_from_kernel_thread+0x14/0x1c[ 0.367722] ---[ end trace7fedf00408fa3bed]---
[ 0.367985]sched_clock: 32 bits at 12MHz, resolution 83ns, wraps every 178956970966ns
Quoted 2 lines
At
kernel/time/sched_clock.c:179there is:
WARN_ON(!irqs_disabled());
That is strange, no drivers is doing that and no warning is appearing.
Isn't missing a local_irq_disable in the code path in the stack above?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
+
local_irq_save(flags);
+ if (soc_info->is64bit)
+sched_clock_register(ingenic_ost_read_cntl, 32, rate); + else
+sched_clock_register(ingenic_ost_read_cnth, 32, rate); +local_irq_restore(flags);drivers/clocksource/ingenic-ost.c new file +4
-0+ + return 0; +} +
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 86 lines · Daniel Lezcano
Quoted 85 lines · Paul Cercueil
Hi Daniel,
Quoted 31 lines · Daniel Lezcano
Quoted 17 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a
sched_clockto
the
system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
Quoted 9 lines
+ err =
clocksource_register_hz(cs, rate);
+ if (err) {
+ dev_err(dev, "clocksource registration failed: %d\n",
err);
+clk_disable_unprepare(ost->clk);
+ return err;
+ }
+
+ /* Cannot register asched_clockwith interrupts on */Quoted 1 line
Aren't they already disabled?
Sorry for the late reply.
No, they are not already disabled; this is what I get if I comment
out
the local_irq_save()/local_irq_restore():[ 0.361014] clocksource: ingenic-ost: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 159271703898 ns [ 0.361515] clocksource: Switched to clocksource ingenic-ost [ 0.361686] ------------[ cut here ]------------ [ 0.361893] WARNING: CPU: 0 PID: 1 at kernel/time/sched_clock.c:179 sched_clock_register+0x7c/0x2e4 [ 0.362174] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-rc5+ #461 [ 0.362330] Stack : 80744558 80069b44 80770000 00000000 00000000 00dfd7a7 806e6db4 8106bb74 [ 0.362619] 806f0000 81067ca4 806f31c7 80769478 00000020 10000400 8106bb20 00dfd7a7 [ 0.362906] 00000000 00000000 80780000 00000000 00000007 00000001 00000049 3563722d [ 0.363191] 8106ba61 00000000 ffffffff 00000010 806f0000 00000000 00000000 806f0000 [ 0.363477] 00000020 00000000 80714534 80770000 00000002 80319154 00000000 80770000 [ 0.363762] ... [ 0.363906] Call Trace: [ 0.364087] [<8001af14>] show_stack+0x40/0x128 [ 0.364289] [<8002fd88>] __warn+0xb8/0xe0 [ 0.364478] [<8002fe14>] warn_slowpath_fmt+0x64/0xc0 [ 0.364678] [<8072b1c8>] sched_clock_register+0x7c/0x2e4 [ 0.364895] [<8073c874>] ingenic_ost_probe+0x224/0x248 [ 0.365090] [<803d5394>] platform_drv_probe+0x40/0x94 [ 0.365526] [<803d362c>] really_probe+0x104/0x374 [ 0.365743] [<803d3ff0>] device_driver_attach+0x78/0x80 [ 0.365938] [<803d4070>] __driver_attach+0x78/0x118 [ 0.366129] [<803d1700>] bus_for_each_dev+0x7c/0xc8 [ 0.366318] [<803d226c>] bus_add_driver+0x1bc/0x204 [ 0.366513] [<803d4878>] driver_register+0x84/0x14c [ 0.366717] [<8073a144>] __platform_driver_probe+0x98/0x140 [ 0.366931] [<80724e38>] do_one_initcall+0x84/0x1b4 [ 0.367126] [<807250cc>] kernel_init_freeable+0x164/0x240 [ 0.367318] [<805df75c>] kernel_init+0x10/0xf8 [ 0.367510] [<8001542c>] ret_from_kernel_thread+0x14/0x1c [ 0.367722] ---[ end trace 7fedf00408fa3bed ]--- [ 0.367985] sched_clock: 32 bits at 12MHz, resolution 83ns, wraps every 178956970966ns
Quoted 6 lines
Quoted 2 lines
At kernel/time/sched_clock.c:179 there is: WARN_ON(!irqs_disabled());That is strange, no drivers is doing that and no warning is appearing.
Isn't missing a
local_irq_disablein the code path in the stack above?
I think it comes to the fact that the other drivers are probed much earlier in the boot process, while this one is probed as a regular platform device driver.
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
+
local_irq_save(flags);
+ if (soc_info->is64bit)
+sched_clock_register(ingenic_ost_read_cntl, 32, rate);
+ else
+sched_clock_register(ingenic_ost_read_cnth, 32, rate);
+local_irq_restore(flags);
+
+ return 0;
+}
+--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM
SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Quoted 87 lines · Paul Cercueil
Quoted 83 lines · Daniel Lezcano
Quoted 81 lines · Paul Cercueil
Hi Daniel,
Quoted 29 lines · Daniel Lezcano
Quoted 16 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a
sched_clockto the system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
Quoted 8 lines
+ err =
clocksource_register_hz(cs, rate);
+ if (err) {
+dev_err(dev, "clocksource registration failed: %d\n", err); +clk_disable_unprepare(ost->clk);
+ return err;
+ }
+
+ /* Cannot register asched_clockwith interrupts on */Quoted 1 line
Aren't they already disabled?
Sorry for the late reply.
No, they are not already disabled; this is what I get if I comment out the local_irq_save()/local_irq_restore():
[ 0.361014] clocksource: ingenic-ost: mask:
0xffffffffmax_cycles:
0xffffffff,max_idle_ns: 159271703898 ns
[ 0.361515] clocksource: Switched to clocksource ingenic-ost [ 0.361686] ------------[ cut here ]------------
[ 0.361893] WARNING: CPU: 0 PID: 1 atkernel/time/sched_clock.c:179sched_clock_register+0x7c/0x2e4
[ 0.362174] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-rc5+ #461 [ 0.362330] Stack : 8074455880069b4480770000 00000000 0000000000dfd7a7806e6db48106bb74
[ 0.362619]806f000081067ca4806f31c780769478 00000020 100004008106bb2000dfd7a7
[ 0.362906] 00000000 00000000 80780000 00000000 00000007 00000001 000000493563722d
[ 0.363191]8106ba6100000000 ffffffff 00000010806f000000000000 00000000806f0000
[ 0.363477] 00000020 00000000 80714534 80770000 00000002 80319154 00000000 80770000
[ 0.363762] ...
[ 0.363906] Call Trace:
[ 0.364087] [<8001af14>]show_stack+0x40/0x128
[ 0.364289] [<8002fd88>]__warn+0xb8/0xe0
[ 0.364478] [<8002fe14>]warn_slowpath_fmt+0x64/0xc0
[ 0.364678] [<8072b1c8>]sched_clock_register+0x7c/0x2e4[ 0.364895] [<8073c874>]ingenic_ost_probe+0x224/0x248
[ 0.365090] [<803d5394>]platform_drv_probe+0x40/0x94
[ 0.365526] [<803d362c>]really_probe+0x104/0x374
[ 0.365743] [<803d3ff0>]device_driver_attach+0x78/0x80[ 0.365938] [<803d4070>]__driver_attach+0x78/0x118
[ 0.366129] [<803d1700>]bus_for_each_dev+0x7c/0xc8
[ 0.366318] [<803d226c>]bus_add_driver+0x1bc/0x204
[ 0.366513] [<803d4878>]driver_register+0x84/0x14c
[ 0.366717] [<8073a144>]__platform_driver_probe+0x98/0x140[ 0.366931] [<80724e38>]do_one_initcall+0x84/0x1b4
[ 0.367126] [<807250cc>]kernel_init_freeable+0x164/0x240[ 0.367318] [<805df75c>]kernel_init+0x10/0xf8
[ 0.367510] [<8001542c>]ret_from_kernel_thread+0x14/0x1c[ 0.367722] ---[ end trace7fedf00408fa3bed]---
[ 0.367985]sched_clock: 32 bits at 12MHz, resolution 83ns, wraps every 178956970966nsAt
kernel/time/sched_clock.c:179there is:
WARN_ON(!irqs_disabled());
Quoted 7 lines
Quoted 3 lines
That is strange, no drivers is doing that and no warning is appearing.
Isn't missing a
local_irq_disablein the code path in the stack above?I think it comes to the fact that the other drivers are probed much earlier in the boot process, while this one is probed as a regular platform device driver.
There are other drivers doing and nobody is disabling the interrupt:
em_sti.c:static struct platform_driver em_sti_device_driver = { ingenic-timer.c:static struct platform_driver ingenic_tcu_driver = { sh_cmt.c:static struct platform_driver sh_cmt_device_driver = { sh_mtu2.c:static struct platform_driver sh_mtu2_device_driver = { sh_tmu.c:static struct platform_driver sh_tmu_device_driver = { timer-ti-dm.c:static struct platform_driver omap_dm_timer_driver = {
Quoted 21 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
+
local_irq_save(flags);
+ if (soc_info->is64bit)
+sched_clock_register(ingenic_ost_read_cntl, 32, rate); + else
+sched_clock_register(ingenic_ost_read_cnth, 32, rate); +local_irq_restore(flags);
+
+ return 0;
+}
+Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 113 lines · Daniel Lezcano
Quoted 104 lines · Paul Cercueil
Quoted 100 lines · Daniel Lezcano
Quoted 90 lines · Paul Cercueil
Hi Daniel,
Quoted 33 lines · Daniel Lezcano
Quoted 19 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered
reading.SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770
and
JZ4780 have a 64-bit OST.This driver will register both a clocksource and a
sched_clock
to the
system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
Quoted 9 lines
+ err =
clocksource_register_hz(cs, rate);
+ if (err) {
+ dev_err(dev, "clocksource registration failed: %d\n",
err);
+clk_disable_unprepare(ost->clk);
+ return err;
+ }
+
+ /* Cannot register asched_clockwith interrupts on */Quoted 1 line
Aren't they already disabled?
Sorry for the late reply.
No, they are not already disabled; this is what I get if I
comment out
the local_irq_save()/local_irq_restore():[ 0.361014] clocksource: ingenic-ost: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 159271703898 ns [ 0.361515] clocksource: Switched to clocksource ingenic-ost [ 0.361686] ------------[ cut here ]------------ [ 0.361893] WARNING: CPU: 0 PID: 1 at kernel/time/sched_clock.c:179 sched_clock_register+0x7c/0x2e4 [ 0.362174] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-rc5+ #461 [ 0.362330] Stack : 80744558 80069b44 80770000 00000000 00000000 00dfd7a7 806e6db4 8106bb74 [ 0.362619] 806f0000 81067ca4 806f31c7 80769478 00000020 10000400 8106bb20 00dfd7a7 [ 0.362906] 00000000 00000000 80780000 00000000 00000007 00000001 00000049 3563722d [ 0.363191] 8106ba61 00000000 ffffffff 00000010 806f0000 00000000 00000000 806f0000 [ 0.363477] 00000020 00000000 80714534 80770000 00000002 80319154 00000000 80770000 [ 0.363762] ... [ 0.363906] Call Trace: [ 0.364087] [<8001af14>] show_stack+0x40/0x128 [ 0.364289] [<8002fd88>] __warn+0xb8/0xe0 [ 0.364478] [<8002fe14>] warn_slowpath_fmt+0x64/0xc0 [ 0.364678] [<8072b1c8>] sched_clock_register+0x7c/0x2e4 [ 0.364895] [<8073c874>] ingenic_ost_probe+0x224/0x248 [ 0.365090] [<803d5394>] platform_drv_probe+0x40/0x94 [ 0.365526] [<803d362c>] really_probe+0x104/0x374 [ 0.365743] [<803d3ff0>] device_driver_attach+0x78/0x80 [ 0.365938] [<803d4070>] __driver_attach+0x78/0x118 [ 0.366129] [<803d1700>] bus_for_each_dev+0x7c/0xc8 [ 0.366318] [<803d226c>] bus_add_driver+0x1bc/0x204 [ 0.366513] [<803d4878>] driver_register+0x84/0x14c [ 0.366717] [<8073a144>] __platform_driver_probe+0x98/0x140 [ 0.366931] [<80724e38>] do_one_initcall+0x84/0x1b4 [ 0.367126] [<807250cc>] kernel_init_freeable+0x164/0x240 [ 0.367318] [<805df75c>] kernel_init+0x10/0xf8 [ 0.367510] [<8001542c>] ret_from_kernel_thread+0x14/0x1c [ 0.367722] ---[ end trace 7fedf00408fa3bed ]--- [ 0.367985] sched_clock: 32 bits at 12MHz, resolution 83ns,Quoted 5 lines
wraps
every 178956970966nsAt kernel/time/sched_clock.c:179 there is: WARN_ON(!irqs_disabled());That is strange, no drivers is doing that and no warning is
appearing.Quoted 6 lines
Quoted 2 lines
Isn't missing a
local_irq_disablein the code path in the stack
above?I think it comes to the fact that the other drivers are probed much earlier in the boot process, while this one is probed as a regular platform device driver.
Quoted 8 lines
There are other drivers doing and nobody is disabling the interrupt:
em_sti.c:static struct
platform_driverem_sti_device_driver= { ingenic-timer.c:static structplatform_driveringenic_tcu_driver= { sh_cmt.c:static structplatform_driversh_cmt_device_driver= { sh_mtu2.c:static structplatform_driversh_mtu2_device_driver= { sh_tmu.c:static structplatform_driversh_tmu_device_driver= { timer-ti-dm.c:static structplatform_driveromap_dm_timer_driver= {
Yes, but they don't register a sched_clock at all (except for ingenic-timer, but it does probe using TIMER_OF_DECLARE), and this warning is in sched_clock_register().
Quoted 33 lines
Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
+
local_irq_save(flags);
+ if (soc_info->is64bit)
+sched_clock_register(ingenic_ost_read_cntl, 32, rate);
+ else
+sched_clock_register(ingenic_ost_read_cnth, 32, rate);
+local_irq_restore(flags);
+
+ return 0;
+}
+Quoted 10 lines
Quoted 8 lines
--
<http://www.linaro.org/> Linaro.org │ Open source software for
ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM
SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Quoted 116 lines · Paul Cercueil
Quoted 103 lines · Daniel Lezcano
Quoted 93 lines · Paul Cercueil
Quoted 89 lines · Daniel Lezcano
Quoted 87 lines · Paul Cercueil
Hi Daniel,
Quoted 31 lines · Daniel Lezcano
Quoted 17 lines · Paul Cercueil
From: Maarten ter Huurne <[email protected]>
OST is the OS Timer, a 64-bit timer/counter with buffered reading.
SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and JZ4780 have a 64-bit OST.
This driver will register both a clocksource and a
sched_clockto the
system.Signed-off-by Maarten ter Huurne <[email protected]>Signed-off-by Paul Cercueil <[email protected]>Tested-by Mathieu Malaterre <[email protected]>Tested-by Artur Rojek <[email protected]>---
[ ... ]
Quoted 9 lines
+ err =
clocksource_register_hz(cs, rate);
+ if (err) {
+dev_err(dev, "clocksource registration failed: %d\n", err);
+clk_disable_unprepare(ost->clk);
+ return err;
+ }
+
+ /* Cannot register asched_clockwith interrupts on */Quoted 1 line
Aren't they already disabled?
Sorry for the late reply.
No, they are not already disabled; this is what I get if I comment out
the local_irq_save()/local_irq_restore():[ 0.361014] clocksource: ingenic-ost: mask:
0xffffffffmax_cycles:
0xffffffff,max_idle_ns: 159271703898 ns
[ 0.361515] clocksource: Switched to clocksource ingenic-ost [ 0.361686] ------------[ cut here ]------------
[ 0.361893] WARNING: CPU: 0 PID: 1 atkernel/time/sched_clock.c:179sched_clock_register+0x7c/0x2e4
[ 0.362174] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-rc5+ #461
[ 0.362330] Stack : 8074455880069b4480770000 00000000 0000000000dfd7a7806e6db48106bb74
[ 0.362619]806f000081067ca4806f31c780769478 00000020 100004008106bb2000dfd7a7
[ 0.362906] 00000000 00000000 80780000 00000000 00000007 00000001 000000493563722d
[ 0.363191]8106ba6100000000 ffffffff 00000010806f000000000000 00000000806f0000
[ 0.363477] 00000020 00000000 80714534 80770000 00000002 80319154 00000000 80770000
[ 0.363762] ...
[ 0.363906] Call Trace:
[ 0.364087] [<8001af14>]show_stack+0x40/0x128
[ 0.364289] [<8002fd88>]__warn+0xb8/0xe0
[ 0.364478] [<8002fe14>]warn_slowpath_fmt+0x64/0xc0
[ 0.364678] [<8072b1c8>]sched_clock_register+0x7c/0x2e4[ 0.364895] [<8073c874>]ingenic_ost_probe+0x224/0x248[ 0.365090] [<803d5394>]platform_drv_probe+0x40/0x94[ 0.365526] [<803d362c>]really_probe+0x104/0x374
[ 0.365743] [<803d3ff0>]device_driver_attach+0x78/0x80[ 0.365938] [<803d4070>]__driver_attach+0x78/0x118
[ 0.366129] [<803d1700>]bus_for_each_dev+0x7c/0xc8
[ 0.366318] [<803d226c>]bus_add_driver+0x1bc/0x204
[ 0.366513] [<803d4878>]driver_register+0x84/0x14c
[ 0.366717] [<8073a144>]__platform_driver_probe+0x98/0x140[ 0.366931] [<80724e38>]do_one_initcall+0x84/0x1b4
[ 0.367126] [<807250cc>]kernel_init_freeable+0x164/0x240[ 0.367318] [<805df75c>]kernel_init+0x10/0xf8
[ 0.367510] [<8001542c>]ret_from_kernel_thread+0x14/0x1c[ 0.367722] ---[ end trace7fedf00408fa3bed]---
[ 0.367985]sched_clock: 32 bits at 12MHz, resolution 83ns, wraps every 178956970966nsAt
kernel/time/sched_clock.c:179there is:
WARN_ON(!irqs_disabled());Quoted 7 lines
Quoted 3 lines
That is strange, no drivers is doing that and no warning is appearing.
Isn't missing a
local_irq_disablein the code path in the stack above?I think it comes to the fact that the other drivers are probed much earlier in the boot process, while this one is probed as a regular platform device driver.
Quoted 8 lines
There are other drivers doing and nobody is disabling the interrupt:
em_sti.c:static struct
platform_driverem_sti_device_driver= { ingenic-timer.c:static structplatform_driveringenic_tcu_driver= { sh_cmt.c:static structplatform_driversh_cmt_device_driver= { sh_mtu2.c:static structplatform_driversh_mtu2_device_driver= { sh_tmu.c:static structplatform_driversh_tmu_device_driver= { timer-ti-dm.c:static structplatform_driveromap_dm_timer_driver= {
Quoted 15 lines
Yes, but they don't register a
sched_clockat all (except for ingenic-timer, but it does probe usingTIMER_OF_DECLARE), and this warning is insched_clock_register().Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
+
local_irq_save(flags);
+ if (soc_info->is64bit)
+sched_clock_register(ingenic_ost_read_cntl, 32, rate); + else
+sched_clock_register(ingenic_ost_read_cnth, 32, rate); +local_irq_restore(flags);
+
+ return 0;
+}
+
Thomas,
the local_irq_save/restore calls shouldn't be in the sched_clock_register() function instead of showing a warning?
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog