summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
AgeCommit message (Collapse)Author
7 daysMerge tag 'drm-misc-fixes-2026-11-20' of ↵Dave Airlie
https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes Short summary of fixes pull: core: - syncobj: Limit allocations - vblank: Resolve deadlock in timer imagination: - Use correct function for polling non-iomem ivpu: - Fix race condition in recovery nouveau: - Fix instmem io_mapping faults and slowdowns omap: - dss: Fix handling deferrals qaic: - Harden ioctl checks rocket: - Many fixes throughout driver tilcdc: - Fix drvdata in suspend/resume vc4: - Many fixes throughout driver vmwgfx: - Many fixes throughout driver Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20261120080903.GA18643@linux.fritz.box
8 daysMerge tag 'drm-xe-fixes-2026-11-19-1' of ↵Dave Airlie
https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes Driver Changes: - hwmon error handling fixes (Dnyaneshwar, Karthik) - Treat CT-disabled TLB invalidation as cancelled (Zongyao) - Validate BOs on export to charge the exporter (Thomas) - Always free requested IRQs on uninstall (Arvind) - Reset TLB invalidation state in submit fini (Piotr) - Use ordered clock reads for engine cycles cpu_delta (Sanjay) - Treat non-fatal PCIe errors as recovered (Riana) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/av91wsZ6Zg9vfrNn@gsse-cloud1.jf.intel.com
8 daysMerge tag 'amd-drm-fixes-7.4-2026-11-19' of ↵Dave Airlie
https://gitlab.freedesktop.org/drm/amdgpu/kernel into drm-fixes amd-drm-fixes-7.4-2026-11-19: amdgpu: - GPUVM fixes - SMU 8 fix - PCO quirk - ATPX lifetime fix - Unwinding fix for module loading failure - UserQ fix - HDMI fixes - DML2 fix - DC DRAM config fixes - DCN 4.2 fixes - DC pre-OS clock handling fixes - DPMS fix - Cleaner shader fixes for multi-XCC parts - Vblank fix for GPU resets - Properly handle firmware with different trust athorities - Freesync/VRR fixes - Backlight fix - Display warning fixes - PSR fixes amdkfd: - SVM fixes radeon: - Bounds checks in vbios parsing - ATPX lifetime fix Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patch.msgid.link/20261119193843.217794-1-alexander.deucher@amd.com
8 daysdrm/vc4: Clear the slice caches before resetting a stalled GPUMaíra Canal
Starting shader code at varying offsets makes the GFXH-16 icache livelock unlikely, but not impossible. When the livelock happens, the QPUs make no progress and the hangcheck resets the GPU, losing the job. When the hangcheck finds no progress, clear the slice instruction and uniforms caches and check again before resetting. If the stall is a livelock, clearing the caches can break it and let the job continue. Drop round_jiffies_up() from the hangcheck timer, so checks run every 100 ms instead of at the next whole second. This shortens the screen freeze before the caches are cleared. Long jobs are unaffected: while the control lists advance, the hangcheck won't clear the caches or reset the GPU. Cc: stable@vger.kernel.org Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652 Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-4-5b8adc2c84fe@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
8 daysdrm/vc4: Start shader code at varying offsets in its BOMaíra Canal
VC4 is affected by the HW erratum GFXH-16: the QPUs can get stuck in a loop where instruction cache loads are evicted before they are used. The QPUs of a slice share one instruction cache. Shader BOs are page aligned and the code always starts at offset 0, so instructions at the same position in different shaders end up mapping to the same cache sets. When the four QPUs of a slice run four different shaders, their fills evict each other, no instruction executes and the hangcheck resets the GPU. Place each shader's code at one of four offsets, 256 bytes apart, inside its BO, and add the offset when relocating the shader record. Shader code is position independent, as the validator only accepts relative branches. The offsets are tracked per client, so shaders a given client creates in sequence (which tend to run together) start in different sets. Notice that this approach makes the livelock unlikely, but not impossible. The next commit will address the remaining cases. On a Raspberry Pi 3 running the issue's reproducer, GPU resets went from dozens in an hour to none. Cc: stable@vger.kernel.org Fixes: 463873d57014 ("drm/vc4: Add an API for creating GPU shaders in GEM BOs.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652 Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-3-5b8adc2c84fe@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
8 daysdrm/vc4: Check for a validated shader before reading its thread modeMaíra Canal
validate_gl_shader_rec() reads the thread mode from the validated_shader of the FS, VS and CS BOs before checking it for NULL. A shader record pointing at a BO not created by DRM_IOCTL_VC4_CREATE_SHADER_BO has no validated_shader, so userspace can trigger a NULL pointer dereference. Check that every shader BO has a validated shader before using it. Cc: stable@vger.kernel.org Fixes: c778cc5df944 ("drm/vc4: Add fragment shader threading support") Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-2-5b8adc2c84fe@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
8 daysdrm/vc4: Fix off-by-one in the shader record BO handle checkMaíra Canal
validate_gl_shader_rec() accepts a shader BO handle equal to exec->bo_count, reading one entry past the end of exec->bo[] and using it as a GEM object. Reject handles that aren't below exec->bo_count. Cc: stable@vger.kernel.org Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.") Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-1-5b8adc2c84fe@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
9 daysdrm/xe/hwmon: Propagate all hardware read errorsKarthik Poosa
Propagate all failures from pcode and mailbox accesses and fix missed return-value checks found by Sashiko in https://patchwork.freedesktop.org/patch/758843/?series=174898&rev=6. Fixes: 7596d839f622 ("drm/xe/hwmon: Add support to manage power limits though mailbox") Fixes: 0c5405d3aa4ad ("drm/xe/hwmon: Read energy status from PMT") Fixes: 25e963a09e059 ("drm/xe/hwmon: Move card reactive critical power under channel card") Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patch.msgid.link/20261015071434.1063785-17-karthik.poosa@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/hwmon: Report errors using structured xe_log APIDnyaneshwar Bhadane
Replace drm_err() calls with xe_log_err() using the HWMON component tag to enable structured error reporting with SIGID for hardware monitor failures: Signed-off-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com> Reviewed-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com> Link: https://patch.msgid.link/20261012122522.2307625-4-dnyaneshwar.bhadane@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/log: Add VRAM, PAT, and HWMON DRIVER_HARDWARE componentsDnyaneshwar Bhadane
Register new DRIVER_HARDWARE log components for hardware I/O subsystems that currently lack structured error reporting: - VRAM (ID 6): Video RAM/Local Memory access and BAR visibility errors - PAT (ID 7): Page Attribute Table programming errors - HWMON (ID 8): Hardware monitor registration and sensor errors All three use IO_BUS as their default SIGID since they interact with hardware through MMIO or PCode register paths. Signed-off-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com> Reviewed-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com> Link: https://patch.msgid.link/20261012122522.2307625-2-dnyaneshwar.bhadane@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/guc: Treat CT-disabled TLB invalidation as cancelledZongyao Bai
During a GT reset the GuC CT channel goes through two states before it is enabled again: gt_reset_worker() xe_uc_stop() ENABLED -> STOPPED send: -ECANCELED xe_tlb_inval_reset() do_gt_reset() do_gt_restart() xe_uc_sanitize_reset() STOPPED -> DISABLED send: -ENODEV GuC load, CT enable DISABLED -> ENABLED xe_tlb_inval_issue() treats -ECANCELED as "undelivered, report done", but -ENODEV is propagated to the caller. A userptr invalidation from an MMU notifier (e.g. munmap() on a fault-mode VM) issued in the DISABLED window thus trips the XE_WARN_ON() in xe_vma_userptr_do_inval() and taints the kernel: Tile0: GT1: GT: reset started WARNING: drivers/gpu/drm/xe/xe_userptr.c:133 at xe_vma_userptr_do_inval+0x340/0x4a0 [xe] RAX: 00000000ffffffed xe_vma_userptr_invalidate_start+0x4b7/0x7c0 [xe] __mmu_notifier_invalidate_range_start+0x247/0x370 unmap_vmas+0x1af/0x1c0 unmap_region+0x91/0xf0 ... The TLB invalidation ops contract is that the backend returns -ECANCELED when it is mid-reset. The reset invalidates all TLBs, so there is nothing left to do. Map -ENODEV to -ECANCELED in send_tlb_inval() so that every GuC TLB invalidation type handles it the same way, instead of only send_tlb_inval_ggtt_full() as done so far. The CT is also DISABLED across system suspend and runtime suspend. On resume from system suspend the GuC is reloaded with all TLBs invalid, so nothing is lost there either; user space and the MM kernel threads are frozen by then, so such a request is not expected anyway. A request issued while runtime suspended violates the PM rules and is still reported by the "Missing outer runtime PM protection" warning in xe_tlb_inval_fence_init(). Fixes: db16f9d90c1d ("drm/xe: Split TLB invalidation code in frontend and backend") Cc: stable@vger.kernel.org # v6.18+ Cc: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Zongyao Bai <zongyao.bai@intel.com> Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com> Link: https://patch.msgid.link/20261116192220.3872267-2-zongyao.bai@intel.com Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com> (cherry picked from commit c17474e39028c7fb5cd6b2fb0f0413d07b1bf232) Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/dma-buf: Validate BOs on export to charge the exporterThomas Hellström
xe_gem_prime_export() calls ttm_bo_setup_export() to make sure the exporter is charged for the memory backing an exported BO. However, that only populates a TTM_PL_SYSTEM tt. A BO that has been evicted, or that has deferred backing, will instead get its memory allocated when the importer maps it. For p2p imports this happens through xe_bo_validate() in xe_dma_buf_map(), so the importer, not the exporter, is charged for the allocation. Call xe_bo_validate() at export time instead, so that the BO is moved into its preferred placement and the exporter is charged. Do the purgeable checks and the validation in the same xe_validation_guard() transaction, to avoid locking the BO twice. The commit message and code was drafted using LLM. Link: https://patchwork.freedesktop.org/patch/747480/?series=172524&rev=1 Fixes: 91494dee1091 ("xe: populate buffers before exporting them.") Cc: Matthew Brost <matthew.brost@intel.com> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: intel-xe@lists.freedesktop.org Cc: stable@vger.kernel.org # v6.18+ Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patch.msgid.link/20261111100929.2228-1-thomas.hellstrom@linux.intel.com Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> (cherry picked from commit 451162b9f6570d19da1c5944aa0a0e3e8f17773d) Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/irq: Always free requested IRQs on uninstallArvind Yadav
xe_irq_suspend() clears irq.enabled after disabling and synchronizing the interrupts. irq_uninstall() currently returns when that flag is clear, so a suspended device can skip free_irq() during teardown. The managed uninstall action is registered only after the IRQ request succeeds. Reset the interrupt registers only when interrupts are still enabled, but always free the requested IRQs. Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") Cc: Matthew Brost <matthew.brost@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com> Link: https://patch.msgid.link/20261020040211.496778-1-arvind.yadav@intel.com Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com> (cherry picked from commit 54dcaa48768b6e7761692f0fa10284d6b13636d1) Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/guc: Reset TLB invalidation state in submit finiPiotr Piórkowski
guc_submit_fini() stops the CT but does not complete pending TLB invalidation fences. If an invalidation was sent right before the stop, its done message from GuC is dropped and the fence only completes when it times out, leaving its waiter stuck for several seconds. We hit this while disabling VFs, where the VF removal was blocked until the TLB invalidation fence timed out. Let's reset the TLB invalidation state right after stopping the CT, as is already done on GT reset. Fixes: a6ab444a111a ("drm/xe: Forcefully tear down exec queues in GuC submit fini") Reviewed-by: Fei Yang <fei.yang@intel.com> Link: https://patch.msgid.link/20261106110620.2065903-1-piotr.piorkowski@intel.com Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com> (cherry picked from commit c20678d43df7666c9493832a03677e735bbc374c) Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/query: Use ordered clock reads for engine cycles cpu_deltaSanjay Yadav
cpu_delta is meant to bound the time taken to read the engine timestamp register, but it is measured with local_clock(), which on x86 is a plain RDTSC that is not ordered against loads. Either end of the window can thus be sampled while an earlier MMIO read is still in flight. A reproducer looping on DRM_XE_DEVICE_QUERY_ENGINE_CYCLES on BMG reports cpu_delta as low as 18 ns, while the MMIO read alone takes > 1.5 us. Use ktime_get_raw_ns() at both ends instead. Its clocksource read is ordered (rdtsc_ordered() on x86). With this, the reproducer reports min/median cpu_delta of 1567/1745 ns and no short values. Fixes: 7793d00d1bf5 ("drm/xe: Correlate engine and cpu timestamps with better accuracy") Cc: <stable@vger.kernel.org> # v6.8+ Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Suggested-by: Aleksander Czerwionka <aleksander.czerwionka@intel.com> Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@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/20261111090401.975803-2-sanjay.kumar.yadav@intel.com (cherry picked from commit 146dec4ce1f0794fefe5ad1d549655745358b515) Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/xe/ras: Treat non-fatal PCIe errors as recoveredRiana Tauro
On systems lacking RAS capability, only PCIe errors are reported, via AER, not device errors. Non-fatal PCIe errors reported at the Upstream Switch Port (USP) have no impact on link or device state, so treat them as recovered without requiring a secondary bus reset (SBR). Fixes: 25913a062cd4 ("drm/xe/xe_ras: Add support for uncorrectable core-compute errors") Reviewed-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com> Link: https://patch.msgid.link/20261112060701.3327125-14-riana.tauro@intel.com Signed-off-by: Riana Tauro <riana.tauro@intel.com> (cherry picked from commit f416c3899d2a0fe5f05921567164c10e5e36dbde) Signed-off-by: Matthew Brost <matthew.brost@intel.com>
9 daysdrm/nouveau/instmem: map only the part of BAR2 that is usedMohamed Ahmed
The io_mapping covers the whole BAR2 resource. With GSP-RM and with NvBar2Halve the BAR2 address space covers only its lower half. The driver maps nothing in the upper half, and a mapping that already exists there would give the io_mapping its type. Size the io_mapping to the BAR2 address space. The range does not change where BAR2 is not halved. Fixes: 34e27b90552a ("nouveau/instmem: use iomapping interface for instmem handling") Cc: stable@vger.kernel.org Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com> Tested-by: Thomas Andersen <phomes@gmail.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patch.msgid.link/20261117214352.337961-4-mohamedahmedegypt2001@gmail.com
9 daysdrm/nouveau/bar: take the GSP-RM flush pointer from the BAR2 io_mappingMohamed Ahmed
r535_bar_new_() maps the first page of BAR2 with ioremap(), to flush BAR2 writes with a read while flushFBZero is not mapped. On x86 with PAT, a mapping that overlaps an existing one gets its type. The instmem io_mapping is created later, so with GSP-RM it is also mapped UC- and its writes are not write-combined. Take the flush pointer from the io_mapping. A new bar2.oneinit hook sets it up once the BAR2 page tables are bootstrapped and the io_mapping exists. Fixes: 34e27b90552a ("nouveau/instmem: use iomapping interface for instmem handling") Cc: stable@vger.kernel.org Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com> Tested-by: Thomas Andersen <phomes@gmail.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patch.msgid.link/20261117214352.337961-3-mohamedahmedegypt2001@gmail.com
9 daysdrm/nouveau: do not return early from a synchronous VM_BINDMohamed Ahmed
A synchronous VM_BIND waits for its job with an interruptible wait and ignores the result. On a signal the ioctl returns 0 while the job is still queued. Userspace can then use the new mappings before the page tables are written, and the channel can take an MMU fault. Wait uninterruptibly. A synchronous job takes no syncobjs, so only the jobs queued before it on the same scheduler can delay it. Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI") Cc: stable@vger.kernel.org Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com> Tested-by: Thomas Andersen <phomes@gmail.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patch.msgid.link/20261117214352.337961-2-mohamedahmedegypt2001@gmail.com
9 daysdrm/amdgpu: bypass IMU ucode loading for GC 11 APUSuresh Guttula
For GC 11,IMU ucode is part of IFWI and ASP would load it by default. Signed-off-by: Suresh Guttula <suresh.guttula@amd.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Tested-by: Mario Limonciello (AMD) <superm1@kernel.org> # gfx1170, gfx1103 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 68107f081efeac9eaeaade028e55a5facef1c5b3)
9 daysdrm/amd/display: Add support for more PSP footer sizesOvidiu Bunea
[why & how] PSP footer size may be as big as 1932 bytes. Add a check for this size so that the DMUB FW meta can be properly located. Cc: Michael Strauss <michael.strauss@amd.com> Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com> Signed-off-by: Roman Li <roman.li@amd.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Tested-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit a6836fcbb5b22968019256025321d655b78bc49c)
9 daysdrm/vc4: dsi: Set the transfer result before completing the transferHenry Zhang
On an HSTX timeout the interrupt handler completes the transfer and only then sets xfer_result to -ETIMEDOUT. The waiter, which may run on another CPU, can wake up and read xfer_result in between, still 0 from the start of the transfer, and report the timed-out transfer as a success. Set xfer_result first. complete() orders the store before the wake-up. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Henry Zhang <henryzhang62@gmail.com> Link: https://patch.msgid.link/20261028164539.3471833-2-henryzhang62@gmail.com Reviewed-by: Maíra Canal <mcanal@igalia.com> Signed-off-by: Maíra Canal <mcanal@igalia.com>
9 daysdrm/vc4: dsi: Register the PHY clock provider with devmHenry Zhang
vc4_dsi_init_phy_clocks() is called from the component bind. It allocates the clock data with devm_kzalloc() and registers the clocks with devm_clk_hw_register(), so both are released with the devres group that the component framework opens for the bind, when the bind fails later or the component is unbound. The OF clock provider that points at that data is added with of_clk_add_hw_provider() and never removed: after an unbind it stays registered with the freed data, and each new bind adds another provider for the same node. A later lookup of one of these clocks, such as <&dsi1 0>, would call of_clk_hw_onecell_get() on freed memory. Use devm_of_clk_add_hw_provider(), so that the provider is removed with the same devres group, before the clocks and their data. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Henry Zhang <henryzhang62@gmail.com> Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://patch.msgid.link/20261117234107.1298575-1-henryzhang62@gmail.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
10 daysdrm/amd/display: Restore PSR-SU guard in power moduleEgor Perevoshchikov
Commit a5ce8695d6d1 ("drm/amd/display: Avoid configuring PSR granularity if PSR-SU not supported") restricted DSC slice-height configuration to PSR-SU. The power-module integration removed that guarded caller. Its replacement in mod_power_psr_notify_mode_change() calls psr_su_set_dsc_slice_height() unconditionally and ignores its return value. On PSR1 links with a DSC slice configuration, this applies a PSR-SU-only alignment check even though selective update is not enabled. If the calculated DSC slice height is not a multiple of the nonzero advertised SU Y granularity, the helper triggers an assertion. It also sets dsc_slice_height before failing the check, so the caller passes this SU-specific value into PSR1 setup despite the failure. Restore the PSR version guard and failure handling in the new caller. PSR1 proceeds with the zero-initialized DSC slice height, while PSR-SU retains its alignment validation and stops setup if that validation fails. Fixes: 3c108046e1d6 ("drm/amd/display: Add power module on Linux") Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/3027 Reviewed-by: Ray Wu <ray.wu@amd.com> Signed-off-by: Egor Perevoshchikov <rickbatra0z@gmail.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 83558fcf83cc911e09962ea17c883add596766c0) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Use FreeSync v3 infopacket for sinks above 255 HzCooper Morgan
Native DP, eDP, and HDMI sinks get the v1 FreeSync infopacket unless they are a whitelisted PCON or support Replay. v1 holds each refresh rate in one byte, so a sink whose range goes above 255 Hz cannot be told its real maximum. The v3 packet carries the high bits in PB11/PB12. The AMD VSDB version is already stored for every DP, eDP, and HDMI sink. Send v3 when the sink advertises AMD VSDB v3 and its maximum refresh rate is above 255 Hz. The choice follows the sink's maximum rather than the current mode, so such a sink gets v3 at every mode and the packet version stays fixed per sink. Sinks whose maximum is 255 Hz or less are unchanged. Tested with this series backported to v7.2.13 on an MSI MAG 271QPX32 (AMD VSDB v3, 48-320 Hz) over DP 1.4 on an RX 9070 XT: 320 Hz shows a correct picture, and with VRR active the refresh rate tracks frame caps of 300, 270, and 100 Hz. At 240 Hz, where the sink now gets v3 instead of v1, the picture is correct and VRR tracks a 100 Hz cap. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/5988 Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Cooper Morgan <ext-github@cwooper.dev> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit e1c2682397f2f8f40eada17c817b5d3b300124b6) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Saturate refresh rates in v1/v2 FreeSync infopacketsCooper Morgan
The v1 and v2 FreeSync infopackets carry the minimum and maximum refresh rate in one byte each, and build_vrr_infopacket_data_v1() casts the rate in Hz to unsigned char. On a sink whose range goes above 255 Hz the value wraps: a 320 Hz mode is advertised as a 64 Hz maximum. Sinks that treat the field as authoritative misbehave once the wrapped value lands inside their range. An MSI MAG 271QPX32 (48-320 Hz) over native DP looks like a ~720p image upscaled to the full screen at 320 Hz and runs its self-test pattern at 305-315 Hz, while 300 Hz (wrapping to 44 Hz, below its minimum) is fine. Capping the EDID range at 255 Hz, so the packet says 255, gives a correct picture at 320 Hz. Saturate the fields at 255 Hz instead of wrapping. Capping v1 at 255 as a fallback was suggested by oystersuki in the linked issue. Fixes: 98e6436d3af5 ("drm/amd/display: Refactor FreeSync module") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/5988 Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Cooper Morgan <ext-github@cwooper.dev> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 8f91c13d9a14085216725f60b55546fce5c2dd19) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Hold the VRR vblank reference only on active CRTCsHugo Sales
amdgpu_dm_handle_vrr_transition() takes a vblank reference when a CRTC state turns VRR on and drops it when a later state turns it off. It only looks at freesync_config.state, and disabling a CRTC keeps that state, so a suspend or DPMS off with VRR active keeps the reference On resume, drm_atomic_helper_resume() first calls drm_mode_config_reset(), which swaps the CRTC state for a zeroed one. The restored state then goes from VRR_STATE_UNSUPPORTED to active and takes a second reference, and the first is never dropped. The vblank irq stays on for good, so the CRTC never idles and PSR is never entered A VRR change on a disabled CRTC can't take the reference at all, since vblank is off there and drm_crtc_vblank_get() fails with a WARN On a Cezanne laptop with VRR always on, each suspend added one to the eDP CRTC's vblank refcount, and it stayed at 1 rather than 0 after VRR was turned off again Treat VRR as active for the reference only while the CRTC is active too. Disabling the CRTC then drops it and enabling it takes it again, which balances suspend, resume and DPMS, and the get only happens once manage_dm_interrupts() has turned vblank on Fixes: 66b0c973d7f7 ("drm/amd/display: Prevent vblank irq disable while VRR is active. (v3)") Reviewed-by: Ivan Lipski <ivan.lipski@amd.com> Signed-off-by: Hugo Sales <hugo@hsal.es> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 4232ec2333ab3ef16520b399b30d50f17ceb9c63) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Don't warn about links without an HPD GPIOThomas Lamprecht
Since commit def3488eb0fd ("drm/amd/display: refactor HPD to increase flexibility"), the link encoder programs the HPD filter, and dce110_program_hpd_filter() and dcn10_program_hpd_filter() hit ASSERT(0) if the encoder has no HPD GPIO. That is the case if link_get_hpd_gpio() finds no usable HPD info for the connector in the VBIOS, where program_hpd_filter() used to return early without a warning. This logs a warning with a stack trace on every boot of some systems, for example with Ryzen 7 PRO 4750G APUs on ASRock Rack X570D4U and X470D4U2-2T boards: WARNING: drivers/gpu/drm/amd/amdgpu/../display/dc/dio/dcn10/dcn10_link_encoder.c:1514 at dcn10_program_hpd_filter+0x39/0x90 [amdgpu], CPU#7: (udev-worker)/836 Call Trace: program_hpd_filter+0x5d/0xb0 [amdgpu] construct_phy+0x96f/0xe60 [amdgpu] link_create+0x1f0/0x240 [amdgpu] create_links+0x164/0x4f0 [amdgpu] dc_create+0x3ba/0x720 [amdgpu] amdgpu_dm_init+0x2c9/0x420 [amdgpu] Return false without asserting if there is no HPD GPIO, as before, and keep the assertion for failing to lock the pin. Fixes: def3488eb0fd ("drm/amd/display: refactor HPD to increase flexibility") Link: https://forum.proxmox.com/threads/kernel-7-0-14-24-and-7-0-14-25-bug-in-amdgpu.187181/ Reviewed-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 62ea146c23e14f958744507c37025f1a7f9c041b) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Add the AUX backlight minimum once on the custom curveHugo Sales
On an AUX backlight, convert_brightness_from_user() maps the user level through the ATIF custom brightness curve with convert_custom_brightness(), which rescales the result to user_min..user_max. convert_brightness_from_user() then rescales it again, from 0..user_max to user_min..user_max, so the minimum goes in twice. On the 1..512 nits AUX fallback range, a request for 0 gives 1998 millinits instead of 1000 Rescale the curve's output to 0..user_max and leave the offset to the caller Fixes: 8dbd72cb7900 ("drm/amd/display: Export full brightness range to userspace") Reviewed-by: Ray Wu <ray.wu@amd.com> Signed-off-by: Hugo Sales <hugo@hsal.es> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 5f95ef2cfd208ca7efe446abfc9e3144dc5ce4fa) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Keep FreeSync flip timing across plane resetsDavey Hughes
dm_update_plane_state() replaces the DC plane with a newly allocated one whenever the plane is reset. The new plane's flip timing is zero, and mod_freesync_handle_preflip() runs before DC stores the new plane's first flip timestamp, so FreeSync takes the 32-bit microsecond timestamp itself as the last render time: the monotonic clock modulo about 71.6 minutes. On a panel with below-the-range compensation (BTR), that engages BTR and pins the frame time at the BTR mid-point (13.447 ms on a 48-165 Hz panel). A panel without BTR (max refresh below twice the min) goes through the fixed refresh path instead and locks to its max refresh after six frames. It takes a reset on every flip to keep the panel there, and color management changes reset the plane. DRM sets color_mgmt_changed whenever a color property is given a different blob, even one with the same contents, and KWin 6.8.1 with HDR enabled and its color accuracy setting at "Prefer efficiency" sets a new GAMMA_LUT blob on every commit (current KWin master no longer does). Plane resets for CRTC color changes, added by commit 7316c4ad2996 ("drm/amd/display: Reset planes for color management changes"), and later for plane color properties and colorops, made this reachable on every flip. Copy the flip timing from the old DC plane into the new one when the plane stays on the same CRTC. Do it in amdgpu_dm_commit_planes() before the preflip, after drm_atomic_helper_wait_for_dependencies() has waited for the previous commit, so the copy holds that commit's flip and does not race with DC writing it. This covers both the BTR and the fixed refresh path. A plane that is newly enabled or moved to another CRTC still starts without history. Fixes: 180db303ff46 ("drm/amd/display: Add below the range support for FreeSync") Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Davey Hughes <davidralphhughes@gmail.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 4acf82d2a2dcca2d7df8649ecafb3da6c1245003) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Fix logger leak on perf trace allocation failureJackie Liu
dc_construct_ctx() allocates a logger and stores an alias in dc->dml.logger before allocating the performance trace object. If dc_perf_trace_create() fails, the function frees dc_ctx without releasing the logger. Since dc->ctx is assigned only after the trace allocation succeeds, dc_destruct() cannot reclaim the logger on this error path. Free the logger before discarding dc_ctx and clear dc->dml.logger to avoid leaving a dangling alias after the failed construction. Fixes: 5d72e247e58c ("drm/amd/display: switch DC over to the new DRM logging macros") Reviewed-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ac088505e74932f276ea6e3bbe19713e5770e7a1) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Don't warn about vendor infoframe for non-infoframe sinksPaul Menzel
With an EIZO EV2781 connected over HDMI to an AMD Ryzen 3 2200G (Raven) on an MSI B350M MORTAR (MS-7A37), Linux logs at every boot since v6.16: amdgpu 0000:30:00.0: [drm] Failed to setup vendor infoframe on connector HDMI-A-1: -22 Commit 6027cbee1900 ("drm/amd/display: Add error check for avi and vendor infoframe setup function") started to log the return value of drm_hdmi_vendor_infoframe_from_display_mode(). With `frame` and `mode` being non-NULL, the helper only fails with -EINVAL, if the sink does not support HDMI infoframes, that means, if `connector->display_info.has_hdmi_infoframe` is false, and its kernel-doc says, that this error can be safely ignored. drm_parse_hdmi_vsdb_video() only sets `has_hdmi_infoframe`, if the HDMI VSDB has HDMI_Video_present set, and drm_parse_hdmi_forum_scds() sets it for sinks with an HF-SCDB. So an HDMI sink, whose VSDB lacks HDMI_Video_present, triggers the warning, although nothing failed. The EIZO EV2781 is such a sink. Its HDMI VSDB has a payload of only seven bytes (source physical address, Supports_AI, and a maximum TMDS clock of 250 MHz), so the byte with HDMI_Video_present is absent, and the EDID has no HF-SCDB: 67 03 0c 00 10 00 80 32 Only warn, if the sink supports HDMI infoframes. The infoframe setup itself is unchanged. Fixes: 6027cbee1900 ("drm/amd/display: Add error check for avi and vendor infoframe setup function") Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5025 Reviewed-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 2abfc667f622eb7132b139db2e175642713662f8) Cc: stable@vger.kernel.org
10 daysdrm/amd: Select the firmware signing scheme the PSP reportsMario Limonciello
Some platforms ship BIOS with either a default or an alternative trust authority, so firmware for every IP must be signed with the matching scheme. The PSP advertises which one is in use in bit 6 of C2PMSG_63, and in bit 28 whether this is a preproduction part, which needs firmware of its own. Add amdgpu_psp_init_fw_variant() which reads those bits through amdgpu's own MMIO, and keep the result in adev->firmware.sign_type next to load_type, where preproduction is a type of its own. It is initialized once, after IP discovery has populated the register bases and only when firmware is loaded through the front door (the PSP). Only MP0 15.0.0 and 15.0.9 report it. For all other ASICs, SR-IOV VFs and an inaccessible register (all ones) the defaults are kept: AMDGPU_FW_SIGN_DEFAULT. A preproduction part that also reports the alternative scheme is not expected. Mark it AMDGPU_FW_SIGN_UNKNOWN, so that firmware requests warn and fail with -EINVAL rather than load firmware that would be rejected. Firmware for preproduction parts is named with a "_p" suffix before the extension and firmware for the alternative scheme with an "_l" suffix (e.g. "foo.bin" becomes "foo_p.bin" or "foo_l.bin"). Production parts on the default scheme use the plain names. Do the substitution centrally in amdgpu_ucode_request() so it covers every IP that loads firmware through it (PSP, SMU, DMUB, GC, IMU, MES, SDMA, VCN, VPE, ...) without each loader having to care. There is no fallback to the default file: it would be rejected anyway. Declare the variants with MODULE_FIRMWARE() so that initramfs generators include them. Acked-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patch.msgid.link/20261114160925.390350-1-superm1@kernel.org Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 2fe41c5fb704e05ccf2bf00634e1b5ad2db4e5b7)
10 daysdrm/amdgpu: keep reading the vblank counter in IRQ context during resetPrike Liang
amdgpu_get_vblank_counter_kms() returns the cached vblank->last instead of reading the hardware counter whenever it can't take reset_domain->sem for reading. The vblank interrupt reads the counter through the same callback via drm_crtc_handle_vblank(), so once GPU recovery holds the semaphore for writing, every vblank interrupt sees diff == 0 and the DRM vblank count stops advancing. The CRTCs keep scanning out until dm_suspend() turns vblank off and stops the streams, though, which only happens after the rest of the recovery preparation. Vblank waits in that window don't see a vblank anymore. They only end when dm_suspend() turns vblank off, or after a second with the "vblank wait timed out" warning if that takes longer. The fbdev damage worker is likely to be waiting already, because recovery prints "GPU reset begin!" right before it takes the semaphore. Vblank interrupts only arrive while a CRTC is scanning out, so the interrupt path can read the hardware counter. amdgpu_device_skip_hw_access() likewise only checks the reset semaphore in task context. Only back off in task context, so the interrupt path keeps the count moving until DM turns vblank off. Fixes: 51a4359f7431 ("drm/amdgpu: serialize vblank counter reads against GPU reset") Cc: Vitaly Prosyak <vitaly.prosyak@amd.com> Cc: James Lin <pinglei.lin@amd.com> Cc: Leo Li <sunpeng.li@amd.com> Assisted-by: Copilot:claude-opus-5.5 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 ff157c5bd3603360f18ed0b427913fb50c043a16)
10 daysdrm/amd/display: Apply the HDMI RGB range default only to HDMI signalsAdrian Betschart
Since d23f735d0eac, Broadcast RGB "Automatic" selects limited range on CTA modes when display_info.is_hdmi is set. That flag comes from an HDMI VSDB in the EDID and says nothing about the link, so a native DisplayPort monitor whose EDID carries an HDMI VSDB now gets limited range on CTA modes too. Monitors that ignore the DP range signal show grey blacks, where 7.2 sent full range. Require an HDMI signal as well, as the original commit intended. DP++ passive adapters drive an HDMI signal and keep the HDMI behaviour; native DP, DP MST and active DP-to-HDMI converters get full range again. Reported and analysed by Andrés Rodríguez in the issue below. Fixes: d23f735d0eac ("drm/amd/display: Default HDMI RGB output to limited range on CTA modes") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/6052 Reviewed-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Adrian Betschart <adrian.betschart@cinemaone.ch> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 39f37a2346410a33edf4af17a873ac96bb5244ce) Cc: stable@vger.kernel.org # 7.3
10 daysdrm/amdgpu: fix cleared PDE/PTE flag generationChristian König
That was broken since adding the NPA support. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 6250a8342784703e2ee4da14fb16f3cdbf05b4d5)
10 daysdrm/amdgpu: Fix fault cleaner race conditionKent Russell
clean_process_queues_cpsch would exit early if the memory was evicted, which would skip running the shader cleaner Run the cleaner unconditionally, and track whether the fault was cleaned with a new boolean in the qcd struct. Fixes: 923d09ab1f9a ("drm/amdkfd: Fix TCP XNACK scoreboard reset race on MI300") Signed-off-by: Kent Russell <kent.russell@amd.com> Reviewed-by: Jay Cornwall <jay.cornwall@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 24672863a9b9f073ca6fb1508e0a44c7958bf597) Cc: stable@vger.kernel.org
10 daysdrm/amdgpu: Fix fault shader cleaner on MI3Kent Russell
MI300/MI350 have a different register layout, and cannot reuse the same definitions from MI2. The shader cleaner can be reused, but not the initialization steps. Also change the dim_x to ensure that we cover all wave slots per SIMD. Fixes: 923d09ab1f9a ("drm/amdkfd: Fix TCP XNACK scoreboard reset race on MI300") Signed-off-by: Kent Russell <kent.russell@amd.com> Reviewed-by: Jay Cornwall <jay.cornwall@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ad884eacf92d19b80cdd723dbbc8472b173685fc) Cc: stable@vger.kernel.org
10 daysdrm/amdgpu: Run shader cleaner on all XCCs on faultsKent Russell
The previous patch only ran on XCC0, giving us a good chance that we don't clear the right registers on fault handling in MI3. Loop through them all to make sure we clear them all. Also clarify the fail/succeed message to accurately reflect what was done Fixes: 923d09ab1f9a ("drm/amdkfd: Fix TCP XNACK scoreboard reset race on MI300") Signed-off-by: Kent Russell <kent.russell@amd.com> Reviewed-by: Jay Cornwall <jay.cornwall@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit eb5fa6f22cdb7c7dbdaf792f1206e808739d5887) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Abort DPMS ON when enabling the link failsAbdulla Bubshait
Since commit 843049bac7c0 ("drm/amd/display: Split DPMS ON into parts"), link_set_dpms_on_enable_link() returns DC_DPMS_FAILED_HANDSHAKE when enable_link() fails and the stream enable has to be aborted: any failure other than link training, or a link training failure on DP MST. The link has already been disabled at that point. The step loop in link_set_dpms_on() treats DC_DPMS_FAILED_HANDSHAKE like DC_DPMS_SUCCESS and goes on to link_set_dpms_on_post_enable_link(). Before the split, this path returned right after disable_link(), because MST displays can't proceed without link training. Now, for failed MST handshakes MST slots are still allocated. When the link trains again later, the new payload starts after the leaked slots so ACT never completes, and the display stays black until reboot. Replugging or power-cycling the monitor does not recover it. Seen on Navi 33 (DCN 3.2.1) with a DP 2.1 MST monitor (Odyssey Neo G9) at UHBR10 x4 with DSC. Link training sometimes fails on DPMS wake. With this change, the failed attempt leaves no payload behind, and the next modeset after the sink reconnects bring the monitor back up. Return early on DC_DPMS_FAILED_HANDSHAKE, as for DC_DPMS_SKIPPED_HANDSHAKE. This restores the pre-split behaviour. Link training failures on non-MST signals still return DC_DPMS_SUCCESS and continue as before. Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/6047 Fixes: 843049bac7c0 ("drm/amd/display: Split DPMS ON into parts") Reviewed-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Abdulla Bubshait <darkstego@gmail.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ece3dae13fb106684f8248f88387b1fbcfef8206) Cc: stable@vger.kernel.org # 7.3
10 daysdrm/amdkfd: keep the DMA addresses of a range intact if splitting failsJesse Zhang
svm_range_split_pages() splits the DMA address array of one GPU after the other, and each split replaces the old range's array by a shorter one. If a later GPU's array can't be allocated, the old range is left with the arrays of the earlier GPUs already shortened, but with its old size. Unmapping it then walks past their end. On navi31 with its iGPU, an SVM range accessible by both GPUs, and unmapping a page in its middle with allocations failing in turn through failslab: BUG: KASAN: slab-out-of-bounds in svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu] Read of size 8 at addr ffff88819ac32800 by task kworker/8:1/171 svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu] svm_range_dma_unmap+0x119/0x2c0 [amdgpu] svm_range_free+0x312/0x520 [amdgpu] svm_range_handle_list_op+0x326/0x500 [amdgpu] svm_range_deferred_list_work+0x338/0x790 [amdgpu] Allocated by task 2749: svm_range_copy_array.constprop.0+0x55/0x190 [amdgpu] svm_range_split+0x388/0x17b0 [amdgpu] svm_range_unmap_split+0x254/0x370 [amdgpu] svm_range_cpu_invalidate_pagetables+0xb29/0x11d0 [amdgpu] The buggy address is located 0 bytes to the right of allocated 2048-byte region [ffff88819ac32000, ffff88819ac32800) Split the arrays of all GPUs first and only replace the old ones once all succeeded. With that the 2759 unmaps of the same sweep give no report. Fixes: f80fe9d3c114 ("drm/amdkfd: map svm range to GPUs") Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 3cbd0b498ac18821ec01c08e39050a4d22ea9eeb) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Take every stream out of self-refresh before a modesetHugo Sales
Commit 3c108046e1d6 ("drm/amd/display: Add power module on Linux") dropped amdgpu_dm_psr_disable_all() and amdgpu_dm_replay_disable_all() from amdgpu_dm_commit_streams(). Since then, a modeset only disables self-refresh on the CRTCs in the commit, so an eDP on another CRTC stays in PSR through dc_commit_streams() Commit 6ee90e88b976 ("drm/amd/display: PSR eDP p-state warning occurs intermittently after unplug DP") added that disable-all for this very case. With it gone, turning off or unplugging an HDMI monitor while the eDP is in PSR hangs DMUB on a Cezanne laptop (DCN 2.1), on the first try: dc_dmub_srv_log_diagnostic_data: DMCUB error Error queueing DMUB command: status=2 The eDP then stays frozen until a GPU reset Do the same through the power module's events. When a CRTC that is or was active needs a modeset, raise the PSR and Replay pause events on every stream mod_power tracks and wait for self-refresh to exit, before amdgpu_dm_mod_power_update_streams() changes the stream set. Clear them on the commit's streams after amdgpu_dm_mod_power_setup_streams(), since enabling a stream clears psr_feature_enabled until then. Use psr_event_pause and replay_event_pause rather than the hw_programming events, which a fast update on the eDP can clear in amdgpu_dm_enable_self_refresh() while the modeset is still running Fixes: 3c108046e1d6 ("drm/amd/display: Add power module on Linux") Reviewed-by: Ray Wu <ray.wu@amd.com> Signed-off-by: Hugo Sales <hugo@hsal.es> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 5d90fdb959505b5f42f2dec699521ac56b4174be) Cc: stable@vger.kernel.org
10 daysdrm/amdkfd: don't check the HMM range when getting its pages failedJesse Zhang
When allocating the PFN array fails, amdgpu_hmm_range_get_pages() returns -ENOMEM before setting the notifier of the range, but svm_range_validate_and_map() still checks the range, as it is not NULL, before looking at the error. On navi48, setting SVM attributes with failslab: KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057] RIP: 0010:amdgpu_hmm_range_valid+0x66/0xa0 [amdgpu] svm_range_validate_and_map+0xaef/0x4e40 [amdgpu] svm_range_set_attr+0x193e/0x4610 [amdgpu] kfd_ioctl_svm+0x137/0x320 [amdgpu] Check the error first; it is only 0 when the pages were taken. Fixes: c0de552910bb ("drm/amdkfd: clean up the code to free hmm_range") Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit c7036242655cb2c6d14a0d04138536e1ddb5e42c) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Seed boot clocks to avoid lowering pre-OS display clocksJing Zhou
[WHY] USB4 DPIA HPD can arrive early in boot, before the first stream commit. Its link detection runs prepare_phy_clocks(), which goes through clk_mgr_exit_optimized_pwr_state() and clk_mgr_optimize_pwr_state() and calls update_clocks(dc->current_state). At that point both dc->current_state->bw_ctx.bw.dcn.clk and clk_mgr->clks are still zero, because init_clocks() memsets them. On the safe_to_lower path, dcn42_update_clocks() clamps the requested DPPCLK to the 100MHz floor and programs it. This drops DPPCLK below what the GOP-lit eDP pipe needs, and the panel flashes white. [HOW] 1. In dcn42_init_clocks() and dcn42b_init_clocks(), seed clk_mgr->clks dispclk/dppclk from the boot snapshot(10kHz units, x10). 2. Add a DC core helper, sync_current_state_clocks_from_clk_mgr(). After every hwss.init_hw() call (legacy_hardware_init, D0 entry in dc_set_power_state, and dc_reinitialize_hardware), it copies clk_mgr->clks into dc->current_state->bw_ctx.bw.dcn.clk for DCN. A later update_clocks() before the first commit then sees the real pre-OS clocks and does not lower them. Raising clocks is still allowed and does not cause a flash. Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Cc: Charlene Liu <charlene.liu@amd.com> Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Jing Zhou <Jing.Zhou@amd.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 2f289740a04f08a5ce4b5e3c69af6e32ab4a540e) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Update DCN42B stutter latency to match DCN42Allen Pan
[Why] The DCN42B stutter latencies do not match DCN42, which can lead to underflow and stutter issues. [How] Update the DCN42B LPDDR5/LPCAMM2 stutter latencies to the same values DCN42 already uses. Cc: Dillon Varone <dillon.varone@amd.com> Cc: Charlene Liu <charlene.liu@amd.com> Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Allen Pan <Allen.Pan@amd.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit c6b576ac64cedc990f3885efa85603fe5998da3f) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Read DRAM channel width from SMU init tableWenjing Liu
[Why] The channel count came from the SMU init table but the channel width came from VBIOS vram info. Both values need to describe the same memory type. [How] Add DramChannelWidthBytes to MemoryConfig_t, using a reserved slot so the layout is unchanged. Populate the channel width in bw_params from the init table instead of VBIOS vram info. Cc: Dillon Varone <dillon.varone@amd.com> Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 37d64c58f610d771b7ab8cfbf7d9f5606939947b) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Flip dml2_core_utils_get_segment_horizontal_contiguous() InputsAustin Zheng
[Why/How] Parameters for dml2_core_utils_get_segment_horizontal_contiguous() should be flipped. Should be swizzle mode then bytes per pixel. Cc: Dillon Varone <dillon.varone@amd.com> Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 8e985b38672c3de9355dd8f166527f96e472706c) Cc: stable@vger.kernel.org
10 daysdrm/amd/display: Stop HDMI FRL status polling on finiFangzhi Zuo
[Why] The HDMI FRL status polling work re-queues itself and its workqueue was not stopped during amdgpu_dm_fini(). During unbind or unload, the worker could access freed DC state, and the workqueue was leaked. This fixes the FRL polling teardown introduced by the HDMI FRL support change. [How] Cancel the delayed polling work synchronously and destroy the workqueue in amdgpu_dm_fini() before the remaining display state is torn down. Cc: Harry Wentland <harry.wentland@amd.com> Reported-by: Eren Özen <erenozen@protonmail.com> Link: https://lore.kernel.org/all/20261110-frl-polling-wq-teardown-v1-0-0ff028d5c35b@protonmail.com/ Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 709b7a5aff3addf2288dedf42bc62c45ae1ab163)
10 daysdrm/amd/display: Move HDMI FRL Polling Outside dc_lockFangzhi Zuo
[Why] amdgpu_dm_commit_streams() started or cancelled the self-rearming HDMI FRL poll under dm->dc_lock. cancel_delayed_work_sync() can wait for a worker that needs the same lock, creating a lock dependency that could deadlock. [How] Release dm->dc_lock after dc_commit_streams() and the idle-optimization update, then scan the committed streams and start or stop FRL polling outside the lock. Cc: Harry Wentland <harry.wentland@amd.com> Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 7a1807cd11a8c2bd26d48de6829d82ae62ad622d)
10 daysdrm/amdgpu: Fix UserQ slot availability checksErhan Bilgili
The compute and DMA queries check each other's disable_uq flags. When the flags differ, this can hide available slots or report slots for disabled UserQs. Check gfx.disable_uq for compute and sdma.disable_uq for DMA. Fixes: 78d0a27ae0e2 ("drm/amdgpu: Add user queue instance count in HW IP info") Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Erhan Bilgili <erhan.bilgili@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit ed4f6b1f8848ad8890fd188da6b2ddfdd538a036) Cc: stable@vger.kernel.org