<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Calibri;font-size:10pt;color:#008000;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
<b>Sent:</b> Tuesday, October 22, 2024 11:21 AM<br>
<b>To:</b> Liu, Shaoyun <Shaoyun.Liu@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu: Increase MES log buffer to dump mes scratch data</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[AMD Official Use Only - AMD Internal Distribution Only]<br>
<br>
[AMD Official Use Only - AMD Internal Distribution Only]<br>
<br>
ping<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Liu, Shaoyun<br>
Sent: Friday, October 11, 2024 12:57 PM<br>
To: amd-gfx@lists.freedesktop.org<br>
Subject: RE: [PATCH] drm/amdgpu: Increase MES log buffer to dump mes scratch data<br>
<br>
[AMD Official Use Only - AMD Internal Distribution Only]<br>
<br>
[AMD Official Use Only - AMD Internal Distribution Only]<br>
<br>
Ping .<br>
<br>
-----Original Message-----<br>
From: Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
Sent: Thursday, October 10, 2024 12:10 PM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
Subject: [PATCH] drm/amdgpu: Increase MES log buffer to dump mes scratch data<br>
<br>
MES internal scratch data is useful for mes debug, it can only located in VRAM, change the allocation type and increase size for mes 11<br>
<br>
Signed-off-by: shaoyunl <shaoyun.liu@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 + drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 12 +++++++++++-<br>
3 files changed, 13 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c<br>
index 83d0f731fb65..bf584e9bcce4 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c<br>
@@ -104,7 +104,7 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)<br>
return 0;<br>
<br>
r = amdgpu_bo_create_kernel(adev, adev->mes.event_log_size, PAGE_SIZE,<br>
- AMDGPU_GEM_DOMAIN_GTT,<br>
+ AMDGPU_GEM_DOMAIN_VRAM,<br>
&adev->mes.event_log_gpu_obj,<br>
&adev->mes.event_log_gpu_addr,<br>
&adev->mes.event_log_cpu_addr); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h<br>
index 45e3508f0f8e..79f13d7e5e16 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h<br>
@@ -40,6 +40,7 @@<br>
#define AMDGPU_MES_VERSION_MASK 0x00000fff<br>
#define AMDGPU_MES_API_VERSION_MASK 0x00fff000<br>
#define AMDGPU_MES_FEAT_VERSION_MASK 0xff000000<br>
+#define AMDGPU_MES_MSCRATCH_SIZE 0x8000<br>
<br>
enum amdgpu_mes_priority_level {<br>
AMDGPU_MES_PRIORITY_LEVEL_LOW = 0,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
index 03bf865fbdd4..aa2e9ef4ff12 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
@@ -913,6 +913,16 @@ static void mes_v11_0_enable(struct amdgpu_device *adev, bool enable)<br>
uint32_t pipe, data = 0;<br>
<br>
if (enable) {<br>
+ if (amdgpu_mes_log_enable) {<br>
+ WREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_LO,<br>
+ lower_32_bits(adev->mes.event_log_gpu_addr + AMDGPU_MES_LOG_BUFFER_SIZE));<br>
+ WREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_HI,<br>
+ upper_32_bits(adev->mes.event_log_gpu_addr + AMDGPU_MES_LOG_BUFFER_SIZE));<br>
+ dev_info(adev->dev, "Setup CP MES MSCRATCH address : 0x%x. 0x%x\n",<br>
+ RREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_HI),<br>
+ RREG32_SOC15(GC, 0, regCP_MES_MSCRATCH_LO));<br>
+ }<br>
+<br>
data = RREG32_SOC15(GC, 0, regCP_MES_CNTL);<br>
data = REG_SET_FIELD(data, CP_MES_CNTL, MES_PIPE0_RESET, 1);<br>
data = REG_SET_FIELD(data, CP_MES_CNTL, @@ -1375,7 +1385,7 @@ static int mes_v11_0_sw_init(struct amdgpu_ip_block *ip_block)<br>
adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init;<br>
adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini;<br>
<br>
- adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE;<br>
+ adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE +<br>
+AMDGPU_MES_MSCRATCH_SIZE;<br>
<br>
r = amdgpu_mes_init(adev);<br>
if (r)<br>
--<br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>