From e0238fcd9f3a0db13fba978584881bd3ed8672a2 Mon Sep 17 00:00:00 2001 From: Silvano di Ninno Date: Thu, 23 May 2019 09:53:14 +0200 Subject: [PATCH] MLK-21698: tee:optee: fix shared memory page attribute checks When allocating pages for share memory with OP-TEE, the driver checks the page attribute (pte). The current checks only allow writealloc pages. i.MX 6SLL sets the page attribute to writeback. Relax this check to allow writealloc, writeback and writethrough. Signed-off-by: Silvano di Ninno Reviewed-by: Franck Lenormand Reviewed-by: Horia Geanta Acked-by: Leonard Crestez (cherry picked from commit a4c5efa2df07a54ce112206c3ffc8fccf3369c52) (cherry picked from commit 51f031613d55e864f22cb244059e70432d7acd81) --- drivers/tee/optee/call.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c index 13b0269a0abc..ee412befdc14 100644 --- a/drivers/tee/optee/call.c +++ b/drivers/tee/optee/call.c @@ -530,7 +530,10 @@ void optee_free_pages_list(void *list, size_t num_entries) static bool is_normal_memory(pgprot_t p) { #if defined(CONFIG_ARM) - return (pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC; + u32 attr = pgprot_val(p) & L_PTE_MT_MASK; + + return (attr == L_PTE_MT_WRITEALLOC) || (attr == L_PTE_MT_WRITEBACK) || + (attr == L_PTE_MT_WRITETHROUGH); #elif defined(CONFIG_ARM64) return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL); #else