[PATCH v2 2/8] drm/amdkfd: Add KFD SMI event IDs and triggers

Philip Yang Philip.Yang at amd.com
Thu Jan 20 23:13:16 UTC 2022


Define new system management interface event IDs, migration triggers and
user queue eviction triggers, those will be implemented in the following
patches.

Signed-off-by: Philip Yang <Philip.Yang at amd.com>
---
 include/uapi/linux/kfd_ioctl.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index af96af174dc4..de0b5bb95db3 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -459,10 +459,37 @@ enum kfd_smi_event {
 	KFD_SMI_EVENT_THERMAL_THROTTLE = 2,
 	KFD_SMI_EVENT_GPU_PRE_RESET = 3,
 	KFD_SMI_EVENT_GPU_POST_RESET = 4,
+	KFD_SMI_EVENT_MIGRATION = 5,
+	KFD_SMI_EVENT_PAGE_FAULT_START = 6,
+	KFD_SMI_EVENT_PAGE_FAULT_END = 7,
+	KFD_SMI_EVENT_QUEUE_EVICTION = 8,
+	KFD_SMI_EVENT_QUEUE_EVICTION_RESTORE = 9,
+	KFD_SMI_EVENT_UNMAP_FROM_GPU = 10,
+
+	/*
+	 * max event number, as a flag bit to get events from all processes,
+	 * this requires super user permission, otherwise will not be able to
+	 * receive event from any process. Without this flag to receive events
+	 * from same process.
+	 */
+	KFD_SMI_EVENT_ALL_PROCESS = 64
 };
 
 #define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
 
+enum KFD_MIGRATION_QUEUE_EVICTION_UNMAP_EVENT_TRIGGER {
+	MIGRATION_TRIGGER_PREFETCH = 1,
+	MIGRATION_TRIGGER_PAGEFAULT,
+	MIGRATION_TRIGGER_PAGEFAULT_CPU,
+	MIGRATION_TRIGGER_TTM_EVICTION,
+	SVM_RANGE_EVICTION,
+	SVM_RANGE_MIGRATION,
+	USERPTR_EVICTION,
+	TTM_EVICTION,
+	UNMAP_FROM_CPU,
+	SUSPEND_EVICTION
+};
+
 struct kfd_ioctl_smi_events_args {
 	__u32 gpuid;	/* to KFD */
 	__u32 anon_fd;	/* from KFD */
-- 
2.17.1



More information about the amd-gfx mailing list