summaryrefslogtreecommitdiff
path: root/drivers/gpu
AgeCommit message (Collapse)Author
2026-08-25drm/amd/display: Test DMUB reg callbacksAlex Hung
[WHAT] Add KUnit tests for amdgpu_dm_dmub_reg_read() and amdgpu_dm_dmub_reg_write(), the register accessors the DMUB service is created with. [HOW] Both accessors reach the hardware through cgs_read_register() and cgs_write_register(), which dispatch through the ops table at the start of struct cgs_device. Add a fake CGS device that records the offset and value of each access, so the callbacks can be driven without real MMIO. The test writes a value through the write callback and reads it back through the read callback, confirming both forward to the DC context of the device passed as their opaque user context. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test dp_handle_test_pattern_request patternsAlex Hung
[WHAT] Add KUnit tests for dm_helpers_dp_handle_test_pattern_request() covering the link test pattern mapping, the colour space mapping, the bit depth change that retimes the stream, and the case where no connector is available to store the original timing. [HOW] Fake link service and clock manager callbacks record the requested pattern instead of programming the PHY or the clocks. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test dm_helpers_read_local_edidAlex Hung
[WHAT] Add KUnit tests for dm_helpers_read_local_edid() covering the AUX read that returns a valid EDID, the compliance test request that acknowledges the EDID checksum, and the I2C path where no sink responds. [HOW] The helper publishes the EDID through drm_edid_connector_update(), which needs a fully initialised connector, so the tests build a real one. A fake AUX channel serves the EDID and answers the native DPCD reads, and a fake I2C algorithm always reports no response. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test dm_helpers_is_dp_sink_presentAlex Hung
[WHAT] Add a KUnit test for dm_helpers_is_dp_sink_present() that walks past the early NULL checks and reaches the link service query. A fake detect_dp_sink_present callback reports a sink, which covers the DDC lookup and the return of the link service result. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test dm_helpers_dmub_set_config_syncAlex Hung
[WHAT] Add a KUnit test for dm_helpers_dmub_set_config_sync() that submits a SET_CONFIG payload without a DC DMUB service. The command cannot reach the firmware, so the helper still returns success while reporting SET_CONFIG_UNKNOWN_ERROR. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test GPU memory allocate and free helpersAlex Hung
[WHAT] Add a KUnit test for dm_helpers_allocate_gpu_mem() and dm_helpers_free_gpu_mem() that allocates a DMUB tracebuffer and frees it again, checking the returned CPU pointer and GPU address. [HOW] amdgpu_bo_create_kernel() and amdgpu_bo_free_kernel() need a live TTM device, so both are replaced by a fake through the existing amdgpu_dm_services KUnit operations table. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test dm_helpers_submit_i2c_over_auxAlex Hung
[WHAT] Add a KUnit test for dm_helpers_submit_i2c_over_aux(), which is still an unimplemented stub, to pin down that it reports failure. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test MST stream feature read failureAlex Hung
[WHAT] Add a KUnit test for dm_helpers_mst_enable_stream_features() that fails the DP_DOWNSPREAD_CTRL read. The helper must bail out without writing the register back, which covers the early return on a failed DPCD read. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test execute_synaptics_rc_command failuresAlex Hung
[WHAT] Add KUnit tests for execute_synaptics_rc_command() covering the three AUX write failures that were untested (data, offset and command), plus the poll loop that waits for the command to go inactive. The Synaptics AUX fake gains a busy read counter so it can report the command as still active for the first reads. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test EDID quirks and ACPI EDID readAlex Hung
[WHAT] Add KUnit tests for apply_edid_quirks() covering the two quirk entries that had no coverage: the Apple Studio Display tile quirk and the Lenovo G34w-30 FreeSync minimum refresh rate override. Both tests build an EDID carrying the quirked panel ID and check the resulting dc_edid_caps panel patch. Add a KUnit test for dm_helpers_read_acpi_edid() that lets an eDP connector reach drm_edid_read_custom() instead of returning early. The probe callback finds no ACPI companion, so the helper returns NULL, which covers the read and the failure return. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Fix CalculateFlipSchedule CalculationAustin Zheng
[Why/How] Row bandwidth contribution to lb_flip_bw was refactored to only consider bandwidth needed for a single row. row_time_budget is for 2 row's worth of time but only half is needed when calculating the row bandwidth used in the lb_flip_bw calculation. Also add meta row bytes that was accidentally removed during previous refactor. Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Disable alt-ch until dependencies are readyAlvin Lee
[Description] - Alt-Ch cannot be enabled until all dependncies are ready (SMU needs to support double p-state + IFWI needs to support G7 regions enabled). - If PMFW enables UCLK DPM without double p-state support and alt-ch is enabled then hangs could occur Reviewed-by: Dillon Varone <Dillon.Varone@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Signed-off-by: Ivan Lipsi <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Clear HUBPREQ_DEBUG_DB on DCN6Ilya Bakoulin
[Why/How] Make sure the HUBPREQ_DEBUG_DB register is cleared to prevent underflow in some instances. Reviewed-by: Dillon Varone <Dillon.Varone@amd.com> Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Cover HDMI infoframe/freesync timing pathsBhawanpreet Lakha
Add KUnit tests for fill_stream_properties_from_drm_display_mode(): an HDMI stream signal that runs the AVI/vendor infoframe block and overwrites the VIC, and a mode matching the connector freesync base mode that takes timing from the drm mode fields with a 10x pixel clock. 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: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Cover amdgpu_dm_update_connector_after_detectBhawanpreet Lakha
Add KUnit tests covering amdgpu_dm_update_connector_after_detect(): the MST-sink early return, connect with and without EDID, disconnect teardown, and the four forced emulated-sink paths. Sinks the function releases to zero use real allocations while retained sinks use kunit-managed memory to keep dc_sink refcounting balanced. 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: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Cover MST-start failure in detect_mstBhawanpreet Lakha
Add a KUnit test for amdgpu_dm_detect_mst_link_for_all_connectors() where an MST branch fails to start its topology manager. A powered-down aux forces drm_dp_mst_topology_mgr_set_mst() to fail on its initial DPCD read, exercising the error path that downgrades the link and stops the manager. 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: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Cover amdgpu_dm_encoder_initBhawanpreet Lakha
Add a KUnit test that initializes a TMDS encoder on a DRM device embedded in an amdgpu_device and verifies the derived possible_crtcs mask, the encoder id set from the link index, and the attached helper funcs. 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: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Cover MST path in encoder atomic_checkBhawanpreet Lakha
Add KUnit tests for the multi-stream transport validation path in dm_encoder_helper_atomic_check(). A shared scaffold builds a fully faked DRM atomic state (private objs, connectors, MST payload list) plus a fake DC link so the PBN divider is non-zero, exercising the topology-state lookup, color-depth/PBN compute, VCPI slot allocation, and both the topology-error and negative-vcpi_slots failure branches. 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: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test GPU memory allocationAlex Hung
[WHAT] Add KUnit tests covering GART and VRAM domain selection, size and alignment forwarding, the buffer object creation failure path, and the free path for a matching pointer, a non-matching pointer and an empty allocation list. [HOW] Add struct amdgpu_dm_services_kunit_ops, a KUnit-only indirection table for the buffer object calls that would otherwise need a live TTM device. Tests install their own table to force an error return and to count calls, which makes the failure and list handling paths reachable in the UML test environment. The default table points at the existing AMDGPU functions, so no test-only wrapper is introduced. Route the affected calls through services_bo_* wrappers, so the KUnit build dispatches through the table while non-KUnit builds call the same functions directly. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Test writeback connectorAlex Hung
[WHAT] Add KUnit tests for the writeback connector. The tests cover the encoder atomic check (missing job, missing framebuffer, matching mode, width, height and combined size mismatches, and an unsupported pixel format), mode enumeration and its 3840x2160 bound, connector initialization, and buffer object preparation and cleanup including the reserve, fence slot, pin and GART allocation failure paths. [HOW] Add struct amdgpu_dm_wb_kunit_ops, a KUnit-only indirection table for the buffer object calls that would otherwise need a live TTM device. Tests install their own table to force error returns and to count calls, which makes the failure and cleanup ordering paths reachable in the UML test environment. The default table points at the existing AMDGPU, TTM and DMA reservation functions, so no test-only wrapper is introduced. Route the affected calls through wb_* wrappers, so the KUnit build dispatches through the table while non-KUnit builds call the same functions directly. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Fix DPREFCLK override when SMU isn't present or ready for ↵Meera Patel
DCN315 [Why] If SMU has not loaded properly or is not present in a test environment, then the DPREFCLK is overridden with an invalid value. [How] Add an SMU present check and shift the override below the check. Reviewed-by: Dmytro Laktyushkin <dmytro.laktyushkin@amd.com> Signed-off-by: Meera Patel <meera.patel@amd.com> Signed-off-by: Dmytro Laktyushkin <dmytro.laktyushkin@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Split OPTC_PIPE_CONTROL_LOCK into smaller HWSS blocksTomasz Siemek
[why] Block level sequence operations should not use global state structs such as pipe_ctx. OPTC_PIPE_CONTROL_LOCK is a BLS with complex logic dispatching a lot of smaller hardware programming operations. BLS should be a simple and atomic hardware operation without performing mutations or having an access to global state. All operations on global state should be moved to build step in HWSS. [how] - Split OPTC_PIPE_CONTROL_LOCK into substeps: - HUBP_WAIT_FLIP_PENDING, - TG_SET_GSL, - TG_SET_GSL_SOURCE_SELECT, - TG_LOCK, - TG_3DLUT_WA_UNLOCK. - Add hwss_pipe_control_lock - for in place build + execution. - Remove timeout from HUBP_WAIT_FOR_FLIP_PENDING. - Move software logic to builder. which fills pipe_control_lock_params containing data for programming actual hwss blocks. - Due to differences in what pipe control lock means bettween asics following builder variants are added: - dce_build_pipe_control_lock_sequence for asics pre DCN20, - dcn20_build_pipe_control_lock_sequence. - Rework gsl group programming to use builder / executor pattern. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Tomasz Siemek <tomasz.siemek@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Refactor DPP_SET_INPUT_TRANSFER_FUNC to drop pipe_ctxTomasz Siemek
[Why] Pipe_ctx shouldn't be passed as block sequence block parameter. [How] - Adjust arguments for: - set_input_transfer_func, - populate_mcm_luts, - set_mcm_location_post_blend, - set_mcm_luts, - program_rmcm_luts. - Remove const qualifier from plane_state in set_mcm_luts since it is mutated. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Tomasz Siemek <Tomasz.Siemek@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Fixes for HPO test regressionsSridevi Arvindekar
[Why&How] Updates and fixes to HPO functionality, initialization, encoder configuration and platform-specific behavior. Reviewed-by: Wenjing Liu <wenjing.liu@amd.com> Signed-off-by: Sridevi Arvindekar <sridevi.arvindekar@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/display: Fall back to overlay cursor on dcn4x when top plane doesn't ↵James Lin
fill CRTC [why] amdgpu_dm_crtc_get_cursor_mode() returns DM_CURSOR_NATIVE_MODE early and unconditionally for dcn4.x. That early return was added because these ASICs no longer have the cursor-on-scaled-plane or cursor-on-yuv-plane restrictions of older DCN, so native cursor is fine in those cases. However, it also bypasses the "does the top plane fill the CRTC?" (hole) evaluation further down. When the top/primary plane does not cover the whole CRTC, the cursor must fall back to an overlay plane so it is composited over the uncovered region; keeping the native cursor there produces an incorrect result. As a consequence igt@amdgpu/amd_cursor_overlay@non-full, which verifies exactly this native->overlay fallback, fails on dcn42. [how] Change unconditional early return with a skip_fmt_scale_restrictions flag. For dcn4.x keep skipping the YUV / active-color-pipeline / different-scale overlay triggers (genuinely unnecessary on this hardware), but fall through to the existing entire_crtc_covered check so a top plane that does not fill the CRTC still selects DM_CURSOR_OVERLAY_MODE. Native mode is still chosen when the plane covers the whole CRTC. Update the amdgpu_dm_cursor KUnit tests accordingly: exercise the dcn4x path with a full atomic state fixture (full coverage -> native) and add a dcn4x hole case (top plane does not fill the CRTC -> overlay). Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: James Lin <PingLei.Lin@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: keep the established socket id layout on older partsXiang Liu
Reporting the RAS capability mask through the ras "features" sysfs node changed the layout that node has always used, so the existing consumer misreads it on the parts it already supports. XGMI error injection then targets the wrong device and the RAS TA rejects it with RAS_TA_STATUS__ERROR_PCS_STATE_HANG. Keep the established layout on parts released before the new one, and stop assigning the multi bit adev->ras_enabled to the single bit en field. Fixes: 375f15db1eb1 ("drm/amdgpu: Support obtaining ras capabilities") Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: use the per-ASIC reserved VRAM size for the bad page thresholdXiang Liu
The default bad page threshold is derived from the VRAM reserved for retirement, but ras_eeprom_i2c_config() hardcodes RAS_RESERVED_VRAM_SIZE_DEFAULT. amdgpu_ras_validate_threshold() instead derives it from con->reserved_pages_in_bytes, which amdgpu_ras_init_reserved_vram_size() doubles on MP0 v13.0.14. That part therefore ends up with a 128 bad page threshold where it should have 256, and reaches the limit after half as many retirements as intended. Reuse the value already computed for con->reserved_pages_in_bytes rather than deriving it again, so the two cannot drift apart. Fixes: c32092c39fa0 ("drm/amd/ras: Refactor EEPROM parameter config to support multiple ras EEPROMs") Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: request GFX RAS features through ras_mgrXiang Liu
psp_ras_enable_features() returns 0 without sending anything once the RAS TA is loaded by ras_mgr, and nothing on that path sends ENABLE_FEATURES either. GFX RAS features therefore end up enabled by no one, silently, because the helper still reports success. This is harmless at boot, where the TA is loaded with poison_mode_en set while GFX is freshly initialized. It is not harmless across a reset: a mode2 reset clears the GFX side, amdgpu_gfx_ras_late_init() re-runs from the reset handler but its enable request goes nowhere, and GFX stops raising SQ EDC_FED. The visible effect is that only the first poison injection after boot is ever consumed. Every later one creates the poison in HBM and is never reported, since the first injection triggers the reset that breaks reporting. Add ras_psp_enable_features() to send ENABLE_FEATURES/DISABLE_FEATURES to the TA owned by ras_mgr, and route amdgpu_ras_feature_enable() through it. Newer parts arm RAS features inside the TA and must not be toggled by the driver, so restrict the request to GFX IP versions below 12.1.0. Fixes: e21b4356a304 ("drm/amdgpu: add switch to select firmware loading path for RAS RL and TA") Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: fix CPER command record retrievalXiang Liu
The CPER command reports the next batch ID as the latest valid record and does not handle a request starting at the write pointer. Batch trace responses also copy only the ACA interpretation of the log union. Report the latest valid CPER ID, select the preceding record for a write pointer request, expose a bounded command transfer size, and copy the complete log body for batch trace records. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: assign BERT platform record ownershipXiang Liu
IA processor and Platform Memory BERT sections are system-wide records and must not be copied into every GPU RAS ring. Per-socket GPU records still need to be offered to each matching GPU. Assign platform sections to the first eligible RAS instance and claim each GPU socket before parsing its cached BERT data. Serialize ownership with the shared mutex and retain the state until the final RAS device exits. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: parse and route BERT sectionsXiang Liu
BERT may contain structured AMD crashdump, IA processor, Platform Memory, PCIe, and SMN sections. Replaying all sections for every GPU either duplicates GPU records or drops CPU and platform records when their topology IDs are compared with GPU OAM IDs. Parse the supported section formats in rascore. Route GPU records using the OAM identity and gate CPU and platform sections through an explicit owner selected by the operating-system integration layer. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: collect CPU MCE metadataXiang Liu
Processor CPER generation needs the APIC ID and bank number from the x86 machine-check record. CPU banks must also be logged by only one GPU to avoid duplicate processor records. Copy the APIC ID and bank number into the rascore ACA bank and route CPU banks through the first registered GPU. Keep GPU banks routed by their decoded socket ID. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: generate Platform Memory CPER recordsXiang Liu
Preserve standard Platform Memory sections recovered from BERT instead of wrapping them in the AMD crashdump format. Validate each boot section, copy its raw payload unchanged, align each complete record to a 32-bit boundary, and report the exact serialized size. Route Platform Memory records through a dedicated generator, independently of crashdump and processor records. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: generate processor CPER recordsXiang Liu
Encode runtime CPU machine checks with the standard IA Processor section, including APIC ID, machine-check status, bank MSR address, and SMCA register context. Also preserve IA Processor sections recovered from BERT as boot-notified records with their original context metadata and variable payload size. Route both forms through a processor-specific generator so they remain separate from AMD crashdump records. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: generate AMD crashdump CPER recordsXiang Liu
Populate the AMD crashdump common header and error information before serializing fatal and boot records. Validate that batched boot records share a section type, clamp the register context to the crashdump payload, and account for each record header when sizing the output. Keep AMD record dispatch in a dedicated helper so processor and Platform Memory generation can be added independently. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: define processor and memory CPER formatsXiang Liu
CPU machine-check and platform boot errors require standard processor and Platform Memory section definitions. The AMD crashdump format also uses a 64-byte common header followed by a common error information structure. Add the required GUIDs, validity fields, processor structures, and AMD crashdump wire layout so rascore can generate each record type. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: preserve CPU MCE context in the log ringXiang Liu
Processor CPER generation needs the APIC ID and machine-check bank number in addition to the ACA register values. Logging the full internal ACA bank also exceeds the stable fixed-size log body representation. Carry the APIC ID and bank number with incoming ACA banks and store CPU MCE events in a compact 128-byte log context for later CPER encoding. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: classify ACA v5 MCE statusXiang Liu
Machine-check records may not carry the hardware-maintained UMC error count expected by the normal polling path. As a result, valid deferred, uncorrected, and corrected MCE status values can remain unclassified. For MCE-originated banks, classify the error directly from the MCA status bits when normal UMC decoding does not produce an error count. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: allow waking RAS processing without an eventXiang Liu
GPU MCE handling queues bank data directly in the MCE FIFO and only needs to wake the RAS processing thread. Requiring a separate event request prevents this path from scheduling processing when no event object is available. Permit a NULL request to skip event queue insertion while still incrementing the interrupt request count and waking the processing thread. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: move BERT boot errors to BERT sw initXiang Liu
Keep BERT boot-error handling owned by the BERT module instead of letting the MCE notifier lifecycle drive BERT processing and cleanup. Group the cached boot-error state into a single structure so the related poll result, raw record data, per-socket write tracking, and lock are managed together. Expose only the standard BERT sw_init/sw_fini entry points. The RAS manager calls them around the existing MCE sw lifecycle, while the MCE code no longer includes BERT headers or calls BERT helpers directly. This lets BERT process cached boot records earlier in the RAS manager sw_init path and release its cached state independently during sw_fini. Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: increase page buffer size for A+AYiPeng Chai
Increase page buffer size for A+A. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: fix and improve bad page count calculationYiPeng Chai
Fix an issue where the saved bad page count is always zero. The cur_nps_valid_page_num field in the record already tracks the available bad page count, so use it directly to calculate the correct saved bad page number. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: filter out invalid pages from extended page addressesYiPeng Chai
Filter out invalid pages from extended page addresses. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: populate cper aca register info for rma deviceYiPeng Chai
Populate cper aca register info for rma device. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: add interface and improve extensibilityYiPeng Chai
Add interface and improve extensibility. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: unify variable naming conventionsYiPeng Chai
Unify variable naming conventions. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: fix ras cmd returning incorrect cper countYiPeng Chai
Fix ras cmd returning incorrect cper count. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: refactor ras cper to simplify adding new cper eventsYiPeng Chai
Restructure ras cper to improve extensibility, making it straightforward to add and handle new cper event types. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amdgpu: extend ras feature mask to 64-bit for A + AYiPeng Chai
Extend ras feature mask to 64-bit for A + A. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25drm/amd/ras: add module parameter for unirasYiPeng Chai
Add module parameter for uniras. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>