[PATCH 17/23] drm/amdgpu: add a flag to indicate UMC channel index version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



v1 (legacy way): store channel index within a UMC instance in eeprom
v2: store global channel index in eeprom

Signed-off-by: Tao Zhou <tao.zhou1@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c |  9 +++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index ad0fbdb01a89..bb559b521a9f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -2838,6 +2838,11 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev,
 	/* only new entries are saved */
 	if (save_count > 0) {
 		if (control->rec_type == AMDGPU_RAS_EEPROM_REC_PA) {
+			/* set the new channel index flag */
+			for (i = 0; i < save_count; i++)
+				data->bps[control->ras_num_recs + i].retired_page |=
+						UMC_CHANNEL_IDX_V2;
+
 			if (amdgpu_ras_eeprom_append(control,
 						     &data->bps[control->ras_num_recs],
 						     save_count)) {
@@ -2846,6 +2851,10 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev,
 			}
 		} else {
 			for (i = 0; i < unit_num; i++) {
+				/* set the new channel index flag */
+				data->bps[bad_page_num + i * adev->umc.retire_unit].retired_page |=
+						UMC_CHANNEL_IDX_V2;
+
 				if (amdgpu_ras_eeprom_append(control,
 						&data->bps[bad_page_num + i * adev->umc.retire_unit],
 						1)) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
index 2f71194d5da8..f97c45b4eeb8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
@@ -54,6 +54,22 @@
 
 /* Page retirement tag */
 #define UMC_ECC_NEW_DETECTED_TAG       0x1
+/*
+ * a flag to indicate v2 of channel index stored in eeprom
+ *
+ * v1 (legacy way): store channel index within a umc instance in eeprom
+ *    range in UMC v12: 0 ~ 7
+ * v2: store global channel index in eeprom
+ *    range in UMC v12: 0 ~ 127
+ *
+ * NOTE: it's better to store it in eeprom_table_record.mem_channel,
+ * but there is only 8 bits in mem_channel, and the channel number may
+ * increase in the future, we decide to save it in
+ * eeprom_table_record.retired_page. retired_page is useless in v2,
+ * we depend on eeprom_table_record.address instead of retired_page in v2.
+ * Only 48 bits are saved on eeprom, use bit 47 here.
+ */
+#define UMC_CHANNEL_IDX_V2	BIT_ULL(47)
 
 typedef int (*umc_func)(struct amdgpu_device *adev, uint32_t node_inst,
 			uint32_t umc_inst, uint32_t ch_inst, void *data);
-- 
2.34.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux