summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
diff options
context:
space:
mode:
authorChenglei Xie <Chenglei.Xie@amd.com>2026-05-07 10:29:10 -0400
committerAlex Deucher <alexander.deucher@amd.com>2026-06-03 13:55:41 -0400
commit10358a396d9779c995ca8ecdbf3c50e6c0977b66 (patch)
tree71828abb6b6a455fa78f8ac2e4fd99753c926a0c /drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
parent758a868043dcb07eca923bc451c16da3e73dc47c (diff)
downloadlinux-next-10358a396d9779c995ca8ecdbf3c50e6c0977b66.tar.gz
linux-next-10358a396d9779c995ca8ecdbf3c50e6c0977b66.zip
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index d563deec0916..d8500c3e48a1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -265,6 +265,8 @@ struct amdgpu_virt_ras_err_handler_data {
struct eeprom_table_record *bps;
/* point to reserved bo array */
struct amdgpu_bo **bps_bo;
+ /* number of slots in bps[] / bps_bo[] (always >= count) */
+ int capacity;
/* the count of entries */
int count;
/* last reserved entry's index + 1 */