[PATCH] drm/amdkfd: Set handle to invalid for non GTT/VRAM BOs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Set dmabuf handle to invalid for BOs that cannot be accessed using SDMA
during checkpoint/restore.

Signed-off-by: David Yat Sin <david.yatsin@xxxxxxx>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++++++--
 include/uapi/linux/kfd_ioctl.h           | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index e1e2362841f8..1ffa976ad318 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1767,7 +1767,9 @@ static int criu_checkpoint_bos(struct kfd_process *p,
 						&bo_bucket->dmabuf_fd);
 				if (ret)
 					goto exit;
-			}
+			} else
+				bo_bucket->dmabuf_fd = KFD_INVALID_FD;
+
 			if (bo_bucket->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL)
 				bo_bucket->offset = KFD_MMAP_TYPE_DOORBELL |
 					KFD_MMAP_GPU_ID(pdd->dev->id);
@@ -2219,7 +2221,9 @@ static int criu_restore_bo(struct kfd_process *p,
 					    &bo_bucket->dmabuf_fd);
 		if (ret)
 			return ret;
-	}
+	} else
+		bo_bucket->dmabuf_fd = KFD_INVALID_FD;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index eb9ff85f8556..42975e940758 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -196,6 +196,8 @@ struct kfd_ioctl_dbg_wave_control_args {
 	__u32 buf_size_in_bytes;	/*including gpu_id and buf_size */
 };
 
+#define KFD_INVALID_FD     0xffffffff
+
 /* Matching HSA_EVENTTYPE */
 #define KFD_IOC_EVENT_SIGNAL			0
 #define KFD_IOC_EVENT_NODECHANGE		1
-- 
2.35.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux