<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">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</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 Zeng, Oak <Oak.Zeng@amd.com><br>
<b>Sent:</b> Monday, January 14, 2019 5:39:41 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zeng, Oak<br>
<b>Subject:</b> [PATCH] drm/amdgpu: Setting doorbell range registers earlier</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">HW doorbell writing routing policy: writing to doorbell<br>
not in SDMA/IH/MM/ACV doorbell range will be routed to CP.<br>
So CP doorbell routing depends on doorbell range setting<br>
of above blocks. Setting doorbell range of above blocks<br>
earlier (soc15_common_hw_init) to make sure CP doorbell<br>
writing be routed to CP block.<br>
<br>
Change-Id: I3f8edd582fb7cc20a83f48f7a1ff789036b3550e<br>
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 --<br>
drivers/gpu/drm/amd/amdgpu/soc15.c | 21 +++++++++++++++++++++<br>
drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 2 --<br>
3 files changed, 21 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
index 59638b8..48a166b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
@@ -834,8 +834,6 @@ static void sdma_v4_0_gfx_resume(struct amdgpu_device *adev, unsigned int i)<br>
OFFSET, ring->doorbell_index);<br>
WREG32_SDMA(i, mmSDMA0_GFX_DOORBELL, doorbell);<br>
WREG32_SDMA(i, mmSDMA0_GFX_DOORBELL_OFFSET, doorbell_offset);<br>
- adev->nbio_funcs->sdma_doorbell_range(adev, i, ring->use_doorbell,<br>
- ring->doorbell_index);<br>
<br>
sdma_v4_0_ring_set_wptr(ring);<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
index 5248b03..4cae547 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
@@ -966,6 +966,21 @@ static int soc15_common_sw_fini(void *handle)<br>
return 0;<br>
}<br>
<br>
+static void soc15_doorbell_range_init(struct amdgpu_device *adev)<br>
+{<br>
+ int i;<br>
+ struct amdgpu_ring *ring;<br>
+<br>
+ for (i = 0; i < adev->sdma.num_instances; i++) {<br>
+ ring = &adev->sdma.instance[i].ring;<br>
+ adev->nbio_funcs->sdma_doorbell_range(adev, i,<br>
+ ring->use_doorbell, ring->doorbell_index);<br>
+ }<br>
+<br>
+ adev->nbio_funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,<br>
+ adev->irq.ih.doorbell_index);<br>
+}<br>
+<br>
static int soc15_common_hw_init(void *handle)<br>
{<br>
struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
@@ -978,6 +993,12 @@ static int soc15_common_hw_init(void *handle)<br>
adev->nbio_funcs->init_registers(adev);<br>
/* enable the doorbell aperture */<br>
soc15_enable_doorbell_aperture(adev, true);<br>
+ /* HW doorbell routing policy: doorbell writing not<br>
+ * in SDMA/IH/MM/ACV range will be routed to CP. So<br>
+ * we need to init SDMA/IH/MM/ACV doorbell range prior<br>
+ * to CP ip block init and ring test.<br>
+ */<br>
+ soc15_doorbell_range_init(adev);<br>
<br>
return 0;<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c<br>
index 5627019..877b4a6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c<br>
@@ -140,8 +140,6 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev)<br>
ENABLE, 0);<br>
}<br>
WREG32_SOC15(OSSSYS, 0, mmIH_DOORBELL_RPTR, ih_doorbell_rtpr);<br>
- adev->nbio_funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,<br>
- adev->irq.ih.doorbell_index);<br>
<br>
tmp = RREG32_SOC15(OSSSYS, 0, mmIH_STORM_CLIENT_LIST_CNTL);<br>
tmp = REG_SET_FIELD(tmp, IH_STORM_CLIENT_LIST_CNTL,<br>
-- <br>
2.7.4<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><br>
</div>
</span></font></div>
</body>
</html>