Repository navigation
fix(aarch64): report NOT_SUPPORTED for unhandled SMC services - #408
Merged
Merged
Conversation
li041
approved these changes
Oct 21, 2026
li041
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thanks for your contribution.
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.
Summary
Unhandled SMC function IDs now return
ARM_SMCCC_NOT_SUPPORTEDinstead of0,and the remaining literal
!0returns use the same constant.handle_smcfallback0->NOT_SUPPORTED(changes)handle_psci_smcfallback0->NOT_SUPPORTED(changes)psci_emulate_features_infofallback!0-> constant (same value)SMCCC_ARCH_FEATURESarm!0-> constant (same value)handle_arch_smcfallback!0-> constant (same value);error!->warn!with the codeMotivation
0is SMCCCSUCCESS. Returning it for a function hvisor does not implementtells the guest the call worked, so optional firmware features probe as present.
Reproduced on
aarch64/qemu-gicv3with Linux 7.2.8:hvisor answered
0, so the guest concluded it was running in a CCA realm andproceeded to
RSI_SET_MEMORY_PROTECTED, which cannot work here. WithNOT_SUPPORTEDthe probes answer honestly, RME is not enabled, and the boardboots. This is reachable on any platform whose firmware advertises RME,
including real hardware with TF-A.
The other hunks do not change behaviour; they exist so the file spells the
return value one way.
Verification
Environment:
aarch64/qemu-gicv3, QEMU 11.1.1, guest Linux 7.2.8, U-Boot/TF-Aboot flow (
-bios u-boot-atf.bin+flash.img).RME: Using RSI version 1.0Failed to set memory range to protected)Mounted root(2.55s), shellCPU features: detected:Not run: real hardware, riscv64/loongarch64/x86_64 (the change is confined to
src/arch/aarch64/trap.rs).Risks and Limitations
NOT_SUPPORTEDis the value theSMCCC specification requires for an unimplemented function, and guests treat
it as "feature absent", which is what was previously being misreported as
"feature present". No caller is known to depend on the old
0.handle_arch_smcfallback now logs atwarninstead oferror. Errorlevel implied a defect where the call simply is not implemented.
ARCH_SCcalls are still answered locally rather thanforwarded to EL3. Forwarding is arguably more correct (the guest is asking
the firmware whether it implements a workaround), but it is a wider behaviour
change with no observable difference on this setup, because QEMU's TF-A does
not implement
ARCH_WORKAROUND_1. Better raised separately.