]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: grow VF RAS bad page table with bounded dynamic alloc
authorChenglei Xie <Chenglei.Xie@amd.com>
Thu, 7 May 2026 14:29:10 +0000 (10:29 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Jun 2026 17:55:41 +0000 (13:55 -0400)
commit10358a396d9779c995ca8ecdbf3c50e6c0977b66
tree71828abb6b6a455fa78f8ac2e4fd99753c926a0c
parent758a868043dcb07eca923bc451c16da3e73dc47c
drm/amdgpu: grow VF RAS bad page table with bounded dynamic alloc

The VF RAS error handler used fixed-size bps[] / bps_bo[] arrays (512
slots). When the PF2VF bad-page block listed more entries than fit,
amdgpu_virt_ras_add_bps() could memcpy() past the end of those arrays.

Replace the fixed backing store with a dynamically grown table:
- Add capacity to track allocated slots separately from count.
- Start at 512 slots and realloc bps / bps_bo together when full.
- Refuse growth beyond maximum EEPROM record limit (AMDGPU_VIRT_RAS_BAD_PAGE_TABLE_MAX_CAPACITY).
- Return failure from amdgpu_virt_ras_add_bps() and stop processing
  the PF2VF block if allocation fails or the cap is reached.

Signed-off-by: Chenglei Xie <Chenglei.Xie@amd.com>
Reviewed-by: YiPeng Chai <YiPeng.Chai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h