Report a bad page threshold breach only when the saved record count
exceeds the configured limit. Allow unlocking at equality to keep the
EEPROM status consistent with that boundary.

Signed-off-by: Xiang Liu <[email protected]>
---
 drivers/gpu/drm/amd/ras/core/eeprom.c         | 2 +-
 drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/ras/core/eeprom.c 
b/drivers/gpu/drm/amd/ras/core/eeprom.c
index e7aad113b98a..562763d33ac8 100644
--- a/drivers/gpu/drm/amd/ras/core/eeprom.c
+++ b/drivers/gpu/drm/amd/ras/core/eeprom.c
@@ -693,7 +693,7 @@ static int ras_eeprom_update_header(struct 
ras_eeprom_control *control)
        record_count = ras_umc_get_saved_eeprom_count(ras_core);
        /* Modify the header if it exceeds.
         */
-       if (record_count >= control->record_threshold_count) {
+       if (record_count > control->record_threshold_count) {
                control->tbl_hdr.header = RAS_TABLE_HDR_BAD;
                if (control->tbl_hdr.version >= RAS_TABLE_VER_V2_1) {
                        control->tbl_rai.rma_status = 
RAS_GPU_RETIRED__ECC_REACH_THRESHOLD;
diff --git a/drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c 
b/drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c
index 2f33e3132f76..e90f89be7ebf 100644
--- a/drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c
+++ b/drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c
@@ -286,7 +286,7 @@ int ras_eeprom_mgr_check_and_report_status(struct 
ras_core_context *ras_core, bo
                                valid_err_count, mgr->ras_err_threshold);
 
        } else if (info.eeprom_status == RAS_EEPROM_LOCKED) {
-               if (info.rma_status || (valid_err_count >= 
mgr->ras_err_threshold)) {
+               if (info.rma_status || valid_err_count > 
mgr->ras_err_threshold) {
                        if (info.rma_status)
                                RAS_DEV_ERR(ras_core->dev, "RAS records:%d 
exceed error threshold",
                                        valid_err_count);
@@ -305,13 +305,13 @@ int ras_eeprom_mgr_check_and_report_status(struct 
ras_core_context *ras_core, bo
                                RAS_DEV_ERR(ras_core->dev,
                                "User defined threshold is set, runtime service 
will be halt when threshold is reached\n");
                        }
-               } else if ((valid_err_count < mgr->ras_err_threshold) &&
+               } else if ((valid_err_count <= mgr->ras_err_threshold) &&
                                mgr->eeprom_ops->unlock_eeprom) {
                        /* This means that, the threshold was increased since
                         * the last time the system was booted, and now,
-                        * the saved error count is less than threshold,
+                        * the saved error count does not exceed the threshold,
                         * so that at least one more record can be saved,
-                        * before the page count threshold is reached.
+                        * before the page count threshold is exceeded.
                         */
                        ret = mgr->eeprom_ops->unlock_eeprom(ras_core);
                        if (ret) {
-- 
2.34.1

Reply via email to