Using EL3 Registers #549
-
Hey y'all! My lab and I are doing tests on the caches using direct access (see https://developer.arm.com/documentation/100798/0401/L1-memory-system/Direct-access-to-internal-memory) on the RPi5, which are all EL3 registers. I know there are some ways to do some operations in EL3 and then switch back using the SMC, but I feel like it might be easier to just stay in EL3 by editing the armstub (apparently it still does support arbitrary armstubs, see https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/plat/rpi5.rst)... Yes the example armstub they provide only does EL2, but I'm sure I could hunt down or cobble together one that doesn't switch from EL3. Is there any big issues with circle that would occur from not switching from EL3? I'm not using most of circle's advanced features (usb, networking, screen, etc.) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I'm afraid the whole interrupt system won't work in Circle, if you don't switch to EL1 in the startup phase. |
Beta Was this translation helpful? Give feedback.
-
Is this just because the SCR_EL3 register is set to have EL3 not take IRQs?
No, it's the Circle model in AArch64 to use EL1t for TASK_LEVEL and EL1h for
IRQ_LEVEL and FIQ_LEVEL. This affects (at least) the system initialization,
exception stubs, and the critical sections handling in lib/synchronize.cpp.
|
Beta Was this translation helpful? Give feedback.
-
I figured out how to add custom user functions to the Trusted Firmware module, used for the Raspberry Pi 5. It's not difficult and maybe this could help you. A short description follows: First you have to clone the Trusted Firmware project from GitHub:
Now add the following file to the sub-directory plat/rpi/rpi5/ and name it rpi5_oem_test_svc.c:
This declares a runtime SMC service with the OEM ID (3) and the handler function oem_smc_handler(). This example has only one service OEM_SVC_CALL_TEST with the function ID 0x8300ff00. This ID has to be loaded into the x0 register, before the Now add this file to the project by appending this line to the file platform.mk in the same sub-directory:
You can build the Trusted Firmware now from project root using:
Copy the file build/rpi5/release/bl31.bin to your SD card and add this to the file config.txt:
Now when you add the following to your Circle application, it should show the value returned from the runtime service:
You can find further related information in the file docs/getting_started/rt-svc-writers-guide.rst in the project. |
Beta Was this translation helpful? Give feedback.
I'm afraid the whole interrupt system won't work in Circle, if you don't switch to EL1 in the startup phase.