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

arm64 EL3 runtime support #12353

Merged
merged 6 commits into from
May 21, 2024
Merged

arm64 EL3 runtime support #12353

merged 6 commits into from
May 21, 2024

Conversation

eenurkka
Copy link
Contributor

Summary

This introduces EL3 support for NuttX meaning it may run from EL3 without dropping privileges. It's useful when it replaces an existing bootloader, such as SPL (from SPL/U-boot combo).

Impact

Most functionalities are behind #ifdef:s, so it should not break other code.

Testing

iMX93 evkit, NSH shell

putreg32() arguments were swapped.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This provides means to run NuttX completely in EL3.  This may
be useful with NuttX based bootloaders that are executed from
OCRAM.  Instead of SPL/U-boot combo, NuttX may replace SPL
completely.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
@eenurkka eenurkka force-pushed the arm64-el3 branch 2 times, most recently from fe5b16e to 57a790f Compare May 15, 2024 13:00
@jlaitine
Copy link
Contributor

Added a few comments, otherwise looks good. Nice work!

Currently MMU supports only EL1.  Introduce EL3 support as well.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
@acassis
Copy link
Contributor

acassis commented May 15, 2024

@pussuw could you please take a look at those CI errors on imx9: "nuttx/tools/imx9/Config.mk: No such file or directory"

Value 1021, when read from ICC_IAR0_EL1 means:

"The GIC returns this value in response to a read of ICC_IAR0_EL1 or ICC_HPPIR0_EL1 at EL3,
to indicate that the interrupt being acknowledged is one which is expected to be handled at
Non-secure EL1 or EL2. This INTID is only returned when the PE is executing at EL3 using
AArch64 state, or when the PE is executing in AArch32 state in Monitor mode."

When this happens:
  - FIQ is fired on group0
  - IRQ is pending at group1

So simply check and handle the interrupt. In short, this provides interrupt support for
EL3.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
@eenurkka eenurkka force-pushed the arm64-el3 branch 7 times, most recently from 43f4bfd to 481c908 Compare May 16, 2024 14:01
arch/arm64/Kconfig Outdated Show resolved Hide resolved
@eenurkka eenurkka force-pushed the arm64-el3 branch 4 times, most recently from 8f73d4e to 5864090 Compare May 17, 2024 07:55
This provides a capable bootloader that may be run from OCRAM.
The OCRAM contains regions that are always zero, so the linker
file avoids those with best effort.

iMX9 infrastructure expects:
  - 0x20480000 (Start of OCRAM, AHAB)
  - 0x2049a000 (NuttX or SPL)
  - 0x204e0000 (ARM Trustzone, not used)

When started from SD-card, the offsets are:
  - 0x1f000 with AHAB
  - 0xa000  without AHAB

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
arch/arm64/Kconfig Show resolved Hide resolved
arch/arm64/src/common/arm64_boot.c Outdated Show resolved Hide resolved
arch/arm64/src/common/arm64_mmu.c Outdated Show resolved Hide resolved
Search and replace ARCH_BOOT_EL3 with more generic
ARCH_ARM64_EXCEPTION_LEVEL that holds the EL level
in an integer variable.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
@xiaoxiang781216 xiaoxiang781216 merged commit 2f753a4 into apache:master May 21, 2024
10 of 26 checks passed
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.

None yet

5 participants