[ATfE] Implement __arm_sme_state in LLVM libc bootcode#849
Merged
Conversation
This adds LLVM libc bootcode support for __arm_sme_state as per https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#811__arm_sme_state to match this LLVM change llvm/llvm-project#191434
Contributor
Author
|
@MacDue @sdesmalen-arm please review __arm_sme_state for LLVM libc, thanks! |
MacDue
reviewed
May 11, 2026
| " /* Check whether SME or SME2 is present. */\n" | ||
| " mrs x16, id_aa64pfr1_el1\n" | ||
| " tst w16, #0x3000000\n" | ||
| " b.eq .L__arm_sme_state_no_sme\n" |
Contributor
There was a problem hiding this comment.
Do we want to TODO/FIXME to handle this similar to picolibc/newlib? i.e., avoiding re-checking id_aa64pfr1_el1 in user code.
Comment on lines
+43
to
+45
| asm volatile("mrs %0, s3_4_c1_c2_6" : "=r"(smcr)); | ||
| smcr = (smcr & ~0xfUL) | 0xfUL; | ||
| asm volatile("msr s3_4_c1_c2_6, %0\n\tisb" : : "r"(smcr) : "memory"); |
Contributor
There was a problem hiding this comment.
Question: Should picolib/newlib also handle the EL2 case?
Contributor
Author
There was a problem hiding this comment.
picolibc assumes it is running at EL1, LLVM libc boot code here can run at EL2 and EL3.
vhscampos
requested changes
May 11, 2026
Add new system register wrappers: TPIDR2 https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/TPIDR2-EL0--EL0-Read-Write-Software-Thread-ID-Register-2 SVCR https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/SVCR--Streaming-Vector-Control-Register SMCR_EL2 https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/SMCR-EL2--SME-Control-Register--EL2- SMCR_EL3 https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/SMCR-EL3--SME-Control-Register--EL3- ID_AA64PFR1 https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/ID-AA64PFR1-EL1--AArch64-Processor-Feature-Register-1
vhscampos
approved these changes
May 18, 2026
vhscampos
left a comment
Contributor
There was a problem hiding this comment.
It looks really good now. Thanks for the updates
Contributor
Author
|
Thank you for the review and confirmation! @MacDue any more comments from your side? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds LLVM libc bootcode support for __arm_sme_state as per https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#811__arm_sme_state to match this LLVM change llvm/llvm-project#191434