drm/amdgpu: limit DMA size to PAGE_SIZE for scatter-gather buffers
PATCH v3 1/1 drm/amdgpu: limit DMA size to PAGE_SIZE for scatter-gather buffers
Code is expecing to observe the same number of buffers returned from dma_map_sg() function compared to sg_alloc_table_from_pages(). This doesn't hold true universally especially for systems with IOMMU.
The hardware actually needs the dma_address on a page by page basis. Joining multiple consecutive pages into one entry is just additional overhead which we don't need.
Signed-off-by Sinan Kaya <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -1948,6 +1948,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,/* init the mode config */ drm_mode_config_init (adev->ddev); +/* limit scatter-gather buffer size to PAGE_SIZE */ +dma_set_max_seg_size (adev->dev,PAGE_SIZE ); + r =amdgpu_device_ip_init (adev);if (r) {/* failed in exclusive mode due to timeout */
Signature · 1 line
2.7.4