@@ -86,6 +86,27 @@ TUNEVALID[zicbom] = "Cache-block management extension"
TUNE_RISCV_MARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "zicbom", "_zicbom", "", d)}"
TUNE_RISCV_PKGARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "zicbom", "_zicbom", "", d)}"
+# The following are mandatory in the RVA20U64 and later profiles
+TUNEVALID[ziccamoa] = "Main memory supports all atomics in A extension"
+TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "ziccamoa", "_ziccamoa", "", d)}"
+TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "ziccamoa", "_ziccamoa", "", d)}"
+
+TUNEVALID[ziccif] = "Main memory supports instruction fetch with atomicity requirement extension"
+TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "ziccif", "_ziccif", "", d)}"
+TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "ziccif", "_ziccif", "", d)}"
+
+TUNEVALID[zicclsm] = "Main memory supports misaligned loads/stores extension"
+TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicclsm", "_zicclsm", "", d)}"
+TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicclsm", "_zicclsm", "", d)}"
+
+TUNEVALID[ziccrse] = "Main memory supports forward progress on LR/SC sequences extension"
+TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "ziccrse", "_ziccrse", "", d)}"
+TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "ziccrse", "_ziccrse", "", d)}"
+
+TUNEVALID[zicntr] = "Base counters and timers extension"
+TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicntr", "_zicntr", "", d)}"
+TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicntr", "_zicntr", "", d)}"
+
TUNEVALID[zicsr] = "Control and status register access extension"
TUNE_RISCV_MARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "zicsr f d", "_zicsr", "", d)}"
TUNE_RISCV_PKGARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "zicsr f d", "_zicsr", "", d)}"
@@ -103,6 +124,11 @@ TUNEVALID[zmmul] = "Integer multiplication (without division) extension"
TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zmmul", "_zmmul", "", d)}"
TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zmmul", bb.utils.contains("TUNE_FEATURES", "m", "", "_zmmul", d), "", d)}"
+# Mandatory in the RVA20U64 profile
+TUNEVALID[za128rs] = "Reservation set size of at most 128 bytes extension"
+TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "za128rs", "_za128rs", "", d)}"
+TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "za128rs", "_za128rs", "", d)}"
+
TUNEVALID[zaamo] = "Atomic memory operations extension"
TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zaamo", "_zaamo", "", d)}"
TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zaamo", bb.utils.contains("TUNE_FEATURES", "a", "", "_zaamo", d), "", d)}"
@@ -2,7 +2,7 @@ require conf/machine/include/riscv/arch-riscv.inc
DEFAULTTUNE ?= "riscv64gc"
-AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf"
+AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf rva20u64"
# Default
TUNE_FEATURES:tune-riscv64gc := "${@oe.tune.riscv_isa_to_tune("rv64gc")}"
@@ -38,3 +38,9 @@ PACKAGE_EXTRA_ARCHS:tune-riscv32nf = "${RISCVPKGARCH:tune-riscv32nf}"
TUNE_FEATURES:tune-riscv64nc := "${@oe.tune.riscv_isa_to_tune("rv64imafd_zicsr_zifencei")}"
RISCVPKGARCH:tune-riscv64nc ?= "riscv64imafd_zicsr_zifencei"
PACKAGE_EXTRA_ARCHS:tune-riscv64nc = "${RISCVPKGARCH:tune-riscv64nc}"
+
+# RISC-V profiles. zifencei isn't mandatory in them, but Linux requires it, so
+# it's added on top of each profile's mandatory extensions.
+TUNE_FEATURES:tune-rva20u64 := "${@oe.tune.riscv_isa_to_tune("rva20u64")} zifencei"
+RISCVPKGARCH:tune-rva20u64 ?= "rva20u64_zifencei"
+PACKAGE_EXTRA_ARCHS:tune-rva20u64 = "${RISCVPKGARCH:tune-rva20u64}"
@@ -11,6 +11,11 @@
# RVA23U64: RVA23 Profiles, version 1.0
# plus the extensions those imply (e.g. zmmul, zaamo, zca, zve*).
#
+# The profile names are also used in package archs, so each entry here is an
+# ABI claim: packages built for e.g. "rva22u64_zifencei" must keep meaning
+# exactly this extension set. Changing an entry changes what existing package
+# feeds mean.
+#
# Do not regenerate these from compiler output (e.g. gcc's -march expansion);
# a newer compiler, or clang, may expand a profile differently. For example,
# gcc's rva22u64 leaves out zihpm, which the specification makes mandatory.
Add TUNE_FEATURES for the extensions mandated by the RVA20U64 profile which weren't yet in arch-riscv.inc: - ziccamoa - ziccif - zicclsm - ziccrse - zicntr - za128rs Then, add an 'rva20u64' tune which uses them. Zifencei isn't mandatory in the profile, but it is added on top of the profile's extensions since it's required by Linux, making the package arch 'rva20u64_zifencei'. Also update the tune.py notes to be clear about the ABI claim being made, since the profiles there are now being used by package archs. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> --- .../conf/machine/include/riscv/arch-riscv.inc | 26 +++++++++++++++++++ .../conf/machine/include/riscv/tune-riscv.inc | 8 +++++- meta/lib/oe/tune.py | 5 ++++ 3 files changed, 38 insertions(+), 1 deletion(-)