From: Volodymyr Babchuk Date: Wed, 19 Jun 2019 17:54:24 +0000 (+0000) Subject: xen/arm: optee: check if OP-TEE is virtualization-aware X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1940 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=68e0eb83ef62a4bbbd4837c3759bada65a62b71b;p=xen.git xen/arm: optee: check if OP-TEE is virtualization-aware 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 Acked-by: Julien Grall --- diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c index 1d79c2c159..ec5402e89b 100644 --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -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; }