<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="#ED7D31"><span style="font-size:11pt;">Please check my comments inline.</span></font></div>
<div><font face="Times New Roman" size="2" color="#ED7D31"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2" color="#ED7D31"><span style="font-size:11pt;">Regards,<br>
Hawking</span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="DengXian" size="2"><span style="font-size:11pt;">_____________________________________________<br>
<b>From:</b> Wang, Yang(Kevin) <KevinYang.Wang@amd.com> <br>
<b>Sent:</b> Wednesday, January 3, 2024 18:29<br>
<b>To:</b> Zhang, Hawking <Hawking.Zhang@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhou1, Tao <Tao.Zhou1@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com><br>
<b>Subject:</b> RE: [PATCH 01/14] drm/amdgpu: implement RAS ACA driver framework</span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div style="padding-right:5pt;padding-left:5pt;"><font face="Arial" color="blue">[AMD Official Use Only - General]<br>
</font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"><br>
</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Hi 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;">Thanks for your review.</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;">Reply comment inline.</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;">Best Regards,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">Kevin</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="DengXian" size="2"><span style="font-size:11pt;">_____________________________________________<br>
<b>From:</b> Zhang, Hawking <<a href="mailto:Hawking.Zhang@amd.com"><font color="#0563C1"><u>Hawking.Zhang@amd.com</u></font></a>>
<br>
<b>Sent:</b> Wednesday, January 3, 2024 5:29 PM<br>
<b>To:</b> Wang, Yang(Kevin) <<a href="mailto:KevinYang.Wang@amd.com"><font color="#0563C1"><u>KevinYang.Wang@amd.com</u></font></a>>; <a href="mailto:amd-gfx@lists.freedesktop.org"><font color="#0563C1"><u>amd-gfx@lists.freedesktop.org</u></font></a><br>
<b>Cc:</b> Zhou1, Tao <<a href="mailto:Tao.Zhou1@amd.com"><font color="#0563C1"><u>Tao.Zhou1@amd.com</u></font></a>>; Chai, Thomas <<a href="mailto:YiPeng.Chai@amd.com"><font color="#0563C1"><u>YiPeng.Chai@amd.com</u></font></a>><br>
<b>Subject:</b> RE: [PATCH 01/14] drm/amdgpu: implement RAS ACA driver framework</span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div style="padding-right:5pt;padding-left:5pt;"><font face="Arial" color="blue">[AMD Official Use Only - General]<br>
</font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"><br>
</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">Please check my comments inline. I added index for each comment (9 in total) since it is a long thread…</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,</span></font></div>
<div><font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">Hawking</span></font></div>
<div><font face="Times New Roman" 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: Wang, Yang(Kevin) <<a href="mailto:KevinYang.Wang@amd.com"><font color="#0563C1"><u>KevinYang.Wang@amd.com</u></font></a>>
<br>
Sent: Wednesday, January 3, 2024 16:02<br>
To: <a href="mailto:amd-gfx@lists.freedesktop.org"><font color="#0563C1"><u>amd-gfx@lists.freedesktop.org</u></font></a><br>
Cc: Zhang, Hawking <<a href="mailto:Hawking.Zhang@amd.com"><font color="#0563C1"><u>Hawking.Zhang@amd.com</u></font></a>>; Zhou1, Tao <<a href="mailto:Tao.Zhou1@amd.com"><font color="#0563C1"><u>Tao.Zhou1@amd.com</u></font></a>>; Chai, Thomas <<a href="mailto:YiPeng.Chai@amd.com"><font color="#0563C1"><u>YiPeng.Chai@amd.com</u></font></a>>;
Wang, Yang(Kevin) <<a href="mailto:KevinYang.Wang@amd.com"><font color="#0563C1"><u>KevinYang.Wang@amd.com</u></font></a>><br>
Subject: [PATCH 01/14] drm/amdgpu: implement RAS ACA driver framework</span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">v1:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">implement new RAS ACA driver code framework.</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;">v2:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- rename aca_bank_set to aca_banks.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- rename aca_source_xxx to aca_handle_xxx</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: Yang Wang <<a href="mailto:kevinyang.wang@amd.com">kevinyang.wang@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/Makefile | 2 +-</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 679 +++++++++++++++++++++</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h | 196 ++++++</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 +</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> 6 files changed, 887 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h</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/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 260e32ef7bae..4c989da4d2f3 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/Makefile</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/Makefile</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -80,7 +80,7 @@ amdgpu-y += amdgpu_device.o amdgpu_doorbell_mgr.o amdgpu_kms.o \</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> amdgpu_fw_attestation.o amdgpu_securedisplay.o \</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> amdgpu_eeprom.o amdgpu_mca.o amdgpu_psp_ta.o amdgpu_lsdma.o \</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">- amdgpu_ring_mux.o amdgpu_xcp.o amdgpu_seq64.o</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ amdgpu_ring_mux.o amdgpu_xcp.o amdgpu_seq64.o amdgpu_aca.o</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-$(CONFIG_PROC_FS) += amdgpu_fdinfo.o</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.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 616b6c911767..9fa6f69a58a7 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -107,6 +107,7 @@</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_smuio.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_fdinfo.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_mca.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#include "amdgpu_aca.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_ras.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_xcp.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_seq64.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -1045,6 +1046,9 @@ struct amdgpu_device {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> /* MCA */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> struct amdgpu_mca mca;</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;">+ /* ACA */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca aca;</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 amdgpu_ip_block ip_blocks[AMDGPU_MAX_IP_NUM];</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> uint32_t harvest_ip_mask;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> int num_ip_blocks;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">new file mode 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 000000000000..6a6f167b5380</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- /dev/null</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -0,0 +1,679 @@</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;">+ * Copyright 2023 Advanced Micro Devices, Inc.</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;">+ * Permission is hereby granted, free of charge, to any person </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+obtaining a</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * copy of this software and associated documentation files (the </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+"Software"),</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * to deal in the Software without restriction, including without </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+limitation</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * the rights to use, copy, modify, merge, publish, distribute, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+sublicense,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * and/or sell copies of the Software, and to permit persons to whom </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+the</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * Software is furnished to do so, subject to the following conditions:</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;">+ * The above copyright notice and this permission notice shall be </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+included in</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * all copies or substantial portions of the Software.</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;">+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+EXPRESS OR</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+MERCHANTABILITY,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+SHALL</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+DAMAGES OR</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+OTHERWISE,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+OR</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * OTHER DEALINGS IN THE SOFTWARE.</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;">+#include <linux/list.h></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 "amdgpu_aca.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#include "amdgpu_ras.h"</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 ACA_BANK_HWID(type, hwid, mcatype) [ACA_HWIP_TYPE_##type] = </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+{hwid, mcatype}</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;">+typedef int bank_handler_t(struct aca_handle *handle, struct aca_bank </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+*bank, enum aca_error_type type, 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;">+struct aca_banks {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int nr_banks;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct list_head list;</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;">+struct aca_hwip {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int hwid;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int mcatype;</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 struct aca_hwip aca_hwid_mcatypes[ACA_HWIP_TYPE_COUNT] = {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_BANK_HWID(SMU, 0x01, 0x01),</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_BANK_HWID(PCS_XGMI, 0x50, 0x00),</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_BANK_HWID(UMC, 0x96, 0x00),</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 void aca_banks_init(struct aca_banks *banks) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!banks)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return;</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(banks, 0, sizeof(*banks));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ INIT_LIST_HEAD(&banks->list);</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 aca_banks_add_bank(struct aca_banks *banks, struct aca_bank </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+*bank) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_node *node;</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 (!bank)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ node = kvzalloc(sizeof(*node), GFP_KERNEL);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!node)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -ENOMEM;</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;">+ memcpy(&node->bank, bank, sizeof(*bank));</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;">+ INIT_LIST_HEAD(&node->node);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_add_tail(&node->node, &banks->list);</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;">+ banks->nr_banks++;</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;">+static void aca_banks_release(struct aca_banks *banks) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_node *node, *tmp;</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;">+ list_for_each_entry_safe(node, tmp, &banks->list, node) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_del(&node->node);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ kvfree(node);</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;">+static int aca_smu_get_valid_aca_count(struct amdgpu_device *adev, enum </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_error_type type, u32 *count) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca *aca = &adev->aca;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_smu_funcs *smu_funcs = aca->smu_funcs;</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 (!count)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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 (!smu_funcs || !smu_funcs->get_valid_aca_count)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EOPNOTSUPP;</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 smu_funcs->get_valid_aca_count(adev, type, 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;">+static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_error_type type,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int start, int count,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_banks *banks)</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 amdgpu_aca *aca = &adev->aca;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_smu_funcs *smu_funcs = aca->smu_funcs;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank bank;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int i, max_count, 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;">+ if (!count)</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;">+ if (!smu_funcs || !smu_funcs->get_valid_aca_bank)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EOPNOTSUPP;</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;">+ switch (type) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case ACA_ERROR_TYPE_UE:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ max_count = smu_funcs->max_ue_aca_count;</span></font></div>
<ol style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: %s/max_ue_aca_count/max_ue_count</b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#1/#2 [Kevin]: will update it , but the new name is still made confused, this number is used indicate valid MCA/ACA bank count, it is not equal with error count.</b></span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"><b> </b><font color="#ED7D31"><b>[Hawking]: good point</b></font><font color="#ED7D31"><b>, </b></font><font color="#ED7D31"><b>Kevin</b></font><font color="#ED7D31"><b>. </b></font><font color="#ED7D31"><b>then
probably rename to max_</b></font><font color="#ED7D31"><b>ue|ce_bank_count</b></font></span></font></div>
<div><font face="Times New Roman" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Times New Roman" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ break;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case ACA_ERROR_TYPE_CE:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case ACA_ERROR_TYPE_DEFERRED:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ max_count = smu_funcs->max_ce_aca_count;</span></font></div>
<ol start="2" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: %s/max_ce_aca_count/max_ce_count</b></li><li><b>[Hawking]: I’ll suggest treating DEFERRED as default for now. (i.e., not supported yet)</b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#3 [Kevin]: will update it in next version.</b></span></font></div>
<div><font face="Times New Roman" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ break;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ default:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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 (start + count >= max_count)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ count = min_t(int, count, max_count);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ for (i = 0; i < count; i++) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ memset(&bank, 0, sizeof(bank));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ret = smu_funcs->get_valid_aca_bank(adev, type, start + i, &bank);</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 = aca_banks_add_bank(banks, &bank);</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;">+</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;">+static bool aca_bank_hwip_is_matched(struct aca_bank *bank, enum </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_hwip_type type) {</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 aca_hwip *hwip;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int hwid, mcatype;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u64 ipid;</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 (!bank || type == ACA_HWIP_TYPE_UNKNOW)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ hwip = &aca_hwid_mcatypes[type];</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!hwip->hwid)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return 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;">+ ipid = bank->regs[ACA_REG_IDX_IPID];</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ hwid = ACA_REG__IPID__HARDWAREID(ipid);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mcatype = ACA_REG__IPID__MCATYPE(ipid);</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 hwip->hwid == hwid && hwip->mcatype == mcatype; }</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 bool aca_bank_is_valid(struct aca_handle *handle, struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_bank *bank, enum aca_error_type type) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_bank_ops *bank_ops = handle->bank_ops;</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 (!aca_bank_hwip_is_matched(bank, handle->hwip))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return 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;">+ if (!bank_ops->aca_bank_is_valid)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return true;</span></font></div>
<ol start="4" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: does it apply to the case where the valid field is not available? Can you please elaborate why return true in such case?</b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#4 [Keivn]:<br>
This callback function is used to verify the mapping relationship between aca hwip and ras block. </b></span></font></div>
<div style="padding-left:36pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>For example, gfx/sdma/mmhub needs to use this function for 2-level verification, the 1</b><font size="1"><span style="font-size:7.3pt;"><b><sup>st</sup></b></span></font><b>
level verification is aca hwid, but the gfx/sdma/mmhub/vcn/… both will point aca smu (0x01,0x01) hwid. (pls check patch #8/#9/#10)</b></span></font></div>
<div style="padding-left:36pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>but for xgmi/umc ras block, it is not necessary, and returns true.</b></span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> <font face="Calibri" color="#ED7D31"><b>[H</b></font><font face="Calibri" color="#ED7D31"><b>awking</b></font><font face="Calibri" color="#ED7D31"><b>]</b></font><font face="Calibri" color="#ED7D31"><b>:
</b></font></span></font></div>
<div style="padding-left:36pt;"><font face="Calibri" size="2" color="#ED7D31"><span style="font-size:11pt;"><b>I see, </b><b>it is caused by the error logging mechanism in</b><b> Traditional MCA IP blocks v.s., Traditional driver managed IP bl</b><b>ocks, right?
</b><b>As discussed, I’d expect this function could be retired in next generation since </b><b>ACA ultimately goes to the same error logging mechanism. It’s okay with me to keep the function for now.</b></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 bank_ops->aca_bank_is_valid(handle, bank, type, handle->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;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+static struct aca_bank_error *new_bank_error(struct aca_error *aerr, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+struct aca_bank_info *info) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_error *bank_error;</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;">+ bank_error = kvzalloc(sizeof(*bank_error), GFP_KERNEL);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!bank_error)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return NULL;</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;">+ INIT_LIST_HEAD(&bank_error->node);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ memcpy(&bank_error->info, info, sizeof(*info));</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_lock(&aerr->lock);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_add_tail(&bank_error->node, &aerr->list);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mutex_unlock(&aerr->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;">+ return bank_error;</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 struct aca_bank_error *find_bank_error(struct aca_error *aerr, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+struct aca_bank_info *info) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_error *bank_error = NULL;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_info *tmp_info;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ bool found = 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;">+ mutex_lock(&aerr->lock);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_for_each_entry(bank_error, &aerr->list, node) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ tmp_info = &bank_error->info;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (tmp_info->socket_id == info->socket_id &&</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ tmp_info->die_id == info->die_id) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ found = true;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ goto out_unlock;</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;">+out_unlock:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mutex_unlock(&aerr->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;">+ return found ? bank_error : NULL;</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 void aca_bank_error_remove(struct aca_error *aerr, struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_bank_error *bank_error) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!aerr || !bank_error)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return;</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;">+ list_del(&bank_error->node);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aerr->nr_errors--;</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;">+ kvfree(bank_error);</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 struct aca_bank_error *get_bank_error(struct aca_error *aerr, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+struct aca_bank_info *info) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_error *bank_error;</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 (!aerr || !info)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return NULL;</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;">+ bank_error = find_bank_error(aerr, info);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (bank_error)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return bank_error;</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 new_bank_error(aerr, info);</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 aca_error_inc_count(struct aca_error *aerr, struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_bank_info *info, u64 count) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_error *bank_error;</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 (!info)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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 (!count)</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;">+ bank_error = get_bank_error(aerr, info);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!bank_error)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -ENOMEM;</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;">+ bank_error->count += 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;">+ 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;">+static int aca_log_error_report(struct aca_handle *handle, enum aca_error_type type,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_report *report)</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 aca_error_cache *error_cache = &handle->error_cache;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error *aerr;</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 (!handle || !report)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ aerr = &error_cache->errors[type];</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return aca_error_inc_count(aerr, &report->info, report->count); }</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+</span></font></div>
<ol start="5" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: Shall we merge the aca_error_inc_count with aca_log_error_report? if you haven’t name any function as aca_log_error, then just rename aca_log_error_report to aca_log_errors. </b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#5 [Kevin]: will update it in next version.</b></span></font></div>
<div style="padding-left:36pt;"><font face="Times New Roman" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+static int aca_generate_bank_report(struct aca_handle *handle, struct aca_bank *bank,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type, struct aca_bank_report *report) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_bank_ops *bank_ops = handle->bank_ops;</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 (!bank || !report)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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 (!bank_ops->aca_bank_generate_report)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EOPNOTSUPP;</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(report, 0, sizeof(*report));</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return bank_ops->aca_bank_generate_report(handle, bank, type,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ report, handle->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;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+static int handler_aca_log_bank_error(struct aca_handle *handle, struct aca_bank *bank,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type, void *data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_report report;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int 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 = aca_generate_bank_report(handle, bank, type, &report);</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;">+ if (!report.count)</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;">+ ret = aca_log_error_report(handle, type, &report);</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;">+ 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;">+static int aca_dispatch_bank(struct aca_handle_manager *mgr, struct aca_bank *bank,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type, bank_handler_t handler, void *data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_handle *handle;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int 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;">+ if (list_empty(&mgr->list))</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;">+ list_for_each_entry(handle, &mgr->list, node) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!aca_bank_is_valid(handle, bank, type))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ continue;</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 = handler(handle, bank, type, 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;">+</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;">+static int aca_dispatch_banks(struct aca_handle_manager *mgr, struct aca_banks *banks,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type, bank_handler_t handler, 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;">+ struct aca_bank_node *node;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank *bank;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int 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;">+ if (!mgr || !banks)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ /* pre check to avoid unnecessary operations */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (list_empty(&mgr->list) || list_empty(&banks->list))</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;">+ list_for_each_entry(node, &banks->list, node) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ bank = &node->bank;</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 = aca_dispatch_bank(mgr, bank, type, handler, 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;">+</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>
<ol start="6" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: Can we merge aca_dispatch_bank with aca_dispatch_banks?</b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#6 [Kevin]: I prefer to keep this; aca banks dispatch has three levels of tasks, namely banks->bank->aca_handle. Keep it this way to make the hierarchy clearer.</b></span></font></div>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b> Thanks.</b></span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> <font face="Calibri" color="#ED7D31"><b>[Hawking]: okay, that works for me as well.</b></font></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 aca_bank_update(struct amdgpu_device *adev, enum aca_error_type type,</span></font></div>
<ol start="7" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: let’s name it aca_update_banks</b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#7 [Kevin]: will update it in next version.</b></span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ bank_handler_t handler, void *data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca *aca = &adev->aca;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_banks banks;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 count = 0;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int 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;">+ if (list_empty(&aca->mgr.list))</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;">+ ret = aca_smu_get_valid_aca_count(adev, type, &count);</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;">+ if (!count)</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;">+ aca_banks_init(&banks);</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 = aca_smu_get_valid_aca_banks(adev, type, 0, count, &banks);</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;">+ goto err_release_banks;</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 (list_empty(&banks.list)) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ret = 0;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ goto err_release_banks;</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;">+ ret = aca_dispatch_banks(&aca->mgr, &banks, type,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handler, 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;">+ goto err_release_banks;</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;">+err_release_banks:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_banks_release(&banks);</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 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 aca_error_update(struct amdgpu_device *adev, enum </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_error_type type) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return aca_bank_update(adev, type, handler_aca_log_bank_error, NULL); </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+}</span></font></div>
<ol start="8" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking]: Shall we drop this function since it’s just a wraper. It seems to the caller __aca_get_error_data does have all the input parameters that can feed into aca_update_banks.</b></li></span></font>
</ol>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"><b> #8 [kevin]: will update it in next version.</b></span></font></div>
<div><font face="Times New Roman" 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;">+static int aca_log_aca_error_data(struct aca_bank_error *bank_error, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+enum aca_error_type type, struct ras_err_data *err_data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_info *info;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_smuio_mcm_config_info mcm_info;</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 (!bank_error->count)</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;">+ info = &bank_error->info;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mcm_info.die_id = info->die_id;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mcm_info.socket_id = info->socket_id;</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;">+ switch (type) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case ACA_ERROR_TYPE_UE:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ amdgpu_ras_error_statistic_ue_count(err_data, &mcm_info, NULL, bank_error->count);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ break;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case ACA_ERROR_TYPE_CE:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ amdgpu_ras_error_statistic_ce_count(err_data, &mcm_info, NULL, bank_error->count);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ break;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case ACA_ERROR_TYPE_DEFERRED:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ default:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ break;</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;">+static int aca_log_aca_error(struct aca_handle *handle, enum </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_error_type type, struct ras_err_data *err_data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error_cache *error_cache = &handle->error_cache;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error *aerr = &error_cache->errors[type];</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_error *bank_error, *tmp;</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_lock(&aerr->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;">+ if (list_empty(&aerr->list))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ goto out_unlock;</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;">+ list_for_each_entry_safe(bank_error, tmp, &aerr->list, node) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_log_aca_error_data(bank_error, type, err_data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_bank_error_remove(aerr, bank_error);</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;">+out_unlock:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mutex_unlock(&aerr->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;">+ 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;">+static int __aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *handle, enum aca_error_type type,</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;">+{</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int 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;">+ /* udpate aca bank to aca source error_cache first */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ret = aca_error_update(adev, type);</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;">+ return aca_log_aca_error(handle, type, 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;">+static bool aca_handle_is_valid(struct aca_handle *handle) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!handle->mask || !list_empty(&handle->node))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return 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;">+ return true;</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_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *handle,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type, void *data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct ras_err_data *err_data = (struct ras_err_data *)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 (!handle || !err_data)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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 (aca_handle_is_valid(handle))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EOPNOTSUPP;</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 (!(BIT(type) & handle->mask))</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;">+ return __aca_get_error_data(adev, handle, type, 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;">+static void aca_error_init(struct aca_error *aerr, enum aca_error_type </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+type) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mutex_init(&aerr->lock);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ INIT_LIST_HEAD(&aerr->list);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aerr->type = type;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aerr->nr_errors = 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;">+static void aca_init_error_cache(struct aca_handle *handle) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error_cache *error_cache = &handle->error_cache;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int type;</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;">+ for (type = ACA_ERROR_TYPE_UE; type < ACA_ERROR_TYPE_COUNT; type++)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_error_init(&error_cache->errors[type], type); }</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 void aca_error_fini(struct aca_error *aerr) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_error *bank_error, *tmp;</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_lock(&aerr->lock);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_for_each_entry_safe(bank_error, tmp, &aerr->list, node)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_bank_error_remove(aerr, bank_error);</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_destroy(&aerr->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 void aca_fini_error_cache(struct aca_handle *handle) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error_cache *error_cache = &handle->error_cache;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int type;</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;">+ for (type = ACA_ERROR_TYPE_UE; type < ACA_ERROR_TYPE_COUNT; type++)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_error_fini(&error_cache->errors[type]);</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 add_aca_handle(struct amdgpu_device *adev, struct aca_handle_manager *mgr, struct aca_handle *handle,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const char *name, const struct aca_info *ras_info, void *data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ memset(handle, 0, sizeof(*handle));</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;">+ handle->adev = adev;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handle->mgr = mgr;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handle->name = name;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handle->hwip = ras_info->hwip;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handle->mask = ras_info->mask;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handle->bank_ops = ras_info->bank_ops;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ handle->data = data;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca_init_error_cache(handle);</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;">+ INIT_LIST_HEAD(&handle->node);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_add_tail(&handle->node, &mgr->list);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mgr->nr_handles++;</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_aca_add_handle(struct amdgpu_device *adev, struct aca_handle *handle,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const char *name, const struct aca_info *ras_info, void *data) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca *aca = &adev->aca;</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 add_aca_handle(adev, &aca->mgr, handle, name, ras_info, 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;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+static void remove_aca(struct aca_handle *handle) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_handle_manager *mgr = handle->mgr;</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;">+ aca_fini_error_cache(handle);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ list_del(&handle->node);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mgr->nr_handles--;</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;">+void amdgpu_aca_remove_handle(struct aca_handle *handle) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!handle || list_empty(&handle->node))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return;</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;">+ remove_aca(handle);</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 aca_manager_init(struct aca_handle_manager *mgr) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ INIT_LIST_HEAD(&mgr->list);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ mgr->nr_handles = 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;">+ 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;">+static void aca_manager_fini(struct aca_handle_manager *mgr) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_handle *handle, *tmp;</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;">+ list_for_each_entry_safe(handle, tmp, &mgr->list, node)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ remove_aca(handle);</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_aca_init(struct amdgpu_device *adev) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca *aca = &adev->aca;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int 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 = aca_manager_init(&aca->mgr);</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;">+ 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;">+void amdgpu_aca_fini(struct amdgpu_device *adev) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca *aca = &adev->aca;</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;">+ aca_manager_fini(&aca->mgr);</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;">+void amdgpu_aca_set_smu_funcs(struct amdgpu_device *adev, const struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_smu_funcs *smu_funcs) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_aca *aca = &adev->aca;</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;">+ WARN_ON(aca->smu_funcs);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ aca->smu_funcs = smu_funcs;</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 aca_bank_info_decode(struct aca_bank *bank, struct aca_bank_info </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+*info) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u64 ipid;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 instidhi, instidlo;</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 (!bank || !info)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ ipid = bank->regs[ACA_REG_IDX_IPID];</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ info->hwid = ACA_REG__IPID__HARDWAREID(ipid);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ info->mcatype = ACA_REG__IPID__MCATYPE(ipid);</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;">+ * Unfied DieID Format: SAASS. A:AID, S:Socket.</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * Unfied DieID[4:4] = InstanceId[0:0]</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * Unfied DieID[0:3] = InstanceIdHi[0:3]</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;">+ instidhi = ACA_REG__IPID__INSTANCEIDHI(ipid);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ instidlo = ACA_REG__IPID__INSTANCEIDLO(ipid);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ info->die_id = ((instidhi >> 2) & 0x03);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ info->socket_id = ((instidlo & 0x1) << 2) | (instidhi & 0x03);</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;">+static int aca_bank_get_error_code(struct amdgpu_device *adev, struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_bank *bank) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int error_code;</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;">+ switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ case IP_VERSION(13, 0, 6):</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (!(adev->flags & AMD_IS_APU) && adev->pm.fw_version >= 0x00555600) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ error_code = ACA_REG__SYND__ERRORINFORMATION(bank->regs[ACA_REG_IDX_SYND]);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return error_code & 0xff;</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;">+ break;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ default:</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ break;</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;">+ /* NOTE: the true error code is encoded in status.errorcode[0:7] */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ error_code = </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ACA_REG__STATUS__ERRORCODE(bank->regs[ACA_REG_IDX_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;">+ return error_code & 0xff;</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 aca_bank_check_error_codes(struct amdgpu_device *adev, struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_bank *bank, int *err_codes, int size) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int i, error_code;</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 (!bank || !err_codes)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return -EINVAL;</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;">+ error_code = aca_bank_get_error_code(adev, bank);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ for (i = 0; i < size; i++) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (err_codes[i] == error_code)</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;">+ return -EINVAL;</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;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">new file mode 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 000000000000..688907270ff7</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- /dev/null</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -0,0 +1,196 @@</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;">+ * Copyright 2023 Advanced Micro Devices, Inc.</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;">+ * Permission is hereby granted, free of charge, to any person </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+obtaining a</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * copy of this software and associated documentation files (the </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+"Software"),</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * to deal in the Software without restriction, including without </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+limitation</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * the rights to use, copy, modify, merge, publish, distribute, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+sublicense,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * and/or sell copies of the Software, and to permit persons to whom </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+the</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * Software is furnished to do so, subject to the following conditions:</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;">+ * The above copyright notice and this permission notice shall be </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+included in</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * all copies or substantial portions of the Software.</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;">+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+EXPRESS OR</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+MERCHANTABILITY,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+SHALL</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+DAMAGES OR</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+OTHERWISE,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+OR</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ * OTHER DEALINGS IN THE SOFTWARE.</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;">+#ifndef __AMDGPU_ACA_H__</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define __AMDGPU_ACA_H__</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 <linux/list.h></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 ACA_MAX_REGS_COUNT (16)</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 ACA_REG_FIELD(x, h, l) (((x) & GENMASK_ULL(h, l)) >> l)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__VAL(x) ACA_REG_FIELD(x, 63, 63)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__OVERFLOW(x) ACA_REG_FIELD(x, 62, 62)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__UC(x) ACA_REG_FIELD(x, 61, 61)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__EN(x) ACA_REG_FIELD(x, 60, 60)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__MISCV(x) ACA_REG_FIELD(x, 59, 59)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__ADDRV(x) ACA_REG_FIELD(x, 58, 58)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__PCC(x) ACA_REG_FIELD(x, 57, 57)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__ERRCOREIDVAL(x) ACA_REG_FIELD(x, 56, 56)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__TCC(x) ACA_REG_FIELD(x, 55, 55)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__SYNDV(x) ACA_REG_FIELD(x, 53, 53)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__CECC(x) ACA_REG_FIELD(x, 46, 46)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__UECC(x) ACA_REG_FIELD(x, 45, 45)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__DEFERRED(x) ACA_REG_FIELD(x, 44, 44)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__POISON(x) ACA_REG_FIELD(x, 43, 43)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__SCRUB(x) ACA_REG_FIELD(x, 40, 40)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__ERRCOREID(x) ACA_REG_FIELD(x, 37, 32)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__ADDRLSB(x) ACA_REG_FIELD(x, 29, 24)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__ERRORCODEEXT(x) ACA_REG_FIELD(x, 21, 16)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__STATUS__ERRORCODE(x) ACA_REG_FIELD(x, 15, 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;">+#define ACA_REG__IPID__MCATYPE(x) ACA_REG_FIELD(x, 63, 48)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__IPID__INSTANCEIDHI(x) ACA_REG_FIELD(x, 47, 44)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__IPID__HARDWAREID(x) ACA_REG_FIELD(x, 43, 32)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__IPID__INSTANCEIDLO(x) ACA_REG_FIELD(x, 31, 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;">+#define ACA_REG__MISC0__VALID(x) ACA_REG_FIELD(x, 63, 63)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__MISC0__OVRFLW(x) ACA_REG_FIELD(x, 48, 48)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_REG__MISC0__ERRCNT(x) ACA_REG_FIELD(x, 43, 32)</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 ACA_REG__SYND__ERRORINFORMATION(x) ACA_REG_FIELD(x, 17, 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;">+/* NOTE: The following codes refers to the smu header file */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_EXTERROR_CODE_CE 0x3a</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_EXTERROR_CODE_FAULT 0x3b</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 ACA_ERROR_UE_MASK BIT_MASK(ACA_ERROR_TYPE_UE)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_ERROR_CE_MASK BIT_MASK(ACA_ERROR_TYPE_CE)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#define ACA_ERROR_DEFERRED_MASK BIT_MASK(ACA_ERROR_TYPE_DEFERRED)</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 aca_reg_idx {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_CTL = 0,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_STATUS = 1,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_ADDR = 2,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_MISC0 = 3,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_CONFG = 4,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_IPID = 5,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_SYND = 6,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_DESTAT = 8,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_DEADDR = 9,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_CTL_MASK = 10,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_REG_IDX_COUNT = 16,</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;">+enum aca_hwip_type {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_HWIP_TYPE_UNKNOW = -1,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_HWIP_TYPE_PSP = 0,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_HWIP_TYPE_UMC,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_HWIP_TYPE_SMU,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_HWIP_TYPE_PCS_XGMI,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_HWIP_TYPE_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;">+enum aca_error_type {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_ERROR_TYPE_INVALID = -1,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_ERROR_TYPE_UE = 0,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_ERROR_TYPE_CE,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_ERROR_TYPE_DEFERRED,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ ACA_ERROR_TYPE_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;">+struct aca_bank {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u64 regs[ACA_MAX_REGS_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;">+struct aca_bank_node {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank bank;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct list_head node;</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;">+struct aca_bank_info {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int die_id;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int socket_id;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int hwid;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int mcatype;</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;">+struct aca_bank_report {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_info info;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u64 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;">+struct aca_bank_error {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct list_head node;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_info info;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u64 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;">+struct aca_error {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct list_head list;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct mutex lock;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int nr_errors;</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;">+struct aca_handle_manager {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct list_head list;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int nr_handles;</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;">+struct aca_error_cache {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error errors[ACA_ERROR_TYPE_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;">+struct aca_handle {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct list_head node;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_hwip_type hwip;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct amdgpu_device *adev;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_handle_manager *mgr;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_error_cache error_cache;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_bank_ops *bank_ops;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const char *name;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 mask;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ 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;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+struct aca_bank_ops {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int (*aca_bank_generate_report)(struct aca_handle *handle, struct aca_bank *bank, enum aca_error_type type,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_bank_report *report, void *data);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ bool (*aca_bank_is_valid)(struct aca_handle *handle, struct aca_bank *bank, enum aca_error_type type,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ 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;">+</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+struct aca_smu_funcs {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int max_ue_aca_count;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int max_ce_aca_count;</span></font></div>
<ol start="9" style="margin:0;padding-left:36pt;list-style-type:decimal;">
<font face="Calibri" size="2" color="#2F5496"><span style="font-size:11pt;">
<li><b>[Hawking] rename them to max_ue_count, and max_ce_count respectively</b></li></span></font>
</ol>
<div style="padding-left:18pt;"><font face="Calibri" size="2"><span style="font-size:11pt;"><b>#9 [Kevin]: same with #1/#2.</b></span></font></div>
<div style="text-indent:18pt;"><font face="Calibri" size="2" color="#ED7D31"><span style="font-size:11pt;"><b>[Hawking]: Sure, let’s rename them to max_ue|ce_</b><b>bank_count</b></span></font></div>
<div style="padding-left:36pt;"><font face="Times New Roman" size="2" color="#2F5496"><span style="font-size:11pt;"> </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int (*set_debug_mode)(struct amdgpu_device *adev, bool enable);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int (*get_valid_aca_count)(struct amdgpu_device *adev, enum aca_error_type type, u32 *count);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ int (*get_valid_aca_bank)(struct amdgpu_device *adev, enum </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_error_type type, int idx, struct aca_bank *bank); };</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 amdgpu_aca {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ struct aca_handle_manager mgr;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_smu_funcs *smu_funcs; };</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 aca_info {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_hwip_type hwip;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const struct aca_bank_ops *bank_ops;</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ u32 mask;</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_aca_init(struct amdgpu_device *adev); void </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+amdgpu_aca_fini(struct amdgpu_device *adev); void </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+amdgpu_aca_set_smu_funcs(struct amdgpu_device *adev, const struct </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+aca_smu_funcs *smu_funcs);</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 aca_bank_info_decode(struct aca_bank *bank, struct aca_bank_info </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+*info); int aca_bank_check_error_codes(struct amdgpu_device *adev, </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+struct aca_bank *bank, int *err_codes, int size);</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_aca_add_handle(struct amdgpu_device *adev, struct aca_handle *handle,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ const char *name, const struct aca_info *aca_info, void *data); </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+void amdgpu_aca_remove_handle(struct aca_handle *handle); int </span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *handle,</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ enum aca_error_type type, void *data); #endif</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 4b694696930e..dc03643a985e 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -4030,6 +4030,10 @@ int amdgpu_device_init(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;"> amdgpu_device_get_pcie_info(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;">+ r = amdgpu_aca_init(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ if (r)</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+ return r;</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;"> r = amdgpu_device_get_job_timeout_settings(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> if (r) {</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n"); @@ -4434,6 +4438,8 @@ void amdgpu_device_fini_sw(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;"> amdgpu_reset_fini(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;">+ amdgpu_aca_fini(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;"> /* free i2c buses */</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> if (!amdgpu_device_has_dc_support(adev))</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> amdgpu_i2c_fini(adev);</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">index 76fb85628716..c36faf353b46 100644</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">@@ -29,6 +29,7 @@</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "ta_ras_if.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_ras_eeprom.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;"> #include "amdgpu_smuio.h"</span></font></div>
<div><font face="Calibri" size="2"><span style="font-size:11pt;">+#include "amdgpu_aca.h"</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 amdgpu_iv_entry;</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;">2.34.1</span></font></div>
<div><font face="Times New Roman" size="2"><span style="font-size:11pt;"> </span></font></div>
</span></font>
</body>
</html>