Commit Graph

1467765 Commits

Author SHA1 Message Date
Le Ma
846938fd04 drm/amdgpu: add NPS2 memory cap for soc v1.0 DPX mode
DPX currently advertises only NPS1 as a compatible memory partition
mode in soc_v1_0_get_xcp_res_info(). As a result, supported_nps_configs
and amd-smi partition --accelerator report NPS1 for the DPX profile even
when the device supports both NPS1 and NPS2.

Include NPS2 in the DPX compatible NPS mask so the reported profile
capabilities match the supported memory partition modes.

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>
2026-08-25 18:47:08 -04:00
Le Ma
bdf48164b6 drm/amdgpu: free memory partition info on gmc v12 sw_fini
Reset the partition count and free the buffer on gmc v12 sw_fini
during driver unload.

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>
2026-08-25 18:47:06 -04:00
Le Ma
c7d54528d4 drm/amdgpu: add memory partition sysfs init/fini for GC 12.1.0
Add the nps sysfs node for GC 12.1.0

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>
2026-08-25 18:47:03 -04:00
Le Ma
c9789733b3 drm/amdgpu: init NPS supported modes for GC 12.1.0
Add nps supported modes init for gc 12.1.0

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>
2026-08-25 18:47:01 -04:00
Horatio Zhang
403d8ca60b drm/amdgpu: Init soc_v1_0 rev_id from IP discovery die_id
Software components need to detect die revisions in order to apply the
correct software workarounds. During system boot, ASP firmware reads
the IDCODE values from the MID, AID and XCD fuses and encodes the die
revision into die_info[0].die_id in the IP discovery blob.

v2: Default die_rev_id to 0 and warn instead of failing probe when IP
discovery does not provide a die rev id.
v3: Update names for external_rev_id enumerators.

Signed-off-by: Horatio Zhang <hongkun.zhang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:46:58 -04:00
Le Ma
b8cb9a172b drm/amdgpu: handle LSDMA instance and harvest information from ip discovery
Track discovered LSDMA instances in inst_mask and clear harvested
instances when processing the harvest table. Report the harvest state
through IP discovery sysfs for LSDMA v7.1.0.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:46:56 -04:00
Le Ma
7f196a3245 drm/amdgpu: handle MMHUB harvest information from ip discovery
Clear harvested MMHUB instances from mmhub.inst_mask when processing
the harvest table. Report the harvest state through IP discovery
sysfs for MMHUB v4.2.0.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:46:54 -04:00
Feifei Xu
45cf81f734 drm/amdgpu/discovery: skip MEM_RESERVED_INFO on unsupported ASICs
Some ASICs' MEM_RESERVED_INFO table_entry may carry non-zero garbage,
causing signature check failed thus probe fail.

Move signature check in amdgpu_discovery_get_mem_reserved_info_table(),
returning -ENOENT when invalid so the table is skipped.

v1->v2: Add discovery binary header check before populate the
        mem_reserved_info table. (Lijo)

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Candice Li <candice.li@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:46:51 -04:00
Feifei Xu
e59206f393 drm/amdgpu: add mem_reserved_info sysfs attribute
Expose the cached MEM_RESERVED_INFO discovery table via a per-device
sysfs file:

    /sys/class/drm/cardX/device/mem_reserved_info

The file is read-only and dumps every region as:

    list_num=<N>
    [<i>] id=<id> (<name>) size=0x<size> start=0x<start>

Only created when the table was successfully resolved at discovery
init time.

Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
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>
2026-08-25 18:46:48 -04:00
Feifei Xu
1380b7be58 drm/amdgpu: add amdgpu_discovery_dump_mem_reserved_info_table
Walk the cached MEM_RESERVED_INFO table once at discovery init time and
log every entry (region id, symbolic name, size, start). Add 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>
2026-08-25 18:46:46 -04:00
Feifei Xu
2eee94d2e0 drm/amdgpu: query the reserved info with get_fw_reserved_info
Extend amdgpu_ttm_init_fw_resv_region() to honour the
->get_fw_reserved_info().

Previously the FW carveout was hardcoded and placed at the top of VRAM
(real_vram_size - reserve_size):
 - a hard-coded 144/256 MB for GC 12.1.0;
 - or DISCOVERY_TMR_OFFSET fallback.

The hard-coded GC 12.1.0 path is replaced by ->get_fw_reserved_info(),
which returns a (size, offset_within_VRAM) pair derived from the
MASTER_DIE_UMF_REGION embedded in IP discovery, and falls back only
when the discovery region is missing or invalid.

v1->v2: Remove !adev->bios check, and call the get_fw_reserved_info
    interface when it is available. (suggested by Hawking)

Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
Suggested-by: Hawking Zhang <Hawking.Zhang@amd.com>
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>
2026-08-25 18:46:42 -04:00
Feifei Xu
afa9574fb5 drm/amdgpu: set reserve_tmr in amdgpu_discovery_get_tmr_info
If reading mmDRIVER_SCRATCH_2 returns non-zero, discovery.reserve_tmr
is set to true and driver need reserve tmr for firmware.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Suggested-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:46:37 -04:00
Feifei Xu
b9ea19d212 drm/amdgpu: add get_fw_reserved_info implementation
Add asic specific callback ->get_fw_reserved_info() that returns the
firmware/UMF VRAM carveout as a (size, offset_within_VRAM) pair, and
provide the soc v1.0 implementation.

Query MASTER_DIE_UMF_REGION_ID from the discovery MEM_RESERVED_INFO
table for the carveout size/start. SPECIFIC_PURPOSE_REGION_ID is used
to resolve the VRAM base in multi-die layouts where VRAM may not start
at the default base.

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>
2026-08-25 18:46:35 -04:00
Feifei Xu
7b2e99877d drm/amdgpu: add amdgpu_discovery_get_mem_reserved_region_by_id
Add a lookup helper to pass a MEM_RESERVED_REGION_ID and receive the
region's start address and size.

A static amdgpu_discovery_mem_reserved_region_name() helper is also
introduced so debug output can refer to regions by symbolic name rather
than raw IDs.

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>
2026-08-25 18:46:32 -04:00
Feifei Xu
f67f312eb3 drm/amdgpu: add amdgpu_discovery_get_mem_reserved_info_table
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>
2026-08-25 18:46:30 -04:00
Feifei Xu
5030ed1774 drm/amdgpu: Add NPS_INFO case to amdgpu_discovery_table_check
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>
2026-08-25 18:46:27 -04:00
Feifei Xu
907b4e4be1 drm/amdgpu: add MEM_RESERVED_INFO to discovery table
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>
2026-08-25 18:46:24 -04:00
Feifei Xu
6ec9124947 drm/amdgpu: add amdgpu_discovery_log_bad_signature helper
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>
2026-08-25 18:46:21 -04:00
Candice Li
4d3ebc5925 drm/amdgpu: enable RAS on psp v15_0_8
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>
2026-08-25 18:46:19 -04:00
Lijo Lazar
11cc725660 drm/amdgpu: Add PSP v15.0.8 interrupt handler
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>
2026-08-25 18:46:17 -04:00
Lijo Lazar
32a1ceed09 drm/amdgpu: Add psp interrupt handling
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>
2026-08-25 18:46:15 -04:00
Stanley.Yang
f1fff3260e drm/amd/ras: add supported aca blocks mapping
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>
2026-08-25 18:46:12 -04:00
Asad Kamal
99fb532b16 drm/amd/amdgpu: Allow reset init for smu_v15_0_8
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>
2026-08-25 18:46:09 -04:00
Asad Kamal
208e5d4b3f drm/amd/amdgpu: Add soc_v1_0 reset handler
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>
2026-08-25 18:46:07 -04:00
Asad Kamal
93eca5a03b drm/amd/pm: add 5s custom timeout for unload messages
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>
2026-08-25 18:46:05 -04:00
Lijo Lazar
90580da8ce drm/amdgpu: Use 100M as refclock for SOCv1.0
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>
2026-08-25 18:46:03 -04:00
Le Ma
73a2a3b172 drm/amdgpu: add get_rom_offset callback for NBIO 6.3.2
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>
2026-08-25 18:46:00 -04:00
Hawking Zhang
e37e02f74b drm/amdgpu: Enable translate further for gc v12_1 v3
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>
2026-08-25 18:45:57 -04:00
YuBiao Wang
a74c7832b1 drm/amdgpu: recompute the dw estimate after allocating a new VM update 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>
2026-08-25 18:43:55 -04:00
Hawking Zhang
1c287e517d drm/amdgpu: Report vm fault status HI32 when avaialble
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>
2026-08-25 18:43:51 -04:00
Hawking Zhang
958ac1732d drm/amdgpu: Use global addr for mmhub v4_2 reg access
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>
2026-08-25 18:43:49 -04:00
Mukul Joshi
2760bfb1fd drm/amdgpu: Drop BUG_ON in PDE address verification for GFX 12.1
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>
2026-08-25 18:43:46 -04:00
Likun Gao
7ceff36ab1 drm/amdgpu: clean up vm flush func for gc v12_1
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>
2026-08-25 18:43:44 -04:00
Alex Sierra
a8b1c724d2 drm/amd: force remote MTYPE_NC on GFX12.1 mtype_local=0
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>
2026-08-25 18:43:40 -04:00
Alex Sierra
8760df21b3 Revert "drm/amdgpu: Set default xnack mode for gfx_v12.1 A0/B0"
This reverts commit bfeb7b28e9.
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>
2026-08-25 18:43:02 -04:00
Mukul Joshi
34e63f01ee drm/amdgpu: Update no-retry PTE flags for GFX12
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>
2026-08-25 18:42:56 -04:00
Hawking Zhang
f8c035cfdb drm/amdgpu: Use mmhub inst_mask for gmc v12_1 vmhub setup
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>
2026-08-25 18:42:54 -04:00
Hawking Zhang
1ad9d95665 drm/amdgpu: Use discovered mmhub inst_mask for v4_2_0
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>
2026-08-25 18:42:49 -04:00
Philip Yang
71ad3f6d66 drm/amdgpu: Fix GMC v12.1.0 MID1 page fault vmhub selection
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>
2026-08-25 18:42:47 -04:00
Mukul Joshi
155d09cc41 drm/amdkfd: Skip pairwise CU mask check for GFX12.1
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>
2026-08-25 18:42:44 -04:00
Alex Sierra
95263281fd drm/amdkfd: disable debug before retiring MES process context on teardown
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>
2026-08-25 18:42:40 -04:00
Philip Yang
f8497de171 drm/amdgpu: Fix MES wb status pointer overwriting adjacent wb slot
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>
2026-08-25 18:42:34 -04:00
Shaoyun Liu
485a873e7a drm/amdgpu: move tlb invalidation to mes sched pipe
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>
2026-08-25 18:42:32 -04:00
Mukul Joshi
94cae2f782 drm/amdkfd: set CP_IQ_WAIT_TIME2.QUE_SLEEP on GFX 12.1
The optimized QUE_SLEEP was only programmed on the HWS packet-manager
path via a PM4 WRITE_DATA packet, which is skipped when MES is enabled.

Add gfx12.1 get_iq_wait_times/build_dequeue_wait_counts_packet_info
callbacks and program CP_IQ_WAIT_TIME2 through the MES WRITE_REG op at
start_cpsch, per XCC.

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>
2026-08-25 18:42:29 -04:00
Mukul Joshi
61c1787f22 drm/amdgpu: Unmap KIQ during driver unload on GFX 12.1
Unmap the KIQ pipe during driver unload so stale pointers do
not carry over to the next driver load.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Michael Chen <michael.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:42:27 -04:00
Candice Li
27098e6d31 drm/amdgpu: declare MEC_1 and RLC firmware in gfx_v12_1
Declare MEC_1 and RLC firmware in gfx_v12_1 with MODULE_FIRMWARE()
so modinfo and distro firmware packaging pick them up.

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>
2026-08-25 18:42:25 -04:00
Likun Gao
6abf0b6af7 drm/amdgpu: remove retired cp cmd pkg for gc v12_1
Remove retired cp command package for GC version 12.1.

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>
2026-08-25 18:42:23 -04:00
Lijo Lazar
67f7737a13 drm/amdgpu: Add workaround to enable GCv12.1 MGCG
A workaround sequence which toggles MGCG override is required to enable
hardware MGCG. As this is not the final solution, don't change the CGCG
flags.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:42:21 -04:00
Le Ma
7c00e5859b drm/amdgpu: disable GFX clockgating for GC 12.1.0
RLC fw disables GFX CGCG and CGLS on GC 12.1.0 by default, so clear the
corresponding CG flags and keep GUI idle interrupts disabled during gfx init.

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>
2026-08-25 18:42:19 -04:00
Shiwu Zhang
23305c88fa drm/amdgpu: add mec FW support for silicon rev 0
MEC will have the specific FW binary for silicon rev 0.

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:42:17 -04:00