summaryrefslogtreecommitdiff
path: root/drivers/gpu
AgeCommit message (Collapse)Author
8 daysdrm/amd/display: Test DM IRQ handler source guardAlex Hung
[Why & How] Add dm_test_irq_handler_invalid_source to cover the early return in amdgpu_dm_irq_handler() when dc_interrupt_to_irq_source() cannot map the hardware entry. Reuse the existing unmapped irq_service stub and assert that neither the high- nor the low-context handler is dispatched. Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Validate irq source in DM IRQ handlerAlex Hung
[Why] dc_interrupt_to_irq_source() can return DC_IRQ_SOURCE_INVALID for an unmapped src_id/src_data pair. The value was passed straight to dc_interrupt_ack() and used to index the DM high/low handler tables. [How] Reject sources outside the valid range before using them. Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Dump clock registers in HW init instead of SW initAlvin Lee
[Why & How] - Dumping clock registers in SW init can get incorrect clock readback due to other init code (e.g., in DMU) potentially not executed yet - Move clk_ip register access into HW init to ensure the clock read back gets the correct values Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix DC Hub reference frequency assert rangeNevenko Stupar
[Why & How] The DC Hub reference frequency valid range was asserted incorrectly. Correct the range to 20 to 50 MHz and update the comment accordingly. Reviewed-by: Sridevi Arvindekar <sridevi.arvindekar@amd.com> Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Nevenko Stupar <Nevenko.Stupar@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Enable FW locality check in DCN6Alvin Lee
[Why & How] Enable FW locality check in DCN6 Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix unused params in flip schedAlex Hung
[Why & How] dcn6_calculate_flip_schedule() no longer uses meta_row_height and meta_row_height_chroma in any of its calculations, so both parameters are flagged as unreferenced by compilers with stricter warning levels. Cast both to void to document that they are intentionally unused. The parameters are kept because the signature is fixed by the shared function pointer. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Austin Zheng <austin.zheng@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix HF-VSDB DSC bpc detection to be cumulativeFangzhi Zuo
[Why & How] The HDMI Forum VSDB reports the maximum DSC color depth a sink supports. This maximum is cumulative: a sink that reports 12 bpc also supports 10 and 8 bpc. The previous code used exact "== 10" and "== 12" comparisons chained with else-if, so a 12 bpc sink only set frl_dsc_12bpc and never set frl_dsc_10bpc, incorrectly narrowing the DSC bpc range usable with that sink. Use ">= 10" and a separate ">= 12" check so a sink advertising a higher maximum also enables the lower DSC bit depths it supports. Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Exit IPS before connector detection on resumeFangzhi Zuo
[Why & How] On resume, dm_resume() walks the connector list and, for each connector, calls dc_link_detect_connection_type() at the top of the loop iteration before the per-connector dc_exit_ips_for_hw_access() that sits in the detection branch. There is no dc_exit_ips_for_hw_access() before the loop, so the very first HW access relies on an earlier connector having already taken the display out of IPS. Commit d1d51519bc3b ("drm/amd/display: Skip eDP detection when no sink") skips the eDP connector when no panel is present. On a DCN3.5 APU whose eDP link has no sink, the eDP iteration - which used to bring the HW out of IPS first - is now skipped, so a downstream DP connector becomes the first one processed. Its initial DDC/AUX access then runs while the HW is still idle, the AUX transfers time out (-ETIMEDOUT), and the EDID read fails: [drm:dm_helpers_read_local_edid [amdgpu]] *ERROR* EDID err: 2, on connector: DP-1 amdgpu: [drm] *ERROR* No EDID read. Take the display out of IPS once before the detection loop so the first connector processed no longer touches the AUX/DDC engine while the HW is still in idle power state. This keeps the eDP-skip boot/resume optimization while fixing the DP EDID read failure. Fixes: d1d51519bc3b ("drm/amd/display: Skip eDP detection when no sink") Reviewed-by: Roman Li <roman.li@amd.com> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Fix missing APG regs for DCN60 HDMIIlya Bakoulin
[Why & How] Add missing APG instance for HDMI stream encoder. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add immediate restore to FAMS2 for DRRDillon Varone
[Why & How] Adds toggle to immediately restore FAMS2 streams instead of waiting for DRR VTotal changes to latch Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Dillon Varone <Dillon.Varone@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add override capability for UTM table paramsAlvin Lee
[Why & How] Add calls for overriding UTM table params from PMFW. This is for debug and test purposes only when PMFW has not yet populated the table values correctly. Reviewed-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Set mpc_tree_params->opp_id during OPP resource constructOvidiu Bunea
[Why & How] Currently, init_pipes() is the only interface responsible for initializing the OPP->MPCC resource for all pipes. However, during seamless boot transitions, init_pipes() is skipped and we transition directly to an ODM2:1 config where we end up programming the default SW struct state of mpc_tree_params, which is 0. This results in a config where both HUBP0 & HUBP1 are being fed into the same OPP inst, 0 in this case. This is purely a case of programming incorrect SW state initialization values into HW, so fix this by initializing mpc_tree_params with the correct instances during resource construct. Reviewed-by: Michael Strauss <michael.strauss@amd.com> Signed-off-by: Ovidiu Bunea <ovidiu.bunea@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Remove unnecessary includesJoshua Aberback
[Why & How] These direct inclusions are unnecessary as the relevant headers are taken care of by the broader inclusions in these files. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Joshua Aberback <joshua.aberback@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Make sure streamclk gating is off when enabling streamclkCharlene Liu
[Why & How] streamclk gating sequence update: disable streamclk gating when using streamclk Reviewed-by: Leo Chen <leo.chen@amd.com> Signed-off-by: Charlene Liu <Charlene.Liu@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Cover EDID CEA parsing helpersBhawanpreet Lakha
[Why & How] Add KUnit coverage for the EDID CEA extension parsing helpers dm_edid_parser_send_cea(), parse_edid_cea_dmcu(), parse_edid_cea_dmub() and parse_edid_cea(). Tests exercise the oversized-chunk rejection and DMUB-unavailable paths of the send helper, the DMCU ack/VSDB branches via a mock dmcu_funcs table, the DMUB empty/send-fail branches, and both routing branches of parse_edid_cea(). Assisted-by: Copilot:Claude-Opus-4.8 Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Cover dm_restore_drm_connector_stateBhawanpreet Lakha
[Why & How] Add KUnit tests exercising every guard branch of dm_restore_drm_connector_state(): the writeback short-circuit, a missing dc_sink, a NULL connector atomic state, a NULL encoder, a crtc state without a dc stream, and an unchanged sink that skips the forced atomic commit. Assisted-by: Copilot:Claude-Opus-4.8 Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/ttm: apply the swapout bulk_move fix to the intended conditionVadim Nikitushkin
Commit 3db7d7d58341 ("drm/ttm: fix swapped-out resources never leaving their bulk_move range") landed in drm-misc-fixes with its one-line change applied to the wrong "if": the "if (ret)" after ttm_resource_try_charge() in ttm_bo_alloc_at_place() became "if (ret > 0)", while the "if (!ret)" after ttm_tt_swapout() in ttm_bo_swapout_cb() that the patch targeted was left untouched. ttm_resource_try_charge() returns 0 or a negative error code, so with "ret > 0" a failed dmem cgroup charge no longer fails the allocation. Restore that check and apply the intended change: ttm_tt_swapout() returns the number of pages swapped out on success, so the bulk_move removal must run for ret > 0. Fixes: 3db7d7d58341 ("drm/ttm: fix swapped-out resources never leaving their bulk_move range") Cc: stable@vger.kernel.org # v7.1+ Signed-off-by: Vadim Nikitushkin <bub4z0r@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20260910143451.65853-1-bub4z0r@gmail.com
8 daysdrm/amd/display: Test atomic validation guardsAlex Hung
[Why] Add KUnit tests for an empty amdgpu_dm_atomic_check(), an unchanged CRTC update, and a detached plane update. [How] Use standard DRM KUnit objects and existing state fixtures so each helper reaches its software-only early return without DC hardware programming. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test writeback state transitionsAlex Hung
[Why] Add KUnit tests for dm_clear_writeback() removing stream writeback state and dm_set_writeback() leaving a job unarmed when no DC pipe matches. [How] Use the real DC removal helper with a state-only update_bandwidth fake, and construct the minimal DRM writeback objects needed to reach the no-pipe cleanup path. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add stressed peak bandwidth probe with DMA contentionWenjing Liu
[Why] Peak-bandwidth-under-contention validation currently needs an external tool to manufacture memory contention while querying peak bandwidth. Expose this as an explicit probe variant so the driver can generate that contention itself. [How] Add a new probe type that builds the same gated perfmon sequence as the plain peak-BW probe, with a DMA copy of the current surface into a scratch buffer inserted before the measurement window to synthesize a competing memory client. Move the scratch buffer fields onto the base resource pool struct instead of an ASIC-specific subclass, and reject the probe with a new status code when the buffer was never allocated. Also fixes a stack- corruption bug where a local variable's address was captured by a deferred callback and used after the local went out of scope, and a missing NULL check on a similar output parameter used by an early-return path. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test cached suspend stateAlex Hung
[Why] Add KUnit tests for dm_cache_state() covering successful caching on an empty DRM device and propagation of an atomic suspend error. [How] Use the standard DRM KUnit device for the success path and the shared DM ops table to inject the suspend failure. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test MST resume guardsAlex Hung
[Why] Add KUnit tests for resume_mst_branch_status() without a primary branch and s3_handle_mst() with an empty connector list. [How] Use the real topology mutex and DRM connector iterator. The tests stop before AUX or topology-manager hardware operations are required. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test plane update adapterAlex Hung
[Why] Add KUnit tests for update_planes_and_stream_adapter() covering descending plane sorting, argument forwarding, call ordering, and DC failure propagation. [How] Extend the existing DM KUnit ops table with the two DC calls and use spies to observe inputs and ordering. Reuse one ops installer for the adapter and MMHUB tests. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Add override for LSDMA BW in QoS tableAlvin Lee
[Why & How] Since PMFW does not yet populate LSDMA BW with correct values, add an override interface for debug purposes until values are populated correctly by PMFW. Reviewed-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test GPU reset helpersAlex Hung
[Why] Add KUnit tests for dm_gpureset_toggle_interrupts() on DCN, amdgpu_dm_commit_zero_streams() on an already empty DC state, and dm_destroy_cached_state() without a cached state. [How] GRPH_PFLIP is unused on DCN, so only the vupdate interrupt is toggled and no interrupt service is needed. An unchanged empty stream list makes dc_commit_streams() return early. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test self refresh entryAlex Hung
[Why] Add KUnit tests for amdgpu_dm_enable_self_refresh(), covering the full update and unsupported link blocks, the skip count gating, the damage settle window, and a Replay capable link. [How] The power module stays NULL, which every mod_power entry point treats as a no-op, so the event updates can be reached without a live power module. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Shorten hdmi_frl_status_polling_workqueueNathan Chancellor
There is a warning when creating the hdmi_frl_status_polling_wq workqueue because "hdmi_frl_status_polling_workqueue" excceds WQ_NAME_LEN: workqueue: name exceeds WQ_NAME_LEN. Truncating to: hdmi_frl_status_polling_workque Shorten the workqueue name to "hdmi_frl_status_polling_wq" like the structure member to avoid the warning. Fixes: 5c9b8b27a883 ("drm/amd/display: Tie FRL support into amdgpu_dm") Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260618-amdgpu-fix-wq_name_len-warning-v2-1-ef0e2e6f5be7@kernel.org Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Test vblank IRQ handlingAlex Hung
[Why] Add KUnit tests for manage_dm_interrupts(), covering the off delay derived from the stream timing, the 30ms fallback, the DCN3.5 APU instant off, and the vblank disable path. [How] The IRQ subsystem is not installed, so amdgpu_irq_get() and amdgpu_irq_put() only report the missing source; the point is that the affected DCN versions request it at all. Assisted-by: Copilot:Claude-Opus-5 GPT-5.6 Sol Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Refactor DC_SEND_CURSOR_INFO_TO_DMU to drop pipe_ctxTomasz Siemek
[Why] Pipe_ctx shouldn't be passed as block sequence parameter. [How] Pass needed parameters explicitly to executor. Reviewed-by: Ilya Bakoulin <ilya.bakoulin@amd.com> Signed-off-by: Tomasz Siemek <tomasz.siemek@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Ensure requested LSDMA BW is within the SOP boundAlvin Lee
[Why & How] - When calculating the required LSDMA bandwidth, it must be capped to the global maximum LSDMA BW. - Also check the calculated bandwidth against what is available in the SOP - Rework code to only compute alt-ch params if alt-ch is in use - Also remove some unused fields - Fix whitespace errors Reviewed-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/display: Force min DCFCLK on AC for DCN42BGabe Teeger
[Why] This is a temporary workaround to address underflows at 4k144 with DCFCLK set to 200MHz. [How] Set the DCFCLK minimum frequency to 300MHz when in AC mode. Signed-off-by: Gabe Teeger <gabe.teeger@amd.com> Signed-off-by: Matthew Stewart <Matthew.Stewart2@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdm/amdgpu: fix malformed link_settings debugfs outputHarry Wentland
[Why] dp_link_settings_read() passed strlen() of each format string as the size argument to snprintf() and then advanced rd_buf_ptr by that same fixed amount. The format-string length has no relation to the formatted output length, so snprintf() truncated each field at a NUL it wrote inside the buffer while the pointer was advanced past it. The result is a buffer peppered with embedded NUL bytes and fields that are silently cut short, so the data read back from the debugfs node does not reflect the actual link settings. [How] Use scnprintf() with the real remaining buffer size (rd_buf_size - (rd_buf_ptr - rd_buf)) and advance rd_buf_ptr by its return value, which is the number of characters actually written. This both bounds each write to the space left in rd_buf and keeps the output a single, properly terminated string. The now-unused str_len local is removed. Fixes: 41db5f1931ec ("drm/amd/display: set-read link rate and lane count through debugfs") Assisted-by: Copilot:claude-opus-4.8 Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amdgpu: skip the VMID 0 flush for VRAMArunpravin Paneer Selvam
Clear-on-release only runs on VRAM, which amdgpu_ttm_map_buffer() reaches via its direct MC address without programming a GART window, yet the wipe still forces a VMID 0 flush. On GFX11 (e.g. Navi33) that spurious SDMA flush can wedge the engine; only flush when a GART window is actually used. v2: Let amdgpu_ttm_map_buffer() return whether the VMID 0 flush is needed, and drive the clear and copy paths from that. (Christian) v3: Make the vm_needs_flush output parameter mandatory instead of allowing NULL. (Christian) Fixes: a68c7eaa7a8f ("drm/amdgpu: Enable clear page functionality") Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5413 Cc: Christian König <christian.koenig@amd.com> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Reviewed-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>
8 daysdrm/amd/display: Consult MCCS FreeSync cap only if requested & supportedMichel Dänzer
When the do_mccs parameter is false, we don't call dm_helpers_read_mccs_caps, so sink->mccs_caps.freesync_supported is unlikely to be true. Fixes: 6f71d5dd3206 ("drm/amd/display: Read sink freesync support via mccs") Bug: https://gitlab.freedesktop.org/drm/amd/-/work_items/5286 Signed-off-by: Michel Dänzer <mdaenzer@redhat.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 daysdrm/amd/pm: Separate PPT limit restore from smu_set_ac_dcLijo Lazar
Move the PPT limit restore out of smu_set_ac_dc. Keep smu_set_ac_dc only for switching the power source. Drop the restore ppt limit policy parameter and add the restore logic to ac/dc notification path. 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>
8 daysdrm/xe/shrinker: Take a runtime PM ref before shrinking non-system memoryShuicheng Lin
__xe_shrinker_walk() walks the SYSTEM and TT LRUs without a runtime PM reference. Shrinking a bo outside system memory invalidates its GPU mappings, which needs the device resumed, so while it is runtime suspended the page table zap trips an assert and the TLB invalidation returns -ENODEV: WARNING: drivers/gpu/drm/xe/xe_bo.c:770 at xe_bo_move_notify+0x1fc/0x450 [xe] xe_bo_shrink+0x20f/0x2b0 [xe] __xe_shrinker_walk+0x174/0x410 [xe] xe_shrinker_scan+0x10c/0x1e0 [xe] do_shrink_slab+0x176/0x7e0 drop_caches_sysctl_handler+0x9c/0xf0 Take a reference before walking a memory type other than XE_PL_SYSTEM and stop there if it cannot be acquired. Reuse the shrinker's existing acquire path, which resumes the device directly where reclaim allows that and otherwise queues the PM worker for a later scan. Stop the walk once the scan target is met, so a satisfied scan does not wake the device. System memory is still reclaimed while the device is suspended. Gate this on xe_device_is_l2_flush_optimized(), the same condition under which xe_bo_trigger_rebind() issues the invalidation for a non-fault-mode vm, so reclaim is unaffected elsewhere. The System CCS copy already has its own reference in xe_bo_shrink(). Only a non-fault-mode vm can reach this, since a fault-mode vm requires LR mode and that holds a runtime PM reference for the vm's lifetime. Reproduced with igt@xe_madvise@dontneed-before-exec while the GPU is runtime suspended. v2: simplify needs_rpm check. (Matt) retarget Fixes tag since the issue occurs with the non-fault-mode path added by 4e7ebff69aed. v3: handle this in xe_shrinker.c instead of xe_bo.c (Thomas) v4: stop the walk once the scan target is met. (Sashiko) v5: rebase on the freed page accounting fix. (Sashiko) v6: reuse the shrinker acquire path so runtime pm can be resumed directly instead of always queueing a worker. (Thomas) v7: replace xe_pm_runtime_put() with xe_shrinker_runtime_pm_put(). (Thomas) Fixes: 4e7ebff69aed ("drm/xe/xe3p_lpg: flush shrinker bo cachelines manually") Assisted-by: Claude:claude-opus-5 Cc: Tejas Upadhyay <tejas.upadhyay@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Link: https://patch.msgid.link/20260909162102.1097006-3-shuicheng.lin@intel.com Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
8 daysdrm/xe/shrinker: Return the freed page count through a parameterShuicheng Lin
__xe_shrinker_walk() and xe_shrinker_walk() return either the number of pages freed or a negative error, so the two cannot be reported at once. On error the pages already freed are dropped, and since xe_shrinker_scan() only accumulates non-negative returns while *scanned is updated by pointer, the shrinker tells mm that it scanned without freeing. Accumulate the count into a caller-provided counter and return only the status, so an error no longer discards what the walk had freed. Fixes: 00c8efc3180f ("drm/xe: Add a shrinker for xe bos") Assisted-by: Claude:claude-opus-5 Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260909162102.1097006-2-shuicheng.lin@intel.com Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
8 daysdrm/sysfb: Use preferred panel size for panel orientation quirksThomas Zimmermann
Sysfb drivers currently use the given display mode for looking up the panel orientation. But the look-up table stores the native geometry of the panels, so the lookup fails if the current mode sizes differs. Get the panel's native geometry with drm_edid_detect_panel_size() from the EDID and use it for looking up the panel orientation. v2: - ofdrm: validate EDID header before using it (Sashiko) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260904090850.43060-4-tzimmermann@suse.de
8 daysdrm/edid: Add drm_edid_detect_panel_size()Thomas Zimmermann
Add drm_edid_detect_panel_size() to extract the panel's preferred display resolution from a given EDID. Required for setting up DRM's panel orientation quirks in sysfb drivers. v4: - fix test for EDID PTD (Jani) v3: - mention use case in documentation (Jani) - use is_detailed_timing_descriptor() (Jani) - rename helper to drm_edid_detect_panel_size() v2: - handle EDID without pixel timing descriptor (Sashiko) - fix checks for width and height pointers Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260904090850.43060-3-tzimmermann@suse.de
8 daysdrm/ttm: fix swapped-out resources never leaving their bulk_move rangeVadim Nikitushkin
ttm_tt_swapout() returns the number of pages swapped out on success and a negative error code on failure; for a populated ttm it never returns zero. Commit b2ed01e7ad3d ("drm/ttm: Fix ttm_bo_swapout() infinite LRU walk on swapout failure") moved the bulk_move bookkeeping in ttm_bo_swapout_cb() under "if (!ret)", so the ttm_resource_del_bulk_move_unevictable() / ttm_resource_move_to_lru_tail() pair is now skipped on every successful swapout. The equivalent change for the shrinker in commit 1d59f36e95f7 ("drm/ttm: Fix ttm_bo_shrink() infinite LRU walk on backup failure") tests "lret > 0", which is what was intended here as well. Before b2ed01e7ad3d the resource was taken off the bulk_move before the swapout; since then a swapped-out resource stays inside its BO's bulk_move range (and on the manager LRU) although it is unevictable. When it is later freed or the BO leaves the bulk_move (ttm_resource_free(), ttm_bo_set_bulk_move() via amdgpu_vm_bo_del()), ttm_resource_del_bulk_move() skips it because of its !ttm_resource_unevictable() guard, so a range endpoint in pos->first / pos->last is left pointing at freed memory. The next ttm_lru_bulk_move_tail() or ttm_resource_add_bulk_move() on that cursor is a use-after-free, seen as the resv WARN in ttm_lru_bulk_move_add(), "list_del corruption" in ttm_resource_move_to_lru_tail() or a NULL dereference in ttm_resource_manager_next() -- minutes to hours after a hibernation, or at process exit / reboot following one. Samuel Ainsworth's analysis of drm/amd issue 5387 (see Link) identified the dangling cursor; the missing removal at swapout time is the reason it dangles. Testing the condition for success restores the removal. On an AMD Phoenix APU (ASUS UM3406GA, gfx1103) running suspend-then-hibernate on a 7.0.y stable kernel carrying the backport (Ubuntu 7.0.0-31) the bug crashed 5 of 18 hibernation cycles; a function profile of one hibernation showed 336 ttm_tt_swapout() calls and zero ttm_resource_del_bulk_move_unevictable() calls. With this change the removal happens for every swapped-out resource and 12 further cycles were clean. Fixes: b2ed01e7ad3d ("drm/ttm: Fix ttm_bo_swapout() infinite LRU walk on swapout failure") Cc: stable@vger.kernel.org # v7.1+ Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/5387 Link: https://lore.kernel.org/dri-devel/CAHYiNPa6aVacJoLOje-qZ1GyYx-9p0tN4NuP8D_eSL+UJeevXw@mail.gmail.com/ Signed-off-by: Vadim Nikitushkin <bub4z0r@gmail.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20260909205028.13799-1-bub4z0r@gmail.com
8 daysdrm/i915: Perform full wedge on display resetVille Syrjälä
We lost the proper display reset deadlock handling in commit d59cf7bb73f3 ("drm/i915/display: Use dma_fence interfaces instead of i915_sw_fence"). Currently the only thing that eventually breaks the deadlock is the 10 second fence timeout, which is very slow. I tried to essentially restore the previous mechanism via a custom dma_fence in https://lore.kernel.org/intel-gfx/20260408233458.22666-6-ville.syrjala@linux.intel.com/ but Christian didn't want it. The ideal solution would be to allow the reset time modesets to proceed ahead of any already queued atomic commits, but that is quite involved since we need to be able to track the already committed (to the hardware) atomic states in addition to the userspace queued atomic states. Years ago I did implement something like that in https://lore.kernel.org/intel-gfx/20170629134948.5614-1-ville.syrjala@linux.intel.com/ but Sima didn't want it. In order to get rid of the dependency on the timeout, and make things faster, let's just effectively revert the remainders of commit 9db529aac938 ("drm/i915: More surgically unbreak the modeset vs reset deadlock"). The upside is that the reset is fast again, but the downside is that we now do a full wedge on all display resets, which will also kill innocent batches. But perhaps no one really cares since this is currently only needed for old pre-g4x hardware. But if anyone has plans on using eg. FLR as a backup GPU reset on new hardware then we probably need to come up with something better... Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260903130116.19089-1-ville.syrjala@linux.intel.com Acked-by: Jani Nikula <jani.nikula@intel.com>
8 daysdrm/i915/display: check configuration index before shiftingLuca Coelho
The calc_allowed_config_filter() function passes the return value of iter_pos_to_idx() directly to BIT(), but the helper can return -1 for an invalid iterator. The iterator already rejects negative indices before doing a configuration, so this should not matter in normal flows. In any case, for robustness, check the index explicitly and warn if it is negative, avoiding an undefined shift. Fixes: 39e30bdf2f92 ("drm/i915/dp_link_caps: Add link configuration iterator") Reviewed-by: Imre Deak <imre.deak@intel.com> Link: https://patch.msgid.link/20260908100659.113555-1-luciano.coelho@intel.com Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 daysdrm/i915/display: Gate periodic AS SDP skip frames behind a debugfs knobUma Shankar
Periodic AS SDP (skip frames) drives a Panel Replay panel down toward its minimum refresh rate. It is a new, panel- and platform-sensitive behaviour, so keep it opt-in rather than enabling it unconditionally. Expose it as a per-device debugfs knob, enable_periodic_assdp, rather than a module parameter. The behaviour is panel-specific, so the correct granularity is per-device, not per-module. The knob is added through the intel_display_params infrastructure (shared by i915 and xe) with a debugfs entry only. It defaults to false (feature disabled); write 1 to the debugfs file to enable periodic AS SDP at runtime. Gate the feature at its single choke point, intel_pr_as_sdp_skip_frames(): returning a zero skip count when the knob is off makes both the PR_ALPM_CTL programming (intel_alpm_configure_pr_as_sdp()) and the DC3co force-disable predicate (intel_alpm_pr_as_sdp_skip_frames_enabled()) a no-op, so AS SDP continues to be sent on every frame as before. v2: Switch to debugfs entry and drop module param Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Uma Shankar <uma.shankar@intel.com> Reviewed-by: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com> Tested-by: Naladala Ramanaidu <ramanaidu.naladala@intel.com> Link: https://patch.msgid.link/20260909080810.2202879-5-uma.shankar@intel.com
8 daysdrm/i915/display: Reprogram AS SDP skip frames on seamless VRR transitionsUma Shankar
The AS SDP skip-frame count is written to PR_ALPM_CTL only from lnl_alpm_configure(), which runs from intel_psr_enable_locked() on a Panel Replay disabled->enabled transition. VRR, however, can be enabled and disabled seamlessly - without a modeset and without cycling Panel Replay (intel_crtc_vrr_enabling()/disabling() in the pipe update path). As a result, when a panel comes up with VRR off the non-zero skip count is programmed, and when VRR is later turned on seamlessly PR stays enabled, lnl_alpm_configure() is not re-invoked, and the stale skip count is left in the register. This also leaves the coupled AS SDP transmission / DC3CO idle-protocol bits inconsistent with the DC3co state, which is recomputed on every commit. Factor the PR_ALPM_CTL AS SDP programming out of lnl_alpm_configure() into intel_alpm_configure_pr_as_sdp() and expose intel_alpm_pr_as_sdp_update(), which recomputes those fields for the current VRR state. Call it from the seamless VRR enable and disable sites (non-modeset only; a modeset re-runs PR enable anyway) so the skip counter always matches whether VRR is actively driving the refresh rate. v2: Fixed Sashiko review comments Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Uma Shankar <uma.shankar@intel.com> Reviewed-by: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com> Tested-by: Naladala Ramanaidu <ramanaidu.naladala@intel.com> Link: https://patch.msgid.link/20260909080810.2202879-4-uma.shankar@intel.com
8 daysdrm/i915/display: Force disable DC3co when AS SDP skip frames is enabledUma Shankar
Periodic AS SDP (skip frames) relies on the AS SDP still being transmitted while Panel Replay is active. DC3co uses the idle protocol which suppresses AS SDP transmission entirely, so the two are mutually exclusive: leaving DC3co enabled while skip frames is programmed breaks the periodic AS SDP and the panel never sees the slower refresh. Add intel_alpm_pr_as_sdp_skip_frames_enabled() as the single predicate for "skip frames will be programmed" (mirroring the gating in lnl_alpm_configure(), including that it only applies when VRR is not active) and use it in intel_display_power_dc3co_compute() to force the DC3co trigger to NONE. This drops the pipe onto the DC_STATE_EN_UPTO_DC6 target instead of DC3co whenever skip frames is active, without touching the DC state module parameter or the allowed DC mask, and only for the skip-frame case. v2: Fixed Sashiko review findings Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Uma Shankar <uma.shankar@intel.com> Reviewed-by: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com> Tested-by: Naladala Ramanaidu <ramanaidu.naladala@intel.com> Link: https://patch.msgid.link/20260909080810.2202879-3-uma.shankar@intel.com
8 daysdrm/i915/display: Enable periodic AS SDP skip framesUma Shankar
When Panel Replay is active the transcoder timing generator runs at the panel's maximum refresh rate. To drive the panel down to its minimum refresh rate the Adaptive-Sync SDP (AS SDP) only needs to reach the panel once per minimum-rate frame, so transmitting it on every (maximum-rate) frame is redundant and shows up as repeated SDPs on the link. Xe3p_LPD adds a HW skip-frame counter in PR_ALPM_CTL that lets the source send a single AS SDP and then suppress it for a programmed number of frames. Program this counter so that one AS SDP is followed by (max_vrefresh / min_vrefresh - 1) idle frames, i.e. one AS SDP per slowest panel frame, allowing the link to be driven down to as low as 1Hz when the hardware supports it. The maximum and minimum refresh rates come from the panel's adaptive-sync monitor range, so the skip count is a function of the sink's capabilities and independent of the current content/flip rate. If the panel does not advertise a usable range the skip counter is left at zero, i.e. the feature is a no-op and AS SDP continues to be sent on every frame. Periodic AS SDP drives the panel down to its minimum refresh rate on its own, so it is only programmed when VRR is not actively driving the refresh rate. The skip-frame mechanism relies on the AS SDP still being transmitted (just less often) while Panel Replay is active, so when a non-zero skip-frame count is programmed both PR_ALPM_CTL_AS_SDP_TRANSMISSION_IN_ACTIVE_DISABLE and PR_ALPM_CTL_USE_DC3CO_IDLE_PROTOCOL are left cleared. The previous behaviour (honouring disable_as_sdp_when_pr_active and the DC3CO idle protocol) is retained for the non skip-frame case. v3: Fixed Sashiko review findings v2: Decoupled CMMRR dependency and using sink refresh rate range for skip frame claculations. This addresses Dibin's review feedback as well. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Uma Shankar <uma.shankar@intel.com> Reviewed-by: Dibin Moolakadan Subrahmanian <dibin.moolakadan.subrahmanian@intel.com> Tested-by: Naladala Ramanaidu <ramanaidu.naladala@intel.com> Link: https://patch.msgid.link/20260909080810.2202879-2-uma.shankar@intel.com
8 daysdrm/i915: Fix memory leak in query_perf_config_list()Thorsten Blum
When krealloc() fails, free the original oa_config_ids before returning to avoid a memory leak. Fixes: 4f6ccc74a85c ("drm/i915: add support for perf configuration queries") Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Cc: <stable@vger.kernel.org> # v5.5+ Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patch.msgid.link/20260823205028.178597-2-thorsten.blum@linux.dev (cherry picked from commit 9977e9d84f46d4f12ad35fbbc0ec4638554bce87) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 daysdrm/i915/dp: Gate UHBR SST SDP splitting on sink capabilityMitul Golani
SDP splitting for 128b/132b (UHBR) SST audio must only be enabled when the sink advertises support for it. Previously sdp_split_enable was set for every UHBR SST stream carrying audio, regardless of sink capability. In MST mode SDP splitting is inherently supported, so the sink capability check (DP_SST_SPLIT_SDP_CAP) is applied only to the SST path. Fixes: 8853750dbad8 ("drm/i915: Enable SDP split for DP2.0") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Link: https://patch.msgid.link/20260825073204.872441-1-mitulkumar.ajitkumar.golani@intel.com (cherry picked from commit b37921c9f533ca936c5b5a484c1299680c570a7e) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 daysdrm/hibmc: Set up vblank event to be send on the next vblankThomas Zimmermann
Do not send the vblank event when the page flip completes, but when the vblank interrupt fires. Sending the vblank event at the wrong time can break synchronization of the display update with the vblank period. Use the vblank helper drm_crtc_vblank_atomic_flush(), which sets up the vblank event accordingly. In case of an error, it still sends out the vblank event immediately; thus not starving consumers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Yongbang Shi <shiyongbang@huawei.com> Link: https://patch.msgid.link/20260827082915.61176-3-tzimmermann@suse.de
8 daysdrm/hibmc: Return IRQ_NONE for unhandled interruptsThomas Zimmermann
Let the kernel know if hibmc did not handle an interrupt. Allows the kernel to detect spurious interrupts and maintain diagnostics. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Yongbang Shi <shiyongbang@huawei.com> Link: https://patch.msgid.link/20260827082915.61176-2-tzimmermann@suse.de