Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPTEE: xtest hang on Nitrogen6x #2227

Closed
Atomar25 opened this issue Apr 3, 2018 · 11 comments
Closed

OPTEE: xtest hang on Nitrogen6x #2227

Atomar25 opened this issue Apr 3, 2018 · 11 comments

Comments

@Atomar25
Copy link
Contributor

Atomar25 commented Apr 3, 2018

Trying to run xtest on Nitrogen6x :
https://boundarydevices.com/product/nitrogen6x-board-imx6-arm-cortex-a9-sbc/

Followed the steps from below page:

http://mrvan.github.io/optee-imx6q-sabresd

Where I am using mainline u-boot and kernel is
#Linux nitrogen6x 4.1.37 #4 SMP PREEMPT Tue Apr 3 13:10:44 IST 2018 armv7l GNU/Linux

I could see optee Linux driver has initialized from dmesg:

root@nitrogen6x:~# dmesg | grep optee
optee firmware:optee: probing for conduit method from DT.
optee firmware:optee: initialized driver
optee soc:firmware:optee: probing for conduit method from DT.
optee soc:firmware:optee: initialized driver

root@nitrogen6x:~# dmesg | grep psci
psci: probing for conduit method from DT.
psci: PSCIv0.2 detected in firmware.
psci: Using standard PSCI v0.2 function IDs

But, when I run xtest, I see it hangs on "* regression_1004 Test User Crypt TA"

root@nitrogen6x:# tee-supplicant &
[1] 576
root@nitrogen6x:
# ERR [576] TEES:main:669: error tee_supp_fs_init

[1]+ Done(1) tee-supplicant
root@nitrogen6x:~# xtest
Run test suite with level=0

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

regression

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

  • regression_1001 Core self tests
    regression_1001 OK

  • regression_1002 PTA parameters
    regression_1002 OK

  • regression_1003 Core internal read/write mutex
    Number of parallel threads: 6 (2 writers and 4 readers)
    Max read concurrency: 2
    Max read waiters: 2
    Mean read concurrency: 1.3375
    Mean read waiting: 1.0125
    regression_1003 OK

  • regression_1004 Test User Crypt TA

It just hangs here and have to press ctrl+c to get the rootfs prompt again.

It looks to me OP-TEE runs out of memory but can anyone please confirm why I see it?

Thanks,
-Amit

@jforissier
Copy link
Contributor

Please check that tee-supplicant has been started and is running.

@Atomar25
Copy link
Contributor Author

Atomar25 commented Apr 3, 2018

Thanks for reply.

Looks like , it didn't start:
root@nitrogen6x:~# ps | grep "tee-supplicant"
609 root 2732 S grep tee-supplicant

But what is it, We are missing here ?

@jforissier
Copy link
Contributor

Indeed tee-supplicant failed to start, it says "ERR [576] TEES:main:669: error tee_supp_fs_init" (I did not notice at first, sorry for that).
Check the code in this function and you should be able to understand what's wrong. Perhaps some configuration is incorrect.

@Atomar25
Copy link
Contributor Author

Atomar25 commented Apr 3, 2018

Yeah, looked into tee_supp_fs_init function and it seems it expects /data/tee directory on rootfs.

After creating /data/tee on my rootfs, can see tee-supplicant has started and xtest runs without a hang.
but some of test cases failed.

is this /data/tee contains something specific ?(at the moment I have empty /data/tee on my rootfs)

@jforissier
Copy link
Contributor

/data/tee can be empty initially. Which test fails?

@Atomar25
Copy link
Contributor Author

Atomar25 commented Apr 3, 2018

Sorry, don't have the logs right now , I would share it tomorrow.

What exactly is the expectation from xtest, do it need all the test cases to be passed?

@jforissier
Copy link
Contributor

What exactly is the expectation from xtest, do it need all the test cases to be passed?

Normally, yes.

@Atomar25
Copy link
Contributor Author

Atomar25 commented Apr 4, 2018

Thanks for your time @jforissier .

It turned out that out rootfs is read only and tee-supplicant could not really create /data/tee and other
files.
After remounting rootfs as "rw", all the test cases are passed now.

+-----------------------------------------------------
15787 subtests of which 0 failed
66 test cases of which 0 failed
0 test case was skipped
TEE test application done!

Apart from it, we are able to run ./optee_example_hello_world test application as well.

root@nitrogen6x:/bin# ./optee_example_hello_world
D/TA: TA_CreateEntryPoint:39 has been called
F/TA: tee_user_mem_alloc:344: Allocate: link:[0x114b98], buf:[0x114ba8:16]
D/TA: TA_OpenSessionEntryPoint:68 has been called
I/TA: Hello World!
Invoking TA to increment 42
D/TA: inc_value:105 has been called
I/TA: Got value: 42 from NW
I/TA: Increase value to: 43
TA incremented value to 43
I/TA: Goodbye!
F/TA: tee_user_mem_free:443: Free: link:[0x114b98], buf:[0x114ba8:16]
D/TA: TA_DestroyEntryPoint:50 has been called

Hope, everything is fine now.

Thanks
Amit.

@PedroRibeiro95
Copy link

Hello @Atomar25

Sorry for commenting on a closed issue, but can I ask you for help? I'm also trying to get OP-TEE running on Nitrogen6X and followed the guide you linked, but I can't manage to boot on the board.
Could you please detail your SD card structure and the u-boot commands you used? Thank you very much!

@Atomar25
Copy link
Contributor Author

Atomar25 commented Jun 4, 2018

Hello @PedroRibeiro95
Sorry for the late reply. I was away from my Nitogenx6x set up.

We used tftp from u-boot prompt to load various images(uTee is one of them) in to memory.

tftp 0x12000000 zImage;tftp 0x18000000 imx6q-nitrogen6x.dtb;tftp 0x20000000 uTee

then just

bootm 0x20000000 - 0x18000000

It should allow you to run OPTEE-OS(uTee) image along side Linux kernel.

Thanks
Amit

@PedroRibeiro95
Copy link

Thank you @Atomar25. Just another question, if you don't mind: How did you partition the card? One ext4 partition containing the rootfs and one FAT partition containing the boot files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants