All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] arm/optee: Use only least 32 bits for SMC type arg according to SMCCC
@ 2021-01-06 11:26 Roman Skakun
  2021-01-06 17:24 ` Volodymyr Babchuk
  2021-01-06 18:02 ` Julien Grall
  0 siblings, 2 replies; 5+ messages in thread
From: Roman Skakun @ 2021-01-06 11:26 UTC (permalink / raw)
  To: xen-devel
  Cc: Volodymyr Babchuk, Stefano Stabellini, Julien Grall,
	Volodymyr Babchuk

This patch added additional sanity and increases an understanding for
getting proper value from the first argument for SMC call on aarch64
according to SMCC Convention.

[0] ARM DEN0028B, page 12

Signed-off-by: Roman Skakun <roman_skakun@epam.com>
---
 xen/arch/arm/tee/optee.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index ee85359742..87060b52b8 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -1643,7 +1643,8 @@ static bool optee_handle_call(struct cpu_user_regs *regs)
     if ( !ctx )
         return false;
 
-    switch ( get_user_reg(regs, 0) )
+    /* Only least 32 bits are significant (see ARM DEN 0028B, page 12) */
+    switch ( (uint32_t)get_user_reg(regs, 0) )
     {
     case OPTEE_SMC_CALLS_COUNT:
         set_user_reg(regs, 0, OPTEE_MEDIATOR_SMC_COUNT);
-- 
2.25.1



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

end of thread, other threads:[~2021-01-08 10:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-06 11:26 [PATCH v1] arm/optee: Use only least 32 bits for SMC type arg according to SMCCC Roman Skakun
2021-01-06 17:24 ` Volodymyr Babchuk
2021-01-06 18:02 ` Julien Grall
2021-01-06 23:22   ` Volodymyr Babchuk
2021-01-08 10:27     ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.