5.15-rc2 panics on boot on RK3288 veyron speedy, seems related to rockchip pinctrl / gpio split

From: Urja Rannikko
Date: Sun Sep 26 2021 - 07:57:48 EST


Hi,

A boot log of this is attached. I can say that this happens on
5.15-rc2 but not on 5.14.7.

Based on the log and some reading of the code my diagnosis is that
rockchip_pinctrl_probe (via rockchip_pinctrl_register and after that
the pinctrl core register calls) ends up trying to apply the
configuration and accesses a null bank->gpio_chip (i think at
drivers/pinctrl/pinctrl-rockchip.c:2139)
before the gpio is "populated" / probed a couple of lines later in
rockchip_pinctrl_probe (line 2710 onwards).

What I don't know is how this is supposed to work and/or how to
properly fix it, so that's why I'm sending this bug report instead.

I'm sending this to the people who last touched the rockchip pinctrl
(and gpio), because that's where this log points me to.

--
Urja Rannikko
[ 0.000000] Booting Linux on physical CPU 0x500
[ 0.000000] Linux version 5.15.0-rc2-test-2-ARCH+ (urjaman@weird) (arm-unknown-linux-gnueabihf-gcc (crosstool-NG 1.23.0.418-d590) 10.2.0, GNU ld (crosstool-NG 1.23.0.418-d590) 2.35) #15 SMP PREEMPT Sun Sep 26 12:46:14 EEST 2021
[ 0.000000] CPU: ARMv7 Processor [410fc0d1] revision 1 (ARMv7), cr=30c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Google Speedy
[ 0.000000] earlycon: uart0 at MMIO32 0x00000000ff690000 (options '115200n8')
[ 0.000000] printk: bootconsole [uart0] enabled
[ 0.000000] printk: debug: skip boot console de-registration.
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 48 MiB at 0x00000000fb000000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000000000-0x000000002fffffff]
[ 0.000000] Normal empty
[ 0.000000] HighMem [mem 0x0000000030000000-0x00000000fdffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000000000000-0x00000000fdffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000000fdffffff]
[ 0.000000] percpu: Embedded 12 pages/cpu s19724 r8192 d21236 u49152
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1038656
[ 0.000000] Kernel command line: earlycon keep_bootcon console=ttyS2,115200n8 console=tty0 init=/sbin/init root=PARTUUID=B938A770-5439-5845-96F5-3E7D705889A4 rootwait rw noinitrd
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 4058708K/4161536K available (8192K kernel code, 1141K rwdata, 2152K rodata, 2048K init, 405K bss, 53676K reserved, 49152K cma-reserved, 3325952K highmem)
[ 0.000000] random: get_random_u32 called from __kmem_cache_create+0x10/0x42c with crng_init=0
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] Trampoline variant of Tasks RCU enabled.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[ 0.000000] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.008329] Switching to timer-based delay loop, resolution 41ns
[ 0.015138] Console: colour dummy device 80x30
[ 0.019701] printk: console [tty0] enabled
[ 0.023991] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
[ 0.034385] pid_max: default: 32768 minimum: 301
[ 0.039284] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.046914] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.055454] CPU: Testing write buffer coherency: ok
[ 0.060481] CPU0: Spectre v2: using BPIALL workaround
[ 0.066290] Setting up static identity map for 0x200000 - 0x200060
[ 0.072704] rcu: Hierarchical SRCU implementation.
[ 0.078090] smp: Bringing up secondary CPUs ...
[ 0.084039] CPU1: Spectre v2: using BPIALL workaround
[ 0.090540] CPU2: Spectre v2: using BPIALL workaround
[ 0.097081] CPU3: Spectre v2: using BPIALL workaround
[ 0.102274] smp: Brought up 1 node, 4 CPUs
[ 0.106451] SMP: Total of 4 processors activated (192.00 BogoMIPS).
[ 0.112973] CPU: All CPU(s) started in SVC mode.
[ 0.118122] devtmpfs: initialized
[ 0.125834] VFP support v0.3: implementor 41 architecture 3 part 30 variant d rev 0
[ 0.133834] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.143714] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.151604] pinctrl core: initialized pinctrl subsystem
[ 0.157657] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.164692] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.172318] thermal_sys: Registered thermal governor 'fair_share'
[ 0.172323] thermal_sys: Registered thermal governor 'bang_bang'
[ 0.178529] thermal_sys: Registered thermal governor 'step_wise'
[ 0.184785] thermal_sys: Registered thermal governor 'user_space'
[ 0.191257] cpuidle: using governor menu
[ 0.201799] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.209915] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.222166] platform ff970000.dp: Fixing up cyclic dependency with ff940000.vop
[ 0.229833] platform ff980000.hdmi: Fixing up cyclic dependency with ff930000.vop
[ 0.241585] 8<--- cut here ---
[ 0.244675] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 0.253110] pgd = (ptrval)
[ 0.255916] [00000000] *pgd=80000000004003, *pmd=00000000
[ 0.261543] Internal error: Oops: 80000206 [#1] PREEMPT SMP ARM
[ 0.267715] Modules linked in:
[ 0.270887] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc2-test-2-ARCH+ #15
[ 0.278682] Hardware name: Rockchip (Device Tree)
[ 0.283577] PC is at 0x0
[ 0.286203] LR is at rockchip_pinconf_set+0x12c/0x408
[ 0.291460] pc : [<00000000>] lr : [<c04dd1d8>] psr: 60000013
[ 0.297977] sp : c1853c08 ip : 00000000 fp : 00000000
[ 0.303419] r10: 00000004 r9 : 00000000 r8 : c1b31ccc
[ 0.308851] r7 : c1b31cc0 r6 : 00000011 r5 : c10ea3d4 r4 : 00000000
[ 0.315654] r3 : 00000000 r2 : 00000000 r1 : 00000011 r0 : c10ea460
[ 0.322440] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 0.329878] Control: 30c5387d Table: 00003000 DAC: fffffffd
[ 0.335857] Register r0 information: non-slab/vmalloc memory
[ 0.341761] Register r1 information: non-paged memory
[ 0.347030] Register r2 information: NULL pointer
[ 0.351926] Register r3 information: NULL pointer
[ 0.356821] Register r4 information: NULL pointer
[ 0.361699] Register r5 information: non-slab/vmalloc memory
[ 0.367601] Register r6 information: non-paged memory
[ 0.372844] Register r7 information: slab kmalloc-64 start c1b31cc0 pointer offset 0 size 64
[ 0.381642] Register r8 information: slab kmalloc-64 start c1b31cc0 pointer offset 12 size 64
[ 0.390534] Register r9 information: NULL pointer
[ 0.395421] Register r10 information: non-paged memory
[ 0.400768] Register r11 information: NULL pointer
[ 0.405759] Register r12 information: NULL pointer
[ 0.410741] Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
[ 0.416999] Stack: (0xc1853c08 to 0xc1854000)
[ 0.421531] 3c00: ???????? ???????? ???????? ???????? ???????? ????????
[ 0.430044] 3c20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.438565] 3c40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.447076] 3c60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.455605] 3c80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.464109] 3ca0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.472637] 3cc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.481158] 3ce0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.489678] 3d00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.498182] 3d20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.506702] 3d40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.515214] 3d60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.523717] 3d80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.532247] 3da0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.540767] 3dc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.549280] 3de0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.557800] 3e00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.566312] 3e20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.574816] 3e40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.583344] 3e60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.591865] 3e80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.600385] 3ea0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.608906] 3ec0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.617426] 3ee0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.625956] 3f00: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.634476] 3f20: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.642980] 3f40: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.651500] 3f60: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.660021] 3f80: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.668524] 3fa0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.677044] 3fc0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.685565] 3fe0: ???????? ???????? ???????? ???????? ???????? ???????? ???????? ????????
[ 0.694100] [<c04dd1d8>] (rockchip_pinconf_set) from [<c04daa18>] (pinconf_apply_setting+0x5c/0xd8)
[ 0.703530] [<c04daa18>] (pinconf_apply_setting) from [<c04d847c>] (pinctrl_commit_state+0x134/0x194)
[ 0.713132] [<c04d847c>] (pinctrl_commit_state) from [<c04d8bd0>] (pinctrl_enable+0xdc/0x2d4)
[ 0.722004] [<c04d8bd0>] (pinctrl_enable) from [<c04d8de0>] (pinctrl_register+0x18/0x28)
[ 0.730442] [<c04d8de0>] (pinctrl_register) from [<c04d8e38>] (devm_pinctrl_register+0x48/0x84)
[ 0.739504] [<c04d8e38>] (devm_pinctrl_register) from [<c04ddc70>] (rockchip_pinctrl_probe+0x5d8/0x9a8)
[ 0.749296] [<c04ddc70>] (rockchip_pinctrl_probe) from [<c05aa4d4>] (platform_probe+0x58/0xa8)
[ 0.758260] [<c05aa4d4>] (platform_probe) from [<c05a8148>] (really_probe+0x1d0/0x400)
[ 0.766508] [<c05a8148>] (really_probe) from [<c05a8524>] (__driver_probe_device+0x1ac/0x1e0)
[ 0.775397] [<c05a8524>] (__driver_probe_device) from [<c05a8594>] (driver_probe_device+0x3c/0xbc)
[ 0.784738] [<c05a8594>] (driver_probe_device) from [<c05a8948>] (__device_attach_driver+0x9c/0xfc)
[ 0.794156] [<c05a8948>] (__device_attach_driver) from [<c05a65d0>] (bus_for_each_drv+0x84/0x8c)
[ 0.803310] [<c05a65d0>] (bus_for_each_drv) from [<c05a877c>] (__device_attach+0xac/0x138)
[ 0.811932] [<c05a877c>] (__device_attach) from [<c05a71a8>] (bus_probe_device+0x28/0x80)
[ 0.820456] [<c05a71a8>] (bus_probe_device) from [<c05a4f08>] (device_add+0x560/0x78c)
[ 0.828714] [<c05a4f08>] (device_add) from [<c06bbe44>] (of_platform_device_create_pdata+0x98/0xbc)
[ 0.838136] [<c06bbe44>] (of_platform_device_create_pdata) from [<c06bc1b4>] (of_platform_bus_create+0x340/0x44c)
[ 0.848838] [<c06bc1b4>] (of_platform_bus_create) from [<c06bc5a8>] (of_platform_populate+0xb0/0x110)
[ 0.858447] [<c06bc5a8>] (of_platform_populate) from [<c0e23538>] (of_platform_default_populate_init+0x74/0xb8)
[ 0.868953] [<c0e23538>] (of_platform_default_populate_init) from [<c02014e8>] (do_one_initcall+0x6c/0x190)
[ 0.879113] [<c02014e8>] (do_one_initcall) from [<c0e01104>] (kernel_init_freeable+0x1b4/0x1fc)
[ 0.888187] [<c0e01104>] (kernel_init_freeable) from [<c0830628>] (kernel_init+0x10/0x124)
[ 0.896811] [<c0830628>] (kernel_init) from [<c0200120>] (ret_from_fork+0x14/0x34)