linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] optee: add writeback to valid memory type
@ 2020-11-13 15:06 Rui Miguel Silva
  2020-11-25 11:55 ` Jens Wiklander
  0 siblings, 1 reply; 2+ messages in thread
From: Rui Miguel Silva @ 2020-11-13 15:06 UTC (permalink / raw)
  To: Jens Wiklander; +Cc: op-tee, linux-kernel, Rui Miguel Silva

Only in smp systems the cache policy is setup as write alloc, in
single cpu systems the cache policy is set as writeback and it is
normal memory, so, it should pass the is_normal_memory check in the
share memory registration.

Add the right condition to make it work in no smp systems.

Fixes: cdbcf83d29c1 ("tee: optee: check type of registered shared memory")
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>

---
 drivers/tee/optee/call.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
index 20b6fd7383c5..c981757ba0d4 100644
--- a/drivers/tee/optee/call.c
+++ b/drivers/tee/optee/call.c
@@ -534,7 +534,8 @@ 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;
+	return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) ||
+		((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK));
 #elif defined(CONFIG_ARM64)
 	return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL);
 #else
-- 
2.29.2


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

* Re: [PATCH] optee: add writeback to valid memory type
  2020-11-13 15:06 [PATCH] optee: add writeback to valid memory type Rui Miguel Silva
@ 2020-11-25 11:55 ` Jens Wiklander
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Wiklander @ 2020-11-25 11:55 UTC (permalink / raw)
  To: Rui Miguel Silva; +Cc: op-tee, Linux Kernel Mailing List

On Fri, Nov 13, 2020 at 4:06 PM Rui Miguel Silva <rui.silva@linaro.org> wrote:
>
> Only in smp systems the cache policy is setup as write alloc, in
> single cpu systems the cache policy is set as writeback and it is
> normal memory, so, it should pass the is_normal_memory check in the
> share memory registration.
>
> Add the right condition to make it work in no smp systems.
>
> Fixes: cdbcf83d29c1 ("tee: optee: check type of registered shared memory")
> Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>

Looks good, I'll pick up this.

Thanks,
Jens

>
> ---
>  drivers/tee/optee/call.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
> index 20b6fd7383c5..c981757ba0d4 100644
> --- a/drivers/tee/optee/call.c
> +++ b/drivers/tee/optee/call.c
> @@ -534,7 +534,8 @@ 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;
> +       return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) ||
> +               ((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK));
>  #elif defined(CONFIG_ARM64)
>         return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL);
>  #else
> --
> 2.29.2
>

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

end of thread, other threads:[~2020-11-25 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 15:06 [PATCH] optee: add writeback to valid memory type Rui Miguel Silva
2020-11-25 11:55 ` Jens Wiklander

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