Skip to contentSkip to conversation

drm/amdgpu : Use XGMI mapping when devices on the same hive v3

PATCH In review Russell, Kent 2 participants 3 messages Nov 15, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu : Use XGMI mapping when devices on the same hive v3

From: Shaoyun Liu <[email protected]>

VM mapping will only fall back to P2P if XGMI mapping is not available

V2: Rebase onto 4.20
V3: Remove PCIe-related things

Change-Id I7a854ab3d5c9958bd45d4fe439ea7e370a092e7a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10 -2
index dad0e23..5aa60bf 100644
@@ -2011,6 +2011,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	struct drm_mm_node *nodes;
 	struct dma_fence *exclusive, **last_update;
 	uint64_t flags;
+	uint64_t vram_base_offset = adev->vm_manager.vram_base_offset;
+	struct amdgpu_device *bo_adev;
 	int r;
 
 	if (clear || !bo) {
@@ -2029,9 +2031,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		exclusive = reservation_object_get_excl(bo->tbo.resv);
 	}
 
-	if (bo)
+	if (bo) {
 		flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem);
-	else
+		bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
+		if (adev->gmc.xgmi.hive_id &&
+		    adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id)
+			vram_base_offset = bo_adev->vm_manager.vram_base_offset;
+		else
+			return -EINVAL;
+	} else
 		flags = 0x0;
 
 	if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1542309797-20009-1-git-send-email-kent.russell-5C7GfCeVMHo@public.gmane.org

Reviewed-by Felix Kuehling Reviewed-by Huang Rui Reviewed-by Christian König
#2 lore raw

Sorry, something is still missing here. The new variable vram_base_offset isn't used anywhere. We have some other changes in amd-kfd-staging to use that vram_base_offset that are probably missing on amd-staging-drm-next. This change won't have any effect as is.

Regards,
Felix

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Thursday, November 15, 2018 2:23 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>; Liu, Shaoyun <[email protected]>
Subject: [PATCH] drm/amdgpu : Use XGMI mapping when devices on the same hive v3

From: Shaoyun Liu <[email protected]>

VM mapping will only fall back to P2P if XGMI mapping is not available

V2: Rebase onto 4.20
V3: Remove PCIe-related things

Change-Id I7a854ab3d5c9958bd45d4fe439ea7e370a092e7a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10 -2
index dad0e23..5aa60bf 100644
@@ -2011,6 +2011,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	struct drm_mm_node *nodes;
 	struct dma_fence *exclusive, **last_update;
 	uint64_t flags;
+	uint64_t vram_base_offset = adev->vm_manager.vram_base_offset;
+	struct amdgpu_device *bo_adev;
 	int r;
 
 	if (clear || !bo) {
@@ -2029,9 +2031,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		exclusive = reservation_object_get_excl(bo->tbo.resv);
 	}
 
-	if (bo)
+	if (bo) {
 		flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem);
-	else
+		bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
+		if (adev->gmc.xgmi.hive_id &&
+		    adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id)
+			vram_base_offset = bo_adev->vm_manager.vram_base_offset;
+		else
+			return -EINVAL;
+	} else
 		flags = 0x0;
 
 	if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB170766293DA1DCFC17E06B0792DC0-2J9CzHegvk9TCtO+SvGBKwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author Reviewed-by Felix Kuehling Reviewed-by Huang Rui Reviewed-by Christian König
#4 lore raw

Not a problem, I just saw the one missing patch when trying to rebase our KFD branch. I'll just put it on there instead.

Kent

-----Original Message-----
From: Kuehling, Felix
Sent: Thursday, November 15, 2018 2:52 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Russell, Kent <[email protected]>; Liu, Shaoyun <[email protected]>
Subject: RE: [PATCH] drm/amdgpu : Use XGMI mapping when devices on the same hive v3

Sorry, something is still missing here. The new variable vram_base_offset isn't used anywhere. We have some other changes in amd-kfd-staging to use that vram_base_offset that are probably missing on amd-staging-drm-next. This change won't have any effect as is.

Regards,
Felix

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Thursday, November 15, 2018 2:23 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>; Liu, Shaoyun <[email protected]>
Subject: [PATCH] drm/amdgpu : Use XGMI mapping when devices on the same hive v3

From: Shaoyun Liu <[email protected]>

VM mapping will only fall back to P2P if XGMI mapping is not available

V2: Rebase onto 4.20
V3: Remove PCIe-related things

Change-Id I7a854ab3d5c9958bd45d4fe439ea7e370a092e7a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +10 -2
index dad0e23..5aa60bf 100644
@@ -2011,6 +2011,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	struct drm_mm_node *nodes;
 	struct dma_fence *exclusive, **last_update;
 	uint64_t flags;
+	uint64_t vram_base_offset = adev->vm_manager.vram_base_offset;
+	struct amdgpu_device *bo_adev;
 	int r;
 
 	if (clear || !bo) {
@@ -2029,9 +2031,15 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		exclusive = reservation_object_get_excl(bo->tbo.resv);
 	}
 
-	if (bo)
+	if (bo) {
 		flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem);
-	else
+		bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
+		if (adev->gmc.xgmi.hive_id &&
+		    adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id)
+			vram_base_offset = bo_adev->vm_manager.vram_base_offset;
+		else
+			return -EINVAL;
+	} else
 		flags = 0x0;
 
 	if (clear || (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv))
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx