]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: refine usage of amdgpu_bad_page_threshold
authorganglxie <ganglxie@amd.com>
Thu, 12 Jun 2025 08:13:08 +0000 (16:13 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Jun 2025 16:19:21 +0000 (12:19 -0400)
when amdgpu_bad_page_threshold == -1 or -2, driver will issue a warning
message when threshold is reached and continue runtime services.

Signed-off-by: ganglxie <ganglxie@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

index 2ddedf476542fe54ff05db0ca9ca4599d393c1c8..2af14c369bb9baa62800e93b88cd93263c342d40 100644 (file)
@@ -763,18 +763,17 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)
                dev_warn(adev->dev,
                        "Saved bad pages %d reaches threshold value %d\n",
                        control->ras_num_bad_pages, ras->bad_page_cnt_threshold);
-               control->tbl_hdr.header = RAS_TABLE_HDR_BAD;
-               if (control->tbl_hdr.version >= RAS_TABLE_VER_V2_1) {
-                       control->tbl_rai.rma_status = GPU_RETIRED__ECC_REACH_THRESHOLD;
-                       control->tbl_rai.health_percent = 0;
-               }
-
                if ((amdgpu_bad_page_threshold != -1) &&
-                   (amdgpu_bad_page_threshold != -2))
+                   (amdgpu_bad_page_threshold != -2)) {
+                       control->tbl_hdr.header = RAS_TABLE_HDR_BAD;
+                       if (control->tbl_hdr.version >= RAS_TABLE_VER_V2_1) {
+                               control->tbl_rai.rma_status = GPU_RETIRED__ECC_REACH_THRESHOLD;
+                               control->tbl_rai.health_percent = 0;
+                       }
                        ras->is_rma = true;
-
-               /* ignore the -ENOTSUPP return value */
-               amdgpu_dpm_send_rma_reason(adev);
+                       /* ignore the -ENOTSUPP return value */
+                       amdgpu_dpm_send_rma_reason(adev);
+               }
        }
 
        if (control->tbl_hdr.version >= RAS_TABLE_VER_V2_1)