All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted()
@ 2016-08-18  5:36 Flora Cui
       [not found] ` <1471498619-7497-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Flora Cui @ 2016-08-18  5:36 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Flora Cui

abort if the bo is pined to other domain already

Change-Id: I0e8eb3e0af0fad1edaf647050399e5a36226a5d9
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 4d084ee..0a0f3cb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -520,6 +520,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		return -EINVAL;
 
 	if (bo->pin_count) {
+		uint32_t mem_type = bo->tbo.mem.mem_type;
+
+		if (domain != amdgpu_mem_type_to_domain(mem_type))
+			return -EINVAL;
+
 		bo->pin_count++;
 		if (gpu_addr)
 			*gpu_addr = amdgpu_bo_gpu_offset(bo);
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] drm/amdgpu: update gart_pin_size only if the bo is pined to GTT
       [not found] ` <1471498619-7497-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
@ 2016-08-18  5:36   ` Flora Cui
       [not found]     ` <1471498619-7497-2-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
  2016-08-18  5:36   ` [PATCH 3/3] drm/amdgpu: use domain's gpu_offset for start addr Flora Cui
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Flora Cui @ 2016-08-18  5:36 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Flora Cui

Change-Id: I975a0a97d570bd14b8031c4033cb447a3b3d2b1a
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 0a0f3cb..dbab3c0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -578,7 +578,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		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 (domain == AMDGPU_GEM_DOMAIN_GTT) {
 		bo->adev->gart_pin_size += amdgpu_bo_size(bo);
 	}
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] drm/amdgpu: use domain's gpu_offset for start addr
       [not found] ` <1471498619-7497-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
  2016-08-18  5:36   ` [PATCH 2/3] drm/amdgpu: update gart_pin_size only if the bo is pined to GTT Flora Cui
@ 2016-08-18  5:36   ` Flora Cui
       [not found]     ` <1471498619-7497-3-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
  2016-08-18  6:12   ` [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted() Michel Dänzer
  2016-08-18  8:10   ` Christian König
  3 siblings, 1 reply; 7+ messages in thread
From: Flora Cui @ 2016-08-18  5:36 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Flora Cui

Change-Id: I77610c286af4cf77bb508136fffc0c77c7cbc34b
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 8 ++------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index dbab3c0..2c08e1b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -530,11 +530,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 			*gpu_addr = amdgpu_bo_gpu_offset(bo);
 
 		if (max_offset != 0) {
-			u64 domain_start;
-			if (domain == AMDGPU_GEM_DOMAIN_VRAM)
-				domain_start = bo->adev->mc.vram_start;
-			else
-				domain_start = bo->adev->mc.gtt_start;
+			u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset;
 			WARN_ON_ONCE(max_offset <
 				     (amdgpu_bo_gpu_offset(bo) - domain_start));
 		}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 105bd22..8a12b24 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -257,10 +257,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 
 	switch (old_mem->mem_type) {
 	case TTM_PL_VRAM:
-		old_start += adev->mc.vram_start;
-		break;
 	case TTM_PL_TT:
-		old_start += adev->mc.gtt_start;
+		old_start += bo->bdev->man[old_mem->mem_type].gpu_offset;
 		break;
 	default:
 		DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
@@ -268,10 +266,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 	}
 	switch (new_mem->mem_type) {
 	case TTM_PL_VRAM:
-		new_start += adev->mc.vram_start;
-		break;
 	case TTM_PL_TT:
-		new_start += adev->mc.gtt_start;
+		new_start += bo->bdev->man[new_mem->mem_type].gpu_offset;
 		break;
 	default:
 		DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* 答复: [PATCH 3/3] drm/amdgpu: use domain's gpu_offset for start addr
       [not found]     ` <1471498619-7497-3-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
@ 2016-08-18  6:11       ` Wang, Ken
  0 siblings, 0 replies; 7+ messages in thread
From: Wang, Ken @ 2016-08-18  6:11 UTC (permalink / raw)
  To: Cui, Flora, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 2944 bytes --]

Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>

________________________________
发件人: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Flora Cui <Flora.Cui@amd.com>
发送时间: 2016年8月18日 13:36:59
收件人: amd-gfx@lists.freedesktop.org
抄送: Cui, Flora
主题: [PATCH 3/3] drm/amdgpu: use domain's gpu_offset for start addr

Change-Id: I77610c286af4cf77bb508136fffc0c77c7cbc34b
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 8 ++------
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index dbab3c0..2c08e1b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -530,11 +530,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                         *gpu_addr = amdgpu_bo_gpu_offset(bo);

                 if (max_offset != 0) {
-                       u64 domain_start;
-                       if (domain == AMDGPU_GEM_DOMAIN_VRAM)
-                               domain_start = bo->adev->mc.vram_start;
-                       else
-                               domain_start = bo->adev->mc.gtt_start;
+                       u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset;
                         WARN_ON_ONCE(max_offset <
                                      (amdgpu_bo_gpu_offset(bo) - domain_start));
                 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 105bd22..8a12b24 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -257,10 +257,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,

         switch (old_mem->mem_type) {
         case TTM_PL_VRAM:
-               old_start += adev->mc.vram_start;
-               break;
         case TTM_PL_TT:
-               old_start += adev->mc.gtt_start;
+               old_start += bo->bdev->man[old_mem->mem_type].gpu_offset;
                 break;
         default:
                 DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
@@ -268,10 +266,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
         }
         switch (new_mem->mem_type) {
         case TTM_PL_VRAM:
-               new_start += adev->mc.vram_start;
-               break;
         case TTM_PL_TT:
-               new_start += adev->mc.gtt_start;
+               new_start += bo->bdev->man[new_mem->mem_type].gpu_offset;
                 break;
         default:
                 DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 7158 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted()
       [not found] ` <1471498619-7497-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
  2016-08-18  5:36   ` [PATCH 2/3] drm/amdgpu: update gart_pin_size only if the bo is pined to GTT Flora Cui
  2016-08-18  5:36   ` [PATCH 3/3] drm/amdgpu: use domain's gpu_offset for start addr Flora Cui
@ 2016-08-18  6:12   ` Michel Dänzer
  2016-08-18  8:10   ` Christian König
  3 siblings, 0 replies; 7+ messages in thread
From: Michel Dänzer @ 2016-08-18  6:12 UTC (permalink / raw)
  To: Flora Cui; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 18/08/16 02:36 PM, Flora Cui wrote:
> abort if the bo is pined to other domain already
> 
> Change-Id: I0e8eb3e0af0fad1edaf647050399e5a36226a5d9
> Signed-off-by: Flora Cui <Flora.Cui@amd.com>

The new patches 1 & 3 are

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted()
       [not found] ` <1471498619-7497-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-08-18  6:12   ` [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted() Michel Dänzer
@ 2016-08-18  8:10   ` Christian König
  3 siblings, 0 replies; 7+ messages in thread
From: Christian König @ 2016-08-18  8:10 UTC (permalink / raw)
  To: Flora Cui, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 18.08.2016 um 07:36 schrieb Flora Cui:
> abort if the bo is pined to other domain already
>
> Change-Id: I0e8eb3e0af0fad1edaf647050399e5a36226a5d9
> Signed-off-by: Flora Cui <Flora.Cui@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com> for the whole 
series.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 4d084ee..0a0f3cb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -520,6 +520,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>   		return -EINVAL;
>   
>   	if (bo->pin_count) {
> +		uint32_t mem_type = bo->tbo.mem.mem_type;
> +
> +		if (domain != amdgpu_mem_type_to_domain(mem_type))
> +			return -EINVAL;
> +
>   		bo->pin_count++;
>   		if (gpu_addr)
>   			*gpu_addr = amdgpu_bo_gpu_offset(bo);


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/3] drm/amdgpu: update gart_pin_size only if the bo is pined to GTT
       [not found]     ` <1471498619-7497-2-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
@ 2016-08-18 13:29       ` Deucher, Alexander
  0 siblings, 0 replies; 7+ messages in thread
From: Deucher, Alexander @ 2016-08-18 13:29 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Cui, Flora

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Flora Cui
> Sent: Thursday, August 18, 2016 1:37 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Cui, Flora
> Subject: [PATCH 2/3] drm/amdgpu: update gart_pin_size only if the bo is
> pined to GTT
> 
> Change-Id: I975a0a97d570bd14b8031c4033cb447a3b3d2b1a
> Signed-off-by: Flora Cui <Flora.Cui@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 0a0f3cb..dbab3c0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -578,7 +578,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
> *bo, u32 domain,
>  		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 (domain == AMDGPU_GEM_DOMAIN_GTT) {
>  		bo->adev->gart_pin_size += amdgpu_bo_size(bo);
>  	}
> 
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-08-18 13:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18  5:36 [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted() Flora Cui
     [not found] ` <1471498619-7497-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
2016-08-18  5:36   ` [PATCH 2/3] drm/amdgpu: update gart_pin_size only if the bo is pined to GTT Flora Cui
     [not found]     ` <1471498619-7497-2-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
2016-08-18 13:29       ` Deucher, Alexander
2016-08-18  5:36   ` [PATCH 3/3] drm/amdgpu: use domain's gpu_offset for start addr Flora Cui
     [not found]     ` <1471498619-7497-3-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org>
2016-08-18  6:11       ` 答复: " Wang, Ken
2016-08-18  6:12   ` [PATCH 1/3] drm/amdgpu: check domain sanity in amdgpu_bo_pin_restricted() Michel Dänzer
2016-08-18  8:10   ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.