-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add ARM_AARCH64_ARMV9 port (SVE2, MTE, PAC, BTI) #1435
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
Open
rpcme
wants to merge
12
commits into
FreeRTOS:main
Choose a base branch
from
rpcme:armv9
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c985868
Add ARM_AARCH64_ARMV9 port with SVE2 context switch
rpcme c23ed2d
armv9: implement per-task PAC keys, MTE heap redirect, BTI landing pads
rpcme d4a16e4
armv9: fix MTE tagged pointer handling in stack assertions
rpcme a84f510
armv9: reconcile critical section, add stack overflow MTE fix, per-ta…
rpcme c1b37ea
armv9: register port in CMake, fix Coverity/MISRA findings
rpcme d18a43e
armv9: optimize portASM.S barriers, ISB merge, IRQ register save
rpcme 294945f
armv9: document Armv9 port MISRA deviations in MISRA.md
rpcme f025e43
armv9: fix CI checks (spelling, header, unit test, formatting)
rpcme 0454271
armv9: fix stack overflow method 2 watermark read for MTE
rpcme 612f709
armv9: portASM.S: include FreeRTOSConfig.h so config guards work
rpcme a640688
armv9: portASM.S: move pointer-literal pool to .data for W^X loaders
rpcme c03b473
armv9: fix taskCHECK_FOR_STACK_OVERFLOW backslash alignment
rpcme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1017,3 +1017,10 @@ XPSR | |
| XRAM | ||
| xtal | ||
| XTENSA | ||
| ACLE | ||
| acle | ||
| APDA | ||
| APDB | ||
| REGEN | ||
| SSVE | ||
| SVCR | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Armv9-A Architecture Port | ||
|
|
||
| This port extends the AArch64 SRE (System Register Enable) port with Armv9-A | ||
| architectural features. It targets processors implementing FEAT_SVE2, FEAT_MTE2, | ||
| FEAT_PAuth, FEAT_BTI, and FEAT_RME. | ||
|
|
||
| ## Relationship to ARM_AARCH64_SRE | ||
|
|
||
| This port is based on `ARM_AARCH64_SRE` and shares the same GICv3 system | ||
| register interface and generic timer infrastructure. The Armv9 additions are | ||
| guarded by `configARMV9_*` configuration flags — when all flags are disabled | ||
| (default), this port behaves identically to the Armv8 SRE port. | ||
|
|
||
| **Note:** This port is currently maintained as a separate directory from | ||
| `ARM_AARCH64_SRE`. A future decision will determine whether to fold these | ||
| changes into the existing SRE port (behind `configARMV9_*` guards) or maintain | ||
| them as a distinct port. Until that decision is made, this directory exists | ||
| independently to avoid regression risk to the Armv8 user base. | ||
|
|
||
| ## Configuration Flags | ||
|
|
||
| All flags default to 0 (disabled). Set in `FreeRTOSConfig.h`: | ||
|
|
||
| | Flag | Feature | | ||
| |------|---------| | ||
| | `configARMV9_SVE2` | SVE2 register save/restore (Z0-Z31, P0-P15, FFR) | | ||
| | `configARMV9_SSVE` | Streaming SVE mode (SVCR save/restore) | | ||
| | `configARMV9_TASK_VL` | Per-task vector length (ZCR_EL1) | | ||
| | `configARMV9_PAC` | Per-task PAC key loading | | ||
| | `configARMV9_PAC_FRAME` | PAC-signed saved context frame | | ||
| | `configARMV9_MTE_HEAP` | MTE-tagged heap allocations | | ||
| | `configARMV9_MTE_STACK` | MTE-tagged task stacks | | ||
| | `configARMV9_BTI` | BTI landing pads in port assembly | | ||
| | `configARMV9_RME` | Realm Management Extension | | ||
| | `configARMV9_RME_EL2` | EL2 hypervisor operation | | ||
|
|
||
| ## Hardware Prerequisites | ||
|
|
||
| - `CPACR_EL1.ZEN = 3` (SVE access from EL1/EL0) | ||
| - `CPTR_EL3.EZ = 1` (no SVE trap from EL3) | ||
| - `ZCR_EL2` / `ZCR_EL1` configured for desired vector length | ||
| - `SCTLR_EL1.EnIA = 1` (PAC enabled) | ||
| - `SCR_EL3.API/APK = 1`, `HCR_EL2.API/APK = 1` (PAC not trapped) | ||
| - `SCTLR_EL1.ATA = 1` (MTE enabled) | ||
| - `TCR_EL1.TBI0 = 1` (Top Byte Ignore for MTE pointers) | ||
| - MMU with GP bit (BTI) and Tagged Normal memory (MTE) | ||
|
|
||
| ## Files | ||
|
|
||
| | File | Description | | ||
| |------|-------------| | ||
| | `port.c` | Task initialization, tick handler, critical sections | | ||
| | `portASM.S` | Context switch macros with `#if configARMV9_SVE2` guards | | ||
| | `portmacro.h` | Type definitions, macros, config flag declarations | | ||
| | `README.md` | This file | | ||
|
|
||
| ## Context Switch Frame Layout | ||
|
|
||
| ### With `configARMV9_SVE2 = 0` (Armv8 compatible) | ||
| ``` | ||
| [SP] → FPU flag + critical nesting (16 bytes) | ||
| FPSR + FPCR (16 bytes) | ||
| Q0-Q31 (512 bytes) | ||
| SPSR + ELR (16 bytes) | ||
| X0-X30 (256 bytes) | ||
| ``` | ||
|
|
||
| ### With `configARMV9_SVE2 = 1` | ||
| ``` | ||
| [SP] → FPU flag + critical nesting (16 bytes) | ||
| P0-P15 + FFR (3 × VL bytes, 16-byte aligned) | ||
| Z0-Z31 (32 × VL bytes) | ||
| FPSR + FPCR (16 bytes) | ||
| SPSR + ELR (16 bytes) | ||
| X0-X30 (256 bytes) | ||
| ``` | ||
|
|
||
| Total SVE frame at VL=128: 32×16 + 3×16 + 16 = 576 bytes | ||
| Total SVE frame at VL=256: 32×32 + 3×32 + 16 = 1136 bytes |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to check the ports for MISRA violations. We generally use a mock interface for running the tests.