Skip to contentSkip to conversation

drm/amdgpu: Report ras_num_recs in debugfs

PATCH In review Luben Tuikov 2 participants 2 messages Jun 3, 2023 – Jun 5, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Report ras_num_recs in debugfs

Report the number of records stored in the RAS EEPROM table in debugfs.

This can be used by user-space to calculate the capacity of the RAS EEPROM table since "bad_page_cnt_threshold" is also reported in the same place in debugfs.

See commit reference 7fb6407145479d (drm/amdgpu: Add bad_page_cnt_threshold to debugfs, 2021-04-13).

ras_num_recs can already be inferred by dumping the RAS EEPROM table, also in the same debugfs location, see commit reference c65b0805e77919 (drm/amdgpu:
RAS EEPROM table is now in debugfs, 2021-04-08). This commit makes it an integer value easily shown in a single file.

Cc Alex Deucher <[email protected]>
Cc Hawking Zhang <[email protected]>
Cc Tao Zhou <[email protected]>
Cc Stanley Yang <[email protected]>
Cc John Clements <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -0
index f2da69adcd9d48..68163890f9632d 100644
@@ -1487,6 +1487,7 @@ static int amdgpu_ras_sysfs_remove_all(struct amdgpu_device *adev)
 static struct dentry *amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
 {
 	struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+	struct amdgpu_ras_eeprom_control *eeprom = &con->eeprom_control;
 	struct drm_minor  *minor = adev_to_drm(adev)->primary;
 	struct dentry     *dir;
 
@@ -1497,6 +1498,7 @@ static struct dentry *amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *
 			    &amdgpu_ras_debugfs_eeprom_ops);
 	debugfs_create_u32("bad_page_cnt_threshold", 0444, dir,
 			   &con->bad_page_cnt_threshold);
+	debugfs_create_u32("ras_num_recs", 0444, dir, &eeprom->ras_num_recs);
 	debugfs_create_x32("ras_hw_enabled", 0444, dir, &adev->ras_hw_enabled);
 	debugfs_create_x32("ras_enabled", 0444, dir, &adev->ras_enabled);
 	debugfs_create_file("ras_eeprom_size", S_IRUGO, dir, adev,

base-commit: e82c20a87511115677528a5e01e58b7763a42edf

Signature · 1 line
2.41.0
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Luben Tuikov

Report the number of records stored in the RAS EEPROM table in debugfs.

This can be used by user-space to calculate the capacity of the RAS EEPROM table since "bad_page_cnt_threshold" is also reported in the same place in debugfs.

See commit reference 7fb6407145479d (drm/amdgpu: Add bad_page_cnt_threshold to debugfs, 2021-04-13).

ras_num_recs can already be inferred by dumping the RAS EEPROM table, also in the same debugfs location, see commit reference c65b0805e77919 (drm/amdgpu:
RAS EEPROM table is now in debugfs, 2021-04-08). This commit makes it an integer value easily shown in a single file.

Quoted 6 lines
Cc Alex Deucher <[email protected]>
Cc Hawking Zhang <[email protected]>
Cc Tao Zhou <[email protected]>
Cc Stanley Yang <[email protected]>
Cc John Clements <[email protected]>
Quoted 29 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -0
index f2da69adcd9d48..68163890f9632d 100644
@@ -1487,6 +1487,7 @@ static int amdgpu_ras_sysfs_remove_all(struct amdgpu_device *adev)
 static struct dentry *amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
 {
        struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
+       struct amdgpu_ras_eeprom_control *eeprom = &con->eeprom_control;
        struct drm_minor  *minor = adev_to_drm(adev)->primary;
        struct dentry     *dir;
 
@@ -1497,6 +1498,7 @@ static struct dentry *amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *
                            &amdgpu_ras_debugfs_eeprom_ops);
        debugfs_create_u32("bad_page_cnt_threshold", 0444, dir,
                           &con->bad_page_cnt_threshold);
+       debugfs_create_u32("ras_num_recs", 0444, dir, &eeprom->ras_num_recs);
        debugfs_create_x32("ras_hw_enabled", 0444, dir, &adev->ras_hw_enabled);
        debugfs_create_x32("ras_enabled", 0444, dir, &adev->ras_enabled);
        debugfs_create_file("ras_eeprom_size", S_IRUGO, dir, adev,

base-commit: e82c20a87511115677528a5e01e58b7763a42edf --
2.41.0