]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
xen/arm: optee: check if OP-TEE is virtualization-aware
authorVolodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Wed, 19 Jun 2019 17:54:24 +0000 (17:54 +0000)
committerJulien Grall <julien.grall@arm.com>
Tue, 9 Jul 2019 14:15:24 +0000 (15:15 +0100)
This is workaround for OP-TEE 3.5. This is the first OP-TEE release
which supports virtualization, but there is no way to tell if
OP-TEE was built with that support enabled. We can probe for it
by calling SMC that is available only when OP-TEE is built with
virtualization support.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/tee/optee.c

index 1d79c2c159825a8158dd258f0f4c98fab8d14416..ec5402e89b35797384c8bc0b0c3678b558cbd196 100644 (file)
@@ -172,6 +172,16 @@ static bool optee_probe(void)
         return false;
     }
 
+    /*
+     * Workaround: OP-TEE 3.5 have no way to tell if it is build with
+     * virtualization support. But we can probe for OPTEE_SMC_VM_DESTROYED
+     * call. It will return OPTEE_SMC_RETURN_UNKNOWN_FUNCTION if
+     * OP-TEE have no virtualization support enabled.
+     */
+    arm_smccc_smc(OPTEE_SMC_VM_DESTROYED, 0, 0, 0, 0, 0, 0, 0, &resp);
+    if ( resp.a0 == OPTEE_SMC_RETURN_UNKNOWN_FUNCTION )
+        return false;
+
     return true;
 }