* [PATCH V3] drm/amdgpu: limit DMA size to PAGE_SIZE for scatter-gather buffers
@ 2018-04-11 22:11 Sinan Kaya
0 siblings, 0 replies; only message in thread
From: Sinan Kaya @ 2018-04-11 22:11 UTC (permalink / raw)
To: amd-gfx, sulrich, timur
Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya, Alex Deucher,
Christian König, David (ChunMing) Zhou, David Airlie,
Monk Liu, Harry Wentland, Pixel Ding, Horace Chen,
open list:DRM DRIVERS, open list
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 <okaya@codeaurora.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index af1b879..91abe1a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -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 */
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-04-11 22:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 22:11 [PATCH V3] drm/amdgpu: limit DMA size to PAGE_SIZE for scatter-gather buffers Sinan Kaya
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).