OpTEE + Android in Hikey960

Try flashing the boot.img you had built earlier using the instructions from https://github.com/vchong/optee_android_manifest/blob/wip/tmp.txt.

Boot failed after flashing the boot.img

Failed how? Anyway, going through the source code the boot.img from step 1 above should have worked as well. Did you do “Building the kernel” from Using Reference Boards  |  Android Open Source Project?

Hi @vchong
I did the following and not able to bring up the HiKey960 board using OP-TEE with AOSP

1. Build aosp for hikey960 based on https://source.android.com/setup/build/devices#960hikey. 
	Boot successful without OP-TEE.
2. Build AOSP with OP-TEE using  https://github.com/linaro-swg/optee_android_manifest/tree/lcr-ref-hikey-o 

and device/linaro/bootloader/arm-trusted-firmware, device/linaro/hikey/uefi-tools, device/linaro/bootloader/edk2, device/linaro/bootloader/OpenPlatformPkg from #1
3. Flash fip.bin & boot.img from #2 but boot failed
--------------boot log…
Audio_codec: [audio]:Could not find “hisilicon,codec-controller” node.
load_teeos: can not find fb node fingerprint
load_teeos: failed to find fb node ese_config
display: [display]hisi_get_disp_info: hisifb_data is NULL pointer, return!
bfm: : >>>>>enter set_boot_stage
bfm: : bootStageCode is 0x02010003, mntnStageCode is 32
bfm: : <<<<<exit set_boot_stage.
misc: [get_misc_message] mmc_read failed
preboot: [fastboot]: check_unlock_misc_info, line:1273 :get misc message failed.
preboot: [fastboot]: check_powerkey_misc_info, line:1242 :!!!CAUTION!!!:get keypad_operator FAIL!
preboot: [fastboot]: check_volumekey_state, line:943 :!!!CAUTION!!!:get keypad_operator FAIL!
misc: [get_misc_message] mmc_read failed
preboot: [fastboot]: comm_read_misc_cmd, line:501 :get misc message failed.
watchdog: Disable watchdog start
bfm: : [disable_boot_fail_system] boot_fail_system state is 0
rescue: ^^^^^^^^^[rescue_init] ok !
usbloader: bootmode is 4
--------------boot log…

4. Building the kernel from https://source.android.com/setup/build/devices#960hikey2? on #2 environment
	Then executed steps at #3 but the result is same

Don’t use the boot.img from #2. Use the boot.img from #1 environment. If you build the kernel, also build it in the #1 environment.

Hi @vchong thanks for your help.

Finally able to boot the hikey960 board using OP-TEE with AOSP.

  1. Recovery from tools-images-hikey960
    https://github.com/96boards-hikey/tools-images-hikey960

  2. Flash reference build
    https://snapshots.linaro.org/96boards/reference-platform/components/uefi-staging/69/hikey960/release/
    Install UEFI on HiKey960 from Binaries [Instructions]

  3. fip.bin from Fresh build…
    https://github.com/OP-TEE/build

  4. Boot and System images from AOSP960 build
    Using Reference Boards  |  Android Open Source Project

  5. Build latest boot image using updated kernel
    Using Reference Boards  |  Android Open Source Project

  6. xtest, tee-supplicant and .ta from build https://github.com/linaro-swg/optee_android_manifest/tree/lcr-ref-hikey-o

But getting the error while running the xtest

console:/ # xtest 200
Test ID: 200
Run test suite with level=0

TEE test application started with device [(null)]
######################################################

regression

######################################################

  • regression_2001 Trivial TCP iSocket API tests
    o regression_2001.1 Start server
    regression_2001.1 OK
    o regression_2001.2 TCP Socket open
    D/TC:0 core_mmu_entry_to_finer_grained:631 xlat tables used 3 / 5
    D/TC:0 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (Secure Storage TA)
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (REE)
    D/TC:0 load_elf_from_store:759 ELF load address 0x40005000
    D/TC:0 tee_ta_init_user_ta_session:879 Processing relocations in 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    E/TC:0 tee_ta_init_user_ta_session:901 Invalid TA flag(s) 0x3
    D/TC:0 tee_ta_open_session:563 init session failed 0xffff0005
    external/optee_test/host/xtest/regression_2000.c:298: xtest_teec_open_session( &session, &socket_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff0005 = TEEC_ERROR_BAD_FORMAT, expected 0x0 = TEEC_SUCCESS
    regression_2001.2 FAILED
    regression_2001 FAILED

  • regression_2002 Concurrent stressing TCP iSocket API tests
    o regression_2002.1 Stressing with 3 threads
    D/TC:0 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    *D/TC:1 __wq_rpc:40 sleep thread 1 0x3f045198 0
    *D/TC:2 __wq_rpc:40 sleep thread 2 0x3f045198 0
    *D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (Secure Storage TA)
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (REE)
    D/TC:0 load_elf_from_store:759 ELF load address 0x40005000
    D/TC:0 tee_ta_init_user_ta_session:879 Processing relocations in 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    E/TC:0 tee_ta_init_user_ta_session:901 Invalid TA flag(s) 0x3
    D/TC:0 __wq_rpc:40 wake thread 1 0x3f045198 -3
    D/TC:0 tee_ta_open_session:563 init session failed 0xffff0005
    *D/TC:1 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    D/TC:1 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (Secure Storage TA)
    D/TC:1 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (REE)
    D/TC:1 load_elf_from_store:759 ELF load address 0x40005000
    D/TC:1 tee_ta_init_user_ta_session:879 Processing relocations in 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    E/TC:1 tee_ta_init_user_ta_session:901 Invalid TA flag(s) 0x3
    D/TC:1 __wq_rpc:40 wake thread 2 0x3f045198 -3
    D/TC:1 tee_ta_open_session:563 init session failed 0xffff0005
    *D/TC:2 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    D/TC:2 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (Secure Storage TA)
    D/TC:2 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (REE)
    D/TC:2 load_elf_from_store:759 ELF load address 0x40005000
    D/TC:2 tee_ta_init_user_ta_session:879 Processing relocations in 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    E/TC:2 tee_ta_init_user_ta_session:901 Invalid TA flag(s) 0x3
    D/TC:2 tee_ta_open_session:563 init session failed 0xffff0005
    external/optee_test/host/xtest/regression_2000.c:538: arg[n].success has an unexpected value: 0x0 = false, expected 0x1 = true
    external/optee_test/host/xtest/regression_2000.c:538: arg[n].success has an unexpected value: 0x0 = false, expected 0x1 = true
    external/optee_test/host/xtest/regression_2000.c:538: arg[n].success has an unexpected value: 0x0 = false, expected 0x1 = true
    regression_2002.1 FAILED
    regression_2002 FAILED

  • regression_2003 Timeout TCP iSocket API tests
    o regression_2003.1 Start server
    regression_2003.1 OK
    o regression_2003.2 TCP Socket open
    D/TC:0 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (Secure Storage TA)
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (REE)
    D/TC:0 load_elf_from_store:759 ELF load address 0x40005000
    D/TC:0 tee_ta_init_user_ta_session:879 Processing relocations in 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    E/TC:0 tee_ta_init_user_ta_session:901 Invalid TA flag(s) 0x3
    D/TC:0 tee_ta_open_session:563 init session failed 0xffff0005
    external/optee_test/host/xtest/regression_2000.c:583: xtest_teec_open_session( &session, &socket_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff0005 = TEEC_ERROR_BAD_FORMAT, expected 0x0 = TEEC_SUCCESS
    regression_2003.2 FAILED
    regression_2003 FAILED

  • regression_2004 UDP iSocket API tests
    o regression_2004.1 Start server
    regression_2004.1 OK
    o regression_2004.2 UDP Socket open
    D/TC:0 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (Secure Storage TA)
    D/TC:0 load_elf:791 Lookup user TA ELF 873bcd08-c2c3-11e6-a937-d0bf9c45c61c (REE)
    D/TC:0 load_elf_from_store:759 ELF load address 0x40005000
    D/TC:0 tee_ta_init_user_ta_session:879 Processing relocations in 873bcd08-c2c3-11e6-a937-d0bf9c45c61c
    E/TC:0 tee_ta_init_user_ta_session:901 Invalid TA flag(s) 0x3
    D/TC:0 tee_ta_open_session:563 init session failed 0xffff0005
    external/optee_test/host/xtest/regression_2000.c:708: xtest_teec_open_session( &session, &socket_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff0005 = TEEC_ERROR_BAD_FORMAT, expected 0x0 = TEEC_SUCCESS
    regression_2004.2 FAILED
    regression_2004 FAILED
    ±----------------------------------------------------
    Result of testsuite regression filtered by “200”:
    regression_2001.2 FAILED first error at external/optee_test/host/xtest/regression_2000.c:298
    regression_2001 FAILED
    regression_2002.1 FAILED first error at external/optee_test/host/xtest/regression_2000.c:538
    regression_2002 FAILED
    regression_2003.2 FAILED first error at external/optee_test/host/xtest/regression_2000.c:583
    regression_2003 FAILED
    regression_2004.2 FAILED first error at external/optee_test/host/xtest/regression_2000.c:708
    regression_2004 FAILED
    ±----------------------------------------------------
    18 subtests of which 6 failed
    4 test cases of which 4 failed
    140 test cases was skipped
    TEE test application done!

1 Like

You’re welcome! Good job putting the pieces together and thanks for sharing!

Din you run xtest as root? In yes, then try adding these selinux policies:
https://android-review.linaro.org/#/c/17177/12/sepolicy/file_contexts
https://android-review.linaro.org/#/c/17177/12/sepolicy/tee.te
https://android-review.linaro.org/#/c/18062/2/sepolicy/tee.te

Now xtest is running OK except the following few test cases related to SDP
console:/ # xtest 1014
Test ID: 1014
Run test suite with level=0

TEE test application started with device [(null)]
######################################################

regression

######################################################

  • regression_1014 Test secure data path against SDP TAs and pTAs
    o regression_1014.1 SDP: NonSecure client invokes a SDP TA
    Error: failed to query the number of heaps
    external/optee_test/host/xtest/regression_1000.c:1258: ret has an unexpected value: 0x1, expected 0x0
    regression_1014.1 FAILED
    o regression_1014.2 SDP: SDP TA invokes a SDP TA
    Error: failed to query the number of heaps
    external/optee_test/host/xtest/regression_1000.c:1264: ret has an unexpected value: 0x1, expected 0x0
    regression_1014.2 FAILED
    o regression_1014.3 SDP: SDP TA invokes a SDP pTA
    Error: failed to query the number of heaps
    external/optee_test/host/xtest/regression_1000.c:1270: ret has an unexpected value: 0x1, expected 0x0
    regression_1014.3 FAILED
    o regression_1014.4 SDP: NSec CA invokes SDP pTA (should fail)
    Error: failed to query the number of heaps
    regression_1014.4 OK
    regression_1014 FAILED
    ±----------------------------------------------------
    Result of testsuite regression filtered by “1014”:
    regression_1014.1 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1258
    regression_1014.2 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1264
    regression_1014.3 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1270
    regression_1014 FAILED
    ±----------------------------------------------------
    4 subtests of which 3 failed
    1 test case of which 1 failed
    66 test cases was skipped
    TEE test application done!

For xtest 200, did the selinux policies help?

Sigh, one more missing piece. The kernel you specified in

  1. Build latest boot image using updated kernel
    Using Reference Boards  |  Android Open Source Project

is not fully patched for SDP, i.e. missing CFG_* for SDP in the defconfig and etc.

Try this. Run https://github.com/linaro-swg/optee_android_manifest/tree/lcr-ref-hikey-o until step 3.4. Then stop. Next cd to kernel/linaro/hisilicon. After that:

make ARCH=arm64 hikey960_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24

After that, continue with step 2 and 3 in the ‘Building the kernel’ section of Using Reference Boards  |  Android Open Source Project. In step 2, make sure you copy hi3660-hikey960.dtb and Image file over to the hikey-kernel directory of your hikey960 aosp source tree! Then run step 3 in your hikey960 aosp source tree, and reflash the boot img.

Btw, this hack is so bad and ugly at this point I don’t know if I’d recommend anybody using it.

What are you using this build for?

Basically trying to bring up the board with OP-TEE with AOSP and after that planning to do some hardware decoding related stuff.

@vchong,

Is there any plan to release OP-TEE with AOSP 8.X for HiKey 960 boards?
That would be very helpful for those who are trying to work on HiKey960 board with OP-TEE + AOSP.

Thanks,
Rabi

Hi @vchong,

This hack does not work for me. Getting boot time issues, board is not booting up.
Planning to integrate SDP related patches on HiKey 960 AOSP build (Using Reference Boards  |  Android Open Source Project).

Could you please suggest what are the patches need to be applied and where. That would be very helpful for me.

Thanks,
Rabi

Hi @vchong,

From where I can download
libstagefrighthw.so
libOMX_Core.so

for HiKey960 board.

Thanks,
Rabi

Hi Rabindranath,

Thank you for sharing your solution. I am also very interested to have op-tee with aosp running on hikey 960.

What does it mean in practice, TAs won’t work at all or only some features?

I was able to run test cases except the SDP related 3 test cases. SDP is not properly integrated with this customized build. In order to run SDP related test cases, need to integrate SDP patches properly which I am not aware of.

Hi @vchong

I am trying to integrate the SDP patches for Hikey960 by manually applying all the patches mentioned in https://android-review.linaro.org/#/c/17907/1/hikey-optee-4.9.

The build that I am using is Kernel build from Android source.

But the main issue that I am facing is after reverting commit 5634cf8762d848b673a0de5259264fb5681d5d00 (https://android-review.linaro.org/#/c/18281/).

I am getting a build error.

drivers/gpu/drm/hisilicon/kirin960/kirin_fbdev.c: In function ‘kirin_alloc_fb_buffer’:
drivers/gpu/drm/hisilicon/kirin960/kirin_fbdev.c:97:2: error: implicit declaration of function ‘ion_map_iommu’ [-Werror=implicit-function-declaration]
_ if (ion_map_iommu(client, handle, &(fbdev->iommu_format))) {_
_ ^_
drivers/gpu/drm/hisilicon/kirin960/kirin_fbdev.c: In function ‘kirin_fbdev_mmap’:
drivers/gpu/drm/hisilicon/kirin960/kirin_fbdev.c:149:2: error: implicit declaration of function ‘ion_sg_table’ [-Werror=implicit-function-declaration]
_ table = ion_sg_table(fbdev->ion_client, fbdev->ion_handle);_
_ ^_
drivers/gpu/drm/hisilicon/kirin960/kirin_fbdev.c:149:8: warning: assignment makes pointer from integer without a cast
_ table = ion_sg_table(fbdev->ion_client, fbdev->ion_handle);_

This is quite obvious as the revert mentioned compromised the functions from ion.c and ion.h.

Do you have any idea how to proceed with the SDP feature?

Hello Rabindranath,

What did you do to achieve this? Did you add the selinux policies as suggested by vchong?

Should I also flash the vendor.img and userdata.img images?

Thanks

Yes need to modify selinux policies.

Yes

Hi,

I want to build Android with OpTEE but I have some issues when I run xtest.

Environment configuration

For UEFI I use UEFI Hikey960 Debug #76 binairies.

For Android environment I use this (Update 08/19) known good manifest.

For hikey-kernel → 02ba176613f0fca9599f0c481b65edf23138d2bf

optee_os → e07aecdb99a2f7b57ded29373c3ed23e7af5dc4b
optee_test → 14f4887f0d8ff6a205aff61979a9d2083262a11e
optee_example → 80344571a86de1ecb76abc32a032ce9374d35f3d
optee_client → b6bfce9f4ee5447e5aaf952dd50ccc8bbb6d5523

To integrate optee in apply this patch : https://android-review.linaro.org/#/c/17833/

Target : hikey960-userdebug

Build command : make CFG_SECSTOR_TA_MGMT_PTA=y CFG_SECURE_DATA_PATH=y -j32

SEPolicy error

I didn’t applied this two patches (first|second) because when I build android I had the followings errors :

treble_sepolicy_test error
[  6% 1742/28043] build out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_26.0_intermediates/treble_sepolicy_tests_26.0
FAILED: out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_26.0_intermediates/treble_sepolicy_tests_26.0
/bin/bash -c "(out/host/linux-x86/bin/treble_sepolicy_tests -l 		out/host/linux-x86/lib64/libsepolwrap.so  -f out/target/product/hikey960/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/hikey960/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts 		-b out/target/product/hikey960/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_26.0_intermediates/26.0_mapping.combined.cil 		-o out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_26.0_intermediates/built_26.0_plat_sepolicy -p out/target/product/hikey960/obj/ETC/sepolicy_intermediates/sepolicy 		--fake-treble ) && (touch out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_26.0_intermediates/treble_sepolicy_tests_26.0 )"
The following domain(s) must be associated with the "coredomain" attribute because they are executed off of /system:
tee

[  6% 1743/28043] build out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0
FAILED: out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0
/bin/bash -c "(out/host/linux-x86/bin/treble_sepolicy_tests -l 		out/host/linux-x86/lib64/libsepolwrap.so  -f out/target/product/hikey960/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/hikey960/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts 		-b out/target/product/hikey960/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_27.0_intermediates/27.0_mapping.combined.cil 		-o out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_27.0_intermediates/built_27.0_plat_sepolicy -p out/target/product/hikey960/obj/ETC/sepolicy_intermediates/sepolicy 		--fake-treble ) && (touch out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_27.0_intermediates/treble_sepolicy_tests_27.0 )"
The following domain(s) must be associated with the "coredomain" attribute because they are executed off of /system:
tee

[  6% 1746/28043] build out/target/product/hikey960/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests
FAILED: out/target/product/hikey960/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests
/bin/bash -c "(out/host/linux-x86/bin/sepolicy_tests -l out/host/linux-x86/lib64/libsepolwrap.so 		 -f out/target/product/hikey960/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/hikey960/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts  -p out/target/product/hikey960/obj/ETC/sepolicy_intermediates/sepolicy ) && (touch out/target/product/hikey960/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests )"
The following types on /data/ must be associated with the "core_data_file_type" attribute: tee_data_file

[  6% 1757/28043] build out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
FAILED: out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0
/bin/bash -c "(out/host/linux-x86/bin/treble_sepolicy_tests -l 		out/host/linux-x86/lib64/libsepolwrap.so  -f out/target/product/hikey960/obj/ETC/plat_file_contexts_intermediates/plat_file_contexts  -f out/target/product/hikey960/obj/ETC/vendor_file_contexts_intermediates/vendor_file_contexts 		-b out/target/product/hikey960/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -m out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_28.0_intermediates/28.0_mapping.combined.cil 		-o out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_28.0_intermediates/built_28.0_plat_sepolicy -p out/target/product/hikey960/obj/ETC/sepolicy_intermediates/sepolicy 		--fake-treble ) && (touch out/target/product/hikey960/obj/ETC/treble_sepolicy_tests_28.0_intermediates/treble_sepolicy_tests_28.0 )"
The following domain(s) must be associated with the "coredomain" attribute because they are executed off of /system:
tee

xtest issues

With this configuration I’m able to boot with android + optee (even if I can use mouse or keyboard for an unknown reason).

By default tee-supplicant wasn’t started, I don’t know if it’s a normal behaviour. So I started it. To counterbalance sepolicy patches which I didn’t applied I run the following command : setenforce 0.

Command: xtest

Result
hikey960:/vendor/bin # ./xtest                                                                                
Run test suite with level=0

TEE test application started with device [(null)]
######################################################
#
# regression
#
######################################################
 
* regression_1001 Core self tests
external/optee_test/host/xtest/regression_1000.c:246: res has an unexpected value: 0xffff000e = TEEC_ERROR_COMMUNICATION, expected 0x0 = TEEC_SUCCESS
Segmentation fault 

Command: xtest --install-ta …/lib/optee_armtz/

Result
hikey960:/vendor/bin # ./xtest --install-ta ../lib/optee_armtz/
xtest: TEEC_OpenSession: res 0xffff000e err_orig 0x2

Command: xtest 200

Result
hikey960:/vendor/bin # xtest 200
Test ID: 200
Run test suite with level=0

TEE test application started with device [(null)]
######################################################
#
# regression
#
######################################################
 
* regression_2001 Trivial TCP iSocket API tests
o regression_2001.1 Start server
  regression_2001.1 OK
o regression_2001.2 TCP Socket open
external/optee_test/host/xtest/regression_2000.c:298: xtest_teec_open_session( &session, &socket_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff000e = TEEC_ERROR_COMMUNICATION, expected 0x0 = TEEC_SUCCESS
  regression_2001.2 FAILED
  regression_2001 FAILED
 
* regression_2002 Concurrent stressing TCP iSocket API tests
o regression_2002.1 Stressing with 3 threads
external/optee_test/host/xtest/regression_2000.c:540: arg[n].success has an unexpected value: 0x0 = false, expected 0x1 = true
external/optee_test/host/xtest/regression_2000.c:540: arg[n].success has an unexpected value: 0x0 = false, expected 0x1 = true
external/optee_test/host/xtest/regression_2000.c:540: arg[n].success has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_2002.1 FAILED
  regression_2002 FAILED
 
* regression_2003 Timeout TCP iSocket API tests
o regression_2003.1 Start server
  regression_2003.1 OK
o regression_2003.2 TCP Socket open
external/optee_test/host/xtest/regression_2000.c:587: xtest_teec_open_session( &session, &socket_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff000e = TEEC_ERROR_COMMUNICATION, expected 0x0 = TEEC_SUCCESS
  regression_2003.2 FAILED
  regression_2003 FAILED
 
* regression_2004 UDP iSocket API tests
o regression_2004.1 Start server
  regression_2004.1 OK
o regression_2004.2 UDP Socket open
external/optee_test/host/xtest/regression_2000.c:714: xtest_teec_open_session( &session, &socket_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff000e = TEEC_ERROR_COMMUNICATION, expected 0x0 = TEEC_SUCCESS
  regression_2004.2 FAILED
  regression_2004 FAILED
+-----------------------------------------------------
Result of testsuite regression filtered by "200":
regression_2001.2 FAILED first error at external/optee_test/host/xtest/regression_2000.c:298
regression_2001 FAILED
regression_2002.1 FAILED first error at external/optee_test/host/xtest/regression_2000.c:540
regression_2002 FAILED
regression_2003.2 FAILED first error at external/optee_test/host/xtest/regression_2000.c:587
regression_2003 FAILED
regression_2004.2 FAILED first error at external/optee_test/host/xtest/regression_2000.c:714
regression_2004 FAILED
+-----------------------------------------------------
18 subtests of which 6 failed
4 test cases of which 4 failed
71 test cases was skipped
TEE test application done!

I don’t know why I have this issues maybe one of my components (UEFI, Kernel, AOSP + OPTEE) is wrong. Someone can say if I missed something to do ?

Thanks in advance