diff mbox series

[RFC,v2,16/19] tune-riscv.inc: add RISCV_PKGARCH vars, set PACKAGE_EXTRA_ARCHS

Message ID 20260930-riscv-tuning-rework-v2-16-9e29f3531d0e@baylibre.com
State Under Review
Headers show
Series riscv: add new ISA extensions and profile support | expand

Commit Message

Trevor Gamblin Sept. 30, 2026, 4:38 p.m. UTC
Add the RISCV_PKGARCH variables to help with indicating which tuning
profiles are valid for use on configurations which are supersets of
them, e.g. 'riscv64gc' packages are valid also for the 'rva20u64'
profile.

AI-Generated: Uses Claude Opus 5.5

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 meta/conf/machine/include/riscv/tune-riscv.inc | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc
index 500808ef12..b31d903172 100644
--- a/meta/conf/machine/include/riscv/tune-riscv.inc
+++ b/meta/conf/machine/include/riscv/tune-riscv.inc
@@ -4,23 +4,33 @@  DEFAULTTUNE ?= "riscv64gc"
 
 AVAILTUNES += "rva23u64 rva22u64 rva20u64 riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf"
 
-# zifencei isn't part of these profiles per gcc's -march expansion, but the
+# Each profile is a superset of the previous one and of riscv64gc (with the same
+# lp64d ABI), so list those as compatible package archs, with lowest priority
+# first. TUNE_RISCV_PKGARCH only expands to the currently selected tune's name.
+RISCV_PKGARCH_GC = "riscv64imafdc_zicsr_zifencei"
+RISCV_PKGARCH_RVA20 = "rva20u64_zifencei"
+RISCV_PKGARCH_RVA22 = "rva22u64_zifencei"
+
+# riscv64gcv is unique in that rva20 and rva22 are not strict supersets of it
+# (they lack the 'v' extension) but rva23 is, so split it out for comprehension.
+RISCV_PKGARCH_GCV = "riscv64imafdcv_zicsr_zifencei"
+
 # Linux kernel requires it, so add it on top of the profile's extensions.
 TUNE_FEATURES:tune-rva20u64 := "${@oe.tune.riscv_isa_to_tune("rva20u64")} zifencei"
-PACKAGE_EXTRA_ARCHS:tune-rva20u64 = "${TUNE_RISCV_PKGARCH}"
+PACKAGE_EXTRA_ARCHS:tune-rva20u64 = "${RISCV_PKGARCH_GC} ${TUNE_RISCV_PKGARCH}"
 
 TUNE_FEATURES:tune-rva22u64 := "${@oe.tune.riscv_isa_to_tune("rva22u64")} zifencei"
-PACKAGE_EXTRA_ARCHS:tune-rva22u64 = "${TUNE_RISCV_PKGARCH}"
+PACKAGE_EXTRA_ARCHS:tune-rva22u64 = "${RISCV_PKGARCH_GC} ${RISCV_PKGARCH_RVA20} ${TUNE_RISCV_PKGARCH}"
 
 TUNE_FEATURES:tune-rva23u64 := "${@oe.tune.riscv_isa_to_tune("rva23u64")} zifencei"
-PACKAGE_EXTRA_ARCHS:tune-rva23u64 = "${TUNE_RISCV_PKGARCH}"
+PACKAGE_EXTRA_ARCHS:tune-rva23u64 = "${RISCV_PKGARCH_GC} ${RISCV_PKGARCH_GCV} ${RISCV_PKGARCH_RVA20} ${RISCV_PKGARCH_RVA22} ${TUNE_RISCV_PKGARCH}"
 
 # Default
 TUNE_FEATURES:tune-riscv64gc := "${@oe.tune.riscv_isa_to_tune("rv64gc")}"
 PACKAGE_EXTRA_ARCHS:tune-riscv64gc = "${TUNE_RISCV_PKGARCH}"
 
 TUNE_FEATURES:tune-riscv64gcv := "${@oe.tune.riscv_isa_to_tune("rv64gcv")}"
-PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${TUNE_RISCV_PKGARCH}"
+PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${RISCV_PKGARCH_GC} ${TUNE_RISCV_PKGARCH}"
 
 TUNE_FEATURES:tune-riscv32gc := "${@oe.tune.riscv_isa_to_tune("rv32gc")}"
 PACKAGE_EXTRA_ARCHS:tune-riscv32gc = "${TUNE_RISCV_PKGARCH}"