Skip to contentSkip to conversation

drm/amdgpu: update gart_pin_size if bo is in GTT

PATCH NAK Flora Cui 3 participants 7 messages Sep 9, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Flora Cui

author
#0 lore raw

PATCH 1/2 drm/amdgpu: update gart_pin_size if bo is in GTT

Change-Id Ia2cb8a8f62d0933b7937991bec4eace560745f97
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
index 5a6216c..296eb6a 100644
@@ -376,6 +376,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
 	amdgpu_fill_placement_to_bo(bo, placement);
+
 	/* Kernel allocation are uninterruptible */
 	r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type,
 			&bo->placement, page_align, !kernel, NULL,
@@ -726,7 +727,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
 		bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
 		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
 			bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
-	} else {
+	} else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
 		bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
 	}
 
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): 1473402651-2395-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amdgpu: calc addr with domain's gpu_offset

Change-Id I8112e9d85866104559ecef7449f50fbb94167382
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index a549abd..3d7a3ab 100644
@@ -1151,7 +1151,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 			break;
 
 		case TTM_PL_VRAM:
-			addr += adev->vm_manager.vram_base_offset;
+			addr += bo_va->bo->tbo.bdev->man[mem->mem_type].gpu_offset;
 			break;
 
 		default:
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): 1473402651-2395-2-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org

#4 lore raw

答复: [PATCH 2/2] drm/amdgpu: calc addr with domain's gpu_offset

Hi Flora:

What is the purpose of these patches?

Thanks
JimQu

________________________________________
发件人: amd-gfx <[email protected]> 代表 Flora Cui <[email protected]> 发送时间: 2016年9月9日 14:30:51
收件人: [email protected]
抄送: Cui, Flora
主题: [PATCH 2/2] drm/amdgpu: calc addr with domain's gpu_offset

Change-Id I8112e9d85866104559ecef7449f50fbb94167382
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index a549abd..3d7a3ab 100644
@@ -1151,7 +1151,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
                        break;
 
                case TTM_PL_VRAM:
-                       addr += adev->vm_manager.vram_base_offset;
+                       addr += bo_va->bo->tbo.bdev->man[mem->mem_type].gpu_offset;
                        break;
 
                default:

--
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

#5 lore raw

Re: [PATCH 2/2] drm/amdgpu: calc addr with domain's gpu_offset

In reply to a message not in the archive

NAK, that is clearly incorrect. The gpu_offset are MC addresses while the vram_base_offset is a bud address.

Most of the time they are both zero, except for APUs which would break with this change.

Regards,
Christian.

Am 09.09.2016 um 08:30 schrieb Flora Cui:

Quoted 11 lines
Change-Id I8112e9d85866104559ecef7449f50fbb94167382
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index a549abd..3d7a3ab 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1157

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -1151,7 +1151,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  			break;
 
  		case TTM_PL_VRAM:
-			addr += adev->vm_manager.vram_base_offset;
+			addr += bo_va->bo->tbo.bdev->man[mem->mem_type].gpu_offset;
  			break;
 
  		default:

_______________________________________________
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): 7b7de55b-a83c-618f-d91a-2174e850d521-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

author
#7 lore raw

Re: [PATCH 2/2] drm/amdgpu: calc addr with domain's gpu_offset

what about commit e6eb9e1cdb740f778fbbacc5f62edd0ce97c2d52? should the start addr get updated either?

Quoted 25 lines · Christian König

NAK, that is clearly incorrect. The gpu_offset are MC addresses while the vram_base_offset is a bud address.

Most of the time they are both zero, except for APUs which would break with this change.

Regards,
Christian.

Am 09.09.2016 um 08:30 schrieb Flora Cui:

Quoted 15 lines
Change-Id I8112e9d85866104559ecef7449f50fbb94167382
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index a549abd..3d7a3ab 100644
@@ -1151,7 +1151,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 			break;
 		case TTM_PL_VRAM:
-			addr += adev->vm_manager.vram_base_offset;
+			addr += bo_va->bo->tbo.bdev->man[mem->mem_type].gpu_offset;
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1157

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
 			break;
 		default:

_______________________________________________
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

#8 lore raw

Re: [PATCH 2/2] drm/amdgpu: calc addr with domain's gpu_offset

No that patch is correct. See we are dealing with different address spaces here.

The TTM code works with MC addresses. E.g. the internal address space as seen by everything which runs on system VM (copy operations, ring buffers, UVD, VCE etc...).

The MC in turn then works with bus addresses which it either send to the PCIE bus or to the VRAM. Those are just a completely different address space.

Regards,
Christian.

Am 09.09.2016 um 09:54 schrieb Flora Cui:

Quoted 36 lines

what about commit e6eb9e1cdb740f778fbbacc5f62edd0ce97c2d52? should the start addr get updated either?

Quoted 16 lines · Christian König

NAK, that is clearly incorrect. The gpu_offset are MC addresses while the vram_base_offset is a bud address.

Most of the time they are both zero, except for APUs which would break with this change.

Regards,
Christian.

Am 09.09.2016 um 08:30 schrieb Flora Cui:

Quoted 6 lines
Change-Id I8112e9d85866104559ecef7449f50fbb94167382
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1155

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index a549abd..3d7a3ab 100644
@@ -1151,7 +1151,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  			break;
  		case TTM_PL_VRAM:
-			addr += adev->vm_manager.vram_base_offset;
+			addr += bo_va->bo->tbo.bdev->man[mem->mem_type].gpu_offset;
  			break;
  		default:

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

Quoted 4 lines

_______________________________________________
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

#9 lore raw
In reply to a message not in the archive

Am 09.09.2016 um 08:30 schrieb Flora Cui:

Quoted 11 lines
Change-Id Ia2cb8a8f62d0933b7937991bec4eace560745f97
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 5a6216c..296eb6a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_restricted(struct amdgpu_device *adev, · line 379

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
@@ -376,6 +376,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
  		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
 
  	amdgpu_fill_placement_to_bo(bo, placement);
+

Unrelated white space change, please remove.

With that fixed the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_unpin(struct amdgpu_bo *bo) · line 733

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
  	/* Kernel allocation are uninterruptible */
  	r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type,
  			&bo->placement, page_align, !kernel, NULL,
@@ -726,7 +727,7 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
  		bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
  		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
  			bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
-	} else {
+	} else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
  		bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
  	}
 

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