<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Arial" size="2"><span style="font-size:10pt;">
<div style="padding-right:5pt;padding-left:5pt;"><font color="blue">[AMD Official Use Only - General]<br>

</font></div>
<div style="margin-top:5pt;"><font face="Times New Roman" size="3"><span style="font-size:12pt;"><br>

</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">Please check my comments inline</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">Regards,<br>

Hawking</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-----Original Message-----<br>

From: Chai, Thomas <YiPeng.Chai@amd.com> <br>

Sent: Tuesday, January 16, 2024 16:21<br>

To: amd-gfx@lists.freedesktop.org<br>

Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Li, Candice <Candice.Li@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com>; Yang, Stanley <Stanley.Yang@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com><br>

Subject: [PATCH 3/5] drm/amdgpu: Use asynchronous polling to handle umc_v12_0 poisoning</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Use asynchronous polling to handle umc_v12_0 poisoning.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Signed-off-by: YiPeng Chai <<a href="mailto:YiPeng.Chai@amd.com">YiPeng.Chai@amd.com</a>></span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">---</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c |   5 +</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 143 +++++++++++++++++++-----</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h |   3 +</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> 3 files changed, 120 insertions(+), 31 deletions(-)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 856206e95842..44929281840e 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -118,6 +118,8 @@ const char *get_ras_block_str(struct ras_common_if *ras_block)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> /* typical ECC bad page rate is 1 bad page per 100MB VRAM */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #define RAS_BAD_PAGE_COVER              (100 * 1024 * 1024ULL)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define MAX_UMC_POISON_POLLING_TIME_ASYNC  100  //ms</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> enum amdgpu_ras_retire_page_reservation {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         AMDGPU_RAS_RETIRE_PAGE_RESERVED,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         AMDGPU_RAS_RETIRE_PAGE_PENDING,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -2670,6 +2672,9 @@ static int amdgpu_ras_page_retirement_thread(void *param)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                         atomic_read(&con->page_retirement_req_cnt));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                 atomic_dec(&con->page_retirement_req_cnt);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               amdgpu_umc_poison_retire_page_polling_timeout(adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               false, MAX_UMC_POISON_POLLING_TIME_ASYNC);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         return 0;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 9d1cf41cf483..2dde29cb807d 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -23,6 +23,7 @@</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "umc_v6_7.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define MAX_UMC_POISON_POLLING_TIME_SYNC   20  //ms</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> static int amdgpu_umc_convert_error_address(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                                     struct ras_err_data *err_data, uint64_t err_addr, @@ -85,17 +86,14 @@ int amdgpu_umc_page_retirement_mca(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         return ret;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               void *ras_error_status,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               struct amdgpu_iv_entry *entry,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               bool reset)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+static void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       void *ras_error_status)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         struct amdgpu_ras *con = amdgpu_ras_get_context(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         int ret = 0;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         unsigned long err_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-       kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       mutex_lock(&con->page_retirement_lock);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         ret = amdgpu_dpm_get_ecc_info(adev, (void *)&(con->umc_ecc));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         if (ret == -EOPNOTSUPP) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                 if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops && @@ -163,19 +161,86 @@ static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                                 con->update_channel_flag = false;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                         }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                 }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               if (reset) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       /* use mode-2 reset for poison consumption */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       if (!entry)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                               con->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE2_RESET;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       amdgpu_ras_reset_gpu(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         kfree(err_data->err_addr);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       mutex_unlock(&con->page_retirement_lock);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+}</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               void *ras_error_status,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               struct amdgpu_iv_entry *entry,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               bool reset)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+{</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       struct amdgpu_ras *con = amdgpu_ras_get_context(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       amdgpu_umc_handle_bad_pages(adev, ras_error_status);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       if (err_data->ue_count && reset) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               /* use mode-2 reset for poison consumption */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               if (!entry)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       con->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE2_RESET;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking]: Shall we do further check on con->poison_supported flag to decide issuing mode-2 or mode-1.</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               amdgpu_ras_reset_gpu(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         return AMDGPU_RAS_SUCCESS;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+int amdgpu_umc_poison_retire_page_polling_timeout(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       bool reset, uint32_t timeout_ms)</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking] int amdgpu_umc_bad_page_polling_timeout(struct amdgpu_device *adev, boot reset, uint32_t timeout_ms)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+{</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       struct ras_err_data err_data;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       struct ras_common_if head = {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               .block = AMDGPU_RAS_BLOCK__UMC,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       };</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       uint32_t timeout = timeout_ms;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       memset(&err_data, 0, sizeof(err_data));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       amdgpu_ras_error_data_init(&err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       do {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               amdgpu_umc_handle_bad_pages(adev, &err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               if (timeout && !err_data.de_count) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       msleep(1);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       timeout--;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       } while (timeout && !err_data.de_count);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       if (!timeout)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               dev_warn(adev->dev, "Page retirment executed, but did not find bad </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+pages\n");</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking] dev_warn (adev->dev, “can’t find bad pages\n”);</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       if (err_data.de_count)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               dev_info(adev->dev, "Page retirment: ue:%ld, ce:%ld, de:%ld\n",</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               err_data.ue_count, err_data.ce_count, err_data.de_count);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking] dev_info(adev->dev, “%ld new deferred hardware errors detected\n”, err_data.de_count)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       if (obj) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               obj->err_data.ue_count += err_data.ue_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               obj->err_data.ce_count += err_data.ce_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               obj->err_data.de_count += err_data.de_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       amdgpu_ras_error_data_fini(&err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       kgd2kfd_set_sram_ecc_flag(adev->kfd.dev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       if (reset) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               struct amdgpu_ras *con = amdgpu_ras_get_context(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               /* use mode-2 reset for poison consumption */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               con->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE2_RESET;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking]: Shall we do further check on con->poison_supported flag to decide issuing mode-2 or mode-1.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               amdgpu_ras_reset_gpu(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+       return 0;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+}</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int amdgpu_umc_poison_handler(struct amdgpu_device *adev, bool reset)  {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         int ret = AMDGPU_RAS_SUCCESS;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -193,25 +258,41 @@ int amdgpu_umc_poison_handler(struct amdgpu_device *adev, bool reset)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         if (!amdgpu_sriov_vf(adev)) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               struct ras_err_data err_data;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               struct ras_common_if head = {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       .block = AMDGPU_RAS_BLOCK__UMC,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               };</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               ret = amdgpu_ras_error_data_init(&err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               if (ret)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       return ret;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               ret = amdgpu_umc_do_page_retirement(adev, &err_data, NULL, reset);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               if (ret == AMDGPU_RAS_SUCCESS && obj) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       obj->err_data.ue_count += err_data.ue_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       obj->err_data.ce_count += err_data.ce_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-                       obj->err_data.de_count += err_data.de_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               if (amdgpu_ip_version(adev, UMC_HWIP, 0) != IP_VERSION(12, 0, 0)) {</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking]: if (amdgpu_ip_version(adev, UMC_HWIP, 0) < IP_VERSION(12, 0, 0)) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       struct ras_err_data err_data;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       struct ras_common_if head = {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               .block = AMDGPU_RAS_BLOCK__UMC,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       };</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       ret = amdgpu_ras_error_data_init(&err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       if (ret)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               return ret;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       ret = amdgpu_umc_do_page_retirement(adev, &err_data, NULL, reset);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">-               amdgpu_ras_error_data_fini(&err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       if (ret == AMDGPU_RAS_SUCCESS && obj) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               obj->err_data.ue_count += err_data.ue_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               obj->err_data.ce_count += err_data.ce_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               obj->err_data.de_count += err_data.de_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       amdgpu_ras_error_data_fini(&err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               } else {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       if (reset) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               amdgpu_umc_poison_retire_page_polling_timeout(adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                                                       reset, MAX_UMC_POISON_POLLING_TIME_SYNC);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       } else {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               struct amdgpu_ras *con = amdgpu_ras_get_context(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               dev_info(adev->dev, "Page retirement pending request count: %d\n",</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               atomic_read(&con->page_retirement_req_cnt));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">[Hawking]: might remove the printed message here.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               atomic_inc(&con->page_retirement_req_cnt);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                               wake_up(&con->page_retirement_wq);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+               }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">         } else {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                 if (adev->virt.ops && adev->virt.ops->ras_poison_handler)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                         adev->virt.ops->ras_poison_handler(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 417a6726c71b..ee487adce7e4 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -118,4 +118,7 @@ int amdgpu_umc_page_retirement_mca(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int amdgpu_umc_loop_channels(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">                         umc_func func, void *data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+int amdgpu_umc_poison_retire_page_polling_timeout(struct amdgpu_device *adev,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+                       bool reset, uint32_t timeout_ms);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #endif</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">2.34.1</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
</span></font>
</body>
</html>