Commit graph

1,467,537 commits

Author SHA1 Message Date
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
YiPeng Chai
49452ca7a7 drm/amd/ras: Add dedicated interface to obtain cper info
Add dedicated interface to obtain cper 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:25:28 -04:00
YiPeng Chai
46de665683 drm/amd/ras: Add interface to get ras eeprom table version
Add interface to get ras eeprom table 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:28 -04:00
Xiang Liu
6524030f58 drm/amd/ras: Introduce BOOT CPER encoding function
Introduce new fields for BOOT CPER encoding, only important fields are
introduced here due to the cache size limit.

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:25:28 -04:00
YiPeng Chai
4d8022d9be drm/amd/ras: Parse error type of MCE and encode CPER
Introduce MCE type ras log event.
Parse error type of MCE and encode to corresponding CPER.

Signed-off-by: Xiang Liu <xiang.liu@amd.com>
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:28 -04:00
YiPeng Chai
c11e8ff438 drm/amd/ras: add interface to support parsing aca bank ecc info
Add interface to support parsing aca bank ecc 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:25:28 -04:00
Xiang Liu
4919e3e796 drm/amd/ras: register mce notifier to obtain ras error info
Register mce notifier to obtain ras error info for A + A.

Signed-off-by: YiPeng Chai <YiPeng.Chai@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:25:28 -04:00
Amin Gattout
753cbc43bd drm/amdgpu: Replace deprecated strcpy with strscpy
strcpy() has been deprecated because it performs no bounds checking
on the destination buffer, which can lead to buffer overflows. Replace
it with the safer strscpy().  No functional changes.

Signed-off-by: Amin Gattout <amin.gattout@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:25:28 -04:00
Dr. David Alan Gilbert
e9e37791f9 drm/amdgpu: Remove is_idle
Remove the actual is_idle member, since it's never read/called and
the previous patches have remove all the assignments.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:25:28 -04:00
Dr. David Alan Gilbert
d1b8ffe14a drm/amdgpu: Remove is_idle (non trivial functions)
The is_idle method on amd_ip_funcs is never called.
Remove the implementations that actually do something.
In most cases the same code has been duplicated in
the wait_for_idle method implementations that is still used.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:25:28 -04:00
Dr. David Alan Gilbert
ecaca20be8 drm/amdgpu: Remove is_idle (trivial cases)
The is_idle method on amd_ip_funcs is never called.
Remove the trivial cases where either:
  a) It's just a return true function that can be deleted
     together with the .is_init =
  b) The function is called somewhere else, so we just remove
     the assignment.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2026-08-25 18:25:28 -04:00