Skip to contentSkip to conversation

drm/amdgpu: fix amdgpu_bo_gpu_accessible()

PATCH In review Christian König 4 participants 4 messages Jul 13, 2017 – Jul 14, 2017 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: fix amdgpu_bo_gpu_accessible()

From: Christian König <[email protected]>

The test was relaxed a bit to much.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +5 -1
index 3824851..833b172 100644
@@ -120,7 +120,11 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
  */
 static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)
 {
-	return bo->tbo.mem.mem_type != TTM_PL_SYSTEM;
+	switch (bo->tbo.mem.mem_type) {
+	case TTM_PL_TT: return amdgpu_ttm_is_bound(bo->tbo.ttm);
+	case TTM_PL_VRAM: return true;
+	default: return false;
+	}
 }
 
 int amdgpu_bo_create(struct amdgpu_device *adev,
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): 1499941370-2520-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw
Reviewed-and-Tested-by Roger He <[email protected]>

Thanks
Roger(Hongbo.He)
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Thursday, July 13, 2017 6:23 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>
Subject: [PATCH] drm/amdgpu: fix amdgpu_bo_gpu_accessible()

From: Christian König <[email protected]>

The test was relaxed a bit to much.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +5 -2
index 3824851..833b172 100644
@@ -120,7 +120,11 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
  */
 static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)  {
-	return bo->tbo.mem.mem_type != TTM_PL_SYSTEM;
+	switch (bo->tbo.mem.mem_type) {
+	case TTM_PL_TT: return amdgpu_ttm_is_bound(bo->tbo.ttm);
+	case TTM_PL_VRAM: return true;
+	default: return false;
+	}
 }
 
 int amdgpu_bo_create(struct amdgpu_device *adev,
--

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): MWHPR1201MB0127A83A43B42D7CF2CE703AFDAC0-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#4 lore raw

Seems to fix the regression I noticed on Carrizo. Can add my Acked-By if you haven't pushed it already.

Cheers,
Tom

Quoted 39 lines · Roger
Reviewed-and-Tested-by Roger He <[email protected]>

Thanks
Roger(Hongbo.He)
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Thursday, July 13, 2017 6:23 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>
Subject: [PATCH] drm/amdgpu: fix amdgpu_bo_gpu_accessible()

From: Christian König <[email protected]>

The test was relaxed a bit to much.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +5 -2
index 3824851..833b172 100644
@@ -120,7 +120,11 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
   */
  static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)  {
-	return bo->tbo.mem.mem_type != TTM_PL_SYSTEM;
+	switch (bo->tbo.mem.mem_type) {
+	case TTM_PL_TT: return amdgpu_ttm_is_bound(bo->tbo.ttm);
+	case TTM_PL_VRAM: return true;
+	default: return false;
+	}
  }
 
  int amdgpu_bo_create(struct amdgpu_device *adev,
--

2.7.4

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

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

Acked-by
#5 lore raw
In reply to a message not in the archive
Quoted 5 lines · Christian König

From: Christian König <[email protected]>

The test was relaxed a bit to much.

Nice catch, yes, we need take care the case that no gtt is bound.

Quoted 22 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +0 -0

amdgpu/amdgpu_object.h
index 3824851..833b172 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +5 -1
@@ -120,7 +120,11 @@ static inline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo
 *bo)
  */
 static inline bool amdgpu_bo_gpu_accessible(struct amdgpu_bo *bo)
 {
-       return bo->tbo.mem.mem_type != TTM_PL_SYSTEM;
+       switch (bo->tbo.mem.mem_type) {
+       case TTM_PL_TT: return amdgpu_ttm_is_bound(bo->tbo.ttm);
+       case TTM_PL_VRAM: return true;
+       default: return false;
+       }
 }
 
Quoted 4 lines

int amdgpu_bo_create(struct amdgpu_device *adev,
--
2.7.4

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