summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_gpusvm.c
diff options
context:
space:
mode:
authorHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>2025-05-12 06:54:55 -0700
committerMatthew Brost <matthew.brost@intel.com>2025-05-12 13:48:48 -0700
commit8a9b978ebd47df9e0694c34748c2d6fa0c31eb4d (patch)
treeb27cc98c459e1f5fa3338c041eeea51798317e50 /drivers/gpu/drm/drm_gpusvm.c
parente5c13e2c505b73a8667ef9a0fd5cbd4227e483e6 (diff)
drm/gpusvm: Introduce devmem_only flag for allocation
This commit adds a new flag, devmem_only, to the drm_gpusvm structure. The purpose of this flag is to ensure that the get_pages function allocates memory exclusively from the device's memory. If the allocation from device memory fails, the function will return an -EFAULT error. Required for shared CPU and GPU atomics on certain devices. v3: - s/vram_only/devmem_only/ Fixes: 99624bdff867 ("drm/gpusvm: Add support for GPU Shared Virtual Memory") Cc: stable@vger.kernel.org Signed-off-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250512135500.1405019-2-matthew.brost@intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_gpusvm.c')
-rw-r--r--drivers/gpu/drm/drm_gpusvm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c
index de424e670995..a58d03e6cac2 100644
--- a/drivers/gpu/drm/drm_gpusvm.c
+++ b/drivers/gpu/drm/drm_gpusvm.c
@@ -1454,6 +1454,11 @@ map_pages:
goto err_unmap;
}
+ if (ctx->devmem_only) {
+ err = -EFAULT;
+ goto err_unmap;
+ }
+
addr = dma_map_page(gpusvm->drm->dev,
page, 0,
PAGE_SIZE << order,