linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] drm/ttm: force cached mappings for system RAM on ARM
@ 2019-01-10  7:28 Ard Biesheuvel
  2019-01-10  8:36 ` Zhang, Jerry(Junwei)
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Ard Biesheuvel @ 2019-01-10  7:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, dri-devel, will.deacon, Bernhard.Rosenkranzer,
	Carsten.Haitzler, Ard Biesheuvel, Christian Koenig, Huang Rui,
	Junwei Zhang, David Airlie

ARM systems do not permit the use of anything other than cached
mappings for system memory, since that memory may be mapped in the
linear region as well, and the architecture does not permit aliases
with mismatched attributes.

So short-circuit the evaluation in ttm_io_prot() if the flags include
TTM_PL_SYSTEM when running on ARM or arm64, and just return cached
attributes immediately.

This fixes the radeon and amdgpu [TBC] drivers when running on arm64.
Without this change, amdgpu does not start at all, and radeon only
produces corrupt display output.

Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Junwei Zhang <Jerry.Zhang@amd.com>
Cc: David Airlie <airlied@linux.ie>
Reported-by: Carsten Haitzler <Carsten.Haitzler@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 046a6dda690a..0c1eef5f7ae3 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -530,6 +530,11 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
 	if (caching_flags & TTM_PL_FLAG_CACHED)
 		return tmp;
 
+#if defined(__arm__) || defined(__aarch64__)
+	/* ARM only permits cached mappings of system memory */
+	if (caching_flags & TTM_PL_SYSTEM)
+		return tmp;
+#endif
 #if defined(__i386__) || defined(__x86_64__)
 	if (caching_flags & TTM_PL_FLAG_WC)
 		tmp = pgprot_writecombine(tmp);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-01-17  8:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10  7:28 [RFC PATCH] drm/ttm: force cached mappings for system RAM on ARM Ard Biesheuvel
2019-01-10  8:36 ` Zhang, Jerry(Junwei)
2019-01-10  8:36 ` Koenig, Christian
2019-01-10  9:34 ` Michel Dänzer
2019-01-14 10:53   ` Ard Biesheuvel
2019-01-14 11:38     ` Koenig, Christian
2019-01-14 17:32       ` Ard Biesheuvel
     [not found]         ` <9f956898-7973-98ee-6bf1-e1d445e9d365@amd.com>
2019-01-14 19:13           ` Will Deacon
2019-01-14 19:21             ` Koenig, Christian
2019-01-14 19:35               ` Will Deacon
2019-01-15 11:31                 ` Michael Ellerman
2019-01-16  0:33                   ` Benjamin Herrenschmidt
2019-01-16  7:35                     ` Koenig, Christian
2019-01-16  7:47                       ` Ard Biesheuvel
2019-01-17  6:07                         ` Benjamin Herrenschmidt
2019-01-17  8:02                           ` Ard Biesheuvel
2019-01-17  5:59                       ` Benjamin Herrenschmidt

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).