Skip to content

versal: Enhance board support for AMD/Xilinx Versal ACAP and Versal NET#857

Open
joft-mle wants to merge 13 commits intoOP-TEE:masterfrom
missinglinkelectronics:mle/versal-net-upgrade
Open

versal: Enhance board support for AMD/Xilinx Versal ACAP and Versal NET#857
joft-mle wants to merge 13 commits intoOP-TEE:masterfrom
missinglinkelectronics:mle/versal-net-upgrade

Conversation

@joft-mle
Copy link

@joft-mle joft-mle commented Mar 6, 2026

This pull request is build on top of previous work by @jcorbier & Co in merged PR #815 .

This pull request extends the existing AMD/Xilinx Versal ACAP and NET build instructions regarding the following aspects:

  • Deduplicate versal_net.mk into versal.mk
  • Add support for easily selecting Versal PS UART1 as primary UART; and/or the "other" PS UART for OP-TEE exclusively
  • Load U-Boot FIT image with Linux included as part of BOOT.BIN by default
  • Add support building custom, adjusted PLM (and PSM) Firmware regarding security features

This pull request depends on and shall be merged after optee_os.git PR #7726 has been merged.

See optee_docs.git PR #280 for updated documentation.

Simply assume that a typical Versal NET board has exactly one of the two
built-in UART peripherals enabled and that this UART does appear as Linux
device ttyAMA0, which is the default in buildroot.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
To whichever package the symbol refers to? There is no reason for disabling
any (compile) tests.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
The optee_os/ clean target already removes all tee* binaries.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
This commit comprises the following changes next to merging:

- Use a dedicated U-Boot config snippet (kconfigs/u-boot_versal*.conf)
  instead of (mis-)using the Linux config snippet (kconfigs/versal.conf) (at
  least in former versal_net.mk). This enables TEE support in U-Boot on
  Versal now, too.

- For devicetree built into U-Boot use xilinx-versal-virt for Versal,
  like xilinx-versal-net-virt for Versal NET, since it gets overridden
  at runtime by dedicated devicetree anyway (see .bif).

- Target image* always concern all images, including fitimage.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
…E OS, only

VERSAL_UART1=  : PS UART0 = primary, PS UART1 = secondary
VERSAL_UART1=y : PS UART1 = primary, PS UART0 = secondary

               | VERSAL_UART2ND_OPTEE= | VERSAL_UART2ND_OPTEE=y |
---------------|-----------------------|------------------------|
VERSAL_UART1=  | (1)                   | (2)                    |
VERSAL_UART1=y | (3)                   | (4)                    |

(1) ATF, OP-TEE OS on PS UART0
(2) ATF on PS UART0, OP-TEE OS on PS UART1
(3) ATF, OP-TEE OS on PS UART1
(4) ATF on PS UART1, OP-TEE OS on PS UART0

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
At least for platform "versal". Associated boards have their devicetrees
generated by PetaLinux, for example and as such typically don't have any
such memory reservations by default.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
… NET with Versal

This commit combines the following core changes for Versal and Versal NET:

- .bif and .its files get generated from templates, by replacing certain
  "variables" (%VAR%) during the build process, or even deleting certain
  "partitions" (== binaries included in BOOT.BIN).

- To get hold of a .pdi file and .dtb file, the build process now allows
  the user to either specify a PetaLinux project/BSP directory (BSP_PATH) or
  a .pdi file (PDI_PATH) and a .dtb file (DTB_PATH) directly.

- To replace the PLM firmware and/or PSM firmware in the selected .pdi file
  by custom .elf files, the user may provide paths to them (PLM_PATH and/or
  PSM_PATH).

- By default the U-Boot FIT image is included in BOOT.BIN. To not do that
  the user may set IUB_BIF_PATH=n (magic value "n").

- U-Boot configuration is modified to automatically boot the included
  U-Boot FIT image, if it is included in BOOT.BIN.

For Versal, this commit does the following changes:

- Like for Versal NET, the U-Boot FIT image is by default included in the
  BOOT.BIN to avoid handling extra boot files, an SDcard etc. when booting a
  board.

For Versal NET, this commit does the following changes:

- Like for Versal, the Linux kernel, device tree and the OP-TEE related
  device tree overlay "versal-optee.dtbo" are now also included in the U-Boot
  FIT image, instead of just the ramdisk (rootfs).

- Where needed, the position of components to be loaded in memory are
  adjusted to adhere to the following map - as indicated by various consulted
  sources:

  - 0x22200000 -  64M - OP-TEE (system and optionally static shared memory)
  - 0x26200000 -   1M - ATF
  - 0x26300000 -  14M - U-Boot
  - 0x27100000 - 512k - Device Tree (and optionally Overlays)
  - 0x27180000 - 512k - U-Boot boot script
  - 0x27200000 - 398M - Linux kernel or U-Boot  image (comprising kernel,
                        dtbs, ramdisk)

  The U-Boot FIT image is designed so that the actual Linux kernel image
  and Device Tree object(s) are loaded to 0x40200000 and 0x40000000, since
  the area up until 0x10000000 (first 256M) can be special on Versal NET
  boards.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
@nathan-menhorn
Copy link
Contributor

@jenswi-linaro
Reviewed-by: Nathan Menhorn <nathan.menhorn@amd.com>
Tested-by: Nathan Menhorn <nathan.menhorn@amd.com>

@ldts
Copy link
Contributor

ldts commented Mar 14, 2026

I had to do the following changes to boot over jtag

  • build : remove CCACHE (quick hack below)
  • JTAG boot: cleanup the connect

could you have a look and retest please

jramirez@trex:build (versal-net-upgrade *$%) $ git diff
diff --git a/versal.mk b/versal.mk
index 8f1f4ba..69de993 100644
--- a/versal.mk
+++ b/versal.mk
@@ -447,17 +447,18 @@ OPTEE_OS_RAWBIN_ELF ?= versal/$(shell basename $(OPTEE_OS_RAWBIN)).elf
 #       (entry_a64.S) depends on a struct boot_embdata placed right at symbol
 #       __data_end. The script gen_tee_bin.py does this placement while crafting
 #       tee-raw.bin (and similarly tee.bin) from tee.elf.
+S_KERNEL := /home/jramirez/Work/versal/optee-project/build/../toolchains/aarch64/bin/aarch64-linux-gnu-
 $(OPTEE_OS_RAWBIN_OBJ): $(OPTEE_OS_RAWBIN)
-   $(CROSS_COMPILE_S_KERNEL)objcopy \
-           -I binary -O elf64-littleaarch64 -B aarch64 \
-           --rename-section .data=.text \
-           --set-section-flags .text=alloc,code,load,readonly,contents \
-           $< $@
+ $(S_KERNEL)objcopy \
+        -I binary -O elf64-littleaarch64 -B aarch64 \
+        --rename-section .data=.text \
+        --set-section-flags .text=alloc,code,load,readonly,contents \
+        $< $@
 $(OPTEE_OS_RAWBIN_ELF).load: $(OPTEE_OS_ELF)
-   $(CROSS_COMPILE_S_KERNEL)nm $< | \
+ $(S_KERNEL)nm $< | \
                awk '/\s_start$$/ {printf "0x%s\n", $$1}' >$@
 $(OPTEE_OS_RAWBIN_ELF): $(OPTEE_OS_RAWBIN_OBJ) $(OPTEE_OS_RAWBIN_ELF).load
-   $(CROSS_COMPILE_S_KERNEL)ld \
+ $(S_KERNEL)ld \
                -Ttext $(shell cat $(OPTEE_OS_RAWBIN_ELF).load) \
                -e $(shell cat $(OPTEE_OS_RAWBIN_ELF).load) \
                $< -o $@
diff --git a/versal/versal.tcl b/versal/versal.tcl
index 7155b1e..edaa3c5 100644
--- a/versal/versal.tcl
+++ b/versal/versal.tcl
@@ -15,15 +15,7 @@ foreach arg $argv {
 }
 
 proc _connect {} {
-   global hw_server_url
-
-   if {[string length $hw_server_url] > 0} {
-           connect -url $hw_server_url
-   } elseif {[string length $::env(HW_SERVER_URL)] > 0} {
-           connect -url $::env(HW_SERVER_URL)
-   } else {
-           connect
-   }
+ connect
        after 1000
 }
 

OPTEE boot:

I/TC: OP-TEE version: 4.9.0-36-g324a18261 (gcc version 14.3.1 20250623 (Arm GNU Toolchain 14.3.Rel4                     
I/TC: WARNING: This OP-TEE configuration might be insecure!                                                             
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelinesl                     
I/TC: Primary CPU initializing                              
I/TC: GIC redistributor base address not provided           
I/TC: Assuming default GIC group status and modifier                                                                    
D/TC:0 0 do_init_calls:19 preinitcall level 2 mobj_mapped_shm_init()                                                    
D/TC:0 0 mobj_mapped_shm_init:540 Shared memory address range: 61000000, 63000000                                       
D/TC:0 0 do_init_calls:19 early_initcall level 1 versal_mbox_init()                                                     
D/TC:0 0 do_init_calls:19 early_initcall level 1 trng_hrng_mode_init()                                                  
D/TC:0 0 do_init_calls:19 early_initcall level 1 teecore_init_pub_ram()                                                 
D/TC:0 0 do_init_calls:19 early_initcall level 2 versal_check_pm_abi()                                                  
D/TC:0 0 do_init_calls:19 service_initcall level 1 tee_cryp_init()                                                      
D/TC:0 0 do_init_calls:19 service_initcall level 2 platform_banner()                                                    
I/TC: Platform Versal:  Silicon Revision v2                 
I/TC: Hardware Root of Trust: Asymmetric[OFF], Symmetric[OFF]                                                           
D/TC:0 0 do_init_calls:19 service_initcall level 2 versal_sha3_384_init()                                               
D/TC:0 0 do_init_calls:19 service_initcall level 2 check_ta_store()                                                     
D/TC:0 0 check_ta_store:460 TA store: "early TA"            
D/TC:0 0 check_ta_store:460 TA store: "Secure Storage TA"                                                               
D/TC:0 0 check_ta_store:460 TA store: "REE"                 
D/TC:0 0 do_init_calls:19 service_initcall level 2 early_ta_init()                                                      
D/TC:0 0 early_ta_init:56 Early TA f04a0fe7-1f5d-4b9b-abf7-619b85b4ce8c size 48944 (compressed, un)                     
D/TC:0 0 do_init_calls:19 service_initcall level 2 verify_pseudo_tas_conformance()                                      
D/TC:0 0 do_init_calls:19 service_initcall level 3 tee_fs_init_key_manager()                                            
[2E/TC:0 0 versal_mbox_notify:469 Can't read the remote response                                                        
 CE/TC:0 0 efuse_req:154 Mailbox error                      
 SE/TC:0 0 do_init_calls:22 service_initcall __text_start + 0x0008ce78 failed                                           
D/TC:0 0 boot_mem_release_tmp_alloc:370 Releasing 32768 bytes from va 0x603f8000                                        
D/TC:0 0 do_init_calls:19 driver_initcall level 1 ecc_init()                                                            
D/TC:0 0 do_init_calls:19 driver_initcall level 1 rsa_init()                                                            
D/TC:0 0 do_init_calls:19 driver_initcall level 2 versal_register_authenc()                                             
D/TC:0 0 do_init_calls:19 driver_initcall level 2 init_multi_core_halt_handler()                                        
D/TC:0 0 do_init_calls:19 driver_initcall level 2 mobj_init()                                                           
D/TC:0 0 do_init_calls:19 driver_initcall level 2 default_mobj_init()                                                   
D/TC:0 0 do_init_calls:19 driver_initcall level 3 gic_set_primary_done()                                                
I/TC: Primary CPU switching to normal world boot            
INFO:    BL31: Preparing for EL3 exit to normal world                                                                   
INFO:    Entry point address = 0x8000000                    
INFO:    SPSR = 0x3c9   

xtest execution:

# xtest
Run test suite with level=0

TEED/TC:? 0 tee_ta_init_pseudo_ta_session:303 Lookup pseudo TA d96a5b40-c3e5-21e3-8794-1002a5d5c61b
 test application started over dD/TC:? 0 ldelf_load_ldelf:110 ldelf load address 0x80007000
efault TEE instance
###########D/LD:  ldelf:151 Loading TS d96a5b40-c3e5-21e3-8794-1002a5d5c61b
################################D/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (early TA)
###########
#
# regression+pkcD/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0008
s11
#
########################D/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (Secure Storage TA)
##############################
D/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0000
 
* regression_1001 Core self tE/LD:  init_elf:493 sys_open_ta_bin(d96a5b40-c3e5-21e3-8794-1002a5d5c61b)
ests
E/TC:? 0 ldelf_init_with_ldelf:152 ldelf failed with res: 0xffff0000
D/TC:? 0 tee_ta_open_session:722 init session failed 0xffff0000
/home/jramirez/Work/versal/optee-D/TC:? 0 tee_ta_init_pseudo_ta_session:303 Lookup pseudo TA d96a5b40-c3e5-21e3-8794-1002a5d5c61b
project/out-br/build/optee_test_D/TC:? 0 ldelf_load_ldelf:110 ldelf load address 0x80007000
ext-1.0/host/xtest/regression_10D/LD:  ldelf:151 Loading TS d96a5b40-c3e5-21e3-8794-1002a5d5c61b
00.c:301: res has an unexpected D/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (early TA)
value: 0xffff0000 = TEEC_ERROR_GD/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0008
ENERIC, expected 0x0 = TEEC_SUCCD/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (Secure Storage TA)
ESS
  regression_1001 FAILED
 D/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0000

* regression_1002 PTA parameteE/LD:  init_elf:493 sys_open_ta_bin(d96a5b40-c3e5-21e3-8794-1002a5d5c61b)
rs
E/TC:? 0 ldelf_init_with_ldelf:152 ldelf failed with res: 0xffff0000
D/TC:? 0 tee_ta_open_session:722 init session failed 0xffff0000
/home/jramirez/Work/versal/optee-project/out-br/build/optee_test_ext-1.0/host/xtest/regression_1000.c:353: res has an unexpected value: 0xffff0000 = TEEC_ERROR_GENERIC, expected 0x0 = TEEC_SUCCESS
/home/jramirez/Work/versal/optee-project/out-br/build/optee_test_ext-1.0/host/xtest/regression_1000.c:365: TEEC_InvokeCommand( &session, 1, &op, &ret_orig) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEES
Segmentation fault

OP-TEE tree:

26 hours.. 324a18261 drivers: versal_net: Add OCP driver                          Dennis R..[Joachim Foerster]
26 hours.. f1deb90e0 drivers: versal: Add struct versal_ip_cmd handling functions Dennis R..[Joachim Foerster]
26 hours.. 95d6d5a4e drivers: versal_net: trng: Fix continuous random generatio.. Joachim ..[Joachim Foerster]
26 hours.. b3ceb58b4 drivers: versal_net: trng: Add support for newer PKI TRNG .. Joachim ..[Joachim Foerster]
26 hours.. 571799a14 drivers: versal_net: trng: Add support for TRNG via PLM Fi.. Joachim ..[Joachim Foerster]
26 hours.. 09958512d plat-versal: Increase IPI command timeout                    Joachim ..[Joachim Foerster]
26 hours.. 2c57bef40 plat-versal: Add support for Versal NET variant              Joachim ..[Joachim Foerster]
26 hours.. 39b1e8d35 drivers: versal_net: pki: Fix queue alignment and DMA setup  Joachim ..[Joachim Foerster]
26 hours.. c1d61e333 drivers: versal_net: pki: Add driver for Versal NET PKI Ac.. Joachim ..[Joachim Foerster]
26 hours.. aa3cbe715 drivers: versal: ecc: Separate code using PLM firmware int.. Joachim ..[Joachim Foerster]
26 hours.. 98b5736e8 drivers: versal_net: puf: Add support for Versal NET         Joachim ..[Joachim Foerster]
26 hours.. c64bb1a57 drivers: versal_net: nvm: Add support for Versal NET         Joachim ..[Joachim Foerster]
26 hours.. 0dbbd6bb4 drivers: versal_net: nvm: Duplicate Versal driver for Vers.. Joachim ..[Joachim Foerster]
26 hours.. ffd252d9c drivers: versal_net: rsa: Add support for flavor-specific .. Joachim ..[Joachim Foerster]
26 hours.. 9af822b33 drivers: versal_net: aes: No alignment restrictions for pa.. Joachim ..[Joachim Foerster]
26 hours.. 0eebba5a0 drivers: versal_net: pm: Add Versal NET SiP UUID             Joachim ..[Joachim Foerster]
26 hours.. 67716db42 drivers: versal: mbox: Rework                                Joachim ..[Joachim Foerster]
26 hours.. 8e9525de6 drivers: versal: mbox: Enhance buffer allocation             Joachim ..[Joachim Foerster]
26 hours.. 07d1c574c plat-versal: Increase TEE memory and heap size to 512k / 4M  Joachim ..[Joachim Foerster]
26 hours.. 4da65161e core: pta: versal: Add loader PTA                            Joachim ..[Joachim Foerster]
26 hours.. ec5e7070f plat-versal: Add flavors uart1 and net_uart1 to select UAR.. Joachim ..[Joachim Foerster]
26 hours.. 6264edb68 plat-versal: Decrease default amount of static shared memo.. Joachim ..[Joachim Foerster]
26 hours.. f67e0a4cf drivers: versal: aes: Fix check for payload length on update Joachim ..[Joachim Foerster]
26 hours.. 6f5fc7d9c drivers: versal: ecc: Enable support for ECC curve NIST P256 Joachim ..[Joachim Foerster]
26 hours.. 188afd765 drivers: versal: nvm: Minor fix, use EFUSE_OFFCHIP_REVOCAT.. Joachim ..[Joachim Foerster]
26 hours.. 5ac998619 drivers: versal: nvm: Really support PLM API id BBRAM_ZERO.. Joachim ..[Joachim Foerster]
26 hours.. 4c46377f3 drivers: versal: nvm: Minor fixes, headers and defines       Joachim ..[Joachim Foerster]
26 hours.. de6eeb652 drivers: versal: trng: Fix seed life evaluation              Joachim ..[Joachim Foerster]
26 hours.. a83ba445a drivers: versal: trng: Minor, cleanup includes               Joachim ..[Joachim Foerster]
31 hours.. 0f154615c drivers: versal: trng: Fix, us early_init() instead of dri.. Joachim ..[Joachim Foerster]
31 hours.. 237edf479 drivers: versal: puf: Minor, remove unneeded initializatio.. Joachim ..[Joachim Foerster]
32 hours.. f49dd7530 drivers: versal: huk: Fix AES key source check               Joachim ..[Joachim Foerster]
32 hours.. 6f42578dc drivers: versal: trng: Restructure and update KAT as found.. Joachim ..[Joachim Foerster]
32 hours.. 3608150e3 drivers: versal: trng: Apply various fixes derived from up.. Joachim ..[Joachim Foerster]
32 hours.. 2f8154f16 drivers: versal: trng: Minor, add comments derived from up.. Joachim ..[Joachim Foerster]
3 days ago df54eeedf drivers: versal: Update API ids to v2024.1 and newer PLM f.. Joachim ..[Joachim Foerster]
8 weeks .. c2b0684fc Update CHANGELOG for 4.9.0                                   Jens Wik..[Jens Wiklander]
8 weeks .. 053593356 core: atomic ftrace buffer map update                        Jens Wik..[Jens Wiklander]
9 weeks .. 3d873d494 core: user_ta: fix cleared userspace PAUTH keys              Etienne ..[Jens Wiklander]
9 weeks .. f75361090 zynqmp: add platform_banner for ZynqMP                       Neal Fra..[Jens Wiklander]
9 weeks .. ef780a338 zynqmp: add flavors for kria starter kits                    Neal Fra..[Jens Wiklander]
9 weeks .. 5aba4fa14 core: only dump ftrace buffer with TA mapped                 Jens Wik..[Jens Wiklander]
9 weeks .. 981a9bd51 MAINTAINERS: update Etienne's e-mail address                 Jens Wik..[Jens Wiklander]

At least with PLM firmware releases v2024.1 and v2024.2 and when
referencing an ELF file with proper attributes in the .bif file, the PLM
firmware is able to provide the BL32 entry point address to TF-A and no
workarounds involving hard-coded addresses in TF-A (BL32_BASE,
VERSAL_BL32_MEM_BASE; see [1], [2]) are needed anymore. This commit
obviously assumes that the above is true for even newer PLM firmware
releases, too.

However, the OP-TEE OS tee.elf file does by itself not suffice for that
purpose since OP-TEE OS entry code (entry_a64.S [3]) depends on a struct
boot_embdata [4] placed right at symbol __data_end. The script
gen_tee_bin.py [5] does this placement while crafting tee-raw.bin (and
similarly tee.bin) from tee.elf.

Thus we wrap the tee-raw.bin file in ELF format with a single .text section
and the appropriate entry point.

[1] ldts/arm-trusted-firmware@011bc68
[2] https://github.com/Xilinx/arm-trusted-firmware/blob/e4a37b000fb9a708112da1e06da0e8fad939dc86/plat/xilinx/versal/bl31_versal_setup.c#L130
[3] https://github.com/OP-TEE/optee_os/blob/3322f1326f141ef3f41ac7a1c1e08ca23a869fd4/core/arch/arm/kernel/entry_a64.S#L222
[4] https://github.com/OP-TEE/optee_os/blob/3322f1326f141ef3f41ac7a1c1e08ca23a869fd4/core/include/kernel/boot.h#L35
[5] https://github.com/OP-TEE/optee_os/blob/master/scripts/gen_tee_bin.py

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
Using the "Build from Git" flow present in AMD/Xilinx embeddedsw
repository.

If BSP_PATH is used, by default PLM_PATH and PSM_PATH are however still
automatically set to firmware binaries found in this BSP/PetaLinux project
directory!

To force building firmware binaries from scratch in any case, whether using
BSP_PATH or not, use PLM_PATH=generate and PSM_PATH=generate on the "make"
command line, next to
CROSS_COMPILE_FIRMWARE=$XILINX_VIVADO/gnu/microblaze/lin/bin/mb-gcc or
CROSS_COMPILE_FIRMWARE=$PETALINUX/components/xsct/gnu/microblaze/lin/bin/mb-gcc
to point to AMD/Xilinx MicroBlaze toolchain, for example as part of the
Vitis/Vivado or the PetaLinux installation.

As before, to explicitly skip including any reference to a firmware binary
in the generated .bif file, use PLM_PATH= and PSM_PATH= explicitly. Note
that not including one in the .bif file means that bootgen takes the
firmware binaries from the .pdi file and puts them into the newly generated
BOOT.BIN.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
- Use xsdb instead of xsct.

- Offer option -i to enter interactive mode after initialing loading of
  BOOT.BIN.

- Offer option -u to specify hw_server URL (tcp:<host>:<port>) of an
  already running hw_server instance, instead of starting a new, local
  hw_server (when executing "connect" without "-url ...").

- Advertise custom commands in interactive mode.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
- A PetaLinux BSP (or project) (BSP_PATH) is identified by its
  characteristic .petalinux subdirectory.

- Both flavors pick up a local BSP subdirectory ("versal-bsp" /
  "versal-net-bsp").

- Both flabors automatically pick up a "design.pdi" and "design.dtb" from
  such a local subdirectory (PDI_PATH and DTB_PATH), if that subdirectory is
  not a PetaLinux BSP.

Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
@joft-mle joft-mle force-pushed the mle/versal-net-upgrade branch from 91386c3 to 52e54fb Compare March 16, 2026 16:38
@joft-mle
Copy link
Author

joft-mle commented Mar 16, 2026

Hi @ldts,

I had to do the following changes to boot over jtag

  • build : remove CCACHE (quick hack below)

Yes, I can reproduce this when enabling ccache (always had it disabled). The problem is caused by the way those CROSS_COMPILE_S_KERNEL & Co variables are defined in common.mk. They include (double) quotes for those assignments to shell variables (e.g. in this list shell variable assignments: OPTEE_OS_COMMON_FLAGS):

CROSS_COMPILE_S_KERNEL  ?= "$(CCACHE)$(AARCH$(COMPILE_S_KERNEL)_CROSS_COMPILE)"
[...]
OPTEE_OS_COMMON_FLAGS ?= \
        [...]
        CROSS_COMPILE=$(CROSS_COMPILE_S_USER) \
        CROSS_COMPILE_core=$(CROSS_COMPILE_S_KERNEL) \
        [...]

However, when ccache is enabled, directly using those quoted variables such as CROSS_COMPILE_S_KERNEL, as I did in a make recipe then causes the shell see a filename to execute which consist of (including double quotes):

"<path-to-ccache> <path-prefix-to-tool>"<tool>

I don't know what the preferred style would be here to solve this issue.

In the 2026/03/16 force-push I've used the following trick to remove those quotes, e.g. to call objcopy:

$(subst ",,$(CROSS_COMPILE_S_KERNEL))objcopy

@joft-mle
Copy link
Author

joft-mle commented Mar 16, 2026

Hi @ldts,

I had to do the following changes to boot over jtag

  • JTAG boot: cleanup the connect

Right, when accessing a non-existent value of a TCL array (environment variable HW_SERVER_URL in $::env in this case) asking for its length is an error.

So I've added an appropriate check for its existence in the 2026/03/16 force-push.

@joft-mle
Copy link
Author

joft-mle commented Mar 16, 2026

OPTEE boot:

I/TC: OP-TEE version: 4.9.0-36-g324a18261 (gcc version 14.3.1 20250623 (Arm GNU Toolchain 14.3.Rel4                     
[...]
D/TC:0 0 do_init_calls:19 service_initcall level 3 tee_fs_init_key_manager()                                            
[2E/TC:0 0 versal_mbox_notify:469 Can't read the remote response                                                        
 CE/TC:0 0 efuse_req:154 Mailbox error                      
 SE/TC:0 0 do_init_calls:22 service_initcall __text_start + 0x0008ce78 failed                                           
D/TC:0 0 boot_mem_release_tmp_alloc:370 Releasing 32768 bytes from va 0x603f8000                                        
D/TC:0 0 do_init_calls:19 driver_initcall level 1 ecc_init()                                                            
[...]

As you already pointed out here, this is occurring due to missing support to read the DNA from the Versal chip to derive the HUK from, which means missing XilNVM module in (default) PLM Firmware; for completeness and how to produce a PLM Firmware image including this and other required features, see my reply.

I'm not sure why xtest then fails with a segmentation fault - after test case 1002, as test cases 1001 to 1003 are usually skipped in the default configuration, since the associate (P?)TA is not included.

xtest execution:

# xtest
Run test suite with level=0

TEED/TC:? 0 tee_ta_init_pseudo_ta_session:303 Lookup pseudo TA d96a5b40-c3e5-21e3-8794-1002a5d5c61b
 test application started over dD/TC:? 0 ldelf_load_ldelf:110 ldelf load address 0x80007000
efault TEE instance
###########D/LD:  ldelf:151 Loading TS d96a5b40-c3e5-21e3-8794-1002a5d5c61b
################################D/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (early TA)
###########
#
# regression+pkcD/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0008
s11
#
########################D/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (Secure Storage TA)
##############################
D/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0000
 
* regression_1001 Core self tE/LD:  init_elf:493 sys_open_ta_bin(d96a5b40-c3e5-21e3-8794-1002a5d5c61b)
ests
E/TC:? 0 ldelf_init_with_ldelf:152 ldelf failed with res: 0xffff0000
D/TC:? 0 tee_ta_open_session:722 init session failed 0xffff0000
/home/jramirez/Work/versal/optee-D/TC:? 0 tee_ta_init_pseudo_ta_session:303 Lookup pseudo TA d96a5b40-c3e5-21e3-8794-1002a5d5c61b
project/out-br/build/optee_test_D/TC:? 0 ldelf_load_ldelf:110 ldelf load address 0x80007000
ext-1.0/host/xtest/regression_10D/LD:  ldelf:151 Loading TS d96a5b40-c3e5-21e3-8794-1002a5d5c61b
00.c:301: res has an unexpected D/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (early TA)
value: 0xffff0000 = TEEC_ERROR_GD/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0008
ENERIC, expected 0x0 = TEEC_SUCCD/TC:? 0 ldelf_syscall_open_bin:163 Lookup user TA ELF d96a5b40-c3e5-21e3-8794-1002a5d5c61b (Secure Storage TA)
ESS
  regression_1001 FAILED
 D/TC:? 0 ldelf_syscall_open_bin:167 res=0xffff0000

* regression_1002 PTA parameteE/LD:  init_elf:493 sys_open_ta_bin(d96a5b40-c3e5-21e3-8794-1002a5d5c61b)
rs
E/TC:? 0 ldelf_init_with_ldelf:152 ldelf failed with res: 0xffff0000
D/TC:? 0 tee_ta_open_session:722 init session failed 0xffff0000
/home/jramirez/Work/versal/optee-project/out-br/build/optee_test_ext-1.0/host/xtest/regression_1000.c:353: res has an unexpected value: 0xffff0000 = TEEC_ERROR_GENERIC, expected 0x0 = TEEC_SUCCESS
/home/jramirez/Work/versal/optee-project/out-br/build/optee_test_ext-1.0/host/xtest/regression_1000.c:365: TEEC_InvokeCommand( &session, 1, &op, &ret_orig) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEES
Segmentation fault

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

Successfully merging this pull request may close these issues.

3 participants