PMFW manages eeprom bad page records, update bad page loading
accrodingly.

Signed-off-by: Tao Zhou <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 7c929f93842c..3d2d1468c531 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -3168,8 +3168,12 @@ static int __amdgpu_ras_convert_rec_from_rom(struct 
amdgpu_device *adev,
        int i = 0;
        enum amdgpu_memory_partition save_nps;
 
-       save_nps = (bps->retired_page >> UMC_NPS_SHIFT) & UMC_NPS_MASK;
-       bps->retired_page &= ~(UMC_NPS_MASK << UMC_NPS_SHIFT);
+       if (!amdgpu_ras_smu_eeprom_supported(adev)) {
+               save_nps = (bps->retired_page >> UMC_NPS_SHIFT) & UMC_NPS_MASK;
+               bps->retired_page &= ~(UMC_NPS_MASK << UMC_NPS_SHIFT);
+       } else {
+               save_nps = nps;
+       }
 
        if (save_nps == nps) {
                if (amdgpu_umc_pages_in_a_row(adev, err_data,
@@ -3235,7 +3239,8 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev,
 
        if (from_rom) {
                /* there is no pa recs in V3, so skip pa recs processing */
-               if (control->tbl_hdr.version < RAS_TABLE_VER_V3) {
+               if ((control->tbl_hdr.version < RAS_TABLE_VER_V3) &&
+                   !amdgpu_ras_smu_eeprom_supported(adev)) {
                        for (i = 0; i < pages; i++) {
                                if (control->ras_num_recs - i >= 
adev->umc.retire_unit) {
                                        if ((bps[i].address == bps[i + 
1].address) &&
@@ -3366,7 +3371,8 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device 
*adev)
                        /*In V3, there is no pa recs, and some cases(when 
address==0) may be parsed
                        as pa recs, so add verion check to avoid it.
                        */
-                       if (control->tbl_hdr.version < RAS_TABLE_VER_V3) {
+                       if ((control->tbl_hdr.version < RAS_TABLE_VER_V3) &&
+                           !amdgpu_ras_smu_eeprom_supported(adev)) {
                                for (i = 0; i < control->ras_num_recs; i++) {
                                        if ((control->ras_num_recs - i) >= 
adev->umc.retire_unit) {
                                                if ((bps[i].address == bps[i + 
1].address) &&
-- 
2.34.1

Reply via email to