]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/panthor: Update memattr programing to align with GPU spec
authorAkash Goel <akash.goel@arm.com>
Wed, 30 Oct 2024 22:54:05 +0000 (22:54 +0000)
committerLiviu Dudau <liviu.dudau@arm.com>
Tue, 19 Nov 2024 16:16:27 +0000 (16:16 +0000)
commit06e931e0fcb8f24e929efba973fd242d6d6cd1e0
treeb3f14d18906454db3cd2cdc5fcdf0971420e8c9c
parent4b64b4a81fcd51f570c046cf904aef19ec756d45
drm/panthor: Update memattr programing to align with GPU spec

Mali GPU Arch spec forbids the GPU PTEs to indicate Inner or Outer
shareability when no_coherency protocol is selected. Doing so results in
unexpected or undesired snooping of the CPU caches on some platforms,
such as Juno FPGA, causing functional issues. For example the boot of
MCU firmware fails as GPU ends up reading stale data for the FW memory
pages from the CPU's cache. The FW memory pages are initialized with
uncached mapping when the device is not reported to be dma-coherent.
The shareability bits are set to inner-shareable when IOMMU_CACHE flag
is passed to map_pages() callback and IOMMU_CACHE flag is passed by
Panthor driver when memory needs to be mapped as cached on the GPU side.

IOMMU_CACHE seems to imply cache coherent and is probably not fit for
purpose for the memory that is mapped as cached on GPU side but doesn't
need to remain coherent with the CPU.

This commit updates the programming of MEMATTR register to use
MIDGARD_INNER instead of CPU_INNER when coherency is disabled. That way
the inner-shareability specified in the GPU PTEs would map to Mali's
internal-shareable mode, which is always supported by the GPU regardless
of the coherency protocal and is required by the Userspace driver to
ensure coherency between the shader cores.

v2:
- Added R-b tags

Signed-off-by: Akash Goel <akash.goel@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://lore.kernel.org/r/20241030225407.4077513-2-akash.goel@arm.com
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
drivers/gpu/drm/panthor/panthor_mmu.c