linux_dsm_epyc7002/drivers/gpu/drm/msm/adreno
Arnd Bergmann 8f93e043d0 drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations
In zap_shader_load_mdt(), we pass a pointer to a phys_addr_t
into dmam_alloc_coherent, which the compiler warns about:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c: In function 'zap_shader_load_mdt':
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:54:50: error: passing argument 3 of 'dmam_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]

The returned DMA address is later passed on to a function that
takes a phys_addr_t, so it's clearly wrong to use the DMA
mapping interface here: the memory may be uncached, or the
address may be completely wrong if there is an IOMMU connected
to the device. What the code actually wants to do is to get
the physical address from the reserved-mem node. It goes through
the dma-mapping interfaces for obscure reasons, and this
apparently only works by chance, relying on specific bugs
in the error handling of the arm64 dma-mapping implementation.

The same problem existed in the "venus" media driver, which was
now fixed by Stanimir Varbanov after long discussions.

In order to make some progress here, I have now ported his
approach over to the adreno driver. The patch is currently
untested, and should get a good review, but it is now much
simpler than the original, and it should be obvious what
goes wrong if I made a mistake in the port.

See also: a6e2d36bf6 ("media: venus: don't abuse dma_alloc for non-DMA allocations")
Cc: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Fixes: 7c65817e6d ("drm/msm: gpu: Enable zap shader for A5XX")
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Acked-and-Tested-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-08-01 19:39:00 -04:00
..
a2xx.xml.h drm/msm: update generated headers 2017-06-16 11:16:07 -04:00
a3xx_gpu.c drm/msm: Remove idle function hook 2017-06-16 11:15:47 -04:00
a3xx_gpu.h drm/msm: update generated headers 2014-08-04 11:55:28 -04:00
a3xx.xml.h drm/msm: update generated headers 2017-06-16 11:16:07 -04:00
a4xx_gpu.c drm/msm: Remove idle function hook 2017-06-16 11:15:47 -04:00
a4xx_gpu.h drm/msm: a4xx support for msm-drm 2014-11-16 14:27:40 -05:00
a4xx.xml.h drm/msm: update generated headers 2017-06-16 11:16:07 -04:00
a5xx_gpu.c drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations 2017-08-01 19:39:00 -04:00
a5xx_gpu.h drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations 2017-08-01 19:39:00 -04:00
a5xx_power.c drm/msm: Separate locking of buffer resources from struct_mutex 2017-06-17 08:03:07 -04:00
a5xx.xml.h drm/msm: update generated headers 2017-06-16 11:16:07 -04:00
adreno_common.xml.h drm/msm: update generated headers 2017-06-16 11:16:07 -04:00
adreno_device.c drm/msm: fix locking inconsistency for gpu->hw_init() 2017-06-16 11:16:01 -04:00
adreno_gpu.c drm/msm/adreno: Prevent unclocked access when retrieving timestamps 2017-08-01 19:20:13 -04:00
adreno_gpu.h drm/msm: Remove memptrs->wptr 2017-06-16 11:16:01 -04:00
adreno_pm4.xml.h drm/msm: update generated headers 2017-06-16 11:16:07 -04:00