From cd389a7461e804142d438d5c36a19bd9fff36e5b Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Wed, 2 Jul 2025 16:44:23 -0500 Subject: linux-yocto/6.12: riscv: Enable TUNE_FEATURES based KERNEL_FEATURES Allow the risc-v TUNE_FEATURES to select specific ISA (kconfig) selections in the kernel config via config fragments selected by KERNEL_FEATURES. This allows the following items to be selected dynamically: CONFIG_ARCH_RV32I CONFIG_ARCH_RV64I CONFIG_FPU CONFIG_RISCV_ISA_C CONFIG_RISCV_ISA_V CONFIG_RISCV_ISA_ZBB CONFIG_RISCV_ISA_ZICBOM CONFIG_RISCV_ISA_ZICBOZ CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI Note: Some ISA options, such as CONFIG_RISCV_ISA_C may be reenabled by other options such as CONFIG_EFI. This is properly reported by the configuration tooling. (From OE-Core rev: 45a1b5aa6abc9007d0d87efc2d740b5564a209dd) Signed-off-by: Mark Hatle Signed-off-by: Antonin Godard Signed-off-by: Richard Purdie --- meta/recipes-kernel/linux/linux-yocto.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc index 389329030d..4d0a726bb6 100644 --- a/meta/recipes-kernel/linux/linux-yocto.inc +++ b/meta/recipes-kernel/linux/linux-yocto.inc @@ -37,6 +37,22 @@ KERNEL_FEATURES:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'efi', 'cfg/ KERNEL_FEATURES:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'numa', 'features/numa/numa.scc', '', d)}" KERNEL_FEATURES:append = " ${@bb.utils.contains('MACHINE_FEATURES', 'vfat', 'cfg/fs/vfat.scc', '', d)}" +KERNEL_FEATURES_RISCV = "\ + arch/riscv/tunes/riscv-isa-clear.scc \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'rv 32 i m a', 'arch/riscv/tunes/riscv-isa-rv32i.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'rv 64 i m a', 'arch/riscv/tunes/riscv-isa-rv64i.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'f d', 'arch/riscv/tunes/riscv-isa-fpu.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'c', 'arch/riscv/tunes/riscv-isa-c.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'v', 'arch/riscv/tunes/riscv-isa-v.scc', '', d)} \ + ${@bb.utils.contains_any('TUNE_FEATURES', 'b zba', 'arch/riscv/tunes/riscv-isa-zba.scc', '', d)} \ + ${@bb.utils.contains_any('TUNE_FEATURES', 'b zbb', 'arch/riscv/tunes/riscv-isa-zbb.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'zbc', 'arch/riscv/tunes/riscv-isa-zbc.scc', '', d)} \ + ${@bb.utils.contains( 'TUNE_FEATURES', 'zicbom', 'arch/riscv/tunes/riscv-isa-zicbom.scc', '', d)} \ + " + +KERNEL_FEATURES:append:riscv32 = " ${KERNEL_FEATURES_RISCV}" +KERNEL_FEATURES:append:riscv64 = " ${KERNEL_FEATURES_RISCV}" + # A KMACHINE is the mapping of a yocto $MACHINE to what is built # by the kernel. This is typically the branch that should be built, # and it can be specific to the machine or shared -- cgit v1.2.3-54-g00ecf