<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"><span>Reviewed-by: Alex Deucher <alexander.deucher@amd.com></span><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 Yang, Philip <Philip.Yang@amd.com><br>
<b>Sent:</b> Monday, November 19, 2018 3:20:07 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Yang, Philip<br>
<b>Subject:</b> [PATCH 2/3] drm/amdgpu: enable paging queue doorbell support v4</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Because increase SDMA_DOORBELL_RANGE to add new SDMA doorbell for paging queue will<br>
break SRIOV, instead we can reserve and map two doorbell pages for amdgpu, paging<br>
queues doorbell index use same index as SDMA gfx queues index but on second page.<br>
<br>
For Vega20, after we change doorbell layout to increase SDMA doorbell for 8 SDMA RLC<br>
queues later, we could use new doorbell index for paging queue.<br>
<br>
Change-Id: I9adb965f16ee4089d261d9a22231337739184e49<br>
Signed-off-by: Philip Yang <Philip.Yang@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++<br>
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 28 +++++++++++++++-------<br>
2 files changed, 25 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 590588a82471..cb06e6883fad 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -534,6 +534,12 @@ static int amdgpu_device_doorbell_init(struct amdgpu_device *adev)<br>
if (adev->doorbell.num_doorbells == 0)<br>
return -EINVAL;<br>
<br>
+ /* For Vega, reserve and map two pages on doorbell BAR since SDMA<br>
+ * paging queue doorbell use the second page<br>
+ */<br>
+ if (adev->asic_type >= CHIP_VEGA10)<br>
+ adev->doorbell.num_doorbells *= 2;<br>
+<br>
adev->doorbell.ptr = ioremap(adev->doorbell.base,<br>
adev->doorbell.num_doorbells *<br>
sizeof(u32));<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 3f6b7882dbd2..4d873fd3242c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
@@ -1502,18 +1502,15 @@ static int sdma_v4_0_sw_init(void *handle)<br>
ring->ring_obj = NULL;<br>
ring->use_doorbell = true;<br>
<br>
- DRM_INFO("use_doorbell being set to: [%s]\n",<br>
- ring->use_doorbell?"true":"false");<br>
-<br>
+ /* doorbell size is 2 dwords, get DWORD offset */<br>
if (adev->asic_type == CHIP_VEGA10)<br>
ring->doorbell_index = (i == 0) ?<br>
- (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 << 1) //get DWORD offset<br>
- : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 << 1); // get DWORD offset<br>
+ (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 << 1)<br>
+ : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 << 1);<br>
else<br>
ring->doorbell_index = (i == 0) ?<br>
- (AMDGPU_DOORBELL64_sDMA_ENGINE0 << 1) //get DWORD offset<br>
- : (AMDGPU_DOORBELL64_sDMA_ENGINE1 << 1); // get DWORD offset<br>
-<br>
+ (AMDGPU_DOORBELL64_sDMA_ENGINE0 << 1)<br>
+ : (AMDGPU_DOORBELL64_sDMA_ENGINE1 << 1);<br>
<br>
sprintf(ring->name, "sdma%d", i);<br>
r = amdgpu_ring_init(adev, ring, 1024,<br>
@@ -1527,7 +1524,20 @@ static int sdma_v4_0_sw_init(void *handle)<br>
if (adev->sdma.has_page_queue) {<br>
ring = &adev->sdma.instance[i].page;<br>
ring->ring_obj = NULL;<br>
- ring->use_doorbell = false;<br>
+ ring->use_doorbell = true;<br>
+<br>
+ /* paging queue use same doorbell index/routing as gfx queue<br>
+ * with 0x400 (4096 dwords) offset on second doorbell page<br>
+ */<br>
+ if (adev->asic_type == CHIP_VEGA10)<br>
+ ring->doorbell_index = (i == 0) ?<br>
+ (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 << 1)<br>
+ : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 << 1);<br>
+ else<br>
+ ring->doorbell_index = (i == 0) ?<br>
+ (AMDGPU_DOORBELL64_sDMA_ENGINE0 << 1)<br>
+ : (AMDGPU_DOORBELL64_sDMA_ENGINE1 << 1);<br>
+ ring->doorbell_index += 0x400;<br>
<br>
sprintf(ring->name, "page%d", i);<br>
r = amdgpu_ring_init(adev, ring, 1024,<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><br>
</div>
</span></font></div>
</body>
</html>