]> xenbits.xensource.com Git - people/jgross/xen.git/commitdiff
xen/arm: optee: The function identifier is always 32-bit
authorRoman Skakun <roman_skakun@epam.com>
Wed, 6 Jan 2021 11:26:57 +0000 (13:26 +0200)
committerJulien Grall <jgrall@amazon.com>
Fri, 8 Jan 2021 10:24:23 +0000 (10:24 +0000)
Per the SMCCC specification (see section 3.1 in ARM DEN 0028D), the
function identifier is only stored in the least significant 32-bits.
The most significant 32-bits should be ignored.

Signed-off-by: Roman Skakun <roman_skakun@epam.com>
Acked-by: Volodymyr Babchyk <volodymyr_babchuk@epam.com>
[jgrall: Reword the commit message and comment]
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/tee/optee.c

index ee8535974214f7b9f5e06a056ab622e5e90ccfad..9570dc6771eb40294680cbc8bb2009f98e8ba4fd 100644 (file)
@@ -1643,7 +1643,11 @@ static bool optee_handle_call(struct cpu_user_regs *regs)
     if ( !ctx )
         return false;
 
-    switch ( get_user_reg(regs, 0) )
+    /*
+     * The function identifier is always stored in the least significant
+     * 32-bit (see section ARM DEN 0028D).
+     */
+    switch ( (uint32_t)get_user_reg(regs, 0) )
     {
     case OPTEE_SMC_CALLS_COUNT:
         set_user_reg(regs, 0, OPTEE_MEDIATOR_SMC_COUNT);