SMC instruction, and PPA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SMC instruction, and PPA

1,132 Views
yaronalterman
Contributor II

Hello, 

In my project I have to write my own bootloader instead of U-Boot for LS1043A, currently I'm working on the LS1043ARDB board. I have 2 issues I would like to ask about:

1. After I bring the processor to non-secure EL1 and try to call the smc #0 instruction, I get an serror exception (offset 0x380) - is there any thing I need to configure in order for smc to go to the appropriate synchroneous vector (offset 0x400) ? The VBAR registers have been pre-configured of course. Also when I call smc #0 from EL2, all is good and it goes to the sync vector. I assume that calling smc #0 from EL1 should be possible.

Another thing is, if I load from U-Boot, then calling smc #0 is ok from EL1 as well, so I guess U-Boot is doing something I don't somewhere, it's just that there are a multitude of initializations to be done, and I can put my finger on in in the U-Boot code - I would appreciate any help.

2. Assuming I get over the previous issue, I need then to load and initialize the PPA instead of U-Boot in order to have a secure monitor going. Can anyone say what is the procedure for loading and initializing the PPA?

Thanks in advance,

Yaron

Tags (1)
0 Kudos
1 Reply

822 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Yaron Alterman,

SMC functions treat registers x0-x12 as volatile, to call an SMC/PSCI function, load the registers according to the table below, then execute an “SMC 0x0” instruction. Please refer to "smc  #0" invoking in the file arch/arm/cpu/armv8/sec_firmware_asm.S of u-boot source code.

pastedImage_1.png

The procedure for loading and initialize PPA.

1. The PPA must be loaded to a 64Kb boundary
2. Copy the binary image to the load address – the component installing the PPA MUST be executing at EL3
3. PPA should be loaded to an address in secure memory - recommend a 2MB secure region in DDR (but PPA can be tested in non-secure DDR)
4. After copying the image file to DDR, clean the data cache by VA (all virtual address ranges affected by PPA load) , and invalidate the instruction cache.
5. The PPA initialization runs at EL3 – but the PPA transfers control back to the address loaded in BOO TLOCPTR at EL2 –you must write the start address of the EL2 portion of your bootloader into BOOTLOCPTR before initializing the PPA.

6. After writing the EL2 start address in BOOTLOCPTR, initialize the PPA by branching to its start address


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos