mirror_ubuntu-kernels/drivers/gpu/drm/amd/display/dc
Sung Joon Kim 6d5276cdf9 drm/amd/display: Fix null pointer exception while load amdgpu
Recently we got a hard hang during the boot on DCN 3.0.1,
which caused the below null pointer exception:

[ +0.000426] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ +0.000003] #PF: supervisor read access in kernel mode
[ +0.000003] #PF: error_code(0x0000) - not-present page
[ +0.000003] PGD 0 P4D 0
[ +0.000004] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ +0.000005] CPU: 6 PID: 874 Comm: Xorg Not tainted 5.16.0.asdn-apr28+ #15
[ +0.000004] Hardware name: AMD Chachani-VN/Chachani-VN, BIOS WCH2303N 03/03/2022
[ +0.000003] RIP: 0010:resource_map_pool_resources+0x431/0xa70 [amdgpu]
[ +0.000356] Code: c1 4d 89 c8 49 c1 e0 07 4d 01 c8 49 c1 e0 04 4d 01 f0 49 83 b8 f0 01 00 00 00 0f 85 16 02 00 00 49 8b b8 e0 02 00 00 89 45 c0 <48> 8b 17 4c 8b 92 a0 01 00 00 4d 85 d2 74 24 4c 89 4d 88 48 8d 4d
[ +0.000003] RSP: 0018:ffffa92a4142f718 EFLAGS: 00010246
[ +0.000003] RAX: 0000000000000000 RBX: ffff9a0b86d93000 RCX: 0000000000000000
[ +0.000002] RDX: 0000000000000000 RSI: 000000000000554b RDI: 0000000000000000
[ +0.000002] RBP: ffffa92a4142f798 R08: ffff9a0bdb3c0000  0000000000000000
[ +0.000002] R10: 0000000000000000 R11: 000000000000f000 R12: 0000000000000000
[ +0.000001] R13: ffff9a0b88360000 R14: ffff9a0bdb3c0000 R15: ffff9a0b86273000
[ +0.000003] FS: 00007f4b5641ca40(0000) GS:ffff9a0cb7f80000(0000) knlGS:0000000000000000
[ +0.000002] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ +0.000002] CR2: 0000000000000000 CR3: 0000000102cb2000 CR4: 00000000003506e0
[ +0.000003] Call Trace:
[ +0.000002] <TASK>
[ +0.000004] ? kvmalloc_node+0x5c/0x90
[ +0.000009] dcn20_add_stream_to_ctx+0x1c/0x90 [amdgpu]
[ +0.000330] dcn30_add_stream_to_ctx+0xe/0x10 [amdgpu]
[ +0.000313] dc_add_stream_to_ctx+0x67/0x80 [amdgpu]
[ +0.000300] dm_update_crtc_state+0x4dd/0x6e0 [amdgpu]
[ +0.000320] amdgpu_dm_atomic_check+0x63b/0x1270 [amdgpu]
[ +0.000311] ? __drm_mode_object_add+0x90/0xc0 [drm]
[ +0.000043] ? preempt_count_add+0x74/0xc0
[ +0.000005] ? _raw_spin_lock_irqsave+0x2a/0x60
[ +0.000006] ? _raw_spin_unlock_irqrestore+0x29/0x3d
[ +0.000003] ? drm_connector_list_iter_next+0x8e/0xb0 [drm]
[ +0.000038] drm_atomic_check_only+0x5dd/0xa20 [drm]
[ +0.000044] drm_atomic_commit+0x18/0x60 [drm]
[ +0.000046] drm_client_modeset_commit_atomic+0x1e5/0x220 [drm]
[ +0.000051] drm_client_modeset_commit_locked+0x57/0x160 [drm]
[ +0.000038] __drm_fb_helper_restore_fbdev_mode_unlocked+0x60/0xd0 [drm_kms_helper]
[ +0.000027] drm_fb_helper_set_par+0x40/0x50 [drm_kms_helper]
[ +0.000022] fb_set_var+0x1c8/0x3d0
[ +0.000007] ? __ext4_mark_inode_dirty+0x83/0x210
[ +0.000006] ? __ext4_journal_stop+0x3c/0xb0
[ +0.000008] fbcon_blank+0x228/0x290
[ +0.000007] do_unblank_screen+0xae/0x150
[ +0.000005] vt_ioctl+0xcf4/0x1360
[ +0.000005] ? get_max_files+0x20/0x20
[ +0.000005] ? get_max_files+0x20/0x20
[ +0.000004] ? debug_smp_processor_id+0x17/0x20
[ +0.000004] tty_ioctl+0x373/0x8a0
[ +0.000005] ? __fput+0x123/0x260
[ +0.000004] ? __fget_light+0xc5/0x100
[ +0.000005] __x64_sys_ioctl+0x91/0xc0
[ +0.000005] do_syscall_64+0x3b/0xc0
[ +0.000005] entry_SYSCALL_64_after_hwframe+0x44/0xae

This issue happens because "pipe_ctx->stream_res.tg"
needs to be initialized first before reading its members.
This commit fixes this issue by properly initializing
the pointer before accessing the target data.

Fixes: 663d2daeae ("drm/amd/display: Add odm seamless boot support")
Cc: Agustin Gutierrez <agustin.gutierrez@amd.com>
Signed-off-by: Sung Joon Kim <Sungjoon.Kim@amd.com>
Reviewed-by: Agustin Gutierrez <agustin.gutierrez@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2022-05-04 09:59:04 -04:00
..
basics Revert "drm/amd/display: Unblank hubp based on plane visibility" 2021-02-18 16:43:10 -05:00
bios drm/amd/display: Add support for USBC connector 2022-03-31 23:05:53 -04:00
clk_mgr drm/amdgpu/display: Make dcn31_set_low_power_state static 2022-04-26 11:44:16 -04:00
core drm/amd/display: Fix null pointer exception while load amdgpu 2022-05-04 09:59:04 -04:00
dce drm/amd/display: fix non-kernel-doc comment warnings 2022-04-26 11:43:08 -04:00
dce60
dce80 drm/amd/display: Return last used DRR VTOTAL from DC 2021-06-08 12:20:12 -04:00
dce100
dce110 drm/amd/display: Move link_trace for edp to dp_trace 2022-04-05 10:29:48 -04:00
dce112 drm/amd/display: Use NULL instead of 0 2022-02-24 17:26:20 -05:00
dce120 drm/amd/display: Return last used DRR VTOTAL from DC 2021-06-08 12:20:12 -04:00
dcn10 drm/amd/display: Add Audio readback registers 2022-04-25 17:10:17 -04:00
dcn20 drm/amd/display: don't ignore alpha property on pre-multiplied mode 2022-04-07 16:34:32 -04:00
dcn21 drm/amd/display: Fix memory leak in dcn21_clock_source_create 2022-04-21 15:59:52 -04:00
dcn30 drm/amd/display: Add Audio readback registers 2022-04-25 17:10:17 -04:00
dcn31 drm/amd/display: protect remaining FPU-code calls on dcn3.1.x 2022-04-28 17:44:02 -04:00
dcn201 drm/amd/display: fix if == else warning 2022-04-26 11:51:20 -04:00
dcn301 drm/amd/display: Add pstate verification and recovery for DCN31 2022-03-15 14:33:57 -04:00
dcn302 drm/amd/display: Enable 3 plane for DCN 3.0 and 3.02 2022-04-05 10:29:48 -04:00
dcn303 drm/amd/display: move FPU associated DCN303 code to DML folder 2022-03-15 14:25:15 -04:00
dcn315 drm/amd/display: protect remaining FPU-code calls on dcn3.1.x 2022-04-28 17:44:02 -04:00
dcn316 drm/amd/display: protect remaining FPU-code calls on dcn3.1.x 2022-04-28 17:44:02 -04:00
dml drm/amd/display: update dcn315 clk table read 2022-04-25 17:06:16 -04:00
dsc drm/amd/display: Correct Slice reset calculation 2022-03-31 23:05:53 -04:00
gpio drm/amd/display: Add null pointer filter 2022-03-15 14:41:48 -04:00
hdcp drm/amd/display: Enforce DPCD Address ranges 2021-06-15 17:25:41 -04:00
inc drm/amd/display: update dcn315 clk table read 2022-04-25 17:06:16 -04:00
irq drm/amd/display: Turn functions into static 2022-02-24 17:26:25 -05:00
link drm/amd/display: extract update stream allocation to link_hwss 2022-04-13 09:14:22 -04:00
virtual drm/amd/display: add virtual_setup_stream_attribute decl to header 2022-04-19 13:58:32 -04:00
dc_bios_types.h drm/amd/display: Interface for LTTPR interop 2021-04-09 16:48:25 -04:00
dc_ddc_types.h drm/amd/display: Support for DMUB AUX 2021-03-02 14:05:41 -05:00
dc_dmub_srv.c drm/amd/display: Wait for ACK for INBOX0 HW Lock 2021-11-17 16:58:11 -05:00
dc_dmub_srv.h drm/amd/display: Wait for ACK for INBOX0 HW Lock 2021-11-17 16:58:11 -05:00
dc_dp_types.h drm/amd/display: add support for handling 128b/132b link training test request 2022-04-05 10:29:48 -04:00
dc_dsc.h drm/amd/display: move bpp range decision in decide dsc bw range function 2021-09-14 15:57:09 -04:00
dc_edid_parser.c
dc_edid_parser.h
dc_helper.c drm/amd/display: Support synchronized indirect reg access 2022-01-25 18:00:35 -05:00
dc_hw_types.h drm/amd/display: add dsc mst stream pbn log for debug 2022-02-16 17:12:00 -05:00
dc_link.h drm/amd/display: Move link_trace for edp to dp_trace 2022-04-05 10:29:48 -04:00
dc_stat.h drm/amd/display: DMUB Outbound Interrupt Process-X86 2021-07-08 15:14:36 -04:00
dc_stream.h drm/amd/display: Keep track of DSC packed PPS 2022-04-25 17:11:54 -04:00
dc_trace.h drm/amd/display: Add control mechanism for FPU utilization 2021-08-05 21:17:59 -04:00
dc_types.h drm/amd/display: Add new enum for EDID status 2022-03-15 14:41:34 -04:00
dc.h drm/amd/display: 3.2.183 2022-04-25 17:12:04 -04:00
dm_cp_psp.h drm/amd/display: unhard code link to phy idx mapping in dc link and clean up 2022-01-07 17:21:20 -05:00
dm_event_log.h
dm_helpers.h drm/amd/display: refine the EDID override 2022-03-04 13:03:29 -05:00
dm_pp_smu.h drm/amdgpu/pm: display vcn pp dpm (v4) 2021-05-21 10:31:55 -04:00
dm_services_types.h
dm_services.h
irq_types.h drm/amd/display: Remove underflow IRQ type 2022-04-05 10:29:47 -04:00
Makefile drm/amd/display: Add DCN315 blocks to Makefile 2022-02-18 14:07:01 -05:00
os_types.h drm/dp: Move public DisplayPort headers into dp/ 2022-01-17 11:25:44 +01:00