]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Save nps to eeprom
authorganglxie <ganglxie@amd.com>
Mon, 24 Feb 2025 03:17:33 +0000 (11:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Feb 2025 16:45:12 +0000 (11:45 -0500)
nps info saved together with bad page makes bad page parsing more efficient

Signed-off-by: ganglxie <ganglxie@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
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h

index 83b54efcaa877c3fa4337f6460dcaa78b8c5cbfb..87fcdda3ec611f7f3d6ddce64cc46441754e1985 100644 (file)
@@ -852,6 +852,7 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
 {
        struct amdgpu_device *adev = to_amdgpu_device(control);
        int res, i;
+       uint64_t nps = AMDGPU_NPS1_PARTITION_MODE;
 
        if (!__is_ras_eeprom_supported(adev))
                return 0;
@@ -865,9 +866,12 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
                return -EINVAL;
        }
 
+       if (adev->gmc.gmc_funcs->query_mem_partition_mode)
+               nps = adev->gmc.gmc_funcs->query_mem_partition_mode(adev);
+
        /* set the new channel index flag */
        for (i = 0; i < num; i++)
-               record[i].retired_page |= UMC_CHANNEL_IDX_V2;
+               record[i].retired_page |= (nps << UMC_NPS_SHIFT);
 
        mutex_lock(&control->ras_tbl_mutex);
 
@@ -881,7 +885,7 @@ int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
 
        /* clear channel index flag, the flag is only saved on eeprom */
        for (i = 0; i < num; i++)
-               record[i].retired_page &= ~UMC_CHANNEL_IDX_V2;
+               record[i].retired_page &= ~(nps << UMC_NPS_SHIFT);
 
        return res;
 }
index a4a7e61817aa7c32578630e5043ecd51d8f09209..857693bcd8d476fc7736bf2b4559135c110f7611 100644 (file)
  */
 #define UMC_CHANNEL_IDX_V2     BIT_ULL(47)
 
+/*
+ * save nps value to eeprom_table_record.retired_page[47:40],
+ * the channel index flag above will be retired.
+ */
+#define UMC_NPS_SHIFT 40
+#define UMC_NPS_MASK 0xffULL
+
 typedef int (*umc_func)(struct amdgpu_device *adev, uint32_t node_inst,
                        uint32_t umc_inst, uint32_t ch_inst, void *data);