arch/riscv: Add CONFIG_ARCH_RV_ISA_ZICSR_ZIFENCEI for fence.i#19229
Merged
Conversation
|
The fence.i instruction is only available when the Zifencei extension (CONFIG_ARCH_RV_ISA_ZICSR_ZIFENCEI) is supported by the hardware. This commit adds a macro wrapper around fence.i usages to prevent compilation errors on toolchains or targets where the Zifencei extension is absent. Signed-off-by: Chengdong Wang <wangcd91@gmail.com>
acassis
approved these changes
Jun 27, 2026
xiaoxiang781216
approved these changes
Jun 27, 2026
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
The fence.i instruction is only available when the Zifencei extension (CONFIG_ARCH_RV_ISA_ZICSR_ZIFENCEI)
is supported by the hardware.
This commit adds a macro wrapper around fence.i usages to prevent compilation errors
on toolchains or targets where the Zifencei extension is absent.
Impact
Fix compilation errors on toolchains or targets where the Zifencei extension is absent
Testing
'''
ostest passed on rv-virt:nsh
NuttShell (NSH)
nsh>
nsh>
nsh> uname -a
NuttX 0.0.0 5e1b109-dirty Jun 27 2026 22:53:48 risc-v rv-virt
nsh>
nsh> ostest
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
stdio_test: Standard I/O Check: fprintf to stderr
ostest_main: putenv(Variable1=BadValue3)
ostest_main: setenv(Variable1, GoodValue1, TRUE)
ostest_main: setenv(Variable2, BadValue1, FALSE)
ostest_main: setenv(Variable2, GoodValue2, TRUE)
ostest_main: setenv(Variable3, GoodValue3, FALSE)
ostest_main: setenv(Variable3, BadValue2, FALSE)
show_variable: Variable=Variable1 has value=GoodValue1
show_variable: Variable=Variable2 has value=GoodValue2
show_variable: Variable=Variable3 has value=GoodValue3
ostest_main: Started user_main at PID=4
user_main: Begin argument test
user_main: Started with argc=5
user_main: argv[0]="ostest"
user_main: argv[1]="Arg1"
user_main: argv[2]="Arg2"
user_main: argv[3]="Arg3"
user_main: argv[4]="Arg4"
...
End of test memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 1fcd580 1fcd580
ordblks 3 3
mxordblk 1fc6fe0 1fc6fe0
uordblks 4330 4330
fordblks 1fc9250 1fc9250
user_main: vfork() test
vfork_test: Child 79 ran successfully
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena 1fcd580 1fcd580
ordblks 2 3
mxordblk 1fc92a0 1fc6fe0
uordblks 42c0 4330
fordblks 1fc92c0 1fc9250
user_main: Exiting
ostest_main: Exiting with status 0
nsh>
'''