<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Would be good to verify this across all vega parts (10/12/20). Other than that:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Monday, March 4, 2019 8:15 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH] drm/amdgpu: reroute VMC and UMD to IH ring 1</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Page faults can easily overwhelm the interrupt handler.<br>
<br>
So to make sure that we never lose valuable interrupts on the primary ring<br>
we re-route page faults to IH ring 1.<br>
<br>
Signed-off-by: Christian König <christian.koenig@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h | 1 +<br>
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 36 +++++++++++++++++++++++++<br>
2 files changed, 37 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h b/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h<br>
index f3a7d207af07..2f79765b4bdb 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h<br>
@@ -43,6 +43,7 @@ enum psp_gfx_crtl_cmd_id<br>
GFX_CTRL_CMD_ID_ENABLE_INT = 0x00050000, /* enable PSP-to-Gfx interrupt */<br>
GFX_CTRL_CMD_ID_DISABLE_INT = 0x00060000, /* disable PSP-to-Gfx interrupt */<br>
GFX_CTRL_CMD_ID_MODE1_RST = 0x00070000, /* trigger the Mode 1 reset */<br>
+ GFX_CTRL_CMD_ID_GBR_IH_SET = 0x00080000, /* set Gbr IH_RB_CNTL registers */<br>
GFX_CTRL_CMD_ID_CONSUME_CMD = 0x000A0000, /* send interrupt to psp for updating write pointer of vf */<br>
GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING = 0x000C0000, /* destroy GPCOM ring */<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c<br>
index 0487e3a4e9e7..143f0fae69d5 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c<br>
@@ -37,6 +37,9 @@<br>
#include "sdma0/sdma0_4_0_offset.h"<br>
#include "nbio/nbio_6_1_offset.h"<br>
<br>
+#include "oss/osssys_4_0_offset.h"<br>
+#include "oss/osssys_4_0_sh_mask.h"<br>
+<br>
MODULE_FIRMWARE("amdgpu/vega10_sos.bin");<br>
MODULE_FIRMWARE("amdgpu/vega10_asd.bin");<br>
MODULE_FIRMWARE("amdgpu/vega12_sos.bin");<br>
@@ -252,6 +255,37 @@ static int psp_v3_1_ring_init(struct psp_context *psp,<br>
return 0;<br>
}<br>
<br>
+static void psp_v3_1_reroute_ih(struct psp_context *psp)<br>
+{<br>
+ struct amdgpu_device *adev = psp->adev;<br>
+ uint32_t tmp;<br>
+<br>
+ /* Change IH ring for VMC */<br>
+ tmp = REG_SET_FIELD(0, IH_CLIENT_CFG_DATA, CREDIT_RETURN_ADDR, 0x1244b);<br>
+ tmp = REG_SET_FIELD(tmp, IH_CLIENT_CFG_DATA, CLIENT_TYPE, 1);<br>
+ tmp = REG_SET_FIELD(tmp, IH_CLIENT_CFG_DATA, RING_ID, 1);<br>
+<br>
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_69, 3);<br>
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);<br>
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, GFX_CTRL_CMD_ID_GBR_IH_SET);<br>
+<br>
+ mdelay(20);<br>
+ psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),<br>
+ 0x80000000, 0x8000FFFF, false);<br>
+<br>
+ /* Change IH ring for UMC */<br>
+ tmp = REG_SET_FIELD(0, IH_CLIENT_CFG_DATA, CREDIT_RETURN_ADDR, 0x1216b);<br>
+ tmp = REG_SET_FIELD(tmp, IH_CLIENT_CFG_DATA, RING_ID, 1);<br>
+<br>
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_69, 4);<br>
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, tmp);<br>
+ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, GFX_CTRL_CMD_ID_GBR_IH_SET);<br>
+<br>
+ mdelay(20);<br>
+ psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),<br>
+ 0x80000000, 0x8000FFFF, false);<br>
+}<br>
+<br>
static int psp_v3_1_ring_create(struct psp_context *psp,<br>
enum psp_ring_type ring_type)<br>
{<br>
@@ -260,6 +294,8 @@ static int psp_v3_1_ring_create(struct psp_context *psp,<br>
struct psp_ring *ring = &psp->km_ring;<br>
struct amdgpu_device *adev = psp->adev;<br>
<br>
+ psp_v3_1_reroute_ih(psp);<br>
+<br>
/* Write low address of the ring to C2PMSG_69 */<br>
psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);<br>
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_69, psp_ring_reg);<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>