From ab5fd4cb83418c6296ef03fa14d8dcd8ae2bdcc9 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 20 May 2024 05:15:34 +0000 Subject: [PATCH] drm/amdkfd: don't allow mapping the MMIO HDP page with large pages From Alex Deucher 4b4cff994a27ebf7bd3fb9a798a1cdfa8d01b724 in linux-6.6.y/6.6.3 be4a2a81b6b90d1a47eaeaace4cc8e2cb57b96c7 in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c index f22b4cda939..010e4af4ea4 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c @@ -1138,7 +1138,7 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep, goto err_unlock; } offset = dev->adev->rmmio_remap.bus_addr; - if (!offset) { + if (!offset || (PAGE_SIZE > 4096)) { err = -ENOMEM; goto err_unlock; } @@ -2307,7 +2307,7 @@ static int criu_restore_memory_of_gpu(struct kfd_process_device *pdd, return -EINVAL; } offset = pdd->dev->adev->rmmio_remap.bus_addr; - if (!offset) { + if (!offset || (PAGE_SIZE > 4096)) { pr_err("amdgpu_amdkfd_get_mmio_remap_phys_addr failed\n"); return -ENOMEM; } @@ -3348,6 +3348,9 @@ static int kfd_mmio_mmap(struct kfd_node *dev, struct kfd_process *process, if (vma->vm_end - vma->vm_start != PAGE_SIZE) return -EINVAL; + if (PAGE_SIZE > 4096) + return -EINVAL; + address = dev->adev->rmmio_remap.bus_addr; vm_flags_set(vma, VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE | -- 2.20.1