[PATCH 012/109] drm/amd/ras: Supports recording data source timestamps to EEPROM

Alex Deucher <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
From: YiPeng Chai <[email protected]>

Supports recording data source timestamps to EEPROM.

Signed-off-by: YiPeng Chai <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/ras/core/aca.c           | 5 +++++
 drivers/gpu/drm/amd/ras/core/aca.h           | 1 +
 drivers/gpu/drm/amd/ras/core/ras.h           | 1 +
 drivers/gpu/drm/amd/ras/core/ras_umc_v12_0.c | 6 ++++++
 4 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/ras/core/aca.c b/drivers/gpu/drm/amd/ras/core/aca.c
index da06c840cfc09..4258ffb490a60 100644
--- a/drivers/gpu/drm/amd/ras/core/aca.c
+++ b/drivers/gpu/drm/amd/ras/core/aca.c
@@ -132,6 +132,9 @@ static void aca_log_bank_data(struct ras_core_context *ras_core,
 			struct aca_bank_reg *bank, struct aca_bank_ecc *bank_ecc,
 			struct ras_log_batch_tag *batch)
 {
+	if (batch && bank->timestamp)
+		batch->timestamp = bank->timestamp;
+
 	if (bank_ecc->ue_count)
 		ras_log_ring_add_log_event(ras_core, RAS_LOG_EVENT_UE, bank->regs, batch);
 	else if (bank_ecc->de_count)
@@ -245,6 +248,7 @@ static int aca_log_bad_bank(struct ras_core_context *ras_core,
 				ras_ecc.nps = ras_core_get_curr_nps_mode(ras_core);
 				ras_ecc.status = bank_ecc->bank_info.status;
 				ras_ecc.seq_no = bank->seq_no;
+				ras_ecc.timestamp = bank->timestamp;
 			}
 		} else {
 			ras_ecc.nps = ras_core_get_curr_nps_mode(ras_core);
@@ -252,6 +256,7 @@ static int aca_log_bad_bank(struct ras_core_context *ras_core,
 			ras_ecc.ipid = bank_ecc->bank_info.ipid;
 			ras_ecc.status = bank_ecc->bank_info.status;
 			ras_ecc.seq_no = bank->seq_no;
+			ras_ecc.timestamp = bank->timestamp;
 		}
 
 		if (!ret) {
diff --git a/drivers/gpu/drm/amd/ras/core/aca.h b/drivers/gpu/drm/amd/ras/core/aca.h
index 00d4cc1185dff..a8aac196605aa 100644
--- a/drivers/gpu/drm/amd/ras/core/aca.h
+++ b/drivers/gpu/drm/amd/ras/core/aca.h
@@ -53,6 +53,7 @@ struct ras_core_context;
 struct aca_block;
 
 struct aca_bank_reg {
+	uint64_t timestamp;
 	u32 ecc_type;
 	u64 seq_no;
 	u64 regs[ACA_REG_MAX_COUNT];
diff --git a/drivers/gpu/drm/amd/ras/core/ras.h b/drivers/gpu/drm/amd/ras/core/ras.h
index 43e028189087b..5baeb15473a83 100644
--- a/drivers/gpu/drm/amd/ras/core/ras.h
+++ b/drivers/gpu/drm/amd/ras/core/ras.h
@@ -247,6 +247,7 @@ struct ras_ecc_count {
 };
 
 struct ras_bank_ecc {
+	uint64_t timestamp;
 	uint32_t nps;
 	uint64_t seq_no;
 	uint64_t status;
diff --git a/drivers/gpu/drm/amd/ras/core/ras_umc_v12_0.c b/drivers/gpu/drm/amd/ras/core/ras_umc_v12_0.c
index ccdbc5c4bab1a..ac78c404bed41 100644
--- a/drivers/gpu/drm/amd/ras/core/ras_umc_v12_0.c
+++ b/drivers/gpu/drm/amd/ras/core/ras_umc_v12_0.c
@@ -396,6 +396,12 @@ static int umc_v12_0_bank_to_eeprom_record(struct ras_core_context *ras_core,
 	if (ras_fw_eeprom_supported(ras_core) && bank->ts)
 		record->ts = bank->ts;
 
+	/* If the bank being converted already has a timestamp,
+	 * then use the bank's timestamp.
+	 */
+	if (bank->timestamp)
+		record->ts = bank->timestamp;
+
 	lookup_bad_pages_in_a_row(ras_core, record,
 		bank->nps, NULL, 0, bank->seq_no, true);
 
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.