mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
drm/gpusvm: use more selective dma dir in get_pages()
If we are only reading the memory then from the device pov the direction can be DMA_TO_DEVICE. This aligns with the xe-userptr code. Using the most restrictive data direction to represent the access is normally a good idea. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250828142430.615826-12-matthew.auld@intel.com
This commit is contained in:
parent
c50729c68a
commit
ad70e289ed
|
|
@ -1224,6 +1224,8 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
|
|||
struct dev_pagemap *pagemap;
|
||||
struct drm_pagemap *dpagemap;
|
||||
struct drm_gpusvm_range_flags flags;
|
||||
enum dma_data_direction dma_dir = ctx->read_only ? DMA_TO_DEVICE :
|
||||
DMA_BIDIRECTIONAL;
|
||||
|
||||
retry:
|
||||
hmm_range.notifier_seq = mmu_interval_read_begin(notifier);
|
||||
|
|
@ -1329,7 +1331,7 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
|
|||
dpagemap->ops->device_map(dpagemap,
|
||||
gpusvm->drm->dev,
|
||||
page, order,
|
||||
DMA_BIDIRECTIONAL);
|
||||
dma_dir);
|
||||
if (dma_mapping_error(gpusvm->drm->dev,
|
||||
range->dma_addr[j].addr)) {
|
||||
err = -EFAULT;
|
||||
|
|
@ -1351,7 +1353,7 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
|
|||
addr = dma_map_page(gpusvm->drm->dev,
|
||||
page, 0,
|
||||
PAGE_SIZE << order,
|
||||
DMA_BIDIRECTIONAL);
|
||||
dma_dir);
|
||||
if (dma_mapping_error(gpusvm->drm->dev, addr)) {
|
||||
err = -EFAULT;
|
||||
goto err_unmap;
|
||||
|
|
@ -1359,7 +1361,7 @@ int drm_gpusvm_range_get_pages(struct drm_gpusvm *gpusvm,
|
|||
|
||||
range->dma_addr[j] = drm_pagemap_addr_encode
|
||||
(addr, DRM_INTERCONNECT_SYSTEM, order,
|
||||
DMA_BIDIRECTIONAL);
|
||||
dma_dir);
|
||||
}
|
||||
i += 1 << order;
|
||||
num_dma_mapped = i;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user