Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

milletwifi: DSI causes kernel error #13

Open
NekoCWD opened this issue Apr 1, 2024 · 4 comments
Open

milletwifi: DSI causes kernel error #13

NekoCWD opened this issue Apr 1, 2024 · 4 comments

Comments

@NekoCWD
Copy link

NekoCWD commented Apr 1, 2024

What's wrong?

When i enable mdss in dts, tablet doesn't boot

Error log

[    1.922228] platform fd900100.display-controller: Fixed dependency cycle(s) with /soc/display-subsystem@fd900000/dsi@fd922800
[    1.928493] platform fd900100.display-controller: Fixed dependency cycle(s) with /soc/display-subsystem@fd900000/dsi@fd922800
[    1.939164] platform fd922800.dsi: Fixed dependency cycle(s) with /soc/display-subsystem@fd900000/dsi@fd922800/panel@0
[    1.950290] platform fd922800.dsi: Fixed dependency cycle(s) with /soc/display-subsystem@fd900000/display-controller@fd900000
[    1.963003] 8<--- cut here ---
[    1.972183] Unhandled fault: external abort on non-linefetch (0x008) at 0xf0dcba00
[    1.975140] [f0dcba00] *pgd=016f1811, *pte=fd922653, *ppte=fd922453
[    1.982694] Internal error: : 8 [#1] PREEMPT SMP ARM
[    1.988853] Modules linked in:
[    1.994060] CPU: 3 PID: 82 Comm: kworker/u11:1 Not tainted 6.8.1 #1
[    1.996926] Hardware name: Generic DT based system
[    2.003090] Workqueue: events_unbound deferred_probe_work_func
[    2.007951] PC is at dsi_pll_28nm_clk_recalc_rate+0xc/0x100
[    2.013765] LR is at __clk_register+0x564/0x8c4
[    2.019234] pc : [<c06e92c8>]    lr : [<c05a4810>]    psr: a0000013
[    2.023749] sp : f0c39af8  ip : 00000000  fp : 00000001
[    2.029998] r10: c0ff2370  r9 : c1656ec0  r8 : 00000000
[    2.035205] r7 : f0c39bb0  r6 : f0dcba00  r5 : c1693000  r4 : c2932300
[    2.040415] r3 : c1690040  r2 : 00000001  r1 : 0124f800  r0 : c1656ec0
[    2.047014] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    2.053527] Control: 10c5387d  Table: 0000406a  DAC: 00000051
[    2.060728] Register r0 information: slab kmalloc-128 start c1656e80 pointer offset 64 size 128
[    2.066460] Register r1 information: non-paged memory
[    2.074964] Register r2 information: non-paged memory
[    2.080171] Register r3 information: slab kmalloc-256 start c1690000 pointer offset 64 size 256
[    2.085210] Register r4 information: slab kmalloc-192 start c2932300 pointer offset 0 size 192
[    2.093717] Register r5 information: slab kmalloc-192 start c1693000 pointer offset 0 size 192
[    2.102398] Register r6 information: 0-page vmalloc region starting at 0xf0dcb000 allocated at devm_ioremap+0x4c/0x88
[    2.110995] Register r7 information: 2-page vmalloc region starting at 0xf0c38000 allocated at kernel_clone+0xa4/0x33c
[    2.121672] Register r8 information: NULL pointer
[    2.132255] Register r9 information: slab kmalloc-128 start c1656e80 pointer offset 64 size 128
[    2.137034] Register r10 information: non-slab/vmalloc memory
[    2.145536] Register r11 information: non-paged memory
[    2.151439] Register r12 information: NULL pointer
[    2.156473] Process kworker/u11:1 (pid: 82, stack limit = 0x(ptrval))
[    2.161249] Stack: (0xf0c39af8 to 0xf0c3a000)
[    2.167760] 9ae0:                                                       c2932300 c1693000
[    2.172110] 9b00: 00000000 f0c39bb0 00000000 c05a4810 ffffffff c05a4cf4 fffffff3 f0c39ba0
[    2.180269] 9b20: 00000000 c1692180 c1656ec0 c0ff2370 c16569c0 c2465c10 c1656f40 c1656ec0
[    2.188428] 9b40: f0c39bd4 c2465c10 c16569c0 00000000 c12ccaa8 c05a4d1c c0f562d4 6f1056cf
[    2.196588] 9b60: c1690040 c1656ec0 c1690040 c06e9524 00000003 f0c39bbc c26a0000 c0163ee4
[    2.204749] 9b80: c15b5094 c01647f0 c2465c10 c070fe6c c2465c10 c15b5010 00000000 c2465c10
[    2.212908] 9ba0: 00000000 c0f52144 c0f56f08 00000000 f0c39bd4 c0db1f34 00000000 f0c39ba0
[    2.221068] 9bc0: 00000000 00000001 00000008 c2465c10 60000013 30697364 5f6f6376 006b6c63
[    2.229226] 9be0: 00000000 00000000 00000000 00000000 00000000 6f1056cf c2465c00 c1690040
[    2.237386] 9c00: c2465c00 00000000 c2465c10 00000000 ef3f593c 00000000 c12ccaa8 c06e6fb8
[    2.245547] 9c20: 00000000 6f1056cf 00000000 6f1056cf 00000000 c2465c10 c12cc388 c12f1080
[    2.253706] 9c40: 00000000 c0703038 c2465c10 00000000 c12cc388 c12f1080 00000000 c07004a4
[    2.261866] 9c60: c2465c94 c070f3a4 c2465c10 c12cc388 c2465c10 00000019 c12f0d50 c0700858
[    2.270027] 9c80: 60000013 ef3f593c c13473e4 c12cc388 c2465c10 00000019 c12f0d50 c07009e0
[    2.278186] 9ca0: 00000001 c12cc388 f0c39cfc c2465c10 c12f0d50 c0700b18 00000000 c141cf00
[    2.286345] 9cc0: f0c39cfc c0700a70 c12f0d50 c06fe478 c141cf00 c141cf6c c253d138 6f1056cf
[    2.294505] 9ce0: c12ccaa8 c2465c10 00000001 c2465c54 c141cf00 c0700f7c ef3f5938 c2465c10
[    2.302665] 9d00: 00000001 6f1056cf c2465c10 00000000 c2465c10 c06ff478 c2465c10 00000000
[    2.310824] 9d20: c13473b4 c15b5010 c12f0d50 c06fcd1c 00000000 00000000 00000000 00000000
[    2.318985] 9d40: 00000000 6f1056cf 00000000 c2465c00 00000000 ef3f5994 ef3f5930 00000000
[    2.327143] 9d60: 00000001 00000000 ef3f5994 c08eb904 ef3f5930 00000000 00000000 00000000
[    2.335303] 9d80: c15b5010 c08ebb20 c2941218 c132c0f0 00000000 c2941200 c0d412ac 00000000
[    2.343463] 9da0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6f1056cf
[    2.351624] 9dc0: 00000160 ef3f5930 ef3f4400 00000000 00000000 c15b5010 00000001 00000000
[    2.359782] 9de0: 00000000 c08ebfb8 00000001 c15b5010 c29ed2c0 c15b5000 c15b5010 00000031
[    2.367942] 9e00: c15b5010 c29ed540 00000160 c06bd24c c0dabdb4 c29ed2c0 c15b5010 00000000
[    2.376103] 9e20: c15b5010 c12cbae4 c12f1080 00000000 c141cd0d c0703038 c15b5010 00000000
[    2.384262] 9e40: c12cbae4 c12f1080 00000000 c07004a4 c15b5094 c070f3a4 c15b5010 c12cbae4
[    2.392423] 9e60: c15b5010 00000019 00000000 c0700858 60000013 c141cd0d c13473e4 c12cbae4
[    2.400581] 9e80: c15b5010 00000019 00000000 c07009e0 00000001 c12cbae4 f0c39eec c15b5010
[    2.408742] 9ea0: 00000000 c0700b18 00000000 c141cf00 f0c39eec c0700a70 00000000 c06fe478
[    2.416901] 9ec0: c141cf00 c141cf6c c253d4b8 6f1056cf 00000000 c15b5010 00000001 c15b5054
[    2.425060] 9ee0: c141cf00 c0700f7c 00000001 c15b5010 00000001 6f1056cf c15b5010 c12ccd28
[    2.433221] 9f00: c15b5010 c06ff478 c15b5010 c12ccd28 c12ccd3c c12f1080 00000000 c06ff994
[    2.441380] 9f20: c1463100 c12ccd60 c141cd00 c1407000 c26a0000 c0139b10 c1407020 61c88647
[    2.449540] 9f40: c1463100 c1407000 c1203d40 c1407020 61c88647 c146312c c26a0000 c0139ee4
[    2.457699] 9f60: f08b9ec8 00000000 f0c39f7c c14430c0 c26a0000 c0139c68 c1463100 c16f30c0
[    2.465860] 9f80: f08b9ec8 00000000 00000000 c014285c c14430c0 c014274c 00000000 00000000
[    2.474019] 9fa0: 00000000 00000000 00000000 c010014c 00000000 00000000 00000000 00000000
[    2.482178] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.490337] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[    2.498501]  dsi_pll_28nm_clk_recalc_rate from __clk_register+0x564/0x8c4
[    2.506652]  __clk_register from devm_clk_hw_register+0x5c/0xc0
[    2.513420]  devm_clk_hw_register from dsi_pll_28nm_init+0x114/0x38c
[    2.519150]  dsi_pll_28nm_init from dsi_phy_driver_probe+0x25c/0x3e4
[    2.525748]  dsi_phy_driver_probe from platform_probe+0x5c/0xb0
[    2.532084]  platform_probe from really_probe+0xe0/0x3f8
[    2.537725]  really_probe from __driver_probe_device+0x9c/0x1f4
[    2.543281]  __driver_probe_device from driver_probe_device+0x30/0xc0
[    2.548925]  driver_probe_device from __device_attach_driver+0xa8/0x120
[    2.555522]  __device_attach_driver from bus_for_each_drv+0x90/0xe4
[    2.561946]  bus_for_each_drv from __device_attach+0xa8/0x1d8
[    2.568194]  __device_attach from bus_probe_device+0x88/0x8c
[    2.574098]  bus_probe_device from device_add+0x624/0x830
[    2.579827]  device_add from of_platform_device_create_pdata+0x94/0xc0
[    2.585123]  of_platform_device_create_pdata from of_platform_bus_create+0x1e4/0x4c8
[    2.591548]  of_platform_bus_create from of_platform_populate+0x88/0x10c
[    2.599446]  of_platform_populate from mdss_probe+0x220/0x350
[    2.606129]  mdss_probe from platform_probe+0x5c/0xb0
[    2.611770]  platform_probe from really_probe+0xe0/0x3f8
[    2.616804]  really_probe from __driver_probe_device+0x9c/0x1f4
[    2.622188]  __driver_probe_device from driver_probe_device+0x30/0xc0
[    2.627830]  driver_probe_device from __device_attach_driver+0xa8/0x120
[    2.634428]  __device_attach_driver from bus_for_each_drv+0x90/0xe4
[    2.640851]  bus_for_each_drv from __device_attach+0xa8/0x1d8
[    2.647100]  __device_attach from bus_probe_device+0x88/0x8c
[    2.653003]  bus_probe_device from deferred_probe_work_func+0x8c/0xd4
[    2.658733]  deferred_probe_work_func from process_one_work+0x140/0x298
[    2.665071]  process_one_work from worker_thread+0x27c/0x4ac
[    2.671493]  worker_thread from kthread+0x110/0x12c
[    2.677396]  kthread from ret_from_fork+0x14/0x28
[    2.681995] Exception stack(0xf0c39fb0 to 0xf0c39ff8)
[    2.686859] 9fa0:                                     00000000 00000000 00000000 00000000
[    2.691900] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.700058] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    2.708220] Code: e8bd8070 e92d41f0 e590300c e5936008 (e5964000) 
[    2.714636] ---[ end trace 0000000000000000 ]---
[    2.720883] note: kworker/u11:1[82] exited with irqs disabled

https://pastebin.com/LAVzpGL2`

@z3ntu
Copy link
Member

z3ntu commented Apr 5, 2024

Copying some text from Matrix:

void __iomem *base = pll_28nm->phy->pll_base;

and error accured when any read called. example:

dsi_phy_read(base + REG_DSI_28nm_PHY_PLL_REFCLK_CFG)

dsi pll reg should be coming from here https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/qcom/qcom-msm8226.dtsi#L1005 plus whatever offsets the driver might have

Yeah so phy->pll_base = msm_ioremap_size(pdev, "dsi_pll", &phy->pll_size); so that should be 0xfd922a00 and since REG_DSI_28nm_PHY_PLL_REFCLK_CFG is 0x0 it's just that value

Can you run this in lk2nd?

$ fastboot oem readl 0xfd922a00

For me the output is

(bootloader) 0x00000001

But this also works on the Samsung:

For me also

(bootloader) 0x00000001

And for reference, with this patch I get the following print

[    1.160583] dsi_pll_28nm_clk_recalc_rate:253 DBG base=f0e72a00
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
index ceec7bb87bf1..9ed29cd224a0 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
@@ -250,6 +250,7 @@ static unsigned long dsi_pll_28nm_clk_recalc_rate(struct clk_hw *hw,
 	VERB("parent_rate=%lu", parent_rate);
 
 	/* Check to see if the ref clk doubler is enabled */
+	printk(KERN_ERR "%s:%d DBG base=%px\n", __func__, __LINE__, base);
 	doubler = dsi_phy_read(base + REG_DSI_28nm_PHY_PLL_REFCLK_CFG) &
 			DSI_28nm_PHY_PLL_REFCLK_CFG_DBLR;
 	ref_clk += (doubler * VCO_REF_CLK_RATE);

@Susurrus
Copy link

Were there any DTS changes necessary to get this working?

@z3ntu
Copy link
Member

z3ntu commented Apr 10, 2024

@NekoCWD Would have to share what they did, I don't have that diff/branch.

@NekoCWD
Copy link
Author

NekoCWD commented Apr 10, 2024

NekoCWD pushed a commit to NekoCWD/msm8xxx-linux that referenced this issue Dec 22, 2024
[ Upstream commit 63de35a ]

An issue was identified in the dcn21_link_encoder_create function where
an out-of-bounds access could occur when the hpd_source index was used
to reference the link_enc_hpd_regs array. This array has a fixed size
and the index was not being checked against the array's bounds before
accessing it.

This fix adds a conditional check to ensure that the hpd_source index is
within the valid range of the link_enc_hpd_regs array. If the index is
out of bounds, the function now returns NULL to prevent undefined
behavior.

References:

[   65.920507] ------------[ cut here ]------------
[   65.920510] UBSAN: array-index-out-of-bounds in drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn21/dcn21_resource.c:1312:29
[   65.920519] index 7 is out of range for type 'dcn10_link_enc_hpd_registers [5]'
[   65.920523] CPU: 3 PID: 1178 Comm: modprobe Tainted: G           OE      6.8.0-cleanershaderfeatureresetasdntipmi200nv2132 msm8226-mainline#13
[   65.920525] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS WMJ0429N_Weekly_20_04_2 04/29/2020
[   65.920527] Call Trace:
[   65.920529]  <TASK>
[   65.920532]  dump_stack_lvl+0x48/0x70
[   65.920541]  dump_stack+0x10/0x20
[   65.920543]  __ubsan_handle_out_of_bounds+0xa2/0xe0
[   65.920549]  dcn21_link_encoder_create+0xd9/0x140 [amdgpu]
[   65.921009]  link_create+0x6d3/0xed0 [amdgpu]
[   65.921355]  create_links+0x18a/0x4e0 [amdgpu]
[   65.921679]  dc_create+0x360/0x720 [amdgpu]
[   65.921999]  ? dmi_matches+0xa0/0x220
[   65.922004]  amdgpu_dm_init+0x2b6/0x2c90 [amdgpu]
[   65.922342]  ? console_unlock+0x77/0x120
[   65.922348]  ? dev_printk_emit+0x86/0xb0
[   65.922354]  dm_hw_init+0x15/0x40 [amdgpu]
[   65.922686]  amdgpu_device_init+0x26a8/0x33a0 [amdgpu]
[   65.922921]  amdgpu_driver_load_kms+0x1b/0xa0 [amdgpu]
[   65.923087]  amdgpu_pci_probe+0x1b7/0x630 [amdgpu]
[   65.923087]  local_pci_probe+0x4b/0xb0
[   65.923087]  pci_device_probe+0xc8/0x280
[   65.923087]  really_probe+0x187/0x300
[   65.923087]  __driver_probe_device+0x85/0x130
[   65.923087]  driver_probe_device+0x24/0x110
[   65.923087]  __driver_attach+0xac/0x1d0
[   65.923087]  ? __pfx___driver_attach+0x10/0x10
[   65.923087]  bus_for_each_dev+0x7d/0xd0
[   65.923087]  driver_attach+0x1e/0x30
[   65.923087]  bus_add_driver+0xf2/0x200
[   65.923087]  driver_register+0x64/0x130
[   65.923087]  ? __pfx_amdgpu_init+0x10/0x10 [amdgpu]
[   65.923087]  __pci_register_driver+0x61/0x70
[   65.923087]  amdgpu_init+0x7d/0xff0 [amdgpu]
[   65.923087]  do_one_initcall+0x49/0x310
[   65.923087]  ? kmalloc_trace+0x136/0x360
[   65.923087]  do_init_module+0x6a/0x270
[   65.923087]  load_module+0x1fce/0x23a0
[   65.923087]  init_module_from_file+0x9c/0xe0
[   65.923087]  ? init_module_from_file+0x9c/0xe0
[   65.923087]  idempotent_init_module+0x179/0x230
[   65.923087]  __x64_sys_finit_module+0x5d/0xa0
[   65.923087]  do_syscall_64+0x76/0x120
[   65.923087]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
[   65.923087] RIP: 0033:0x7f2d80f1e88d
[   65.923087] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 b5 0f 00 f7 d8 64 89 01 48
[   65.923087] RSP: 002b:00007ffc7bc1aa78 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   65.923087] RAX: ffffffffffffffda RBX: 0000564c9c1db130 RCX: 00007f2d80f1e88d
[   65.923087] RDX: 0000000000000000 RSI: 0000564c9c1e5480 RDI: 000000000000000f
[   65.923087] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000002
[   65.923087] R10: 000000000000000f R11: 0000000000000246 R12: 0000564c9c1e5480
[   65.923087] R13: 0000564c9c1db260 R14: 0000000000000000 R15: 0000564c9c1e54b0
[   65.923087]  </TASK>
[   65.923927] ---[ end trace ]---

Cc: Tom Chung <[email protected]>
Cc: Rodrigo Siqueira <[email protected]>
Cc: Roman Li <[email protected]>
Cc: Alex Hung <[email protected]>
Cc: Aurabindo Pillai <[email protected]>
Cc: Harry Wentland <[email protected]>
Cc: Hamza Mahfooz <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Roman Li <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants