summaryrefslogtreecommitdiff
path: root/drivers/gpu
AgeCommit message (Collapse)Author
2026-09-24drm/imagination: Fix page count for page table for map() interfaceBrajesh Gupta
The GPU virtual start address wasn't included in the calculation for the amount of page tables required for mapping a BO object in map() interface. It resulted in map failure later due to not enough pages at L0/L1 level. Update pvr_mmu_op_context_create() interface to pass device address as well to allow correct calculation for page table memory. If L0 tables cover 2MB (0x200000), the range defined by device address 0x80001ff000 (general heap at 2MB - 4KB) and size 0x2000 (two 4KB pages) requires two L0 pages to be mapped, but without the base address a range of 0x2000 computes to a single L0 page which is not enough. Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code") Reviewed-by: Alexandru Dadu <alexandru.dadu@imgtec.com> Reviewed-by: Alessio Belle <alessio.belle@imgtec.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260922-mmu_fix-v4-2-12f1a871456a@imgtec.com Signed-off-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
2026-09-24drm/imagination: Propagate map failures correctly from pvr_mmu_map_sgl()Brajesh Gupta
Map failure from pvr_mmu_map_sgl() interface was not returned correctly to pvr_mmu_map() interface. This resulted in pvr_mmu_map() interface to continue instead of returning an error to caller. Fix it by returning a proper error code from pvr_mmu_map_sgl() interface. Call stack for crash: [ 1179.286237] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 [ 1179.295067] Mem abort info: [ 1179.297877] ESR = 0x0000000096000004 [ 1179.301656] EC = 0x25: DABT (current EL), IL = 32 bits [ 1179.306987] SET = 0, FnV = 0 [ 1179.310048] EA = 0, S1PTW = 0 [ 1179.313198] FSC = 0x04: level 0 translation fault [ 1179.318096] Data abort info: [ 1179.320993] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 [ 1179.326483] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 1179.331546] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 1179.336895] user pgtable: 4k pages, 48-bit VAs, pgdp=000000009822a000 [ 1179.343402] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000 [ 1179.350243] Internal error: Oops: 0000000096000004 [#2] SMP [ 1179.355908] Modules linked in: powervr gpu_sched drm_shmem_helper drm_gpuvm drm_exec xhci_plat_hcd xhci_hcd dwc3 usbcore usb_common snd_soc_simple_card snd_soc_simple_card_utils dwc3_am62 at24 sa2ul sha512 libsha512 sha256 authenc sch_fq_codel fuse dm_mod ipv6 [ 1179.378992] CPU: 1 UID: 1000 PID: 680 Comm: deqp-vk Tainted: G D 6.17.0 #1 PREEMPT [ 1179.388120] Tainted: [D]=DIE [ 1179.390994] Hardware name: Texas Instruments AM625 SK (DT) [ 1179.396467] pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 1179.403415] pc : pvr_mmu_op_context_unmap_curr_page+0x6c/0x134 [powervr] [ 1179.410140] lr : pvr_mmu_op_context_unmap_curr_page+0x58/0x134 [powervr] [ 1179.416848] sp : ffff8000839ab8c0 [ 1179.420153] x29: ffff8000839ab8c0 x28: 0000000000000001 x27: 000000008f386000 [ 1179.427283] x26: ffff000016d1df98 x25: 0000000000247000 x24: 00000000000001e6 [ 1179.434413] x23: 0000000000000002 x22: 000000000000ffff x21: 0000000000000247 [ 1179.441540] x20: 0000000000000245 x19: ffff000016d1df60 x18: 0000000000000002 [ 1179.448668] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000001 [ 1179.455793] x14: 0000000000060810 x13: ffff80007fffffff x12: ffff000004190480 [ 1179.462921] x11: ffff8000853f7000 x10: ffff8000811ae000 x9 : ffff0000041900b8 [ 1179.470051] x8 : 0000000000000000 x7 : 00000000990c4001 x6 : 0000000000000007 [ 1179.477177] x5 : ffff000016d1df60 x4 : 0000000000000000 x3 : ffff00000a7d8000 [ 1179.484306] x2 : 00000000000001ff x1 : 0000000000000000 x0 : 0000000000000000 [ 1179.491433] Call trace: [ 1179.493872] pvr_mmu_op_context_unmap_curr_page+0x6c/0x134 [powervr] (P) [ 1179.500582] pvr_mmu_map+0x31c/0x388 [powervr] [ 1179.505027] pvr_vm_gpuva_map+0x40/0x88 [powervr] [ 1179.509732] __drm_gpuvm_sm_map+0x250/0x44c [drm_gpuvm] [ 1179.514952] drm_gpuvm_sm_map+0x48/0x5c [drm_gpuvm] [ 1179.519822] pvr_vm_bind_op_exec+0x64/0x70 [powervr] [ 1179.524785] pvr_vm_map+0x1f8/0x2a8 [powervr] [ 1179.529142] pvr_ioctl_vm_map+0x12c/0x188 [powervr] [ 1179.534018] drm_ioctl_kernel+0xb8/0x128 [ 1179.537941] drm_ioctl+0x21c/0x4ec [ 1179.541337] __arm64_sys_ioctl+0xac/0x108 [ 1179.545344] invoke_syscall+0x44/0x100 [ 1179.549091] el0_svc_common.constprop.0+0x40/0xe0 [ 1179.553790] do_el0_svc+0x1c/0x28 [ 1179.557106] el0_svc+0x34/0xf0 [ 1179.560159] el0t_64_sync_handler+0xd0/0xe4 [ 1179.564334] el0t_64_sync+0x198/0x19c [ 1179.567996] Code: 54000300 35000360 f9402261 79409a62 (f9400421) [ 1179.574081] ---[ end trace 0000000000000000 ]--- Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code") Reviewed-by: Alexandru Dadu <alexandru.dadu@imgtec.com> Reviewed-by: Alessio Belle <alessio.belle@imgtec.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260922-mmu_fix-v4-1-12f1a871456a@imgtec.com Signed-off-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
2026-09-24drm/imagination: Don't map FW interface structures unnecessarilyAlessio Belle
Connection control, OS init and HWR info buffer structures are currently not accessed by the driver during or after firmware initialisation. OS init is accessed during hard reset, but the common hard reset logic already takes care of temporarily mapping it again. Signed-off-by: Alexandru Dadu <alexandru.dadu@imgtec.com> Reviewed-by: Brajesh Gupta <brajesh.gupta@imgtec.com> Link: https://patch.msgid.link/20260915-b4-do-not-map-if-structs-unnecessarily-v1-2-a0e2ccee154a@imgtec.com Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
2026-09-24drm/imagination: Treat FW connection ctl like other interface structuresAlessio Belle
There is no particular reason for this structure to be allocated and freed on its own. Move the related logic to where there other firmware interface structures are allocated and freed. Signed-off-by: Alexandru Dadu <alexandru.dadu@imgtec.com> Reviewed-by: Brajesh Gupta <brajesh.gupta@imgtec.com> Link: https://patch.msgid.link/20260915-b4-do-not-map-if-structs-unnecessarily-v1-1-a0e2ccee154a@imgtec.com Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
2026-09-24drm/i915/psr: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-9-suraj.kandpal@intel.com
2026-09-24drm/i915/dptest: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Store the EDID checksum write result in ret as well, so that it can be logged the same way. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-8-suraj.kandpal@intel.com
2026-09-24drm/i915/linktraining: log link training DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-7-suraj.kandpal@intel.com
2026-09-24drm/i915/dp: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-6-suraj.kandpal@intel.com
2026-09-24drm/i915/backlight: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Store the brightness control write result in ret as well, so that it can be logged the same way. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-5-suraj.kandpal@intel.com
2026-09-24drm/i915/ddi: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Store the FEC_STATUS write result in ret as well, so that it can be logged the same way. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-4-suraj.kandpal@intel.com
2026-09-24drm/i915/alpm: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260921053710.1586776-3-suraj.kandpal@intel.com
2026-09-24drm/i915/lspcon: log DPCD access errorsSuraj Kandpal
Now that the DPCD accessors return a proper error code, include it in the error messages using %pe and ERR_PTR(), instead of just stating that the access failed. While at it, fix the AVI IF control write error message, which incorrectly reported a failed read. Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Nemesa Garg <nemesa.garg@intel.com> Link: https://patch.msgid.link/20260922121316.1768918-1-suraj.kandpal@intel.com
2026-09-23drm/amd/display: Bump frame warning limit for all builds of dmlAlex Deucher
Some configs with gcc are also now affected. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/xe/sysctrl: Allow per-command mailbox response timeoutAnoop Vijay
xe_sysctrl_send_command() currently uses a fixed mailbox response timeout of %XE_SYSCTRL_MB_DEFAULT_TIMEOUT_MS for all commands. Add a timeout_ms field to struct xe_sysctrl_mailbox_command to allow callers to override the default timeout when needed. A value of 0 preserves the existing default behavior. Signed-off-by: Anoop Vijay <anoop.c.vijay@intel.com> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Link: https://patch.msgid.link/20260922111416.94416-2-anoop.c.vijay@intel.com
2026-09-23drm/amd/display: Bump frame warning limit for clang builds of dmlIvan Lipski
[Why&How] When building the DML files with clang without any sanitizer or LTO, the following -Wframe-larger-than errors break the build under CONFIG_WERROR: display_mode_vba_30.c: error: stack frame size (2512) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' display_mode_vba_31.c: error: stack frame size (2416) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' display_mode_vba_314.c: error: stack frame size (2392) exceeds limit (2048) in 'dml314_ModeSupportAndSystemConfigurationFull' Clang consistently spills more than gcc, pushing the frame past the 2048 byte limit. Apply an existing approach of increasing the warn stack size to the non-sanitizer path so plain clang builds use a 3072 byte limit. Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5642 Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 21711b6e66bb7b41b1aec67b2d99aafe768c8fcb) Cc: stable@vger.kernel.org
2026-09-23drm/amd/display: Relax DML frame limit with UBSANAlex Hung
[WHY] UBSAN instrumentation adds checks and handler calls and increases stack usage in the large DML calculation functions, similar to KASAN and KCSAN. With UBSAN enabled these files exceed the default -Wframe-larger-than limit and fail to build when -Werror is in effect. Reproduced with LLVM (make LLVM=1, clang 19.1.1), CONFIG_UBSAN=y, CONFIG_GCOV_PROFILE_ALL=y and CONFIG_DRM_AMDGPU_WERROR=y on x86_64. [HOW] Include CONFIG_UBSAN in the sanitizer check that selects the higher per-file frame warning limit in the dml and dml2_0 Makefiles. Suggested-by: Leo Li <sunpeng.li@amd.com> Assisted-by: Copilot:Claude-Opus-5.5 Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ebf8b0fd8508b744f85a8eee82b745b1d3502dd0) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu: Fix runtime PM leak in amdgpu_debugfs_test_ib_show()Wentao Liang
amdgpu_debugfs_test_ib_show() resumes the device with pm_runtime_get_sync() before taking the reset domain semaphore with down_write_killable(). If the write lock acquisition is interrupted, the function returns without calling pm_runtime_put_autosuspend(), leaking the runtime PM reference acquired for the device and keeping the GPU awake. Drop the runtime PM reference on the interrupted down_write_killable() error path before returning. Fixes: 6049db43d6dd ("drm/amdgpu: change reset lock from mutex to rw_semaphore") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ec30a576c2d4c0364549e6c04218f50704ef56c8) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init()Wentao Liang
amdgpu_vm_init() initializes vm->last_update, vm->last_unlocked and vm->last_tlb_flush with references to the stub fence taken via dma_fence_get_stub(). The error label at the end of the function releases the last_unlocked and last_tlb_flush references with dma_fence_put(), but the reference stored in vm->last_update is never dropped, so whenever the page table root creation, the reservation of the root BO or the PASID registration fails, the stub fence reference leaks. Drop the vm->last_update reference together with the other stub fence references on the error path. Fixes: 187916e6ed9d ("drm/amdgpu: install stub fence into potential unused fence pointers") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit e7979c84fc05a176bdf855ee664871b1648404c9) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu: Fix acpi device leak in amdgpu_acpi_enumerate_xcc()Wentao Liang
amdgpu_acpi_enumerate_xcc() looks up each XCC ACPI device with acpi_dev_get_first_match_dev(), which takes a reference to the device. The reference is dropped with acpi_dev_put() after the XCC info is initialized, but if the kzalloc_obj() allocation of the XCC info fails the function returns -ENOMEM without releasing the reference, leaking the last reference to the ACPI device. Drop the ACPI device reference on the allocation failure path before returning. Fixes: 4d5275ab0b18 ("drm/amdgpu: Add parsing of acpi xcc objects") Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 9211ef48b31ec66999cf55e04d0cbc60cd855fd5) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu: Fix vmid_wait fence leak in amdgpu_ring_init()Wentao Liang
amdgpu_ring_init() initializes ring->vmid_wait with a reference to the stub fence taken via dma_fence_get_stub(). When a later step of the initialization fails, e.g. amdgpu_fence_driver_init_ring(), a writeback slot allocation or the ring buffer allocation, the function returns an error without releasing the stub fence reference and the reference is leaked if the ring is torn down without amdgpu_ring_fini(). Move the stub fence assignment to the end of the initialization, right before the ring is registered with the GPU scheduler, where no further failure is possible. The stub fence is only consumed by command submission handling in amdgpu_ids.c once the ring is up and running, so nothing reads it during the error-prone part of the initialization. Fixes: 48e9fbd1a284 ("drm/amdgpu: initialize the vmid_wait with the stub fence") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit f2b96986851203e9c50ca0d13aaa3581ca3e8ebd) Cc: stable@vger.kernel.org
2026-09-23drm/amdkfd: fix use-after-free and multi-container gap in kfd_dev_mappingAsad Kamal
kfd_dev_mapping caches the address_space of the first /dev/kfd opener so that the GPU reset path can call unmap_mapping_range() to zap all userspace mappings of doorbell and MMIO ranges. This design has two bugs that both manifest under SRIOV with multiple containers: 1. Use-after-free / rwsem deadlock. The cached pointer refers to an inode owned by the first opener's container. When that container exits and its inode is released, kfd_dev_mapping becomes a dangling pointer. A subsequent GPU reset dereferences it inside unmap_mapping_range(), which takes i_mmap_rwsem on the freed inode, causing a hard hang observable as an uninterruptible rwsem wait. 2. Multi-container gap. Only the first opener's address_space is cached; VMAs created by later openers live in a different address_space and are never reached by unmap_mapping_range(). After a GPU reset those stale mappings keep doorbell and MMIO pages accessible to guest userspace with no GPU behind them, risking PCIe transaction timeouts and NMI panics. Fix both bugs with the same approach used by DRM core (drm_drv.c): create a private pseudo-filesystem at module init time and allocate one anonymous inode from it. In kfd_open() redirect every opener's file->f_mapping to that inode's address_space. The inode is module-owned, lives exactly as long as the amdgpu module, and collects VMAs from all openers in one address_space. A single unmap_mapping_range() call in the reset path then correctly reaches every container's mappings with no dangling pointer risk. The hang manifests as an NMI backtrace on the GPU reset workqueue stuck spinning in rwsem_down_read_slowpath() with a corrupted i_mmap_rwsem: Workqueue: amdgpu-reset-dev xgpu_ai_mailbox_flr_work [amdgpu] Call Trace: <TASK> kvm_wait+0x1f/0x40 __pv_queued_spin_lock_slowpath+0x31d/0x3a0 _raw_spin_lock_irq+0x51/0x80 rwsem_down_read_slowpath+0xb3/0x550 down_read+0x48/0xd0 unmap_mapping_range+0x71/0x140 kfd_dev_unmap_mapping_range+0x5b/0x140 [amdgpu] amdgpu_amdkfd_clear_kfd_mapping+0xd8/0x190 [amdgpu] amdgpu_device_gpu_recover+0x232/0x450 [amdgpu] xgpu_ai_mailbox_flr_work+0xb5/0xc0 [amdgpu] process_one_work+0x18e/0x3e0 worker_thread+0x2e3/0x420 kthread+0x10a/0x230 Fixes: 70cadefcc616 ("drm/amdgpu: unmap all user mappings of framebuffer and doorbell before mode1 reset") Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 1128b4a52de1572e87431de837fd9850cb99542c) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu/vcn4.0.3: fix video_timeout unit mismatch in jpeg reset waitSunil Khatri
vcn_v4_0_3_reset_jpeg_pre_helper() passes adev->video_timeout directly to amdgpu_fence_wait_polling(), whose timeout parameter is documented and implemented in usecs (busy-wait loop decrementing by udelay(2)). adev->video_timeout is set in jiffies by amdgpu_device_get_job_timeout_settings(), via msecs_to_jiffies(). Passing it unconverted means the intended ~2s wait for outstanding JPEG fences to complete before the JPEG queue is torn down actually lasts only a couple of microseconds (HZ jiffies interpreted as usecs), so pending jobs are almost never given a real chance to finish before the reset path forces completion in the following helper. Convert the jiffies value to usecs with jiffies_to_usecs() before passing it to amdgpu_fence_wait_polling(). Fixes: d25c67fd9d6f ("drm/amdgpu/vcn4.0.3: rework reset handling") Cc: Jesse.Zhang <Jesse.Zhang@amd.com> Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 5feabbd673c10ebee22b880e4d812f08974d2ef7) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu/vcn5.0.1: fix video_timeout unit mismatch in jpeg reset waitSunil Khatri
vcn_v5_0_1_reset_jpeg_pre_helper() passes adev->video_timeout directly to amdgpu_fence_wait_polling(), whose timeout parameter is documented and implemented in usecs (busy-wait loop decrementing by udelay(2)). adev->video_timeout is set in jiffies by amdgpu_device_get_job_timeout_settings(), via msecs_to_jiffies(). Passing it unconverted means the intended ~2s wait for outstanding JPEG fences to complete before the JPEG queue is torn down actually lasts only a couple of microseconds (HZ jiffies interpreted as usecs), so pending jobs are almost never given a real chance to finish before the reset path forces completion in the following helper. Convert the jiffies value to usecs with jiffies_to_usecs() before passing it to amdgpu_fence_wait_polling(). Fixes: fab47d2db5ca ("drm/amdgpu/vcn5.0.1: rework reset handling") Cc: Jesse.Zhang <Jesse.Zhang@amd.com> Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit b8334fec8b90ebffcaa01001a23edca9f29a05e9) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu/userq: fix double jiffies conversion in hang detect timeoutSunil Khatri
Function amdgpu_userq_start_hang_detect_work() calls msecs_to_jiffies() on adev->gfx_timeout/compute_timeout/sdma_timeout before arming hang_detect_work. These timeout values already hold jiffies values from amdgpu_device_get_job_timeout_settings() at device init. This silently shrinks the real hang-detect deadline to (2 * HZ) ms instead of the intended timeout. e.g. 500ms instead of the 2000ms default on a CONFIG_HZ=250 kernel, only coincidentally correct at HZ=1000. The shortened window is easily exceeded by ordinary fence-completion latency, causing hang_detect_work to fire and trigger a per-queue or full GPU reset for queues that are not actually hung. Pass the jiffies value directly to queue_delayed_work() instead of converting it a second time. Fixes: fc3336be9c62 ("drm/amd/amdgpu: Add independent hang detect work for user queue fence") Signed-off-by: Sunil Khatri <sunil.khatri@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 13d44ca033cb74756c2aef0ade54a75cdf2f6271) Cc: stable@vger.kernel.org
2026-09-23drm/amdgpu: move userq fence wait out of signalling sectionPrike Liang
The eviction fence suspend worker waits for every pending userq fence from inside a dma_fence_begin_signalling() critical section. Waiting on another DMA fence while responsible for signalling one violates the cross-driver fence contract and is reported by lockdep as a dma_fence_map dependency. Move the wait before dma_fence_begin_signalling(). Keep userq_mutex held so queue lifetime remains stable while inspecting last_fence. Fixes: fc61df151617 ("drm/amdgpu: annotate eviction fence signaling path") Signed-off-by: Prike Liang <Prike.Liang@amd.com> Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 3bd4fbc5ed89621340b5cd249869092691a9c81f) Cc: stable@vger.kernel.org
2026-09-23drm/amd/display: Fix dc stream excess put in dm_update_crtc_state()Wentao Liang
In dm_update_crtc_state(), when a modeset is required the newly created stream is stored in dm_new_crtc_state->stream and an extra reference is taken with dc_stream_retain(). The reference returned by create_validate_stream_for_sink() is released as an extra reference at the skip_modeset label, leaving the stream owned by the new CRTC state. If amdgpu_dm_check_crtc_color_mgmt() fails afterwards, the code jumps to the fail label which releases new_stream again. Since the extra reference was already released at skip_modeset, this drops the reference owned by dm_new_crtc_state->stream and the stream is released while the atomic state still points to it, leading to a premature free of the dc stream. Set new_stream to NULL after releasing the extra reference at the skip_modeset label so that a later goto fail cannot release the reference owned by the new CRTC state. Fixes: 7cd4b70091a5 ("drm/amd/display: Rework CRTC color management") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 102a47065a62dc8f6bbbb47cf082a2934282eb08) Cc: stable@vger.kernel.org
2026-09-23drm/amd/display: Bump frame warning limit for clang builds of dmlIvan Lipski
[Why&How] When building the DML files with clang without any sanitizer or LTO, the following -Wframe-larger-than errors break the build under CONFIG_WERROR: display_mode_vba_30.c: error: stack frame size (2512) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' display_mode_vba_31.c: error: stack frame size (2416) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' display_mode_vba_314.c: error: stack frame size (2392) exceeds limit (2048) in 'dml314_ModeSupportAndSystemConfigurationFull' Clang consistently spills more than gcc, pushing the frame past the 2048 byte limit. Apply an existing approach of increasing the warn stack size to the non-sanitizer path so plain clang builds use a 3072 byte limit. Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5642 Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Relax DML frame limit with UBSANAlex Hung
[WHY] UBSAN instrumentation adds checks and handler calls and increases stack usage in the large DML calculation functions, similar to KASAN and KCSAN. With UBSAN enabled these files exceed the default -Wframe-larger-than limit and fail to build when -Werror is in effect. Reproduced with LLVM (make LLVM=1, clang 19.1.1), CONFIG_UBSAN=y, CONFIG_GCOV_PROFILE_ALL=y and CONFIG_DRM_AMDGPU_WERROR=y on x86_64. [HOW] Include CONFIG_UBSAN in the sanitizer check that selects the higher per-file frame warning limit in the dml and dml2_0 Makefiles. Suggested-by: Leo Li <sunpeng.li@amd.com> Assisted-by: Copilot:Claude-Opus-5.5 Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix compound literal stackframe limitDominik Kaszewski
[Why] Use of compound literals to initialize heap objects may create stack temporaries when compiling in debug mode. For large objects such as dc_memory_pool which is 2 pages large to avoid cacheline sharing, this causes function stackframe to exceed kernel limit. [How] Replace compound literal with field-by-field initialization. Reported-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/all/aq0vYhZXtMqA41wZ@sirena.org.uk/ Signed-off-by: Dominik Kaszewski <dominik.kaszewski@amd.com> Signed-off-by: Leo Li <sunpeng.li@amd.com> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Reviewed-by: Aric Cyr <aric.cyr@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amdkfd: Preserve v1 in gfx12.1 trap workaroundJay Cornwall
If MODE.DST_VGPR_MSB != MODE.SRC0_VGPR_MSB upon trap entry then v1 would be trashed. Adjust workaround to prefetch random address 0xFFFFFFFFxxxxxxxx. This address space is unavailable to userspace on gfx12.1, ensuring no functional side-effects of prefetch. Also remove unused WAVE_START exception handler. Fixes: 0e1e0f87af55 ("drm/amdkfd: gfx12.1 add no-op prefetch on trap entry") Signed-off-by: Jay Cornwall <jay.cornwall@amd.com> Reviewed-by: Lancelot Six <lancelot.six@amd.com> Cc: Joseph Greathouse <joseph.greathouse@amd.com> Cc: Vladimir Indic <vladimir.indic@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amdgpu: nuke most amdgpu_vm_eviction_(try)lock usesChristian König
Use scoped_guard/scoped_cond_guard instead. Saving and restoring the GFP flags is not necessary in those use case. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Natalie Vock <nat@pixelcluster.dev> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/pm: Add NPM status sensorLijo Lazar
The logic for checking whether NPM is enabled/disabled stays within the particular IP version. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/pm: Create NPM sysfs files from capabilityLijo Lazar
Advertise each NPM board attribute from a per-field R/W bitmap instead of probing a single sensor. SMU 13.0.6/13.0.12 reports the cap only when NPM metrics and MaxNodePowerLimit are present. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Assisted-by: Cursor Grok 4.6 Reviewed-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix null deref of link_enc in dce110_enable_tmds_link_outputSrinivasan Shanmugam
Smatch reports that link->link_enc is unconditionally dereferenced at the top of dce110_enable_tmds_link_output() while the later setup_ri_pj_check_in_sw_or_hw_mode calls guard against it being NULL, making those checks contradictory. Add an early return when link_enc is NULL and drop the redundant NULL checks from the two call sites that follow, since link_enc is guaranteed non-NULL past the guard Fixes: 992694ad2858 ("drm/amd/display: Enable DCN6 sources compilation") Reported-by: Dan Carpenter <error27@gmail.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Roman Li <Roman.Li@amd.com> Cc: Ivan Lipski <ivan.lipski@amd.com> Cc: Dan Wheeler <daniel.wheeler@amd.com> Cc: Alex Hung <alex.hung@amd.com> Cc: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Reviewed-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Promote DC to 3.2.399Taimur Hassan
This DC patchset brings improvements in multiple areas. In summary, we have: - Increased KUnit coverage - Reverts a patch causing regression on DCN42 - Fixes for cursor - Imporvements for ABM Reviewed-by: George Zhang <george.zhang@amd.com> Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: [FW Promotion] Release 0.1.76.0Taimur Hassan
Updated DMUB interface - Add OEM visual debug flags - Updated HW lock pending error - Add new DMUB_CMD__NBIF_AZ_PME_RESTORE command Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix LSDMA divide by zeroAlex Hung
[WHY] element_size_to_bytes_per_pixel() handled only element sizes 0 to 4 and returned 0 for every other value, and an unexpected element size caused a divide by zero. [HOW] Derive the size as 1 << element_size, which matches the existing encoding, and fall back to 1 for values of 8 or more to keep the result nonzero. Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Revert "request DMUB HW cursor offload"Tony Qi
This reverts commit 555641725f21 ("drm/amd/display: Request DMUB HW cursor offload"). [WHY] This commit causes the following failures on DCN42: igt@kms_plane_cursor@viewport igt@kms_plane_cursor@overlay Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Tony Qi <Haoming.Qi@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Resync cursor cache after offload abort on DCN60Ivan Lipski
[Why&How] The cursor programming path caches the last-written cursor state in SW and, for the enable bit, skips the register write when the cache already matches the request. Under cursor offload the SW cache is updated even though the actual register write is deferred to firmware. When an offloaded cursor update is aborted (e.g. an overlay geometry change reprograms the cursor directly in the same frame), the queued firmware write is dropped but the cache is left stale, so the following direct programming pass skips the enable write and the cursor disappears over the overlay plane. Add a refresh_cursor_state() hubp/dpp hook that reads the cursor position and attribute registers back from hardware into the SW cache, and call it from dcn35_abort_cursor_offload_update() so the cache is truthful after an abort. This keeps the enable-change optimization intact for all ASICs and is race-robust regardless of whether firmware applied the queued write before the abort. Only dcn60 (the sole offload user) wires up the hook. Assisted-by: Copilot:Claude-Opus-4.8 Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Remove DCN6 DCFCLK num assertIvan Lipski
[Why&How] There can be more than 2 DCFCLK values for DCN6, so the assert is not applicable. Remove it. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Rename build_cursor_position to ↵Piotr Maziarz
dcn10_build_cursor_pos_update_params This commit contains renames, adding const to pipe_ctx in build_cursor_pos_update_params and also removing unnecessary checks before dc_dmub_srv_is_cursor_offload_enabled(). [Why] It improves code clarity. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Piotr Maziarz <piotr.maziarz@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: clamp cursor hotspot at the register writePiotr Maziarz
[Why] dcn401_build_cursor_position() clamped x_hotspot to 0xFF before publishing *pos_out, but that field is also stored into hubp->curs_pos and forwarded to dpp1_set_cursor_position(), which derives src_x_offset from it. The ODM/MPC slice adjustments earlier in the same function deliberately grow x_hotspot past 255 to keep the cursor visible across a slice boundary, so the clamp corrupted DPP source addressing in exactly the case it was meant to handle. [How] Clamp in hubp401_cursor_set_position() instead, where the 8-bit CURSOR_HOT_SPOT_X field lives. A local is used for the register write only; pos->x_hotspot passes through unmodified. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Piotr Maziarz <piotr.maziarz@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: fix cursor refactor fallout and sync UT headersPiotr Maziarz
[Why] UT mirror headers still declared the old prototypes and hwss_gtest still called the callback directly. Separately, the divide by param.pixel_clk_khz used to sit after hubp401_cursor_set_position()'s "curs_attr.address == 0" early return; hoisting the math into the builder moved it ahead of that guard, so it now traps on streams with no timing programmed. [How] Guard the dst_x_offset block with "if (param.pixel_clk_khz)" Route the test through hwss_program_cursor_position(). Update dc_hwss_ut.h / dc_hwseq_ut.h and the BLS docs to the new signatures. Move the pos/param declarations to the top of the loop body. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Piotr Maziarz <piotr.maziarz@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: refactor hwss SET_CURSOR_POSITION block sequenceRafal Ostrowski
Flatten the executor params for the initial set of HWSS block sequence ops for SET_CURSOR_POSITION to separate SW and HW logic Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Rafal Ostrowski <rafal.ostrowski@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Drop pipe_ctx from hwss block sequence operationsRafal Ostrowski
[Why] pipe_ctx is not allowed to reach a block sequence step. Several operations still carried it into the executor, which then walked the logical state at execute time (pipe_ctx->stream->timing, pipe_ctx->plane_state and similar) instead of acting on data resolved during build. [How] Give each operation a flat parameter list holding only the hardware objects and values the final hwss call needs, and change the matching hooks to take it. The function pointer, the params struct, the executor, the builder helpers and all call sites are updated together. Operations covered: - OPTC_PROGRAM_MANUAL_TRIGGER - takes tg - HUBP_PROGRAM_TRIPLEBUFFER - program_triplebuffer takes (hubp, bool) - DPP_SETUP_DPP, DPP_PROGRAM_BIAS_AND_SCALE - take (dpp, plane_state) - DSC_ENABLE_WITH_OPP - takes (dsc, opp_inst) - OPP_PROGRAM_BIT_DEPTH_REDUCTION - opp Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Rafal Ostrowski <rafal.ostrowski@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix KUnit checkpatch warningsAlex Hung
[WHY] Clean up the AMDGPU DM KUnit tests after checkpatch reported an invalid sizeof(void) allocation, typed kzalloc patterns, and a repeated word in a kernel-doc summary. Clarify the test name that covers an active CRTC state transition. [HOW] - Use sizeof(cpu_ptr) for the fake CPU pointer allocation. - Replace typed kzalloc(sizeof(*object), ...) calls with kzalloc_obj(*object, ...) in the connector, IRQ, plane, and atomic-state tests. - Rename the CRTC active-state test and update its kernel-doc and suite registration. Assisted-by: Copilot:GPT-5.6-Luna Reviewed-by: Jerry Zuo <jerry.zuo@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Restore FreeSync VCP code check for HDMI/PCON sinksFangzhi Zuo
[WHAT] Folding the MCCS FreeSync checks into the do_mccs block dropped the other half of the original condition: the check that clears freesync_capable for HDMI or PCON-in-whitelist sinks that expose no EDID FreeSync VCP code. That check does not depend on the MCCS caps and must run regardless of do_mccs. As a result, when do_mccs is false such a sink without a FreeSync VCP code is still reported as FreeSync-capable. [HOW] Restore the VCP code check outside the do_mccs block so it is evaluated whether or not MCCS caps were read. Fixes: 115bf5ca318e ("drm/amd/display: Consult MCCS FreeSync cap only if requested & supported") Reviewed-by: Roman Li <roman.li@amd.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix KUnit writeback warningsAlex Hung
[WHY] Writeback mode tests call drm_mode_probed_add without holding mode_config.mutex, producing a warning for every generated mode. [HOW] Hold the mutex around writeback mode enumeration and release it before checking the returned count or inspecting the generated modes. Assisted-by: Copilot:GPT-6-Astra Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix KUnit DM warningsAlex Hung
[WHY] Vblank and interrupt-management tests need discoverable CRTCs with complete vblank callbacks and balanced teardown. [HOW] Add the callbacks, link the fake CRTCs, and register cleanup actions to disable vblank before unlinking. Pass the CRTC directly so cleanup does not reinterpret two different fixture types through one layout. Assisted-by: Copilot:GPT-6-Astra Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-09-23drm/amd/display: Fix KUnit MST warningsAlex Hung
[WHY] The MST add-connector fixture registers an unmanaged master connector but does not clean it up before its KUnit-owned storage is released. [HOW] Register a KUnit action after successful connector initialization to run drm_connector_cleanup before freeing the master connector. Assisted-by: Copilot:GPT-6-Astra Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: George Zhang <george.zhang@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>