Re: [PATCH 0/4] cpufreq support for the Raspberry Pi

From: Stefan Wahren
Date: Wed Jun 05 2019 - 07:38:45 EST


Hi,

Am 05.06.19 um 13:00 schrieb Nicolas Saenz Julienne:
> Hi Stefan,
> thanks for the review, I took note of your code comments.
>
> On Wed, 2019-06-05 at 11:46 +0200, Stefan Wahren wrote:
>> Hi Nicolas,
>>
>> Am 04.06.19 um 19:32 schrieb Nicolas Saenz Julienne:
>>> Hi all,
>>> this series aims at adding cpufreq support to the Raspberry Pi family of
>>> boards.
>>>
>>> The previous revision can be found at: https://lkml.org/lkml/2019/5/20/431
>>>
>>> The series first factors out 'pllb' from clk-bcm2385 and creates a new
>>> clk driver that operates it over RPi's firmware interface[1]. We are
>>> forced to do so as the firmware 'owns' the pll and we're not allowed to
>>> change through the register interface directly as we might race with the
>>> over-temperature and under-voltage protections provided by the firmware.
>> it would be nice to preserve such design decision in the driver as a
>> comment, because the cover letter usually get lost.
>>> Next it creates a minimal cpufreq driver that populates the CPU's opp
>>> table, and registers cpufreq-dt. Which is needed as the firmware
>>> controls the max and min frequencies available.
>> I tested your series on top of Linux 5.2-rc1 with multi_v7_defconfig and
>> manually enable this drivers. During boot with Raspbian rootfs i'm
>> getting the following:
>>
>> [ 1.177009] cpu cpu0: failed to get clock: -2
>> [ 1.183643] cpufreq-dt: probe of cpufreq-dt failed with error -2
> This is surprising, who could be creating a platform_device for cpufreq-dt
> apart from raspberrypi-cpufreq? Just to make things clear, you're using the
> device tree from v5.2-rc1 (as opposed to the Raspbian one)?

sorry my fault, i thought it already has been replaced. The behavior in
this unexpected case is fine, since it doesn't crash.

I replaced the the DTB with the mainline one, but now i'm getting this:

[ÂÂÂ 4.566068] cpufreq: cpufreq_online: CPU0: Running at unlisted freq:
600000 KHz
[ÂÂÂ 4.580690] cpu cpu0: dev_pm_opp_set_rate: Invalid target frequency 0
[ÂÂÂ 4.594391] cpufreq: __target_index: Failed to change cpu frequency: -22
[ÂÂÂ 4.608413] ------------[ cut here ]------------
[ÂÂÂ 4.620203] kernel BUG at drivers/cpufreq/cpufreq.c:1348!
[ÂÂÂ 4.632787] Internal error: Oops - BUG: 0 [#1] SMP ARM
[ÂÂÂ 4.645062] Modules linked in:
[ÂÂÂ 4.655147] CPU: 2 PID: 1 Comm: swapper/0 Tainted: GÂÂÂÂÂÂÂ WÂÂÂÂÂÂÂÂ
5.2.0-rc1-00004-g5aa6d98-dirty #2
[ÂÂÂ 4.671891] Hardware name: BCM2835
[ÂÂÂ 4.682549] PC is at cpufreq_online+0x690/0x6b0
[ÂÂÂ 4.694409] LR is at __wake_up_common_lock+0xa0/0xc8
[ÂÂÂ 4.706744] pc : [<c0c696c0>]ÂÂÂ lr : [<c03860d4>]ÂÂÂ psr: a0000013
[ÂÂÂ 4.720518] sp : ea89dce8Â ip : eaa1ace0Â fp : c1704d54
[ÂÂÂ 4.733288] r10: eaa1acb4Â r9 : c1673440Â r8 : c1705038
[ÂÂÂ 4.746085] r7 : c18e6728Â r6 : 000927c0Â r5 : 00000000Â r4 : eaa1ac00
[ 4.760288] r3 : d89db0bd r2 : d89db0bd r1 : 60000013 r0 : ffffffea
[ 4.774541] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARMÂ
Segment none
[ 4.789431] Control: 10c5383d Table: 0020406a DAC: 00000051
[ÂÂÂ 4.802897] Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
[ÂÂÂ 4.816661] Stack: (0xea89dce8 to 0xea89e000)
[ÂÂÂ 4.828744] dce0:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ 00000000 d89db0bd eaa1ac04
00000001 ea89dd28 00000000
[ÂÂÂ 4.844876] dd00: c184539c c1704c48 00000000 c186de1c 0000000f
00000000 c15dc83c c0c6975c
[ÂÂÂ 4.861033] dd20: c186d9e4 c096dbbc ea891358 ea9a5db4 00000000
d89db0bd c186de68 c18e6728
[ÂÂÂ 4.877227] dd40: c186d99c c0c66ffc eaff1800 c0c6bda0 00000000
eb80c050 eaff1800 c0c6c148
[ÂÂÂ 4.893461] dd60: eaff1810 00000000 c186de1c c097126c c18e16a4
eaff1810 c18e16a8 c096f314
[ÂÂÂ 4.909769] dd80: eaff1810 c186de1c c096f800 c1704c48 00000001
00000000 c1667b7c c096f64c
[ÂÂÂ 4.926077] dda0: c186de1c ea89ddfc eaff1810 00000000 ea89ddfc
c096f800 c1704c48 00000001
[ÂÂÂ 4.942410] ddc0: 00000000 c1667b7c c15dc83c c096d864 00000000
ea89126c eaf85138 d89db0bd
[ÂÂÂ 4.958798] dde0: eaff1810 eaff1810 c1704c48 eaff1854 c1704c48
c096f1b0 c1667b7c eaff1810
[ÂÂÂ 4.975236] de00: 00000001 d89db0bd eaff1810 eaff1810 c1845308
c1704c48 00000000 c096e574
[ÂÂÂ 4.991705] de20: eaff1810 c1845138 00000000 c096b490 00000000
c0e822d8 c1704c48 ea89dea0
[ÂÂÂ 5.008233] de40: eaff1800 d89db0bd ea89de60 eaff1800 00000000
eaff1800 eb80c050 00000000
[ÂÂÂ 5.024770] de60: eaff1810 c0971098 eaff1800 ea89dea0 c1704c48
eb80c050 00000000 05f5e100
[ÂÂÂ 5.041302] de80: c1667b7c c0971ae4 00000000 23c34600 c1704c48
eb80c050 00000000 c15a7a30
[ÂÂÂ 5.057796] dea0: 00000000 00000000 00000000 c1361770 ffffffff
00000000 00000000 00000000
[ÂÂÂ 5.074269] dec0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 d89db0bd
[ÂÂÂ 5.090693] dee0: 00000167 c1704c48 c188d420 ffffe000 00000000
c15a7908 00000167 c0302eec
[ÂÂÂ 5.107119] df00: 00000167 c0365a5c c13ff448 c130e700 00000000
00000007 00000007 c124057c
[ÂÂÂ 5.123539] df20: 00000000 c1704c48 c1251c04 c12405f0 00000000
ebfffc7d 00000000 d89db0bd
[ÂÂÂ 5.139941] df40: 00000000 c188d420 00000008 d89db0bd c188d420
00000008 c1899800 c1899800
[ÂÂÂ 5.156355] df60: c15dc838 c15010f8 00000007 00000007 00000000
c150067c c0e949cc 00000000
[ÂÂÂ 5.172779] df80: 00000000 00000000 c0e949cc 00000000 00000000
00000000 00000000 00000000
[ÂÂÂ 5.189192] dfa0: 00000000 c0e949d4 00000000 c03010e8 00000000
00000000 00000000 00000000
[ÂÂÂ 5.205577] dfc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[ÂÂÂ 5.221915] dfe0: 00000000 00000000 00000000 00000000 00000013
00000000 00000000 00000000
[ÂÂÂ 5.238205] [<c0c696c0>] (cpufreq_online) from [<c0c6975c>]
(cpufreq_add_dev+0x6c/0x78)
[ÂÂÂ 5.254372] [<c0c6975c>] (cpufreq_add_dev) from [<c096dbbc>]
(subsys_interface_register+0xa0/0xec)
[ÂÂÂ 5.271557] [<c096dbbc>] (subsys_interface_register) from
[<c0c66ffc>] (cpufreq_register_driver+0x14c/0x20c)
[ÂÂÂ 5.289700] [<c0c66ffc>] (cpufreq_register_driver) from [<c0c6c148>]
(dt_cpufreq_probe+0x94/0x114)
[ÂÂÂ 5.307002] [<c0c6c148>] (dt_cpufreq_probe) from [<c097126c>]
(platform_drv_probe+0x48/0x98)
[ÂÂÂ 5.323802] [<c097126c>] (platform_drv_probe) from [<c096f314>]
(really_probe+0xf0/0x2c8)
[ÂÂÂ 5.340390] [<c096f314>] (really_probe) from [<c096f64c>]
(driver_probe_device+0x60/0x164)
[ÂÂÂ 5.357113] [<c096f64c>] (driver_probe_device) from [<c096d864>]
(bus_for_each_drv+0x58/0xb8)
[ÂÂÂ 5.374142] [<c096d864>] (bus_for_each_drv) from [<c096f1b0>]
(__device_attach+0xd0/0x13c)
[ÂÂÂ 5.390937] [<c096f1b0>] (__device_attach) from [<c096e574>]
(bus_probe_device+0x84/0x8c)
[ÂÂÂ 5.407684] [<c096e574>] (bus_probe_device) from [<c096b490>]
(device_add+0x3bc/0x608)
[ÂÂÂ 5.424208] [<c096b490>] (device_add) from [<c0971098>]
(platform_device_add+0x110/0x214)
[ÂÂÂ 5.440983] [<c0971098>] (platform_device_add) from [<c0971ae4>]
(platform_device_register_full+0x130/0x148)
[ÂÂÂ 5.459471] [<c0971ae4>] (platform_device_register_full) from
[<c15a7a30>] (raspberrypi_cpufreq_driver_init+0x128/0x178)
[ÂÂÂ 5.479053] [<c15a7a30>] (raspberrypi_cpufreq_driver_init) from
[<c0302eec>] (do_one_initcall+0x54/0x21c)
[ÂÂÂ 5.497336] [<c0302eec>] (do_one_initcall) from [<c15010f8>]
(kernel_init_freeable+0x244/0x2e0)
[ÂÂÂ 5.514735] [<c15010f8>] (kernel_init_freeable) from [<c0e949d4>]
(kernel_init+0x8/0x10c)
[ÂÂÂ 5.531590] [<c0e949d4>] (kernel_init) from [<c03010e8>]
(ret_from_fork+0x14/0x2c)
[ÂÂÂ 5.547768] Exception stack(0xea89dfb0 to 0xea89dff8)
[ÂÂÂ 5.561323] dfa0:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ 00000000
00000000 00000000 00000000
[ÂÂÂ 5.578116] dfc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[ÂÂÂ 5.594962] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ÂÂÂ 5.610133] Code: e59f1024 e34c0136 ebdcbce4 eaffff63 (e7f001f2)
[ÂÂÂ 5.624789] ---[ end trace 7aaf0f77e232247e ]---
[ÂÂÂ 5.637981] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x0000000b
[ÂÂÂ 5.654308] CPU3: stopping
[ÂÂÂ 5.665609] CPU: 3 PID: 0 Comm: swapper/3 Tainted: GÂÂÂÂÂ D WÂÂÂÂÂÂÂÂ
5.2.0-rc1-00004-g5aa6d98-dirty #2
[ÂÂÂ 5.683854] Hardware name: BCM2835
[ÂÂÂ 5.695927] [<c0312304>] (unwind_backtrace) from [<c030cc08>]
(show_stack+0x10/0x14)
[ÂÂÂ 5.712502] [<c030cc08>] (show_stack) from [<c0e7d358>]
(dump_stack+0xb4/0xc8)
[ÂÂÂ 5.728537] [<c0e7d358>] (dump_stack) from [<c03107c8>]
(handle_IPI+0x3bc/0x3dc)
[ÂÂÂ 5.744710] [<c03107c8>] (handle_IPI) from [<c0301a8c>]
(__irq_svc+0x6c/0x90)
[ÂÂÂ 5.760601] Exception stack(0xea8d7f60 to 0xea8d7fa8)
[ÂÂÂ 5.774348] 7f60: 00000000 000004e4 eb854ae0 c031d840 ffffe000
c1704c6c c1704cac 00000008
[ÂÂÂ 5.791381] 7f80: 00000000 c1704c48 c1673568 00000000 00000002
ea8d7fb0 c0309164 c0309168
[ÂÂÂ 5.808421] 7fa0: 60000013 ffffffff
[ÂÂÂ 5.820668] [<c0301a8c>] (__irq_svc) from [<c0309168>]
(arch_cpu_idle+0x38/0x3c)
[ÂÂÂ 5.836950] [<c0309168>] (arch_cpu_idle) from [<c03747c4>]
(do_idle+0x1bc/0x298)
[ÂÂÂ 5.853198] [<c03747c4>] (do_idle) from [<c0374b3c>]
(cpu_startup_entry+0x18/0x1c)
[ÂÂÂ 5.869667] [<c0374b3c>] (cpu_startup_entry) from [<003025cc>]
(0x3025cc)
[ÂÂÂ 5.885362] CPU1: stopping
[ÂÂÂ 5.896857] CPU: 1 PID: 0 Comm: swapper/1 Tainted: GÂÂÂÂÂ D WÂÂÂÂÂÂÂÂ
5.2.0-rc1-00004-g5aa6d98-dirty #2
[ÂÂÂ 5.915295] Hardware name: BCM2835
[ÂÂÂ 5.927623] [<c0312304>] (unwind_backtrace) from [<c030cc08>]
(show_stack+0x10/0x14)
[ÂÂÂ 5.944490] [<c030cc08>] (show_stack) from [<c0e7d358>]
(dump_stack+0xb4/0xc8)
[ÂÂÂ 5.960861] [<c0e7d358>] (dump_stack) from [<c03107c8>]
(handle_IPI+0x3bc/0x3dc)
[ÂÂÂ 5.977364] [<c03107c8>] (handle_IPI) from [<c0301a8c>]
(__irq_svc+0x6c/0x90)
[ÂÂÂ 5.993562] Exception stack(0xea8d3f60 to 0xea8d3fa8)
[ÂÂÂ 6.007632] 3f60: 00000000 00002930 eb82cae0 c031d840 ffffe000
c1704c6c c1704cac 00000002
[ÂÂÂ 6.024974] 3f80: 00000000 c1704c48 c1673568 00000000 00000000
ea8d3fb0 c0309164 c0309168
[ÂÂÂ 6.042285] 3fa0: 60000013 ffffffff
[ÂÂÂ 6.054772] [<c0301a8c>] (__irq_svc) from [<c0309168>]
(arch_cpu_idle+0x38/0x3c)
[ÂÂÂ 6.071321] [<c0309168>] (arch_cpu_idle) from [<c03747c4>]
(do_idle+0x1bc/0x298)
[ÂÂÂ 6.087880] [<c03747c4>] (do_idle) from [<c0374b3c>]
(cpu_startup_entry+0x18/0x1c)
[ÂÂÂ 6.104610] [<c0374b3c>] (cpu_startup_entry) from [<003025cc>]
(0x3025cc)
[ÂÂÂ 6.120535] CPU0: stopping
[ÂÂÂ 6.132240] CPU: 0 PID: 0 Comm: swapper/0 Tainted: GÂÂÂÂÂ D WÂÂÂÂÂÂÂÂ
5.2.0-rc1-00004-g5aa6d98-dirty #2
[ÂÂÂ 6.150859] Hardware name: BCM2835
[ÂÂÂ 6.163308] [<c0312304>] (unwind_backtrace) from [<c030cc08>]
(show_stack+0x10/0x14)
[ÂÂÂ 6.180258] [<c030cc08>] (show_stack) from [<c0e7d358>]
(dump_stack+0xb4/0xc8)
[ÂÂÂ 6.196660] [<c0e7d358>] (dump_stack) from [<c03107c8>]
(handle_IPI+0x3bc/0x3dc)
[ÂÂÂ 6.213214] [<c03107c8>] (handle_IPI) from [<c0301a8c>]
(__irq_svc+0x6c/0x90)
[ÂÂÂ 6.229479] Exception stack(0xc1701f10 to 0xc1701f58)
[ÂÂÂ 6.243636] 1f00:ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ 00000000
0000190c eb818ae0 c031d840
[ÂÂÂ 6.261073] 1f20: ffffe000 c1704c6c c1704cac 00000001 00000000
c1704c48 c1673568 00000000
[ÂÂÂ 6.278565] 1f40: 00000002 c1701f60 c0309164 c0309168 60000013 ffffffff
[ÂÂÂ 6.294466] [<c0301a8c>] (__irq_svc) from [<c0309168>]
(arch_cpu_idle+0x38/0x3c)
[ÂÂÂ 6.311211] [<c0309168>] (arch_cpu_idle) from [<c03747c4>]
(do_idle+0x1bc/0x298)
[ÂÂÂ 6.327979] [<c03747c4>] (do_idle) from [<c0374b3c>]
(cpu_startup_entry+0x18/0x1c)
[ÂÂÂ 6.344934] [<c0374b3c>] (cpu_startup_entry) from [<c1500e88>]
(start_kernel+0x460/0x48c)
[ÂÂÂ 6.362527] [<c1500e88>] (start_kernel) from [<00000000>] (0x0)
[ÂÂÂ 6.377824] ---[ end Kernel panic - not syncing: Attempted to kill
init! exitcode=0x0000000b ]---