Commit graph

1,467,547 commits

Author SHA1 Message Date
Xiang Liu
7008fc10a6 drm/amdgpu/ras: reload RAS TA from ras mgr resume
When uniras owns the RAS TA, rascore can no longer rely on the legacy
PSP context to keep TA session state alive across reset or suspend.
The manager has to provide enough metadata to reload the TA and rebuild
its shared buffer after PSP reinitialization.

Source TA firmware metadata from adev->psp.ras_context.context.bin_desc,
allocate and free the shared buffer on demand, and hand the fini
cleanup back to rascore through a put_ras_ta_fini_param callback. Add a
resume hook that reloads the TA with skip_lock set so the reload can
run after GPU reset.

Export thin ras_mgr helpers for feature toggles and deferred replay so
higher layers can use the rascore-owned TA path without depending on
legacy PSP-managed TA session state directly.

Signed-off-by: Jinzhou Su <jinzhou.su@amd.com>
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-25 18:26:11 -04:00
Xiang Liu
8e1561247d drm/amdgpu/ras: prepare ras_psp for ras_mgr-owned TA reload
Stop deriving RAS TA session state from the legacy PSP status query and
switch ras_psp over to locally tracked TA lifetime. Delegate TA init
parameters and fini cleanup through ras_psp sys callbacks, update the
load and unload flow to keep firmware metadata in rascore, and add a
skip_lock load path that can be used after PSP reinitialization.

This prepares ras_psp for a later ras_mgr resume hook that reloads the
TA without relying on legacy PSP-managed session ownership.

Signed-off-by: Jinzhou Su <jinzhou.su@amd.com>
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-25 18:26:11 -04:00
YiPeng Chai
a10d7135b1 drm/amdgpu: fix duplicate ras debugfs node creation on driver reload
On A+A, when ras_enabled is 0, the RAS debugfs node is
not deleted when the driver is uninstalled.

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-25 18:26:11 -04:00
YiPeng Chai
b7146153a6 drm/amdgpu: Add bad page preloading and pre-reservation support
Add bad page preloading and pre-reservation support.

v2:
  Add modification to ensure amdgpu_sw_init does not fail
  and remove deferred ras instance release.

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-25 18:26:11 -04:00
YiPeng Chai
5a72a85cd5 drm/amd/ras: Add null check to prevent null pointer exception
Add null check to prevent null pointer exception.

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-25 18:26:11 -04:00
YiPeng Chai
e161bcb0eb drm/amd/ras: remove unused code from ras eeprom
Remove unused code from ras eeprom.

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-25 18:26:11 -04:00
YiPeng Chai
0c2fdd842a drm/amd/ras: use record count instead of bad page count for EEPROM threshold checking
- Since EEPROM threshold configuration is record count, use
  record count instead of bad page count for EEPROM threshold
  checking.
- RMA check and notification have been moved to ras_eeprom_mgr.

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-25 18:26:11 -04:00
YiPeng Chai
9260a9e55a drm/amd/ras: Add gpu rma exception handling
Add gpu rma exception handling.

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-25 18:26:11 -04:00
YiPeng Chai
87bd1227b1 drm/amd/ras: Support obtaining bad page info at boot time for ras_mp1_v15_0
Support obtaining bad page info at boot time for ras_mp1_v15_0.

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-25 18:26:11 -04:00
YiPeng Chai
18a6121cb1 drm/amd/ras: add interface to report bad page info
Add interface to report bad page info.

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-25 18:26:11 -04:00
YiPeng Chai
486680e9d3 drm/amd/ras: preload and handle bad pages at boot time
Preload bad pages occur during the sw_init stage, so
the preload-related code in RAS module must be moved
to sw_init for proper initialization.

v2:
  Rename functions and variables.

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-25 18:26:11 -04:00
YiPeng Chai
93a05388b0 drm/amd/ras: add interface to obtain FW eeprom records at runtime
Add interface to obtain FW eeprom records at runtime.

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-25 18:26:11 -04:00
YiPeng Chai
d7a282ef25 drm/amd/ras: unify umc record logging paths for runtime and preload
Unify UMC record logging paths for runtime and preload.

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-25 18:26:11 -04:00
YiPeng Chai
8059469e33 drm/amdgpu/ras: Rework fw eeprom handling for new management interface
Rework fw eeprom handling for new management interface:
- Support new eeprom management interfaces.
- Use ras_mp1 common interfaces to retrieve bad page information
- Keep a local backup to reduce the interaction frequency with MP1.

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-25 18:26:11 -04:00
YiPeng Chai
3982ee2df8 drm/amd/ras: switch to use new eeprom management interfaces
Switch to use new eeprom management interfaces.

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-25 18:26:10 -04:00
YiPeng Chai
c0e07e0d96 drm/amd/ras: Ras eeprom supports new eeprom management interfaces
Ras eeprom supports new eeprom management interfaces.

v2:
  Correct incorrect return values.

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-25 18:26:10 -04:00
YiPeng Chai
c32092c39f drm/amd/ras: Refactor EEPROM parameter config to support multiple ras EEPROMs
- Refactor EEPROM parameter config to support multiple ras EEPROMs.
- Convert bad page count to record count as EEPROM threshold.

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-25 18:26:10 -04:00
YiPeng Chai
7f71f61ac3 drm/amd/ras: add interfaces to manage multiple EEPROMs
Add interfaces to manage multiple EEPROMs.

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-25 18:26:10 -04:00
YiPeng Chai
11a948c781 drm/amd/ras: Support retrieving bad page info from mp1_v15_0
Support retrieving bad page info from mp1_v15_0.

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-25 18:26:10 -04:00
YiPeng Chai
5f1eaec0ea drm/amd/ras: ras mp1 introduces common interfaces
Ras mp1 introduces common interfaces to manage mp1 data
obtained from different ASICs.

v2:
  Add mutex to ensure complete data transactions with MP1.

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-25 18:26:10 -04:00
YiPeng Chai
8db689ce4e drm/amd/ras: add helper to convert aca bank to eeprom record
add helper to convert aca bank to eeprom record.

v2:
  Correct incorrect return values.

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-25 18:26:10 -04:00
YiPeng Chai
766123b81d drm/amd/ras: add interface to query nps mode and vram type
Add interface to query nps mode and vram type.

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-25 18:26:10 -04:00
YiPeng Chai
b36f085b7e drm/amd/ras: Isolate ras mce handler with CONFIG_X86_MCE_AMD
Isolate ras mce handler with CONFIG_X86_MCE_AMD.

v2:
  Isolate all ras mce handlers.
v3: squash in fix to remove extra header

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-25 18:26:10 -04:00
Felix Kuehling
51d45ebeeb drm/amdgpu: Make extra space in psp->cmd_buf_bo usable
Make space at the end of psp->cmd_buf_bo usable for extra data returned
from PSP commands.

Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:25:30 -04:00
Candice Li
230af314e9 drm/amd/ras: add ext_umc_mask to RAS TA init
Add ext_umc_mask for the upper half of
adev->umc.active_mask and fill both fields
when building RAS TA init message.

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:25:30 -04:00
Candice Li
37608c5089 drm/amdgpu: add ext_umc_mask to RAS TA init
Add ext_umc_mask for the upper half of
adev->umc.active_mask and fill both fields
when building RAS TA init message.

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:25:30 -04:00
Candice Li
87d30adf9a drm/amdgpu: update UMC active_mask to u64
amdgpu_umc.active_mask is widened to u64 to
match 64-bit harvest masks and avoid LP32
unsigned long width limits.

Fix UMC harvest bitmask (drop le16 on u8, use 1ULL shift).

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:25:30 -04:00
Candice Li
2ebeb04925 drm/amdgpu: load TA firmware for psp v15_0_8
Register psp_15_0_8_ta.bin with MODULE_FIRMWARE and
load TA for psp v15_0_8.

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:25:30 -04:00
Candice Li
f2b1095fe2 drm/amdgpu: load standalone RL firmware on psp v15_0_8
Add psp_init_rl_microcode() to request amdgpu/%s_rl.bin and populate
psp->rl using the existing v1.0 PSP firmware header parsing.

Wire it up for psp v15_0_8.

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:25:30 -04:00
Candice Li
581ada8f9b drm/amdgpu: factor PSP v1.0 firmware bin descriptor parsing
Add parse_psp_v1_bin_descriptor to populate struct psp_bin_desc
from psp_firmware_header_v1_0, shared by ASD, TOC and CAP
standalone firmware loads.

Use psp-> fields directly instead of adev->psp.

v2: code rebase
v3: Rename v1 header helper to parse_psp_v1_bin_descriptor,
    have it return an error code with explicit NULL checks.
    Rename sos v2 helper to parse_psp_v2_bin_descriptor for symmetry.

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:25:30 -04:00
YiPeng Chai
be5cccc0fd drm/amd/ras: Remove unused function interfaces
Remove unused function interfaces.

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-25 18:25:30 -04:00
YiPeng Chai
375f15db1e drm/amdgpu: Support obtaining ras capabilities
Support obtaining ras capabilities.

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-25 18:25:30 -04:00
YiPeng Chai
ccb31ea5f8 drm/amdgpu: Handle ras interrupts using unified interface
Handle ras interrupts using unified interface.

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-25 18:25:30 -04:00
YiPeng Chai
4ff44fc197 drm/amd/ras: Support poison consumption handling for A + A sriov guest
Support poison consumption handling for A + A sriov guest.

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-25 18:25:29 -04:00
YiPeng Chai
c27bd592ea drm/amd/ras: Add ras command to obtain ras capabilities
Add ras command to obtain ras capabilities.

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-25 18:25:29 -04:00
YiPeng Chai
858cd57c60 drm/amd/ras: Support querying RAS driver capabilities
Support querying RAS driver capabilities:
1. Generate ras block bitmask for HW.
   -- Read ras hw capabilities from registers.
   -- Convert hw ras block bitmask to driver ras block bitmask.
2. Generate ras block bitmask for SW.
3. Add interfaces to query RAS capabilities.

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-25 18:25:29 -04:00
YiPeng Chai
85c2f0d033 drm/amd/ras: Add ras block id mapping
Some ASICs have different hw ras block IDs.
In order to be compatible with these ASICs,
it is necessary to map these hw RAS block IDs
to unified RAS block IDs.

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-25 18:25:29 -04:00
YiPeng Chai
dac815dd57 drm/amd/ras: Add ras_psp v15_0 for A + A
Add ras_psp v15_0 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-25 18:25:29 -04:00
YiPeng Chai
86571f69e5 drm/amd/ras: Add ras ip configuration for A + A
Add ras ip configuration 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-25 18:25:29 -04:00
YiPeng Chai
e33c9d29c6 drm/amd/ras: Handling ras mce notification event
Handling ras mce notification event.

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-25 18:25:29 -04:00
YiPeng Chai
88559f5af6 drm/amd/ras: Add mce ras error type
Add new ras error type so that ACA parser
can parse ras data from mce.

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-25 18:25:29 -04:00
YiPeng Chai
406cf5f039 drm/amd/ras: Add fifo to cache ras data from mce notification
Add fifo to cache ras data from mce notification.

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-25 18:25:29 -04:00
YiPeng Chai
6e3e6e5e5e drm/amd/ras: Add aca parser v5_0
Add aca parser v5_0.

V2:
  Support new mappings for hwip and hwid.

V3:
  Change aca ip version.

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-25 18:25:29 -04:00
YiPeng Chai
2a56719be9 drm/amd/ras: add common interface to query ras subunit version
Add common interface to query ras subunit version.

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-25 18:25:29 -04:00
YiPeng Chai
b40848b044 drm/amd/ras: Change variable name to avoid confusion
Change variable name to avoid confusion.

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-25 18:25:29 -04:00
YiPeng Chai
59ed9cabb3 drm/amd/ras: Improve function interface to record different types of data
Improve function interface to record different types of data.

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-25 18:25:29 -04:00
YiPeng Chai
03f110b5ea drm/amd/ras: Supports recording data source timestamps to EEPROM
Supports recording data source timestamps to EEPROM.

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-25 18:25:29 -04:00
YiPeng Chai
a673a82f5d drm/amd/ras: Optimize and remove redundant code
Optimize and remove redundant code.

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-25 18:25:29 -04:00
YiPeng Chai
7e88c621ac drm/amd/ras: support separate logging of gfx aid and xcd errors
Support separate logging of gfx aid and xcd errors.

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-25 18:25:29 -04:00
YiPeng Chai
6e0280fab7 drm/amd/ras: optimize mp1 dump bank interface
Optimize mp1 dump bank interface.

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-25 18:25:29 -04:00