[PATCH 2/2] drm/amdgpu: add bo flag that indicates KFD BOs
Chunming Zhou
david1.zhou at amd.com
Mon Apr 2 07:00:32 UTC 2018
KFD wraps amdgpu_bo_create, they have no fallback case which is different
with amdgpu_gem_object_create.
since upstream branch has no amdgpu_amdkfd_gpuvm.c, which need KFD
guys add this flag to __alloc_memory_of_gpu:
+ flags |= AMDGPU_GEM_CREATE_KFD;
Change-Id: Id3ac1a0bdd48633328d0b22c4c057fab4e94d0b3
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
Cc: felix.kuehling at amd.com
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
include/uapi/drm/amdgpu_drm.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index f04bfab1eebd..72dabb9886be 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -420,7 +420,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size,
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
&bo->placement, page_align, &ctx, acc_size,
NULL, resv, &amdgpu_ttm_bo_destroy);
- if (unlikely(r && r != -ERESTARTSYS) && type == ttm_bo_type_device) {
+ if (unlikely(r && r != -ERESTARTSYS) && type == ttm_bo_type_device &&
+ !(flags & AMDGPU_GEM_CREATE_KFD)) {
if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
goto retry;
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index 0087799962cf..0be994be269f 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -98,6 +98,8 @@ extern "C" {
#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
/* Flag that BO sharing will be explicitly synchronized */
#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7)
+/* Flag that BO is created from KFD side */
+#define AMDGPU_GEM_CREATE_KFD (1 << 8)
struct drm_amdgpu_gem_create_in {
/** the requested memory size */
--
2.14.1
More information about the amd-gfx
mailing list