I have an IMX8MM board with both 2 GB and 4GB DRAM. These boards have a Linux image based on yocto Kirkstone branch. I am trying to execute xtest after enabling OPTEE on both boards.
#zcat /proc/config.gz | grep OPTEE
CONFIG_OPTEE=y
CONFIG_OPTEE_SHM_NUM_PRIV_PAGES=1
also in the local.conf, the MACHINE_FEATURE+=optee is configured.
I can see the xtest test runs successfully on 2GB DRAM board.
#xtest
Run test suite with level=0
TEE test application started over default TEE instance
######################################################
#
# regression+pkcs11+regression_nxp
#
######################################################
* regression_1001 Core self tests
o regression_1001.1 Core self tests
regression_1001.1 OK
o regression_1001.2 Core dt_driver self tests
regression_1001.2 OK
*
regression_nxp_0021 OK
regression_nxp_1001 OK
+-----------------------------------------------------
38168 subtests of which 0 failed
135 test cases of which 0 failed
0 test cases were skipped
TEE test application done!
But on the 4GB board, this test fails instantly.
# xtest
Run test suite with level=0
TEE test application started over default TEE instance
######################################################
#
# regression+pkcs11+regression_nxp
#
######################################################
* regression_1001 Core self tests
/usr/src/debug/optee-test/3.19.0.imx-r0/git/host/xtest/regression_1000.c:253: res has an unexpected value: 0xffff000e = TEEC_ERROR_COMMUNICATION, expected 0x0 = TEEC_SUCCESS
regression_1001 FAILED
* regression_1002 PTA parameters
/usr/src/debug/optee-test/3.19.0.imx-r0/git/host/xtest/regression_1000.c:292: res has an unexpected value: 0xffff000e = TEEC_ERROR_COMMUNICATION, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.19.0.imx-r0/git/host/xtest/regression_1000.c:304: TEEC_InvokeCommand( &session, 1, &op, &ret_orig) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
Segmentation fault.
Am I missing something in the 4GB board wrt optee?
Hi Sneha,
We are encountering the same issue as you on our custom i.MX8MQ board with latest 6.6.52 BSP. In the 2GB configuration, xtest passes without any issues. However, with the 4GB configuration, the following error occurs:
root@imx8mqevk:~# xtest
Run test suite with level=0
TEE test application started over default TEE instance
######################################################
#
# regression+pkcs11+regression_nxp
#
######################################################
* regression_1001 Core self tests
ERR [553] LT:TEEC_OpenSession:643: TEE_IOC_OPEN_SESSION failed
/usr/src/debug/optee-test/4.4.0.imx/host/xtest/regression_1000.c:299: res has an unexpected value: 0xffff0000 = TEEC_ERROR_GENERIC, expected 0x0 = TEEC_SUCCESS
regression_1001 FAILED
* regression_1002 PTA parameters
ERR [553] LT:TEEC_OpenSession:643: TEE_IOC_OPEN_SESSION failed
/usr/src/debug/optee-test/4.4.0.imx/host/xtest/regression_1000.c:338: res has an unexpected value: 0xffff0000 = TEEC_ERROR_GENERIC, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/4.4.0.imx/host/xtest/regression_1000.c:350: TEEC_InvokeCommand( &session, 1, &op, &ret_orig) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
Segmentation fault (core dumped)
For 2GB Configuration:
For 4GB Configuration:
Have you found a solution to this issue? Are there any insights or suggestions you could share? It would be greatly appreciated if you could point out if I might be missing anything from my side.
Looking forward to your response.
Best regards,
Maruti Naik
Hi Chavira,
Thank you for your reply.
I tried to add the 4GB DRAM in core/arch/arm/plat-imx/conf.mk
ifneq (,$(filter $(PLATFORM_FLAVOR),mx8mmevk))
CFG_DDR_SIZE ?= 0xc0000000
CFG_UART_BASE ?= UART4_BASE
endif
But the Linux kernel image is not booting and is stuck.
Is this the correct way of adding the 4GB DRAM? Could you please share the patch to enable the 4GB DRAM in the conf.mk?
Hi @sneha_mohan!
I will send you the patches needed to enable 4GB in iMX8MM but these are only references due to we don't have access to your hardware.
The UART that you are using is the UART4 instead of UART2?
Best Regards!
Chavira
Hello Chavira,
Thank you for sharing the patches. I didn't change the UART channel. This patch was already part of the imx optee-os package
/optee-os/3.19.0.imx-r0/git/patches$ ls
series use_uart4.patch
diff --git a/core/arch/arm/plat-imx/conf.mk b/core/arch/arm/plat-imx/conf.mk
index 31186c5..4d58ea9 100644
--- a/core/arch/arm/plat-imx/conf.mk
+++ b/core/arch/arm/plat-imx/conf.mk
@@ -440,7 +440,7 @@ endif
ifneq (,$(filter $(PLATFORM_FLAVOR),mx8mmevk))
CFG_DDR_SIZE ?= 0x80000000
-CFG_UART_BASE ?= UART2_BASE
+CFG_UART_BASE ?= UART4_BASE
endif
ifneq (,$(filter $(PLATFORM_FLAVOR),mx8qmmek))
Also while looking into the patches(4GB-2GB_2GB.7z), I couldn't find any patch for changing the DRAM size in the config.mk file?
I was referring to this post here and I found these changes added to config.mk
ifneq (,$(filter $(PLATFORM_FLAVOR),mx8mqevk))
-CFG_DDR_SIZE ?= 0xc0000000
+CFG_DDR_SIZE ?= 0x100000000
+CFG_TZDRAM_START ?= 0xfe000000
CFG_UART_BASE ?= UART1_BASE
+$(call force,CFG_CORE_LARGE_PHYS_ADDR,y)
+$(call force,CFG_CORE_ARM64_PA_BITS,36)
endif
Do I need to add something similar for IMX8MM?
Hi @sneha_mohan!
For 4GB you should set 0x100000000 to DDR SIZE.
Probably the terminal was changed by error by you.
By default we use the UART2 to show the terminal.
And you are using the UART4?
Best Regards!
Chavira
Hello Chavira,
I have changed the DRR size to enable 4GB. The UART2 remains unchanged.
ifneq (,$(filter $(PLATFORM_FLAVOR),mx8mmevk))
CFG_DDR_SIZE ?= 0x100000000
CFG_UART_BASE ?= UART2_BASE
endif
But the still the kernel is stuck in the initial boot stage.
U-Boot SPL 2022.04-lf_v2022.04+g1c881f4da8 (Sep 06 2021 - 09:25:26 +0000)
power_bd71837_init
User leds init done
DDRINFO(D): Micron 4096G
DDRINFO: start DRAM init
DDRINFO: DRAM rate 3000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
DDRINFO(M): mr5-8 [ 0xff070010 ]
DDRINFO(E): mr5-8 [ 0xff070010 ]
eeprom_get_osize: board_osize: 0xffffffff
Normal Boot
Trying to boot from MMC1
NOTICE: BL31: v2.4(release):lf-5.10.72-2.2.0-0-g5782363f9-dirty
NOTICE: BL31: Built : 12:17:17, Nov 18 2021
Could you let me know if I am missing anything?
Hi @sneha_mohan !
Did you modify CFG_DDR_SIZE to reflect the real DDR size of the board they are using? The default value is 2 GB (defined in core/arch/arm/plat-imx/conf.mk)
Best Regards!
Chavira