[PATCH 1/2] drm/prime: correct logic for mapping sg to arrays

2020-03-23 Thread Shane Francis
mapping Signed-off-by: Shane Francis --- drivers/gpu/drm/drm_prime.c | 71 - include/drm/drm_prime.h | 5 +++ 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 86d9b0e45c8c

[PATCH 0/2] AMDGPU / DRM Fix mapping of user pages

2020-03-23 Thread Shane Francis
via the correct dma macro Shane Francis (2): drm/prime: correct logic for mapping sg to arrays drm/amdgpu: fix scatter-gather mapping with user pages drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 +-- drivers/gpu/drm/drm_prime.c | 71 + include/drm

[PATCH 2/2] drm/amdgpu: fix scatter-gather mapping with user pages

2020-03-23 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff

Re: [PATCH 2/2] drm/amdgpu: fix scatter-gather mapping with user pages

2020-03-23 Thread Shane Francis
hat seems to use the same logic for user pages. Regards : Shane Francis ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 0/3] AMDGPU / RADEON / DRM Fix mapping of user pages

2020-03-23 Thread Shane Francis
the segment length via the correct dma macro Shane Francis (3): drm/prime: correct logic for mapping sg to arrays drm/amdgpu: fix scatter-gather mapping with user pages drm/radeon: fix scatter-gather mapping with user pages drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 +-- drivers/gpu/drm

[PATCH v2 2/3] drm/amdgpu: fix scatter-gather mapping with user pages

2020-03-23 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff

[PATCH v2 3/3] drm/radeon: fix scatter-gather mapping with user pages

2020-03-23 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/radeon/radeon_ttm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a

[PATCH v2 1/3] drm/prime: correct logic for mapping sg to arrays

2020-03-23 Thread Shane Francis
mapping Signed-off-by: Shane Francis --- drivers/gpu/drm/drm_prime.c | 71 - include/drm/drm_prime.h | 5 +++ 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 86d9b0e45c8c

[PATCH 2/2] drm/amdgpu: fix scatter-gather mapping with user pages

2020-03-24 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff

[PATCH 1/2] drm/prime: correct logic for mapping sg to arrays

2020-03-24 Thread Shane Francis
mapping Signed-off-by: Shane Francis --- drivers/gpu/drm/drm_prime.c | 71 - include/drm/drm_prime.h | 5 +++ 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 86d9b0e45c8c

[PATCH v3 3/3] drm/radeon: fix scatter-gather mapping with user pages

2020-03-24 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH v3 2/3] drm/amdgpu: fix scatter-gather mapping with user pages

2020-03-24 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH v3 1/3] drm/prime: use length macro when mapping sgl

2020-03-24 Thread Shane Francis
As dma_map_sg can reorganize scatter-gather lists in a way that can cause some later segments to be empty we should always use the sg_dma_len macro to fetch the actual length. This could now be 0 and not need to be mapped to a page or address array Signed-off-by: Shane Francis --- drivers/gpu

[PATCH v3 0/3] AMDGPU / RADEON / DRM Fix mapping of user pages

2020-03-24 Thread Shane Francis
The sg_dma_len macro is representative of the length of the sg item after dma_map_sg Example Crash : > [drm:amdgpu_ttm_backend_bind [amdgpu]] *ERROR* failed to pin userptr This happens in OpenCL applications, causing them to crash or hang, on either amdgpu-pro or ROCm OpenCL implementations Shane F

[PATCH v4 0/3] AMDGPU / RADEON / DRM Fix mapping of user pages

2020-03-25 Thread Shane Francis
I have verified this fixes the above on kernel 5.5 and 5.5rc using an AMD Vega 64 GPU Shane Francis (3): drm/prime: use dma length macro when mapping sg to arrays drm/amdgpu: fix scatter-gather mapping with user pages drm/radeon: fix scatter-gather mapping with user pages drivers/gpu/drm/amd/

[PATCH v4 1/3] drm/prime: use dma length macro when mapping sg

2020-03-25 Thread Shane Francis
As dma_map_sg can reorganize scatter-gather lists in a way that can cause some later segments to be empty we should always use the sg_dma_len macro to fetch the actual length. This could now be 0 and not need to be mapped to a page or address array Signed-off-by: Shane Francis --- drivers/gpu

[PATCH v4 2/3] drm/amdgpu: fix scatter-gather mapping with user pages

2020-03-25 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH v4 3/3] drm/radeon: fix scatter-gather mapping with user pages

2020-03-25 Thread Shane Francis
Calls to dma_map_sg may return segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Signed-off-by: Shane Francis --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

Re: [PATCH v4 3/3] drm/radeon: fix scatter-gather mapping with user pages

2020-03-25 Thread Shane Francis
> >-Original Message- > >From: dri-devel On Behalf Of > >Shane Francis > >Sent: Wednesday, March 25, 2020 5:08 AM > >To: dri-devel@lists.freedesktop.org > >Cc: airl...@linux.ie; linux-ker...@vger.kernel.org; bigbeesh...@gmail.com; > >amd-gfx-req

Re: [PATCH] drm/prime: fix extracting of the DMA addresses from a scatterlist

2020-03-27 Thread Shane Francis
On Fri, Mar 27, 2020 at 8:24 AM Marek Szyprowski wrote: > > Scatterlist elements contains both pages and DMA addresses, but in general, > one cannot assume 1:1 relation between them. The sg->length is the size of > the physical memory chunk described by sg->page, while sg_dma_length(sg) is > the s

Re: [PATCH] drm/prime: fix extracting of the DMA addresses from a scatterlist

2020-03-27 Thread Shane Francis
mentation it is not instantly clear why you would be mapping the pages in this way. Would probably prevent someone in the future making the same mistake I did while updating this code. Regards, Shane Francis ___ dri-devel mailing list dri-devel@lists.f

Re: [PATCH v2] drm/prime: fix extracting of the DMA addresses from a scatterlist

2020-03-28 Thread Shane Francis
sed when accessing addr and len rather than sg->address and sg->length. Maybe it would be worth splitting this out into 2 functions to avoid potential issues with the above use case ? Regards, Shane Francis ___ dri-devel mailing list dri-devel@list

Re: [v4,1/3] drm/prime: use dma length macro when mapping sg

2020-03-30 Thread Shane Francis
On Mon, Mar 30, 2020 at 9:18 AM Marek Szyprowski wrote: > Today I've noticed that this patch went to final v5.6 without even a day > of testing in linux-next, so v5.6 is broken on Exynos and probably a few > other ARM archs, which rely on the drm_prime_sg_to_page_addr_arrays > function. > > Best r

Re: [v4,1/3] drm/prime: use dma length macro when mapping sg

2020-03-30 Thread Shane Francis
On Mon, Mar 30, 2020 at 9:18 AM Marek Szyprowski wrote: > Today I've noticed that this patch went to final v5.6 without even a day > of testing in linux-next, so v5.6 is broken on Exynos and probably a few > other ARM archs, which rely on the drm_prime_sg_to_page_addr_arrays > function. > > Best r

Re: [v4,1/3] drm/prime: use dma length macro when mapping sg

2020-03-30 Thread Shane Francis
On Mon, Mar 30, 2020 at 9:18 AM Marek Szyprowski wrote: > Today I've noticed that this patch went to final v5.6 without even a day > of testing in linux-next, so v5.6 is broken on Exynos and probably a few > other ARM archs, which rely on the drm_prime_sg_to_page_addr_arrays > function. > > Best