<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 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.duecher@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 Russell, Kent <Kent.Russell@amd.com><br>
<b>Sent:</b> Thursday, November 15, 2018 11:54:27 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Russell, Kent; Liu, Shaoyun<br>
<b>Subject:</b> [PATCH] drm/amdgpu : Use XGMI mapping when devices on the same hive v2</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Shaoyun Liu <Shaoyun.Liu@amd.com><br>
<br>
VM mapping will only fall back to P2P if XGMI mapping is not available<br>
<br>
V2: Rebase onto 4.20<br>
<br>
Change-Id: I7a854ab3d5c9958bd45d4fe439ea7e370a092e7a<br>
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com><br>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com><br>
Reviewed-by: Huang Rui <ray.huang@amd.com><br>
Reviewed-by: Christian König <christian.koenig@amd.com><br>
Signed-off-by: Kent Russell <kent.russell@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 ++++++++++++++--<br>
1 file changed, 14 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
index dad0e23..576d168 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
@@ -2011,6 +2011,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,<br>
struct drm_mm_node *nodes;<br>
struct dma_fence *exclusive, **last_update;<br>
uint64_t flags;<br>
+ uint64_t vram_base_offset = adev->vm_manager.vram_base_offset;<br>
+ struct amdgpu_device *bo_adev;<br>
int r;<br>
<br>
if (clear || !bo) {<br>
@@ -2029,9 +2031,19 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,<br>
exclusive = reservation_object_get_excl(bo->tbo.resv);<br>
}<br>
<br>
- if (bo)<br>
+ if (bo) {<br>
flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem);<br>
- else<br>
+ bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);<br>
+ if (mem && mem->mem_type == TTM_PL_VRAM && adev != bo_adev) {<br>
+ if (adev->gmc.xgmi.hive_id &&<br>
+ adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id) {<br>
+ vram_base_offset = bo_adev->vm_manager.vram_base_offset;<br>
+ } else {<br>
+ flags |= AMDGPU_PTE_SYSTEM;<br>
+ vram_base_offset = bo_adev->gmc.aper_base;<br>
+ }<br>
+ }<br>
+ } else<br>
flags = 0x0;<br>
<br>
if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))<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>