Skip to contentSkip to conversation

drm/amdkfd: remove obsolete events page mmap support

PATCH In review Yongqiang Sun 1 participant 1 message Jun 11

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

PATCH 1/2 drm/amdkfd: remove obsolete events page mmap support

The mmap of the events (signal) page from /dev/kfd via KFD_MMAP_TYPE_EVENTS was only needed on APUs using IOMMUv2, which is no longer supported by the kernel mode driver. For dGPUs (and modern APUs) the events page is allocated in user mode and mapped to the kernel through the event_page_offset of the create event IOCTL (kfd_kmap_event_page), so the KFD_MMAP_TYPE_EVENTS mmap path is no longer functional.

Remove kfd_event_mmap() and reject KFD_MMAP_TYPE_EVENTS in kfd_mmap, similar to the recent removal of KFD_MMAP_TYPE_RESERVED_MEM. This also removes a way for user space to abuse KFD_MMAP_TYPE_EVENTS of kfd_mmap.

---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c |  3 +-
 drivers/gpu/drm/amd/amdkfd/kfd_events.c  | 45 ------------------------
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h    |  1 -
 3 files changed, 2 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -1
index 349e462f8ee9..c322cec9e216 100644
@@ -3762,7 +3762,8 @@ static int kfd_mmap(struct file *filep, struct vm_area_struct *vma)
 		return kfd_doorbell_mmap(dev, process, vma);
 
 	case KFD_MMAP_TYPE_EVENTS:
-		return kfd_event_mmap(process, vma);
+		pr_warn("KFD_MMAP_TYPE_EVENTS is no longer supported\n");
+		return -EINVAL;
 
 	case KFD_MMAP_TYPE_RESERVED_MEM:
 		pr_warn("KFD_MMAP_TYPE_RESERVED_MEM is no longer supported\n");
drivers/gpu/drm/amd/amdkfd/kfd_events.c +0 -45

51 lines not on this page · raw message

drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0 -1
index 3a8bd3eaf12b..13a021b0e6e5 100644
@@ -1540,7 +1540,6 @@ extern const struct kfd_device_global_init_class device_global_init_class_cik;
 
 int kfd_event_init_process(struct kfd_process *p);
 void kfd_event_free_process(struct kfd_process *p);
-int kfd_event_mmap(struct kfd_process *process, struct vm_area_struct *vma);
 int kfd_wait_on_events(struct kfd_process *p,
 		       uint32_t num_events, void __user *data,
 		       bool all, uint32_t *user_timeout_ms,
Signature · 1 line
2.43.0