Repository navigation
drm/amd/ras: attribute MP5-aggregated GFX MCA banks to GFX - #236
Open
tpatward-amd wants to merge 3475 commits into
Open
tpatward-amd wants to merge 3475 commits into
tpatward-amd wants to merge 3475 commits into
Conversation
The heavy weight shootdown need special handling in MES sched pipe Signed-off-by: Shaoyun Liu <shaoyun.liu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
status_ptr was declared as u64 * but the WB allocation is only one u32. Writing through a u64 * pointer zeroed 8 bytes, corrupting the adjacent WB slot. Fix by using u32 * to match the actual allocation size. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
…down On process teardown, kfd_process_notifier_release_internal() called kfd_process_dequeue_from_all_devices() (which issues the MES SET_SHADER_DEBUGGER process_ctx_flush=1 that retires the process context) before kfd_dbg_trap_disable(). For a process under a debugger, the debug teardown path (kfd_dbg_trap_disable -> kfd_dbg_trap_deactivate) then issues several SET_SHADER_DEBUGGER process_ctx_flush=0 packets (reset wave launch mode, clear debug flags, reset MES debug mode). Because those packets carry the process_context_addr, MES re-adds the process to its scheduler list after the flush had retired it. Teardown then frees proc_ctx_bo, and a later MES scheduling pass dereferences the freed process context, producing a GPUVM page fault (vmid 0, GC_UTCL2) on the freed page. This is intermittent because it depends on an MES pass landing on the process before its GART page is reused. It is specific to the debugger path, where queues are added with skip_process_ctx_clear=1 so the last REMOVE_QUEUE does not clear the context and delisting relies on the flush. Reorder teardown so debug is disabled first, and the process context is flushed/retired last, so nothing re-adds the process after it is retired. kfd_dbg_trap_disable() now runs while queues still exist, which matches the normal live debug-disable ordering. Signed-off-by: Alex Sierra <alex.sierra@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
GFX12.1 doesn't follow the pair-wise CU mask requirement as is the case for GFX 10,GFX 11 and GFX 12. Currently, the ioctl call is returning error because of this incorrect condition of checking for a pair of CUs to be enabled in the CU mask. Fix the issue by removing this check for GFX 12.1. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
For GMC v12.1.0, the IH cookie NodeID spacing is 8 (MID0=0x0, MID1=0x8), not 4. The wrong divisor caused NPA page faults (node_id=8) to select mmhub2 instead of the correct mmhub1. Fix the divisor from 4 to 8, and add a comment documenting the NodeID to DIE mapping for reference. Warn once if page fault from the vmhub but vmhub print fault status function not initialized because not all hubs are initialized. Signed-off-by: Philip Yang <Philip.Yang@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
mmhub v4_2_0 used adev->aid_mask as the mid_mask when programming MMHUB instances. That assumption is not valid for products with more AIDs than MIDs. Track discovered MMHUB instances in mmhub.inst_mask and use that mask for mmhub v4_2_0 programming paths. Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Le Ma <le.ma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
gmc v12_1 currently derives the number of mmhub vmhubs from the aid_mask when populating vmhubs_mask. This breaks when mmhub is represented by mid and mmhub inst_mask does not match the aid_mask. Iterate over adev->mmhub.inst_mask instead so vmhubs_mask reflects the discovered mmhub instances. Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Mangesh Gadre <Mangesh.Gadre@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
The current combination of PTE flags to translate a retry fault into a no-retry fault is not valid for GFX12. Use a valid no-retry PTE flags combination that works for GFX 12. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This reverts commit bfeb7b2. Revert the rev 0x1 (B0) special case for IP_VERSION(12, 1, 0) that forced noretry_default off. Align GFX12.1.0 with the GC >= 10.3.0 noretry default. Signed-off-by: Alex Sierra <alex.sierra@amd.com> Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Work around this in both the amdgpu GMC and KFD SVM paths by explicitly selecting MTYPE_NC for remote memory when amdgpu_mtype_local is 0. Remove this once rev_id-based AID detection is reliable. Signed-off-by: Alex Sierra <alex.sierra@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Clean up gfx_v12_1_ring_emit_vm_flush function, since PFP_SYNC_ME cmd not support on gc v12_1, and it does not have gfx ring. Signed-off-by: Likun Gao <Likun.Gao@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Update the address mask to support 52-bits addresses when validating the PDE addresses for GFX 12.1. Currently the address mask was incorrect and only permitted 48-bits addresses. Additionally, drop the BUG_ON() and replace it with code to reset the invalid address and valid bit if the address verification fails. This should help generate a page fault instead of crashing the kernel. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Philip Yang <philip.yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Use global SMN addresses for MMHUB v4_2_0 register access across all instances. Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Le Ma <Le.Ma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
VM fault status is 64 bits on gfxhub v12_1 and mmhub v4_2, with fields such as FED located in the upper status register. Add an optional HI32 fault status callback to help identify FED status on gfxhub v12_1 and mmhub v4_2 Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Horatio Zhang <hongkun.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
…e job amdgpu_vm_sdma_update() keeps the number of free dwords of the current job in a local variable. When the job runs out of room it is committed and a new one is allocated, but that local variable is not refreshed and still describes the job which was just submitted. The stale value is then used to decide how many PTEs fit into the new job. If it happens to be copy_pte_num_dw + 7, or one more than that, the result is zero. copy_pte() encodes the transfer size as count * 8 - 1, so a count of zero asks the engine for a 1GB copy starting inside the IB pool. That runs off the end of the pool, faults on the first unmapped GART page above it and hangs the ring. Re-initialize the estimate from the newly allocated job, which is empty and therefore has its full budget available. Cc: stable@vger.kernel.org Signed-off-by: YuBiao Wang <YuBiao.Wang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Enable translate further for gc v12_1 to resolve the tlb reach issue v2: ensure PTE.P is set to 1 for leaf PTE v3: Do not clear the P bit when it has been set on a PDB0 entry by the common VM update code Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Horatio Zhang <hongkun.zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add the get_rom_offset callback to retrieve the VBIOS ROM offset from REGS_ROM_OFFSET_CTRL for vbios imaging fetching from spirom. Signed-off-by: Le Ma <le.ma@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
When VBIOS is not available, fallback to use 100M for refclock value. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
The default SMU message timeout may be too short for the
PrepareMp1ForUnload message on smu_v15_0_8, leading to spurious
-ETIME errors under load or slow firmware response conditions.
Introduce SMU_V15_0_8_MSG_TIMEOUT_US (5 seconds) and apply it to:
- smu_v15_0_8_notify_unload(): switch from smu_cmn_send_smc_msg()
to smu_cmn_send_smc_msg_with_params_ext() to pass the explicit
timeout.
v2: Use c2pmsgctl and args directly (Lijo)
Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add soc_v1_0 reset handler for mode2 reset v2: Remove XGMI parallel reset dispatch and xgmi_update_topology() call, reset on soc_v1_0 is per-device only. (Lijo) v3: Remove ras as will be plugged later as separate ip. Remove vcn from ip mask as vcn not part of reset sequence yet (Lijo) Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Trigger reset init and fini for smu_v15_0_8 Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add dacee_be, ucie_pcs, lsdma aca blocks mapping, add pcs_xgmi aca block info. Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add interrupt manager for handling psp interrupts and callbacks to enable/disable psp interrupts. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Register and add interrupt handler in PSP v15.0.8. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Enable psp v15_0_8 RAS support. Signed-off-by: Candice Li <candice.li@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add a helper that prints the actual vs expected signature for debugging purpose. Signed-off-by: Feifei Xu <Feifei.Xu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
MEM_RESERVED_INFO holds the reserved info like size/offset for
firmware usage.
On soc_v1_0, MASTER_DIE_UMF_REGION_ID is to query UMF reserved region
info for master die MPASP. SPECIFIC_PURPOSE_REGION_ID is to query VRAM
base.
v1->v2: convert // to /* */ and move comments ahead of declarations
(per Christian's review)
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
On DKMS builds, amdgpu fails with: error: expected specifier-qualifier-list before 'DECLARE_FLEX_ARRAY' from drivers/gpu/drm/amd/include/discovery.h:162. kcl_amdgpu_drm_fb_helper.h includes amdgpu.h, which pulls in amdgpu_discovery.h -> discovery.h where DECLARE_FLEX_ARRAY is used. When kcl_stddef.h is not visible early enough, this macro is undefined at parse time. Fix by including kcl_stddef.h directly in kcl_amdgpu_drm_fb_helper.h, so the dependency is self-contained and no longer sensitive to include order in backport.h. it's caused by 8997539 "drm/amdgpu: add MEM_RESERVED_INFO to discovery table" Signed-off-by: Yang Su <Yang.Su2@amd.com> Reviewed-by: Bob Zhou <Bob.Zhou@amd.com>
Add a NPS_INFO case with check_table=false to skip annoying "invalid ip discovery table id" error. Signed-off-by: Feifei Xu <Feifei.Xu@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Suggested-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add interface to query the optional MEM_RESERVED_INFO table:
- introduce amdgpu_discovery_get_mem_reserved_info_table() which
resolves the table from the discovery binary and caches the pointer
in adev->discovery.mem_reserved_table so subsequent lookups are
cheap;
- invoke it once at init time. Missing/invalid table is non-fatal.
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[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> Change-Id: I7a647955f7e243d8dab8da3c501ec724eef74a31
[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> Change-Id: I68ecdd72515cf6b56bec78c28f43d01071636ff1
Revert commit 067059c28ffb ("drm/amd/display: Fix CalculateFlipSchedule Calculation")
Because it causes some regression
Reviewed-by: Austin Zheng <austin.zheng@amd.com>
Signed-off-by: Samson Tam <samson.tam@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Change-Id: Idd9ee7ebaa646f806d4957b38cad2c4f367f3c42
[Why & How] Always set DISPCLK per surface. Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Change-Id: I2547376e9516ca1b3594b7f2bd5a40154b4c1fba
…nded Requests [Why & How] dcn5_calculate_urgent_burst_factor function is aware of unbounded request mode making the buffer larger Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Change-Id: Ia4737ee044d5f1a758aae90cd909d0b23560774d
Revert commit c3ae66ed0ee3 ("drm/amd/display: Unify CalculateFlipSchedule Logic")
Because it causes some regression
Reviewed-by: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Austin Zheng <Austin.Zheng@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Change-Id: I900439316cfa911551462b7f7816e2de6471664b
[Why] DCN6 core mode support/programming call DCN5 and DCN6 calcs functions directly by name. The calcs layer needs one seam the funcs layer can go through instead of hardcoding a generation. [How] Add union dml2_core_calcs holding one function pointer table per generation, plus a calcs field on dml2_core_instance and on the mode support/programming contexts. Add dml2_core_dcn6_calcs.c/.h defining struct dml2_core_dcn6_calcs, a flat table covering every DCN6 calcs function and every DCN5 calcs function DCN6 reuses, and dml2_core_dcn6_calcs_init() to populate it. Call dml2_core_dcn6_calcs_init() from dml2_core_dcn6_funcs_initialize(). Reviewed-by: Austin Zheng <austin.zheng@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> Change-Id: Ic1e95024f1baa7884f2811e3e6d45469317bc578
…er table [Why] dml2_core_dcn6_funcs_mode_support.c called DCN5 and DCN6 calcs functions directly by name, coupling the mode support flow to specific generations. Routing through the calcs table lets a future core generation reuse this flow without editing it. [How] Add a static get_calcs(ctx) helper returning ctx->calcs->dcn6. Replace every direct dcn5_*/dcn6_* calcs call with get_calcs(ctx)->slot(...). Assign calc_ms_ctx->calcs from core->calcs when the context is built. Drop the now-unused dml2_core_dcn5_calcs_dchub.h, dml2_core_dcn5_calcs_display_pipe.h, and dml2_core_dcn6_calcs_dchub.h includes in favor of dml2_core_dcn6_calcs.h. Reviewed-by: Austin Zheng <austin.zheng@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> Change-Id: Iea783566e30c23b834ccf216c99496301aa87b20
…ointer table [Why] dml2_core_dcn6_funcs_mode_programming.c called DCN5 and DCN6 calcs functions directly by name, coupling the mode programming flow to specific generations. Routing through the calcs table lets a future core generation reuse this flow without editing it. [How] Add a static get_calcs(ctx) helper returning ctx->calcs->dcn6. Replace every direct dcn5_*/dcn6_* calcs call with get_calcs(ctx)->slot(...). dcn6_populate_mode_programming() did not previously receive the mp context, so thread calc_mp_ctx through it to reach get_calcs() for its three calcs calls. Assign ctx->calcs from core->calcs in dcn6_mp_build_calculate_mp_context(). Drop the now-unused dml2_core_dcn5_calcs_dchub.h, dml2_core_dcn5_calcs_display_pipe.h, and dml2_core_dcn6_calcs_dchub.h includes in favor of dml2_core_dcn6_calcs.h. Reviewed-by: Austin Zheng <austin.zheng@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> Change-Id: I4dad38cf4a2a9ead921e4c6f814a27313be9e687
[Why & How] Update fields used for mode support. Also expose some functions so they can be re-used for future products Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Austin Zheng <Austin.Zheng@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Change-Id: I24ecf6094dce531e0891f8f1fdd27b306b0abd33
[Why & How]
amdgpu_dm_update_freesync_state_on_stream() keyed the VTEM guard off
new_stream->sink->sink_signal, but new_stream->sink can be NULL, leading
to a NULL pointer dereference.
Use new_stream->signal instead, which is a direct field of the already
validated new_stream and carries the same HDMI signal type. This matches
the ALLM block in the same function, which already uses new_stream->signal.
Fixes: fabf2169cb45 ("drm/amd/display: Emit VTEM for HF-VSDB VRR on TMDS links")
Reviewed-by: Tom Chung <chiahsuan.chung@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>
Change-Id: I3c6c3561dbad439a412ddae5009aacd39a8c7e70
[Why] In cm3_helper_translate_curve_to_degamma_hw_format(), seg_distr[] and the loop counter k are uint32_t, while -1, region_start/region_end and i are signed. Comparing them relies on implicit integer conversions, which some compilers diagnose and which obscures the intent of the comparisons. [How] Add explicit casts so the signedness of each comparison is stated in the code. No functional change. Assisted-by: Copilot:Claude-Opus-5 Reviewed-by: Tom Chung <chiahsuan.chung@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> Change-Id: Ic929f2ce6cbdeea07cd2cf16bd12fbaa3189f4ae
[Why & How] Update DMUB related command structure. Acked-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Change-Id: I7ee9e859b36f8a608ba1fbb0121cbaf6cb39e4f9
This version brings along the following updates: - Ensure requested LSDMA bandwidth stays within the SOP bound. - Refactor DC_SEND_CURSOR_INFO_TO_DMU to drop the pipe_ctx param. - Add an override for LSDMA bandwidth in the QoS table. - Expand amdgpu_dm KUnit coverage across vblank IRQ, self-refresh, GPU reset, plane update, MST resume, cached suspend state, writeback transitions, atomic validation, connector-state restore, EDID CEA parsing and DM IRQ source handling. - Keep streamclk gating off when enabling streamclk. - Remove unnecessary includes. - Set mpc_tree_params->opp_id during OPP resource construct. - Add override capability for UTM table params. - Add immediate restore to FAMS2 for DRR. - Fix missing APG registers for DCN60 HDMI. - Exit IPS before connector detection on resume. - Fix HF-VSDB DSC bpc detection to be cumulative. - Fix unused params in flip schedule. - Enable the FW locality check in DCN6. - Fix DC Hub reference frequency assert range. - Dump clock registers in HW init instead of SW init. - Validate the IRQ source in the DM IRQ handler. - Revert "Fix CalculateFlipSchedule Calculation". - Assorted DML updates. - Update urgent burst calculation to account for unbounded requests. - Add a stressed peak-bandwidth probe with DMA contention. - Revert "Unify CalculateFlipSchedule Logic". Acked-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com> Signed-off-by: Ray Wu <ray.wu@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Change-Id: I21566a57673d8add979908cd40fad05b42644e6d
Convert all of them to the existing ttm_to_amdgpu_ttm_tt() helper, which goes through container_of() and is checked at build time. No functional change intended. Signed-off-by: Perry Yuan <perry.yuan@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
GFX 12.1.0 queues are managed by MES, not by the HWS runlist, so the 127 queue limit does not apply. The topology advertises 32 CP queues plus 16 SDMA engines with 6 queues each, so creating every queue needs 128 and the last one fails with -ENOSPC. Signed-off-by: Horatio Zhang <hongkun.zhang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
This reverts commit f9801da. Signed-off-by: Chengjun Yao <Chengjun.Yao@amd.com>
This reverts commit a2afa41. Signed-off-by: Chengjun Yao <Chengjun.Yao@amd.com>
This reverts commit 2717d56. Signed-off-by: Chengjun Yao <Chengjun.Yao@amd.com>
Signed-off-by: Chengjun Yao <Chengjun.Yao@amd.com>
Signed-off-by: Chengjun Yao <Chengjun.Yao@amd.com>
The critical region v2 patches clear the fw_reserve.p_pf2vf variable after pf2vf data is read the first time. have_atomics_support relies on that variable to check for PCIe atomic ops support. Move have_atomics_support check for SRIOV VFs to be when pf2vf data is read. Signed-off-by: Victor Lu <victorchengchi.lu@amd.com> Reviewed-by: Ellen Pan <yunru.pan@amd.com>
tpatward-amd
force-pushed
the
user/tpatward-amd/PLAT-213958
branch
3 times, most recently
from
October 11, 2026 18:28
9424b1f to
91d92ca
Compare
On MI450 (gfx 12.1, ACA v5, flex MCA) a correctable GFX MCA error is logged by the x86 MCE core, but unified RAS reports no GFX error count and no runtime CPER for it. The host never sees the GFX bank itself. XCD/AID MP5 firmware polls the GFX MCA banks and copies an error into its own MP5 bank: STATUS copied with ErrorCodeExt=0x3E (FW logged), SYND.ErrorInformation = 0x1_0018 (version 1, aggregated error), MISC0 ErrCnt copied, SYND1 = source SYND, SYND2 = source IPID ACAType + MCA_CTL base. That bank's IPID is HWID 0x01 / McaType 0x2 (SMCA "MP5"; arch/x86/kernel/cpu/mce/amd.c smca_hwid_mcatypes). Example record: STATUS 0x9c200000003e0109, IPID 0x0002100136430404, SYND 0x42010018. Root cause: aca_hwip_maps[] (ras/core/aca_v5_0.c) has no entry for HWID 0x01 / McaType 0x2, so aca_get_bank_aca_block() finds no block and ras_aca_parse_bank() returns -ENODATA (ras/core/aca.c). amdgpu_ras_mce_notifier_v5() then returns before queueing the bank (ras/ras_mgr/amdgpu_ras_mce.c): no ACA log, no log-ring entry, no GFX count, so RAS_CMD__GET_CPER_RECORD has nothing to encode. Fix, scoped to the GFX block and to MP5 copies only: - GFX bank_match also accepts an MP5 bank carrying both aggregation markers: STATUS.ErrorCodeExt 0x3E with SyndV set, and SYND.ErrorInformation[15:0] 0x18. MP5 self-logged errors (SMN timeout 0x2, DMA error 0x19) stay unattributed. - GFX bank_parse: for an MP5 copy delivered through the MCE notifier, classify from the copied STATUS (UC/PCC/TCC -> UE) and count a CE as ErrCnt, or 1 when the copied ErrCnt is 0 (the default MCE branch would log it with a zero count). Every other bank, and every other block, still uses aca_parse_bank_default() unchanged. Socket/die decode is unchanged: the MP5 IPID carries the socket in InstanceIdLo[7:0] (0x04) and the die in InstanceIdHi (1), so only the matching device queues the bank. The source GFX ACAType is only in MP5 SYND2, which the MCE record does not carry, so every aggregated copy is counted under GFX. Tested on an AMD Instinct MI450 system (amdgpu DKMS 7.1.1 with unified RAS enabled, same hunks backported), with the record above injected in software (mce-inject) through the kernel MCE decode chain. Before this change the record is dropped while a mapped PCS_XGMI record is logged and encoded. With it, the bank is logged in the ACA log, counted as one correctable GFX error and encoded as a CPER with the same STATUS/ADDR/IPID/SYND. An MP5 self-error (SYND 0x42010002) and a bank with ErrorCodeExt != 0x3E are still not attributed, and a copied ErrCnt of 3 is counted as 3. The UE classification of a UC copy and an end-to-end hardware-raised error were not exercised on hardware. Assisted-by: Claude:claude-opus-5-5
Add a KUnit suite for the GFX bank match/parse in ras/core/aca_v5_0.c that attributes MP5 firmware-aggregated copies of GFX MCA banks to GFX. The tests call the GFX block's bank_match/bank_parse through the ras_aca_func_v5_0 table, so they also check that the GFX block is wired to these callbacks. The bank values are the MP5 record logged by the x86 MCE core on an AMD Instinct MI450 system: STATUS 0x9c200000003e0109, ADDR 0x2e, MISC0 0xd018000000000000 (ErrCnt 0), IPID 0x0002100136430404 (HWID 0x01, ACAType 0x2, socket 4, die 1), SYND 0x42010018. Coverage: - the aggregated GFX CE copy (ErrorCodeExt 0x3E, SyndV, SYND.ErrorInformation[15:0] 0x18) is matched by GFX and by no other ACA v5.0 block; - MP5 self-errors (SYND ErrorInformation 0x2 SMN timeout, 0x19 DMA error), a copy with ErrorCodeExt 0x3D and a copy without SyndV are not matched; - an MCE copy is counted as a CE of 1 when the copied ErrCnt is 0, and as ErrCnt (3) otherwise; the bank info keeps the socket, die, STATUS, IPID and ADDR; - a copy with UC+PCC or TCC set is classified as one UE and no CE; - a deferred copy stays one DE, and a copy that is not delivered through the MCE notifier keeps the default CE count; - a GFX XCD bank (HWID 0x2E2) is still matched through the HWID/ACAType map and parsed by the default path (MCE CE count = ErrCnt, also when it is 0; no UE reclassification; a polled UE bank is one UE). Wiring: a DRM_AMDGPU_RAS_KUNIT_TEST Kconfig symbol, a tests/ directory under ras/core hooked from ras/core/Makefile, and EXPORT_SYMBOL_IF_KUNIT(ras_aca_func_v5_0) so the test module can reach the table. The <kunit/visibility.h> include and the export are both under #if IS_ENABLED(CONFIG_DRM_AMDGPU_RAS_KUNIT_TEST): that header only exists since Linux 6.2 and aca_v5_0.c is also built out of tree against older kernels, so a build without the test symbol neither includes the header nor exports the table. The .kunitconfig also enables HSA_AMD, NET and INET, which amdgpu currently needs to link as a built-in driver. amdgpu does not link on UML in this tree, so the suite runs on x86_64: ./tools/testing/kunit/kunit.py run --arch=x86_64 \ --kunitconfig=drivers/gpu/drm/amd/ras/core/tests Assisted-by: Claude:claude-opus-5-5
tpatward-amd
force-pushed
the
user/tpatward-amd/PLAT-213958
branch
from
October 12, 2026 19:02
91d92ca to
ca9fd42
Compare
tpatward-amd
marked this pull request as ready for review
October 12, 2026 23:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #239
On MI450 (gfx 12.1, ACA v5, flex MCA), the x86 MCE core logs a correctable GFX MCA error, but unified RAS reports no GFX error count and no runtime CPER for it.
The host never sees the GFX bank itself. XCD/AID MP5 firmware polls the GFX MCA banks and copies an error into its own MP5 bank. The copied STATUS has ErrorCodeExt=0x3E (FW logged), SYND.ErrorInformation is 0x1_0018 (version 1, aggregated error), and MISC0 ErrCnt is copied. That bank's IPID is HWID 0x01 / McaType 0x2 (SMCA "MP5"). Example record: STATUS
0x9c200000003e0109, IPID0x0002100136430404, SYND0x42010018.aca_hwip_maps[]inras/core/aca_v5_0.chas no entry for HWID 0x01 / McaType 0x2. Soaca_get_bank_aca_block()finds no block andras_aca_parse_bank()returns-ENODATA.amdgpu_ras_mce_notifier_v5()then returns before it queues the bank. Nothing is written to the ACA log or the log ring and the GFX count is not updated, soRAS_CMD__GET_CPER_RECORDhas nothing to encode.Technical Details
This PR has two commits.
1.
drm/amd/ras: attribute MP5-aggregated GFX MCA banks to GFX. This is the fix. It changes only the GFX block and only MP5 copies (drivers/gpu/drm/amd/ras/core/aca_v5_0.c):bank_matchalso accepts an MP5 bank that carries both aggregation markers:STATUS.ErrorCodeExt0x3E with SyndV set, andSYND.ErrorInformation[15:0]0x18. MP5 self-logged errors (SMN timeout 0x2, DMA error 0x19) stay unattributed.bank_parse: an MP5 copy delivered through the MCE notifier is classified from the copied STATUS (UC/PCC/TCC -> UE). A CE is counted as ErrCnt, or as 1 when the copied ErrCnt is 0. The default MCE branch would log it with a count of zero. Every other bank and every other block still usesaca_parse_bank_default()unchanged.Socket/die decode is unchanged. The MP5 IPID carries the socket in InstanceIdLo[7:0] and the die in InstanceIdHi, so only the matching device queues the bank. The source GFX ACAType is stored only in MP5 SYND2, and the MCE record does not include SYND2. Every aggregated copy is therefore counted under GFX.
2.
drm/amd/ras: add KUnit tests for ACA v5.0 MP5-aggregated GFX banks. This adds a new KUnit suite,amdgpu_ras_aca_v5_0, underdrivers/gpu/drm/amd/ras/core/tests/. It follows the existing amdgpu KUnit layout (display/amdgpu_dm/tests):DRM_AMDGPU_RAS_KUNIT_TESTindrivers/gpu/drm/amd/amdgpu/Kconfig, which covers the unified RAS code. drm/amd/ras: skip the early init service when it is not enabled #237 adds the same Kconfig entry for itsras_mgrtests. With a GitHub merge the two PRs can land in either order; when they are applied as patches, drop the Kconfig hunk from whichever lands second.tests/Makefile hooked fromras/core/Makefile, plus a.kunitconfigwith a comment that it needs--arch=x86_64and why it enablesHSA_AMD,NETandINET.EXPORT_SYMBOL_IF_KUNIT(ras_aca_func_v5_0)from<kunit/visibility.h>. Both the include and the export are under#if IS_ENABLED(CONFIG_DRM_AMDGPU_RAS_KUNIT_TEST):<kunit/visibility.h>only exists since Linux 6.2, and this file is also built out of tree (amdgpu DKMS) against older kernels. A build without the test symbol neither includes the header nor exports the table. The tests call the GFX block's realbank_match/bank_parsethrough theras_aca_func_v5_0block table, so they also check that the GFX block uses these callbacks. No function is made non-static.Test Plan
make x86_64_defconfig, thenCONFIG_DRM_AMDGPU=m,CONFIG_HSA_AMD=y,CONFIG_KUNIT=y,CONFIG_DRM_AMDGPU_RAS_KUNIT_TEST=m,CONFIG_WERROR=y, then a from-scratchmake -j64(vmlinux and modules).CONFIG_DRM_AMDGPU_RAS_KUNIT_TESTnot set, from scratch. Then check the dependency list indrivers/gpu/drm/amd/ras/core/.aca_v5_0.o.cmdforkunit/visibility.h, andModule.symversforras_aca_func_v5_0.W=1build ofdrivers/gpu/drm/amd/amdgpu/, which includes theras/coreobjects and the test object.scripts/checkpatch.pl --stricton both commits.amdgpudoes not link on UML in this tree (see "Not covered"), so the suite runs on x86_64 under QEMU. The kernel is built on the host and run with QEMU 7.2 in a Debian bookworm container (qemu-system-x86):qemu-system-x86_64,kunit.py run --arch=x86_64 --kunitconfig=drivers/gpu/drm/amd/ras/core/testsdoes both steps. The suite was also run with the fix hunks reverted and the test hook kept, to check that it detects the bug.mce-inject) through the kernel MCE decode chain, once with the stock driver and once with the fixed driver.0x42010002) and check that it is not attributed.Test Result
=m. The full kernel and modules build with 0 warnings and 0 errors (CONFIG_WERROR=y).amdgpu.koandaca_v5_0_test.koare built, andras_aca_func_v5_0is exported in theEXPORTED_FOR_KUNIT_TESTINGnamespace.CONFIG_WERROR=y).kunit/visibility.his not in the dependency list ofaca_v5_0.o, andras_aca_func_v5_0is not exported (not inModule.symvers).W=1. No warnings indrivers/gpu/drm/amd/ras/. The onlyW=1warning indrivers/gpu/drm/amd/amdgpu/is an existing-Wformat-truncationinjpeg_v2_5.c, which this PR does not touch.--strict. No style errors, warnings or checks in the code. The fix commit reports only the missingSigned-off-by:. The test commit reports the same, plus the "does MAINTAINERS need updating?" reminder for new files;get_maintainer.plshows they are already covered by the existing AMDGPU entry.ras/:-Wunused-but-set-variableinamdkfd/kfd_ais.cand-Wunused-functioninpm/swsmu/amdgpu_smu.c. The KUnit configuration does not setCONFIG_WERROR.Ran 10 tests: passed: 5, failed: 5. The failures are the MP5 match, the GFX-only attribution, the ErrCnt-0 CE count, the UE classification and the deferred copy match.IPID=0x0002100136430404,SYND=0x0000000042010018). dmesg reportssocket: 4, die: 1, 1 new correctable hardware errors detected in gfx block, and one new CPER is encoded with the record's STATUS/ADDR/IPID/SYND. The CPER count for that IPID went from 6 to 7.Not covered
End-to-end hardware path. A hardware-raised CP_GFX CE was not verified. On the test system, the hardware inject produces no host MCE while unified RAS is enabled. This is a separate firmware-side issue that does not depend on this change, so every positive hardware result above comes from software-injected records.
UC/UE classification on hardware. The UC path (STATUS UC/PCC/TCC -> UE) was not run on hardware, because injecting a UC record goes through the #MC exception path and can panic the host. The classification logic is covered by the KUnit tests above (UC+PCC and TCC copies), not by a hardware run.
KUnit on UML. The suite does not run under UML in this tree, because the amdgpu driver itself does not link for UML:
HSA_AMD,amdgpu_amdkfd_rlc_spm_interrupthas no stub;HSA_AMD,kfd_peerdirect.cusessg->dma_length.Both problems already exist and are not related to this PR, so the tests were run on x86_64 under QEMU. For the same reason the
.kunitconfigenablesHSA_AMD,NETandINET, which built-in amdgpu currently needs in order to link, and says in a comment that it needs--arch=x86_64.Submission Checklist
Both commits carry an
Assisted-by:tag and noSigned-off-by:, followingDocumentation/process/coding-assistants.rst. The human submitter will add their ownSigned-off-by:before this PR leaves draft.🤖 Generated with Claude Code