From patchwork Wed Nov 18 20:48:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104795 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.592.1795034965699198219 for ; Wed, 18 Nov 2026 12:49:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=UkFYe9Tz; spf=pass (domain: baylibre.com, ip: 209.85.160.176, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-55bd96affd2so2814431cf.1 for ; Wed, 18 Nov 2026 12:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034964; x=1795639764; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JfbLiMnfeI0Q8DFY8T6IxuDvwVUHfeh+M9zgixKK7Es=; b=UkFYe9TzZHujz5Z4zwrsK7H4/sXFRXHdfnXUUeA+48h4TvHG7iCI5mxBIFRWjR9C19 VjmZbZZKm7T+igNUscIlzms+sAMqgsaRI+B8M5YdmcuBMb4uePQR9+H/TmWJZb8rLfjs vnIH5lAA8JJnNbNKXbIo9bdyrZGeCTZNnnlG8EgVZCY/yYpTLh0gzaE6iBylSlgT828e zWMFP3SNs8S9/AsUk7QJH9N0duksIkuroiO8RHq8WvfMwCRtDfPIIeKbieuv0QdLCcuL aQtAT3jrJvUbMG4wZ9rnTUOKz0tEnXeFLlBSI7fXy5JNPDeiJb4GG46ggqHPi7yDTyr7 YDSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034964; x=1795639764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=JfbLiMnfeI0Q8DFY8T6IxuDvwVUHfeh+M9zgixKK7Es=; b=e4Nwijl5CpG3rq1orXjEBG2i4vpdCwwm39MD4FZVt0twOAVL6LqLNy8YOugjlwZ3kQ LS7RQ6GUacW9vDRIb1kqJ47X0MOylVXwm3sWsH47XLVNVs9TsUeCDNrxnUWmWEvBDyQs NJxav0m8jNzkXUh+3wmBJyFeVbx3pW+JylsmZHZg5LvyxCm78NPs3nXP97knFI+RV40I TOFfMo7KOjCZxaX8wRPR4yPcK25hv2WT4c1/1suGGidB/8N4EYto/7UVubvnNDpq20H3 s8ZQACkOTXVubvOdw3bMEsCvtzXm+IuqtuHHohCr6taUvoq3ETmFCTBgyNCn2aWsa3A+ KFeA== X-Gm-Message-State: APuU4Z+ZfinGdIZ2JNfPYEH3Ox72LcxWwa5yXz1cp/Ft6f3AkMsKKcz+ 0Ic7WnaVhT+exTQcapccW5V42dI1WwEAj0t8QXs1iYkBSU0QV+P0xo2zTam/1AEaN0GzAZtzYuq eqzKl X-Gm-Gg: AYBFou2LSim6+T/Y0Jc9EFis7MRlfll1X37Ja4YJRVIqdsiOEV3S5m/8BbMJWWbHJ9C xsm60OfHczRhXeASeIKTpdiLamwr6nVD/InSqJipUIZQ5LOXR9DcDMDbPZsmkKVF4wBRUcIIXYJ c2lZvaYt6vRPMslcb3U0E5ZgA6G6CKqLKjaVoyub4WqvemMC0OjuhnvsJucYSA4hRUu6bD59tXk pU4Y/+9UsaMjQv1jLXHRWQQGGyBdpTNIlCZnjSfyOhfDF22cccdMsY7zcJ00VYMIrMyzuk4vTNu 4EaBnhWlLAK+N8NIMi+6fxlZ9E+IhHP5ya1e+jTztPolz4sa+/5FwJvEEU9s/bA8OJ4SA7wyYt8 QHNHLXAYOS+CIcRkrGNuq18d7r4rrZPWFNHe4qqLqRnpr1tl68UKdCrThRdGU4h/TLLOlcqP+ml cfGeh3SzT6Qr0hmsLVguJ6tzvduHdSxRktW9EgXeZlicmb1xD0CxFgBUsxdspCnKL/ywN0OBAYc v/CjaSGXCmd8IaI+G0Yr5NEn1scNvRNQPUWC896GidKNrZQjqCDbJpNXdBLewnnViZcrpbkCfNv 5IWUkM6wVdDjPmzywxS2ONz+7Iagb8NQSqGst1IHeTM1mYgKxLM8NBfpEBX88IqQusaZhfLnQsB cvHFiE202BzFp57IkQ8y1jDWSgg== X-Received: by 2002:a05:622a:5e14:b0:55c:aee9:4f69 with SMTP id d75a77b69052e-55d6839e453mr11990051cf.5.1795034964323; Wed, 18 Nov 2026 12:49:24 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:23 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 01/12] arch-riscv.inc, tune-riscv.inc: add RISCVPKGARCH Date: Wed, 18 Nov 2026 15:48:42 -0500 Message-ID: <20261118204853.2155173-2-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:26 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250584 Set each generic RISC-V tune's package arch as a literal in RISCVPKGARCH:tune-, matching how we do so for ARM and ARMPKGARCH. Include a fallback to TUNE_RISCV_PKGARCH for tunes that don't set RISCVPKGARCH:tune-. No package arch changes. Signed-off-by: Trevor Gamblin --- meta/conf/machine/include/riscv/README | 10 ++++++++-- .../conf/machine/include/riscv/arch-riscv.inc | 8 ++++++-- .../conf/machine/include/riscv/tune-riscv.inc | 20 +++++++++++++------ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/meta/conf/machine/include/riscv/README b/meta/conf/machine/include/riscv/README index beef68f523..b17c86c814 100644 --- a/meta/conf/machine/include/riscv/README +++ b/meta/conf/machine/include/riscv/README @@ -87,7 +87,13 @@ TUNE_RISCV_ABI - This is the generated ABI that corresponds to the ARCH and ISA variation. The ISA affects the ABI when the 'e', 'f' and 'd' extension are used. -TUNE_RISCV_PKGARCH - This is the generated PKGARCH value. +TUNE_RISCV_PKGARCH - This is the PKGARCH value generated from TUNE_FEATURES. + +RISCVPKGARCH - This is the package arch actually used. As with ARMPKGARCH + on arm, each tune sets it as a literal in + RISCVPKGARCH:tune-, so that it only changes when + deliberately changed. Tunes that don't set it fall back to + TUNE_RISCV_PKGARCH. The standard variables are defined as: @@ -99,7 +105,7 @@ not adequate for some reason. It is expected that most, if not all, implementations will use the default behavior. TUNE_ARCH = "${TUNE_RISCV_ARCH}" -TUNE_PKGARCH = "${TUNE_RISCV_PKGARCH}" +TUNE_PKGARCH = "${RISCVPKGARCH}" The above two will always base their setting off the standard TUNE_FEATURES. diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc index 6f9b74974d..b2a9aa8952 100644 --- a/meta/conf/machine/include/riscv/arch-riscv.inc +++ b/meta/conf/machine/include/riscv/arch-riscv.inc @@ -121,9 +121,13 @@ TUNE_CCARGS = "${@ '-march=${TUNE_RISCV_MARCH} -mabi=${TUNE_RISCV_ABI}' if not d TUNE_ARCH = "${TUNE_RISCV_ARCH}" # Construct TUNE_PKGARCH -# This should result in a package are like: +# As with ARMPKGARCH on arm, each tune sets its package arch as a literal in +# RISCVPKGARCH:tune-, so that it only changes when deliberately changed. +# Tunes that don't set it fall back to TUNE_RISCV_PKGARCH, which is built from +# TUNE_FEATURES above, e.g.: # riscv32imac -TUNE_PKGARCH = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or d.getVar('TUNE_RISCV_PKGARCH')}" +TUNE_PKGARCH = "${RISCVPKGARCH}" # Misc settings # Fix: ld: unrecognized option '--hash-style=sysv' diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc index ed71dc06ba..88c9184c8b 100644 --- a/meta/conf/machine/include/riscv/tune-riscv.inc +++ b/meta/conf/machine/include/riscv/tune-riscv.inc @@ -6,27 +6,35 @@ AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64n # Default TUNE_FEATURES:tune-riscv64gc := "${@oe.tune.riscv_isa_to_tune("rv64gc")}" -PACKAGE_EXTRA_ARCHS:tune-riscv64gc = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH:tune-riscv64gc ?= "riscv64imafdc_zicsr_zifencei" +PACKAGE_EXTRA_ARCHS:tune-riscv64gc = "${RISCVPKGARCH:tune-riscv64gc}" TUNE_FEATURES:tune-riscv64gcv := "${@oe.tune.riscv_isa_to_tune("rv64gcv")}" -PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH:tune-riscv64gcv ?= "riscv64imafdcv_zicsr_zifencei" +PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${RISCVPKGARCH:tune-riscv64gcv}" TUNE_FEATURES:tune-riscv32gc := "${@oe.tune.riscv_isa_to_tune("rv32gc")}" -PACKAGE_EXTRA_ARCHS:tune-riscv32gc = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH:tune-riscv32gc ?= "riscv32imafdc_zicsr_zifencei" +PACKAGE_EXTRA_ARCHS:tune-riscv32gc = "${RISCVPKGARCH:tune-riscv32gc}" # Compatibility aliases so that layers using old tunes don't break TUNE_FEATURES:tune-riscv64 := "${TUNE_FEATURES:tune-riscv64gc}" +RISCVPKGARCH:tune-riscv64 ?= "${RISCVPKGARCH:tune-riscv64gc}" PACKAGE_EXTRA_ARCHS:tune-riscv64 = "${PACKAGE_EXTRA_ARCHS:tune-riscv64gc}" TUNE_FEATURES:tune-riscv32 := "${TUNE_FEATURES:tune-riscv32gc}" +RISCVPKGARCH:tune-riscv32 ?= "${RISCVPKGARCH:tune-riscv32gc}" PACKAGE_EXTRA_ARCHS:tune-riscv32 = "${PACKAGE_EXTRA_ARCHS:tune-riscv32gc}" # No float TUNE_FEATURES:tune-riscv64nf := "${@oe.tune.riscv_isa_to_tune("rv64imac_zicsr_zifencei")}" -PACKAGE_EXTRA_ARCHS:tune-riscv64nf = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH:tune-riscv64nf ?= "riscv64imac_zicsr_zifencei" +PACKAGE_EXTRA_ARCHS:tune-riscv64nf = "${RISCVPKGARCH:tune-riscv64nf}" TUNE_FEATURES:tune-riscv32nf := "${@oe.tune.riscv_isa_to_tune("rv32imac_zicsr_zifencei")}" -PACKAGE_EXTRA_ARCHS:tune-riscv32nf = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH:tune-riscv32nf ?= "riscv32imac_zicsr_zifencei" +PACKAGE_EXTRA_ARCHS:tune-riscv32nf = "${RISCVPKGARCH:tune-riscv32nf}" # no compressed TUNE_FEATURES:tune-riscv64nc := "${@oe.tune.riscv_isa_to_tune("rv64imafd_zicsr_zifencei")}" -PACKAGE_EXTRA_ARCHS:tune-riscv64nc = "${TUNE_RISCV_PKGARCH}" +RISCVPKGARCH:tune-riscv64nc ?= "riscv64imafd_zicsr_zifencei" +PACKAGE_EXTRA_ARCHS:tune-riscv64nc = "${RISCVPKGARCH:tune-riscv64nc}" From patchwork Wed Nov 18 20:48:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104796 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.593.1795034966797514843 for ; Wed, 18 Nov 2026 12:49:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=UFfIYnTZ; spf=pass (domain: baylibre.com, ip: 209.85.160.173, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-53644ab1f7bso11731111cf.3 for ; Wed, 18 Nov 2026 12:49:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034966; x=1795639766; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zK75qA3J7DNQEmMb6IF9UszkGrjC5CT8DpROWalXV2o=; b=UFfIYnTZ45BaY5gqLM6eRjiyM/yFIhNa1lt0KQJGjmrbUVHyw2X4Do0dZ2WTfCPZhA 62KrtHbm04SQllomwHhwVia7xRaQfPOTVBTXIitjsYcHDc0SXlxznCitNKs9zOdBjNdl pWvMT6Rrg8Ut6dbSIo1xC0ulFpPzZVfKJwAi2piVFi55IX3nVoC/7qeTRRwDG6BXKZGX Ks4zUIMudiaanYuxfcANz3GSAjWbL0CF5PlcSDSnsre1Xyc6PGnXdktxpXWYpw3KL3GF /hziDO9zoi09TmulQ/XhVOx2giKCnJ+2vlsXsPjivOp/b2SCwQTDF1pkux2izqjcSFki F6XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034966; x=1795639766; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zK75qA3J7DNQEmMb6IF9UszkGrjC5CT8DpROWalXV2o=; b=FpiMUrofDgiU95EbbCtG2y2Oq6w/MJCBFy7zoMJX+HcjKQ25Uo7JxJ14qRuZLX04z5 kR2OmqJb8w9tmhckdY5yBf8ESz4EHTOCjMG5dUCBaFyoG8fyLy4pkioKR82lhPiOe5/K y2J1YdnloUhCajYLnksi2Rm3Ivu4PqhTwdfoZ8SuyxtAGkDsHqlYbgEdu2Tjo+rrRsDt gLwwA86KJDBwjV1uwrUQFMRL9u2dYXDrSDMy5KyjKgyceUaOqZQTE+yL2wKNcYoi+OOs HCl4e2oNbYa4yfRDo/fA+gSD5d+10fbK/KzbBAmg8FEI9lsG5WRXmZ2lvMy4R2lYiE9h 1bzw== X-Gm-Message-State: APuU4Z8SphTZy59a01823PYAOdl3qfDEcC0oPHCPlNZ9Rwe01bilcG02 XMqkLfH2hr4umyYDvI7IHkb0O7Q96vJsr7I96lGMKQlVrZrI5nZxqYfgtnTTlkLKpXs1wi5asJ2 eBP1t X-Gm-Gg: AYBFou0NCfrX0inc3s655LUp+6cBl9iHsVDAv8ley0WK5JGp7+n/mFn2Uap1A5OZik5 Bvyab5RaN5OZ0jRKuJlH4fDX4YaEfITagMt2OgydMKsfmSJxWXs9JLVe0Xize/BDNbzKyJH3T4w xqYd3YTKKEUL/NOAbmZ4sUbVQIfIm3a+I8hxssnxPyo2cM44GkgVb8jrW1rO/GNH5TnNGtPYrqQ DsWhn4LrHu5+qiyPQzcX8Jqu73v75eVpIN7f4YBWyFisSF2mVJJ6E+n+z5GeHTUzPX+WOxh9H9y cdrmdnlfi+ItnBJbpEH79WZfXqNGsme7STt3Zg/9PbARuZmGsvrrdBIqDvXACuiKKyntf3ORF3B BL+CJlQ9MrUGBh1o9td1yC2uJD3iRBt4bAU96PZn7jKVk7HelCqhrJEk6oX9oj4EZ30d7oYiYPO Wy2aU+esi/6UvrL2bD557D5srfz0VsLY6Mf3j2b5PIbHUpeK/5vBqBhLwHPjGCpgMnp+nr76Fob /DniA/yC/D+oWBbUF7+PF+t6avYH/Xp7lsaEh0Yz0Y3/4wq55jvoHBcmKVy9rCUTvB/BjhJtC9G Cb0ukemOpVaQzG0f3PfN2Z3OZLWySS0yexjcuRfowNlHsTmRPXvRvSFDoVPMcdMm5TseVuPnrWo kjhwv X-Received: by 2002:ac8:5994:0:b0:535:1368:4582 with SMTP id d75a77b69052e-55d5a612c80mr62583831cf.46.1795034965594; Wed, 18 Nov 2026 12:49:25 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:24 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 02/12] arch-riscv.inc: add zmmul, zaamo, zalrsc, zca, zcd Date: Wed, 18 Nov 2026 15:48:43 -0500 Message-ID: <20261118204853.2155173-3-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250585 Add TUNE_FEATURES for the zmmul, zaamo, zalrsc, zca, and zcd extensions, which are enabled by compilers with m, a, c, and c with d: |tgamblin@megalith ~/workspace/git/linux (master)$ riscv64-linux-gnu-gcc -march=rv64gc -mabi=lp64d -Q --help=target | grep march | --print-supported-extensions -march=help | -march= rv64imafdc_zicsr_zifencei_zmmul_zaamo_zalrsc_zca_zcd | -march=help [disabled] | -print-supported-extensions -march=help Only pass them to '-march' when TUNE_FEATURES lists them, so that '-march' doesn't change for existing tunes. Also add them to the generated package arch, so that e.g. 'rv64ia_zmmul' doesn't share a package arch with 'rv64ia', but only when the extension that they're a subset of isn't enabled, so that e.g. 'rv64ima_zmmul' still shares one with 'rv64ima', as the code is the same. Signed-off-by: Trevor Gamblin --- .../conf/machine/include/riscv/arch-riscv.inc | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc index b2a9aa8952..6883e39a5f 100644 --- a/meta/conf/machine/include/riscv/arch-riscv.inc +++ b/meta/conf/machine/include/riscv/arch-riscv.inc @@ -94,6 +94,31 @@ TUNEVALID[zifencei] = "Instruction-fetch fence extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zifencei", "_zifencei", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zifencei", "_zifencei", "", d)}" +# zmmul, zaamo, zalrsc, zca and zcd are subsets of single-letter extensions +# above (m, a, c and c with d), which compilers enable along with them. They +# are only passed on when listed in TUNE_FEATURES, so that -march doesn't +# change for existing tunes, and only added to the package arch when the +# extension they're part of isn't enabled. +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)}" + +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)}" + +TUNEVALID[zalrsc] = "Load-reserved/store-conditional extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zalrsc", "_zalrsc", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zalrsc", bb.utils.contains("TUNE_FEATURES", "a", "", "_zalrsc", d), "", d)}" + +TUNEVALID[zca] = "Compressed integer instructions extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zca", "_zca", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zca", bb.utils.contains("TUNE_FEATURES", "c", "", "_zca", d), "", d)}" + +TUNEVALID[zcd] = "Compressed double-precision floating-point instructions extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcd", "_zcd", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcd", bb.utils.contains("TUNE_FEATURES", "c d", "", "_zcd", d), "", d)}" + TUNEVALID[zba] = "Address bit manipulation extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "b zba", "_zba", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "b zba", "_zba", "", d)}" From patchwork Wed Nov 18 20:48:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104798 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.602.1795034968214989667 for ; Wed, 18 Nov 2026 12:49:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=e0UZvaKv; spf=pass (domain: baylibre.com, ip: 209.85.160.179, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-5430f70c827so20543621cf.2 for ; Wed, 18 Nov 2026 12:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034967; x=1795639767; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pyB8Lq0JyUc8t5nQ+HZiOlReXCqlNwgyqNb6K2jq2sM=; b=e0UZvaKvt+TE0wPzhosk9GDlK5DKt6ouSsnxrwUEgc2kavXL33UVGbfGG6+a4jDJuE n2hPa4EVTyM0c4nxrcsv4mAGccJZaQ2brHn/IFKDLaxE8FVnAdQYsxYAlP7f7LBi3lSH 1kHcEEiVYL9JQeTNpveDvfoqYVUV9rtlUUY9F+CqbgYUrdtCRMhiGc18LM04P8abjN9h AptjYO8JoK4cREjb4QiJZ8DfgCC1JPDjnp0QY/0utXL8E1Opz7fhGo5fE6fCaR43Tpai RjPrnf7rTUPWHNyBdclcarAKGHbeDM/ZYr0JbSpwFZkfqPQl1hccv5D6Ca+KgmhPYiZ0 kkYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034967; x=1795639767; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=pyB8Lq0JyUc8t5nQ+HZiOlReXCqlNwgyqNb6K2jq2sM=; b=ixYL9aQKGglBWzfosSQPbWaN+z1yPwtTQbaby3JTtkck8+VPg5y/zeOzrRs8fRcazJ zk6TpE9M8eE+OYRmuIWlVf3qN3NQVt5xfZtcWCy9mTBvVzuYt8jEFDdb7i+O0OFzP38F FE/1w2gu93ZkQZwp/OcQufnHaecbkVbR2Qoc3pJHkGPvk/jxiQdcT2zQ0kMaRgQf1z40 X12FA8nWx9BXtnjnj4ik3OXhsQA77xrbEa9ufcIRyiQy2+ZNndRhRrVW3Waa+DXMbpwP YeLuq5ZyTFuTgQRjz+thOCYW+j8u2d78SZ4o3emf6axK0llcJk/6WnhFE79AXfEYvva5 Xhcw== X-Gm-Message-State: APuU4Z/aYS9Fl0ntPBfDXDyQBDM50499JFzEIXN+l7AIWyd3+rZixPpX BIMlqqf9SnC4YwvqzN1+A30yucDaIrQFzjni24gpfnbTbSkhDNQ09M43PrEmaLbcDqrom7RMJ+g 2DSHg X-Gm-Gg: AYBFou2C4sgnZ55HM+U92ryw469dai2q8l03lhtbi91BRlnX3q1wdKHL0rlbboa4Q4A gMYZjDs+jQSRkJc9wGecWegsZOFsKIx+gZ3aZCgCnBZHgDIG2Nt2TbRZjoMGFrOC+DoATkMPQYc HFteEMPZAtodudPLc/lLQYka7XWEsQ3q8KEoI9BFSJiZL37NuphDbzxs6t5Ogn2HUE4VpDjQBJy KO18s58MZp4Lo1iaXd+TEpNflJ9C4WgZFcJnzmMmElOK5PkAhgI5MOEi1Qa3SVrk8LNuJuWyc9S ze8949lgp4bcNtpTEaG/XpaO8pX5771t50Q/aKuY4dsyIr25+Y8wGZatvrhK02sQXnV/L++qZIc NPNUGBbLdiSn+N0T0G94Rwzm3+wsFLb+ilRPHCkylDs0pCD4Bv3wSW/C7KInITDsXHDUuQaENRt qCX/CPoAepe6xXVGA8uexslK+5t1OyvYKEeKzZ06dC+wz9C44V32jfa8knlavFwVsS8aZsRMjTk xgZOn/TuDUx1Th+1HIpGEK52XJUoAsH4W3DSLygNWKMaca05RLXbAqXBIFSKyXjVN4wja8r+9W1 GS8C3WTI9gftJ9gQprHUeRIb4GqkRfEJs4bmdFalyInvcTVuDRLdeqWgN0cD6Ci9/TDAYyWjedW RbWUy X-Received: by 2002:a05:622a:1a90:b0:536:352d:65f6 with SMTP id d75a77b69052e-55d5a62eb65mr58668611cf.64.1795034966948; Wed, 18 Nov 2026 12:49:26 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:26 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 03/12] lib/oe/tune.py: support RISC-V profiles in riscv_isa_to_tune() Date: Wed, 18 Nov 2026 15:48:44 -0500 Message-ID: <20261118204853.2155173-4-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250586 Add RISCV_PROFILES for mapping the rva20u64, rva22u64, and rva23u64 profile names to their extension sets according to the RISC-V Profiles specification. riscv_isa_to_tune() now accepts them in addition to ISA strings, for tunes based on a profile. Signed-off-by: Trevor Gamblin --- meta/conf/machine/include/riscv/README | 3 +++ meta/lib/oe/tune.py | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/meta/conf/machine/include/riscv/README b/meta/conf/machine/include/riscv/README index b17c86c814..ef7a484f25 100644 --- a/meta/conf/machine/include/riscv/README +++ b/meta/conf/machine/include/riscv/README @@ -126,3 +126,6 @@ rv32g -> rv 32 i m a f d zicsr zifencei The helper can be called using oe.tune.riscv_isa_to_tune("") such as oe.tune.riscv_isa_to_tune("rv64gc") which would return: rv 64 i m a f d c zicsr zifencei + +The RISC-V profile names listed in RISCV_PROFILES in lib/oe/tune.py, such as +rva22u64, are also accepted, and return the profile's mandatory extensions. diff --git a/meta/lib/oe/tune.py b/meta/lib/oe/tune.py index 7fda19430d..580c84d4fa 100644 --- a/meta/lib/oe/tune.py +++ b/meta/lib/oe/tune.py @@ -4,16 +4,33 @@ # SPDX-License-Identifier: GPL-2.0-only # +# RISC-V profile name -> equivalent ISA string, i.e. the mandatory extensions of +# each profile as ratified in the RISC-V Profiles specification +# (https://github.com/riscv/riscv-profiles): +# RVA20U64, RVA22U64: RVA20/RVA22 Profiles, version 1.0 +# RVA23U64: RVA23 Profiles, version 1.0 +# plus the extensions those imply (e.g. zmmul, zaamo, zca, zve*). +# +# 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. +RISCV_PROFILES = { + 'rva20u64': 'rv64imafdc_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zicsr_zmmul_za128rs_zaamo_zalrsc_zca_zcd', + 'rva22u64': 'rv64imafdcb_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zicsr_zihintpause_zihpm_zmmul_za64rs_zaamo_zalrsc_zfhmin_zca_zcd_zba_zbb_zbs_zkt', + 'rva23u64': 'rv64imafdcbv_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zicond_zicsr_zihintntl_zihintpause_zihpm_zimop_zmmul_za64rs_zaamo_zalrsc_zawrs_zfa_zfhmin_zca_zcb_zcd_zcmop_zba_zbb_zbs_zkt_zvbb_zve32f_zve32x_zve64d_zve64f_zve64x_zvfhmin_zvkb_zvkt_zvl128b_zvl32b_zvl64b_supm', +} + # riscv_isa_to_tune(isa) # # Automatically translate a RISC-V ISA string to TUNE_FEATURES # # Abbreviations, such as rv32g -> rv32imaffd_zicsr_zifencei are supported. # -# Profiles, such as rva22u64, are NOT supported, you must use ISA strings. +# The profile names in RISCV_PROFILES, such as rva22u64, are also supported, +# and are translated to the profile's mandatory extensions. # def riscv_isa_to_tune(isa): - _isa = isa.lower() + _isa = RISCV_PROFILES.get(isa.lower(), isa).lower() feature = [] iter = 0 From patchwork Wed Nov 18 20:48:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104799 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.603.1795034969564966107 for ; Wed, 18 Nov 2026 12:49:29 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=Z4zaMfBy; spf=pass (domain: baylibre.com, ip: 209.85.160.175, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-5363c8de563so16065281cf.0 for ; Wed, 18 Nov 2026 12:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034968; x=1795639768; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Mcxphd9lINXzpSYuUGqxs05PmeHnSnKvebbqmnX0sMA=; b=Z4zaMfByAnWJCLCX8Zu0y1PDOwPBpctNcuvjHbAgliOAEMB+t+fo2a4j6YM8sdhg+s 3yMnpdsPvyRin2YnN0bBllTTWQoXWwDjoH9+c51wzzKekD34CTfmWUlHXM8e6MfzRp5R 99g77rAMl0YmUIUF3PUKOkmxAwqUTSq1B3hxFcZecRbC/Avt6maSKZ/qXLXRWr3Lh3s9 qnJ6faj8cQ/NroT0ug4yoimhxFQDkCI7Z1MbkCcrBfmN4YW8k+OTsTTUNWOSC+cdEBxq PWA82ykrrmzuaiMvP6GSA3cLKx+vjANNzY95H9nLT0eujcoTtEywf2uaVNMqWkPJ5bmt SkNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034968; x=1795639768; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Mcxphd9lINXzpSYuUGqxs05PmeHnSnKvebbqmnX0sMA=; b=HUEicU0xJHeFRLa+wrafrrCCPt1GSHUginOjUZAvn1HATJp5JS+RFw/M9M7UH0kjY2 2bjPrustina03MG2OZqO4Qk2LjhxJapahSxdjEhvRINahdAwFkQ/gsf/wIroTQSh1SBS pcbCIgpQbfHz4jV4kLH2fN3hvkKc1totb600pFLvROpXj1ZEdLIKMse/oaN5QlOmBzsv 31/v9UWOOzRaAD3Vx2yBlqDw2/1VfBQAwJI5p8nYgBRqw9mLJlusqTK2kclqFTCHNZas p0wl8TCbnYx3Y9IT1OYMf5DeLoA3H47Ljh1xSj8imSughha3oAdHkF3Zq86cIfxlZhLp GyMg== X-Gm-Message-State: APuU4Z81nWLDyKZEl1KkmuzX9ofjVR2Hez2RmGELbDf2FWUyyDxXV11B 18Yxd5IQWLWIFG94b/BE6D7OJQikoocUAD0h4vzqUsdob6Rt2KVY3vLRMNtVlnhHt41fACOcf5Y 9jjNs X-Gm-Gg: AYBFou3INkKHArXP/GgWkeZRnXN8WF4qu/LUOrw+tHevaerzSAs0gdsgr9U/9yez9RX vmYMiTnESaAAyP9T3wf2BmxGoggaw0MAPESjDGviCXWUCOs516j61mP6mDrTXFPGaX2iFywib+b paEk6EtPmNd9wU7ZnRQNM5BsqkMuRyX5ZZdt9VirXu6FC5E3XsXqhqcTnBcuyqrjDLukbO3Ip4w 3AZZAvo5WwMXJ2Q+/zJ19TFdyGn57ADP2tMDjp94q/w/vZ3oHh1FSKogcJMtyQofXy51474as+i TZ3GpadBkoKsujoUT4L8xaVXAQB7Kj0vaBto8TGlMB7sG7nK1yi104w1NAaXwY7Gh6GMCGiqqUE dROxrSrJAZCAu7HBQ5+2j1MyILlEo3dGu40IiPHkBnWpEHOaDLUReUfS9zyOr/Pa5dS6RRCTsE0 0TQ/nBxLlDwlRS64miwqQC7PvA0buPP/Y/VWge3zRTtIKVUATOGFkqCc5OO82fMwQBOxnmSeQqu L/r4/zeSbWkvCUYnSr6/W2RPEr1XQTzclMo5AFo+5e1SF6ec1uGo/Y1Egsy0gUpqYPo12ZHYMJw YLN3FW1PE3iUqtDOLWAZLfYACRRpD/eRpm4NBuNXJdTZYmS60fDCeyge28pIDJLsglHJ0pF73RP VaPwl X-Received: by 2002:ac8:59ca:0:b0:55d:35a5:5256 with SMTP id d75a77b69052e-55d5a30881bmr64506831cf.10.1795034968310; Wed, 18 Nov 2026 12:49:28 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:27 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 04/12] lib/oeqa/selftest/cases/oelib/tune.py: add selftests for lib/oe/tune.py Date: Wed, 18 Nov 2026 15:48:45 -0500 Message-ID: <20261118204853.2155173-5-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250587 Add basic selftests for tune.py's riscv_isa_to_tune() function, covering: - Abbreviations of tune feature lists - Explicit tuning mappings - Whitespace as valid separators in tuning lists - Duplicate extensions only appear once - Extensions starting with z, s, or x are not shortened - Non-RISC-V architecture strings don't result in valid RISC-V tunings - Profile names and ISA strings are parsed the same - Expected profile ISA string lengths - Deltas between successive profiles' extension sets (e.g. RVA22 vs RVA20, RVA23 vs RVA22) AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Trevor Gamblin --- meta/lib/oeqa/selftest/cases/oelib/tune.py | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 meta/lib/oeqa/selftest/cases/oelib/tune.py diff --git a/meta/lib/oeqa/selftest/cases/oelib/tune.py b/meta/lib/oeqa/selftest/cases/oelib/tune.py new file mode 100644 index 0000000000..e851876588 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/oelib/tune.py @@ -0,0 +1,81 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +from unittest.case import TestCase +from oe.tune import RISCV_PROFILES, riscv_isa_to_tune + +def _features(isa): + return set(riscv_isa_to_tune(isa).split()) + +class TestRiscvIsaToTune(TestCase): + def test_abbreviation(self): + self.assertEqual(riscv_isa_to_tune('rv32g'), 'rv 32 i m a f d zicsr zifencei') + self.assertEqual(riscv_isa_to_tune('rv64g'), 'rv 64 i m a f d zicsr zifencei') + self.assertEqual(riscv_isa_to_tune('rv64gc'), 'rv 64 i m a f d c zicsr zifencei') + self.assertEqual(riscv_isa_to_tune('rv32gcv'), 'rv 32 i m a f d c v zicsr zifencei') + # Single-letter extensions after g stay ahead of the multi-letter ones + self.assertEqual(riscv_isa_to_tune('rv64gcv_zba'), 'rv 64 i m a f d c v zba zicsr zifencei') + + def test_explicit(self): + self.assertEqual(riscv_isa_to_tune('rv32imac_zicsr_zifencei'), 'rv 32 i m a c zicsr zifencei') + self.assertEqual(riscv_isa_to_tune('rv32ec'), 'rv 32 e c') + self.assertEqual(riscv_isa_to_tune('RV64IMAFD_Zicsr'), 'rv 64 i m a f d zicsr') + # riscv as well as rv + self.assertEqual(riscv_isa_to_tune('riscv64gc'), riscv_isa_to_tune('rv64gc')) + + def test_separators(self): + self.assertEqual(riscv_isa_to_tune('rv64imac zicsr'), 'rv 64 i m a c zicsr') + + def test_duplicates(self): + self.assertEqual(riscv_isa_to_tune('rv64imac_zicsr_zicsr'), 'rv 64 i m a c zicsr') + + def test_multi_letter_prefixes(self): + # z, s and x extensions are all kept whole + self.assertEqual(riscv_isa_to_tune('rv64gc_xtheadba_svpbmt'), + 'rv 64 i m a f d c xtheadba svpbmt zicsr zifencei') + + def test_not_riscv(self): + self.assertEqual(riscv_isa_to_tune('x86_64'), 'x86_64') + self.assertEqual(riscv_isa_to_tune('aarch64'), 'aarch64') + self.assertEqual(riscv_isa_to_tune(''), '') + + def test_profile(self): + self.assertEqual(riscv_isa_to_tune('rva20u64'), + 'rv 64 i m a f d c ziccamoa ziccif zicclsm ziccrse zicntr zicsr zmmul za128rs zaamo zalrsc zca zcd') + for name, isa in RISCV_PROFILES.items(): + with self.subTest(profile=name): + tune = riscv_isa_to_tune(name).split() + self.assertEqual(tune, riscv_isa_to_tune(isa).split()) + self.assertEqual(riscv_isa_to_tune(name.upper()).split(), tune) + self.assertEqual(tune[:3], ['rv', '64', 'i']) + self.assertEqual(len(tune), len(set(tune))) + # Required by Linux, but not by the profiles + self.assertNotIn('zifencei', tune) + + def test_profile_sizes(self): + self.assertEqual(len(_features('rva20u64')), 20) + self.assertEqual(len(_features('rva22u64')), 32) + self.assertEqual(len(_features('rva23u64')), 53) + + def test_rva22u64_additions(self): + # Everything in RVA20U64 is in RVA22U64, except that the latter's za64rs + # (a reservation set of at most 64 bytes) replaces za128rs + rva20 = _features('rva20u64') + rva22 = _features('rva22u64') + self.assertEqual(rva20 - rva22, {'za128rs'}) + self.assertEqual(rva22 - rva20, + {'b', 'za64rs', 'zba', 'zbb', 'zbs', 'zfhmin', 'zic64b', + 'zicbom', 'zicbop', 'zicboz', 'zihintpause', 'zihpm', 'zkt'}) + + def test_rva23u64_additions(self): + rva22 = _features('rva22u64') + rva23 = _features('rva23u64') + self.assertLessEqual(rva22, rva23) + self.assertEqual(rva23 - rva22, + {'supm', 'v', 'zawrs', 'zcb', 'zcmop', 'zfa', 'zicond', + 'zihintntl', 'zimop', 'zvbb', 'zve32f', 'zve32x', + 'zve64d', 'zve64f', 'zve64x', 'zvfhmin', 'zvkb', 'zvkt', + 'zvl128b', 'zvl32b', 'zvl64b'}) From patchwork Wed Nov 18 20:48:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104800 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.597.1795034971373440220 for ; Wed, 18 Nov 2026 12:49:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=ZOS3F/u7; spf=pass (domain: baylibre.com, ip: 209.85.160.171, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-5363c8de563so16065991cf.0 for ; Wed, 18 Nov 2026 12:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034970; x=1795639770; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bv5/WQimG6ogNJygDRHxWwu24aCUR+1M/7Oiw7vZxa4=; b=ZOS3F/u7kUm+6iQqnIM3W5FSauduBOgPQc2qMTTap979xJugMkjKNGy+x9WvYlVkzA az+3ylGA4wA1bezCUnKthqQeNz7ZXFD2axwNGb13lrDDT793dNwzgzV+M8Tmg6+2IGR7 OsqtzJ97qgwjKidq+9jOe1RILNLB+gyO/vu64M36mQBYuajYVGD+OTtMl7oLqRD7byAV t84UyVzzFmKQSi5cgUZAR/fz0buty79dkBGTdaCaYOJwP2gRiJDJzPGP7Tbz5VeWSq++ IoRTGY9/Uh2UsBrp8VDLjIwfcMkAjALeSsTN7SEqyi1oo0nXx8NRdy4MTnwdg8vL6NXv lirg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034970; x=1795639770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=bv5/WQimG6ogNJygDRHxWwu24aCUR+1M/7Oiw7vZxa4=; b=aKMIi6xSPAApOPNIAboyMG6U2BcZZ73mq5TAfepUtAxtW5hJYTqe71k67iIZaOIlJg GGksAP4lajWkw7w2vgTeup2MRXZDZ1cUFcO+bRKK5Og9cx2Kwh5L1W6549wMXHibRpA6 4clKiT6kt2+BocBJeFzINQj3jW688IKwJqORMTsA7Iidj9Ywr9TSPQVeWwZOEkCFkMRH N/A1gW54E6yINXkG5eQlW25U3k4oG0AsnPxTF8zUimK1VfWi7mCwH4hbOs2/b9FTK7KN ARutozpzu2omFFR30QwajK8Vw8iiM++iaBH5eLbg5r2cXtshAYEH4mxH4CLGrno3uLYV VZAQ== X-Gm-Message-State: APuU4Z9zU7xP/GJBWXO08X/YRdgk397P+hc6lSbfY2sm523ncwPvFXso g3vLPnG9pPkZShQgjJCB1zyaQSEk2TJEXRLw+pMPcV86DQ26J3rAKjI1bXHkcu5TWqef5aSli7s jzeqg X-Gm-Gg: AYBFou15lGxE+wfZe/qhtDBpbgxZ2bke/MSdklblQhW37JQRBgfGiuudnDmcP9GNk0u jbDfpNn+Ye4a3r8klczsMrkhsqzEmR+FSYHDyCvr/fsOravaXkPiDr63Os4zvB/UNao9Y9X+mba hYvAy1hk0lhVkEztbTkd5FlZIji51ZRlOR6DZxGh/W38EJMimllEh8WOcIQPoC9eMWbvlT4o1dS nzT/gLJCrxeJ/AMWZQ2BmdbaaGw1Mf7ImOm5MgfQu06MnKj0yNjBKRQNVQvU/TU4hLII8wxlbMg 8SqFFDpHMj51BxawS/th860iOFDzE63vs8YWThqVuznb4jlVkI1FOHWLOhqk4zmqKo6nGuRxGY/ ZvJGSkNlaudSQoXN0pAXX8RNd4AiOSVClGb1+vCOmVEKvJVlqxrINL2mJLQniv6ZQT3fksqiCIH UF2g3lEviMWNEPUyG9oD/4CHDZL54io75VTVjpbLok9PuTEErN4J19NFW7AUZ+jTfpgGwX0cCEn Om1scGW6ZEhdAqPa81/lEurVX6odzfZRUAiffRpx5AuOsVUkr72sg+p9OhXi4bcbUVjYJcdDxat hqlE5zvRK7HR7/eBfmZlemnsGlhvbMoEY0qLm3cJ3AJB7tFT+szCGzwYfpdS444AYyEd34PhQn4 QWKf/ X-Received: by 2002:a05:622a:4806:b0:54d:ac62:b7f5 with SMTP id d75a77b69052e-55d5a308b57mr54556631cf.3.1795034970092; Wed, 18 Nov 2026 12:49:30 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:29 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 05/12] arch-riscv.inc, tune-riscv.inc: add rva20u64 tune Date: Wed, 18 Nov 2026 15:48:46 -0500 Message-ID: <20261118204853.2155173-6-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250588 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 --- .../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(-) diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc index 6883e39a5f..26b8940f15 100644 --- a/meta/conf/machine/include/riscv/arch-riscv.inc +++ b/meta/conf/machine/include/riscv/arch-riscv.inc @@ -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)}" diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc index 88c9184c8b..bce345f684 100644 --- a/meta/conf/machine/include/riscv/tune-riscv.inc +++ b/meta/conf/machine/include/riscv/tune-riscv.inc @@ -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}" diff --git a/meta/lib/oe/tune.py b/meta/lib/oe/tune.py index 580c84d4fa..f44043c605 100644 --- a/meta/lib/oe/tune.py +++ b/meta/lib/oe/tune.py @@ -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. From patchwork Wed Nov 18 20:48:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104797 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.598.1795034973081007192 for ; Wed, 18 Nov 2026 12:49:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=Jf3WGBW8; spf=pass (domain: baylibre.com, ip: 209.85.160.173, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-5364d86f7f0so17215131cf.1 for ; Wed, 18 Nov 2026 12:49:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034972; x=1795639772; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dY1++kw6FewzDjCLhQ1asRVYp+wsExy49aP8gt1T3d0=; b=Jf3WGBW8oprUfRIDKuGmGrwJ3RSm9XVcuLIsTr9KF5X2je+X4t1Lty2naEb/tFthlq xDyJ4R9SaOgni0pmmBAhVZLBoh5VU0s4Od3gvvz5Y6zUkFqaBs/zG8ztoRcfE16jl2G5 6N6ddp3DP6sTm/vW3Cy+KQJkuqz2uxhU4JyIcnWb7f1VvGk4p2mLXa8lvuNc54ybRBYo F275sNV5iQUBq7XchsP10a7+M0I4SowJd8YzM/FB2TPt9fwAVP9yG4nlX2wbYJvtvNvS MWsn0yZxrZ534B+Pqi6sRBcG1V34hOJDykKEFd9U4ON38y172+Tjw9NzJOes70qD7apy A7mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034972; x=1795639772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=dY1++kw6FewzDjCLhQ1asRVYp+wsExy49aP8gt1T3d0=; b=AC5ngfEIbAOv2moRZmDBIGQx6Y6V4yYRUJFco5G4PTzzt/0KEjTA2YMd7uIXg2/4vU EhQOiRNwH9ikwQJ1dROPOK14hJcYHxXzwtPlt0yE+SqJXLFnVi/v5FlK3LOsRqXaCANc AjVERVkqRM9rjB+JnccyLDEz3GdtwH+XkpjSJBg8BchIsHyRBbs0kFr3n5CGVLfpjs8o VW7nyERi2lgRs8QHG8AvO4T6cLy3jnDn/5vqINGDlWodHAcCS9e7doElhU+oamwKlPGu jbRvmQ84uJwgzGgX4lQdvObXgve20y0oMuYkfuWTviy6j2Bk5QqR+ei5T7kKtqUC01js E34w== X-Gm-Message-State: APuU4Z//zgKvSPQhAfva7mfjhvS7ExddmrcdCLPW64s8OTJsR0qVt3Mj TvYVyeZqSZH+M8n2k59ITeiW5aUhZfjBdSN+uaEWj8XkCJA6gsY+Rq/hP5z7XW0icthdsekeAcr VjHDS X-Gm-Gg: AYBFou3efRyNdT+JdMxtz+e31UZLOc4cChnHDRol9DYI0rSaH1EfaxtTNoV5YIKBa47 CTO3y+A+rbgKPRSY/NKSZSsKsYI1LrF3YgghS3IXUoQ6NCBZZ5smRzqfXpSqWtr5kG5O8ec5x+y WhFfbkcO73k4gm1hALj8GlCYuFd3K5NUSp7mlEdtVXlBclJMH49KzTBpOirJpHr9kWpJkWIWMHf DBn6IHWjaFoThDFO/jG/trWO0A4ZBm6A2WVd60GiIJwvWG/ED9MUFF2C+Gmh59P2jZpOm6CcD5/ SbhuCQga47B8YacLSBh3k2qC9C08UpMR89HZnUoo1KvkvwhpNldvZr0+chKi2B9btWarlHzn5PJ jd4L9n+LcFJcdfB2k/4lvmrVQg6RuXJg08tdDJpkMGtsQDp9xefZ0dmzTxRLnZBf9oW/QzIEJCo 9s9iseoZyL+STTPsV9eDKkzp3BXI4LTHc1aEk3sOD0WKUBIQlUJ+URK5rtbNWQ4v4sqt5c0UV8l ftKrM+j6i0h19Xr3VHP+NaF0RHw4FVxCF+mFMdNf5sdE63a1ckB5xsf1wtuQxubyB+tVABMaBbr kI0DjKzAHlSLzc3+tJlTK/Z+b3uKymMaun5S4wueMMkfoKZR9uMTOxPzvHnVhREEsON2uK2SEt7 vxMAT X-Received: by 2002:ac8:5d48:0:b0:536:72b4:b835 with SMTP id d75a77b69052e-55d5a5fc199mr60978561cf.46.1795034971829; Wed, 18 Nov 2026 12:49:31 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:30 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 06/12] arch-riscv.inc, tune-riscv.inc: add rva22u64 tune Date: Wed, 18 Nov 2026 15:48:47 -0500 Message-ID: <20261118204853.2155173-7-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:36 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250589 Add TUNE_FEATURES for extensions mandated by the RVA22U64 profile but not yet included in arch-riscv.inc: - zic64b - zicbop - zicboz - zihintpause - zihpm - za64rs - zfhmin - zkt It also mandates the following, which were already in oe-core: - b - zicbom - zba - zbb - zbs Then, add an 'rva22u64' tune using them. Zifencei isn't mandatory in the profile, but it is added on top of the profile's extensions since Linux requires it, making the package arch 'rva22u64_zifencei'. Signed-off-by: Trevor Gamblin --- .../conf/machine/include/riscv/arch-riscv.inc | 37 ++++++++++++++++++- .../conf/machine/include/riscv/tune-riscv.inc | 6 ++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc index 26b8940f15..0661c24e8e 100644 --- a/meta/conf/machine/include/riscv/arch-riscv.inc +++ b/meta/conf/machine/include/riscv/arch-riscv.inc @@ -82,10 +82,24 @@ TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "v", "v", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "v", "v", "", d)}" # Now the special Z extensions +# zic64b, zicbop, zicboz, zihintpause, zihpm, za64rs, zfhmin and zkt are +# mandatory in the RVA22U64 and later profiles +TUNEVALID[zic64b] = "Cache blocks are 64 bytes extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zic64b", "_zic64b", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zic64b", "_zic64b", "", d)}" + 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)}" +TUNEVALID[zicbop] = "Cache-block prefetch extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicbop", "_zicbop", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicbop", "_zicbop", "", d)}" + +TUNEVALID[zicboz] = "Cache-block zero extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicboz", "_zicboz", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicboz", "_zicboz", "", 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)}" @@ -115,6 +129,14 @@ TUNEVALID[zifencei] = "Instruction-fetch fence extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zifencei", "_zifencei", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zifencei", "_zifencei", "", d)}" +TUNEVALID[zihintpause] = "Pause hint extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihintpause", "_zihintpause", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihintpause", "_zihintpause", "", d)}" + +TUNEVALID[zihpm] = "Hardware performance counters extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihpm", "_zihpm", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihpm", "_zihpm", "", d)}" + # zmmul, zaamo, zalrsc, zca and zcd are subsets of single-letter extensions # above (m, a, c and c with d), which compilers enable along with them. They # are only passed on when listed in TUNE_FEATURES, so that -march doesn't @@ -124,11 +146,16 @@ 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 +# Mandatory in the RVA20U64 profile. Later profiles require za64rs (below), +# which is stricter, instead. 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[za64rs] = "Reservation set size of at most 64 bytes extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "za64rs", "_za64rs", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "za64rs", "_za64rs", "", 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)}" @@ -137,6 +164,10 @@ TUNEVALID[zalrsc] = "Load-reserved/store-conditional extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zalrsc", "_zalrsc", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zalrsc", bb.utils.contains("TUNE_FEATURES", "a", "", "_zalrsc", d), "", d)}" +TUNEVALID[zfhmin] = "Minimal half-precision floating-point extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zfhmin", "_zfhmin", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zfhmin", "_zfhmin", "", d)}" + TUNEVALID[zca] = "Compressed integer instructions extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zca", "_zca", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zca", bb.utils.contains("TUNE_FEATURES", "c", "", "_zca", d), "", d)}" @@ -161,6 +192,10 @@ TUNEVALID[zbs] = "Single-bit manipulation extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "b zbs", "_zbs", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "b zbs", "_zbs", "", d)}" +TUNEVALID[zkt] = "Data-independent execution latency extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zkt", "_zkt", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zkt", "_zkt", "", d)}" + # Construct TUNE_CCARGS # This should result in a CCARG similar to: # -march=rv32imac -mabi=ilp32 diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc index bce345f684..6aad54ae97 100644 --- a/meta/conf/machine/include/riscv/tune-riscv.inc +++ b/meta/conf/machine/include/riscv/tune-riscv.inc @@ -2,7 +2,7 @@ require conf/machine/include/riscv/arch-riscv.inc DEFAULTTUNE ?= "riscv64gc" -AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf rva20u64" +AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf rva20u64 rva22u64" # Default TUNE_FEATURES:tune-riscv64gc := "${@oe.tune.riscv_isa_to_tune("rv64gc")}" @@ -44,3 +44,7 @@ PACKAGE_EXTRA_ARCHS:tune-riscv64nc = "${RISCVPKGARCH:tune-riscv64nc}" 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}" + +TUNE_FEATURES:tune-rva22u64 := "${@oe.tune.riscv_isa_to_tune("rva22u64")} zifencei" +RISCVPKGARCH:tune-rva22u64 ?= "rva22u64_zifencei" +PACKAGE_EXTRA_ARCHS:tune-rva22u64 = "${RISCVPKGARCH:tune-rva22u64}" From patchwork Wed Nov 18 20:48:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104801 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.599.1795034974721487563 for ; Wed, 18 Nov 2026 12:49:34 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=P+Zah+4j; spf=pass (domain: baylibre.com, ip: 209.85.160.181, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-55d03bfd477so15258791cf.1 for ; Wed, 18 Nov 2026 12:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034974; x=1795639774; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=c0usQ2KbYs6d5gYEhYZoYnkpE1b9uehK7b0NbfdSvik=; b=P+Zah+4jg7oarAYrnM05uNmxg1JwqH78ADAe8biU+uxi10UR5EYMVhQt+4lZG2h72U ktNEivuar8tstF2aapGl/9LE+7ytvueeYsWXPg0hv1ITRXfgw0NFbT2LJxKUPKFzBWwL A6hhz9dM+lBbdceBh5IAKDVP+382OsilzI/aBBo/dDsDKX7ZFnjVXqFvnvh50akrYCmQ 20JyF1QW3ZGNLlVarLOMYZAu1T7nao8zNe1Y7EPJjqJ6ceHGDDpG3qav4n2ZUKSDUe+7 LifnBB9DFCCSsqnmzNdessffLnYijwkI/YYRkJJGkk90/YbT+4lYwAa8oVLBpPCmObF1 MH3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034974; x=1795639774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=c0usQ2KbYs6d5gYEhYZoYnkpE1b9uehK7b0NbfdSvik=; b=2cERUyOnfm4IhWO3j0Vc5H9UXlcEZ3p0cs78WeHPMVhsJoYLlG2xRjw2LyZfPwKdGu Xl3kQsGOWRd9tIE5b4mtLAfL6G48aflwfpeFWKLQ31xfd7paFaaLHMFLuvz2OTs8ubSt k5AQ3HdrE1xj6iJRHlz757iicd3jqg0aBcvYw8EQ9pzZ1C7ZzthVOKkLi0SZPxS03v3h fDtLLyVtob+2xLxTh+3eBZr7Ac0F3aAz+G+lcpJ3uvhVk1HZ3MVwwWjKbhYctjvksYei x708hNXHbG9AqDHoSu6LX8QNca7TthLEqV8MawFjXj+KKziKw1IFQfsHE7jFL5wZ/t4f WOcg== X-Gm-Message-State: APuU4Z8TPmSLbSYr/kbgmsgMfsiVLNGyamnpX7kVOPsngg3hRXzwKJ2g W7DbADIvka+VPcWiC6HVvaz6txcZUs6fMnabJSHAJO7DdZrsSddUz5B6bxxTCfAKTeaKJmHrB3x XVBM8 X-Gm-Gg: AYBFou2ee15EZj1KScM7f5hnie+j8ouMAtM4NfxqBMVK+LGROHpfrCBrTgti5U9ISDj MQd9sh16MJXFwoipyGkyH0vbkXSdHGpYsxiU0tX9PIpyTNEJvPri5x+ahMLPVuqcb4yCK+R7Txy udk8AQ6xH5LqW0M4TMOcu4dSKfDsWMoezWD2pcZxd7GhIwWcWc/C5mXwzcWrV4mn1kOEsJ8OM7F vwwxmAeDZFp47pa8F+EVRQk9XADVSwdaht/6G7a2xNKp5Gt68Nj/KLMOkNMGObKHaeaRCaYZ3lk c4Fnuber0bl945fnsKtzgeBfZXtWL2a3Urt4J/M0/qLOy5IAPJQ1dyYNnF8AbiwoxHqHg5ufVav dftCE/kvCkRxXcHrJFKPSmQgc0riOF6VcNl5a0ya5cnjPEHFwAYvYGJEtvGFTaXDykXNWrsHskJ /77JhD3d4+fEcwZGXGlLwIk543QFv/ckrTHC6CGZD6RKL820J6yzDMVrD92zyysBzpL52Y0iLSS GLTgwbFRsibjz3iO68ShDCb8sqZKptPWDu81jbTaUsBJX7rJ9Q1254IS4qFPCklpsPhzDyit/un Lf4j294q+tk+sahIqe0kQsjXFwswQ8HjZ3mFoOfRJhXB/WBtTQLkSQhsxljd8q4vK12+qjIGpiF F4Oulk3G+OQWp+af9fGOzolkWcQ== X-Received: by 2002:a05:622a:4109:b0:55d:99e:822f with SMTP id d75a77b69052e-55d5a6259e1mr57120501cf.46.1795034973402; Wed, 18 Nov 2026 12:49:33 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:32 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 07/12] arch-riscv.inc, tune-riscv.inc: add rva23u64 tune Date: Wed, 18 Nov 2026 15:48:48 -0500 Message-ID: <20261118204853.2155173-8-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250590 Add TUNE_FEATURES for the extensions mandated by the RVA23U64 profile, which weren't yet in arch-riscv.inc: - zicond - zihintntl - zimop - zawrs - zfa - zcb - zcmop - zvbb - zvfhmin - zvkb - zvkt - supm - zve* and zvl* vector extensions The zve*/zvl* extensions are only added to the package arch when v isn't enabled, and zvkb, when zvbb isn't. As with other profiles, zifencei is added to the extension set since it's required by Linux, making the package arch 'rva23u64_zifencei'. Signed-off-by: Trevor Gamblin --- .../conf/machine/include/riscv/arch-riscv.inc | 89 +++++++++++++++++++ .../conf/machine/include/riscv/tune-riscv.inc | 6 +- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc index 0661c24e8e..ff14f94deb 100644 --- a/meta/conf/machine/include/riscv/arch-riscv.inc +++ b/meta/conf/machine/include/riscv/arch-riscv.inc @@ -84,6 +84,8 @@ TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "v", "v", "", d)}" # Now the special Z extensions # zic64b, zicbop, zicboz, zihintpause, zihpm, za64rs, zfhmin and zkt are # mandatory in the RVA22U64 and later profiles +# zicond, zihintntl, zimop, zawrs, zfa, zcb, zcmop, zvbb, zvfhmin, zvkb, zvkt +# and supm, as well as v, are mandatory in the RVA23U64 and later profiles TUNEVALID[zic64b] = "Cache blocks are 64 bytes extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zic64b", "_zic64b", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zic64b", "_zic64b", "", d)}" @@ -121,6 +123,10 @@ 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[zicond] = "Integer conditional operations extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicond", "_zicond", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zicond", "_zicond", "", 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)}" @@ -129,6 +135,10 @@ TUNEVALID[zifencei] = "Instruction-fetch fence extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zifencei", "_zifencei", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zifencei", "_zifencei", "", d)}" +TUNEVALID[zihintntl] = "Non-temporal locality hints extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihintntl", "_zihintntl", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihintntl", "_zihintntl", "", d)}" + TUNEVALID[zihintpause] = "Pause hint extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihintpause", "_zihintpause", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihintpause", "_zihintpause", "", d)}" @@ -137,6 +147,10 @@ TUNEVALID[zihpm] = "Hardware performance counters extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihpm", "_zihpm", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zihpm", "_zihpm", "", d)}" +TUNEVALID[zimop] = "May-be-operations extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zimop", "_zimop", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zimop", "_zimop", "", d)}" + # zmmul, zaamo, zalrsc, zca and zcd are subsets of single-letter extensions # above (m, a, c and c with d), which compilers enable along with them. They # are only passed on when listed in TUNE_FEATURES, so that -march doesn't @@ -164,6 +178,14 @@ TUNEVALID[zalrsc] = "Load-reserved/store-conditional extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zalrsc", "_zalrsc", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zalrsc", bb.utils.contains("TUNE_FEATURES", "a", "", "_zalrsc", d), "", d)}" +TUNEVALID[zawrs] = "Wait-on-reservation-set instructions extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zawrs", "_zawrs", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zawrs", "_zawrs", "", d)}" + +TUNEVALID[zfa] = "Additional floating-point instructions extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zfa", "_zfa", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zfa", "_zfa", "", d)}" + TUNEVALID[zfhmin] = "Minimal half-precision floating-point extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zfhmin", "_zfhmin", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zfhmin", "_zfhmin", "", d)}" @@ -172,10 +194,18 @@ TUNEVALID[zca] = "Compressed integer instructions extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zca", "_zca", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zca", bb.utils.contains("TUNE_FEATURES", "c", "", "_zca", d), "", d)}" +TUNEVALID[zcb] = "Additional compressed instructions extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcb", "_zcb", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcb", "_zcb", "", d)}" + TUNEVALID[zcd] = "Compressed double-precision floating-point instructions extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcd", "_zcd", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcd", bb.utils.contains("TUNE_FEATURES", "c d", "", "_zcd", d), "", d)}" +TUNEVALID[zcmop] = "Compressed may-be-operations extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcmop", "_zcmop", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zcmop", "_zcmop", "", d)}" + TUNEVALID[zba] = "Address bit manipulation extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "b zba", "_zba", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains_any("TUNE_FEATURES", "b zba", "_zba", "", d)}" @@ -196,6 +226,65 @@ TUNEVALID[zkt] = "Data-independent execution latency extension" TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zkt", "_zkt", "", d)}" TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zkt", "_zkt", "", d)}" +TUNEVALID[zvbb] = "Vector basic bit-manipulation extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvbb", "_zvbb", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvbb", "_zvbb", "", d)}" + +# The zve* and zvl* extensions are subsets of v, like zmmul is of m above, so +# they are only added to the package arch when v isn't enabled. Other extensions +# also imply them (e.g. zvbb implies zvkb, zve32x, and zvl32b), which the +# compilers handle but the package arch doesn't. Tunes using them without v +# should set RISCVPKGARCH:tune-. +TUNEVALID[zve32f] = "Embedded vector (32-bit integer and floating-point) extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve32f", "_zve32f", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve32f", bb.utils.contains("TUNE_FEATURES", "v", "", "_zve32f", d), "", d)}" + +TUNEVALID[zve32x] = "Embedded vector (32-bit integer) extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve32x", "_zve32x", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve32x", bb.utils.contains("TUNE_FEATURES", "v", "", "_zve32x", d), "", d)}" + +TUNEVALID[zve64d] = "Embedded vector (64-bit integer, 64-bit floating-point) extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve64d", "_zve64d", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve64d", bb.utils.contains("TUNE_FEATURES", "v", "", "_zve64d", d), "", d)}" + +TUNEVALID[zve64f] = "Embedded vector (64-bit integer, 32-bit floating-point) extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve64f", "_zve64f", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve64f", bb.utils.contains("TUNE_FEATURES", "v", "", "_zve64f", d), "", d)}" + +TUNEVALID[zve64x] = "Embedded vector (64-bit integer) extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve64x", "_zve64x", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zve64x", bb.utils.contains("TUNE_FEATURES", "v", "", "_zve64x", d), "", d)}" + +TUNEVALID[zvfhmin] = "Vector minimal half-precision floating-point extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvfhmin", "_zvfhmin", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvfhmin", "_zvfhmin", "", d)}" + +# zvkb is a subset of zvbb +TUNEVALID[zvkb] = "Vector cryptography bit-manipulation extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvkb", "_zvkb", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvkb", bb.utils.contains("TUNE_FEATURES", "zvbb", "", "_zvkb", d), "", d)}" + +TUNEVALID[zvkt] = "Vector data-independent execution latency extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvkt", "_zvkt", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvkt", "_zvkt", "", d)}" + +TUNEVALID[zvl128b] = "Minimum vector length of 128 bits extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvl128b", "_zvl128b", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvl128b", bb.utils.contains("TUNE_FEATURES", "v", "", "_zvl128b", d), "", d)}" + +TUNEVALID[zvl32b] = "Minimum vector length of 32 bits extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvl32b", "_zvl32b", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvl32b", bb.utils.contains("TUNE_FEATURES", "v", "", "_zvl32b", d), "", d)}" + +TUNEVALID[zvl64b] = "Minimum vector length of 64 bits extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvl64b", "_zvl64b", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "zvl64b", bb.utils.contains("TUNE_FEATURES", "v", "", "_zvl64b", d), "", d)}" + +# Supervisor-level extensions, which come after all of the Z extensions +TUNEVALID[supm] = "User-mode pointer masking extension" +TUNE_RISCV_MARCH .= "${@bb.utils.contains("TUNE_FEATURES", "supm", "_supm", "", d)}" +TUNE_RISCV_PKGARCH .= "${@bb.utils.contains("TUNE_FEATURES", "supm", "_supm", "", d)}" + # Construct TUNE_CCARGS # This should result in a CCARG similar to: # -march=rv32imac -mabi=ilp32 diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc index 6aad54ae97..d2657d8dad 100644 --- a/meta/conf/machine/include/riscv/tune-riscv.inc +++ b/meta/conf/machine/include/riscv/tune-riscv.inc @@ -2,7 +2,7 @@ require conf/machine/include/riscv/arch-riscv.inc DEFAULTTUNE ?= "riscv64gc" -AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf rva20u64 rva22u64" +AVAILTUNES += "riscv64gcv riscv64gc riscv32gc riscv64 riscv32 riscv64nc riscv64nf riscv32nf rva20u64 rva22u64 rva23u64" # Default TUNE_FEATURES:tune-riscv64gc := "${@oe.tune.riscv_isa_to_tune("rv64gc")}" @@ -48,3 +48,7 @@ PACKAGE_EXTRA_ARCHS:tune-rva20u64 = "${RISCVPKGARCH:tune-rva20u64}" TUNE_FEATURES:tune-rva22u64 := "${@oe.tune.riscv_isa_to_tune("rva22u64")} zifencei" RISCVPKGARCH:tune-rva22u64 ?= "rva22u64_zifencei" PACKAGE_EXTRA_ARCHS:tune-rva22u64 = "${RISCVPKGARCH:tune-rva22u64}" + +TUNE_FEATURES:tune-rva23u64 := "${@oe.tune.riscv_isa_to_tune("rva23u64")} zifencei" +RISCVPKGARCH:tune-rva23u64 ?= "rva23u64_zifencei" +PACKAGE_EXTRA_ARCHS:tune-rva23u64 = "${RISCVPKGARCH:tune-rva23u64}" From patchwork Wed Nov 18 20:48:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104802 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.606.1795034977858593268 for ; Wed, 18 Nov 2026 12:49:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=eJuM5zwS; spf=pass (domain: baylibre.com, ip: 209.85.160.171, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-5366ae57896so13423991cf.3 for ; Wed, 18 Nov 2026 12:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034977; x=1795639777; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mq4aAE39ze15y6ddcOUaHNDq0p4WKNeQGdMB1DuxGqg=; b=eJuM5zwSsmUR5eEXm/KVSce9+ATgsH5DRNV+68WTgTek9XrZEB4jskM2LFc9jIDHpP 8l9rkA8P70EZVxhFnjC7KkCyHfqgcVhI1x/2vePUh7Lbu7OmB44t+0eFukeMRllzH3du 6tQ4cINdnzRKZ8z0X90HoMuCvFntBMsslCsI5lDgbwJ8n+5nXs88fgHH0rgBr+DL0Y0L Kb/8xyRMuNuq71+1+3evkUTK/sWx1Y4xRyhaOyQTbY9HBAN02q/iTu54usPHfb/rw3X3 n4p6wM3wEFeWogNEs9RvIx5dv3wvrsCD58uDOuC06C2DTk9deMbdG15J1xD1ZRjzqyUx gJAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034977; x=1795639777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mq4aAE39ze15y6ddcOUaHNDq0p4WKNeQGdMB1DuxGqg=; b=Jqmt/hWHmGTwy4kzAJhj+AuCOFGBeYTVxnat31z8IOVsOll6LzSTyWyoONhYHzffpg nzrjC3cni51rsSOHbgWFkI1kRBUcejHM+NetbKWqvyn4U1/DQfBh1Y8/JEFs0pk7AIRs VDUjty5SPaUX1O9m912WdKbWqubfrju0/zQGEQonF45yO0nfNGLSEG5WvbTH15h8uJOK Tmm8viWquvsBVdtF1s+JvOJEij5DH5k6wGTI5Uc/Wfl7ViAdJy5JUWQxJa+yPru6Fkh6 +Mqvng+RdLW1zPksa9yB8xvQKjbtNB2xglJsYQYYrYwAfISR4rmIexqNYRMdUREi9yUj /4Xw== X-Gm-Message-State: APuU4Z+RrW2KAz+orWlSCO/sJlQBDOOnBtJ6jeHJltKwjTjUR8Xuj2bo srjkWd/EbhV6l/IMv4WpCT6UbUQjbkjrR/hSP342k0WR0Fm4wzNVLwDON0W2hI3bAQev2h7qysF P898P X-Gm-Gg: AYBFou2lK9Mn+H+oIMnNW2ymZGDhKcAKA6WW6uCHnK47CwBDeU8MCQ5MKd3yztgZklH EJR1AooxXY26FFXNPI+D7WtxpURT2Nc+PQShG+/RSlo7eStUM0h1xbOdnHRsmE/HVU8DiA3h95l ga8zxZMGohws7bFEypuof5rzVDOT2aFl8xct5UJb8B7JfDnsNKfiaBoLc9SiziDSau3wpcbRPaW qO/bYyRPHbzjFfZLCQCk1PoLS5ciHM/k0dN/q6LoYXpisxQXuJPpGY64KKuNgbkhre4PNDNtsQg CH175Gyfyez/DfiqC/Qp/yKcMp7GRj6ttoip61ZHOBbXmhw92QrrhgprjZpKxwAfn/N6K9ZubA5 8hFJJdtqmUDqmfggAPSA0yizVJ7s05xpOK4n/CRJ5K4VJNulDwfd5IATgA9kKAQJ8teoNKCJHPr Dibi+hSd/KnM+KQKy1BDhIhTGgQSPz2Acn9f24jdAyWTSP2WT/tToypJNNd33WElzszgxyG/Ymj jh/sJGyQypF9xIK+azPsos4HC83sOGFu/1RNtIN2m3L1XeZLfbqFnVpYwCWA/c+KVyHe4WTDAFZ XmHiX89bmhbvVXpbOPSa8d6UW3JE8xB27Pw1UmEnzYHczqGE5reWM8q2dKg5aAelwEqY57TDuMK nQDyp X-Received: by 2002:a05:622a:313:b0:535:864:82cf with SMTP id d75a77b69052e-55d5a321ae4mr63317911cf.10.1795034976546; Wed, 18 Nov 2026 12:49:36 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:35 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 08/12] tune-riscv.inc: set PACKAGE_EXTRA_ARCHS for supersets Date: Wed, 18 Nov 2026 15:48:49 -0500 Message-ID: <20261118204853.2155173-9-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250591 For each tune, list the package archs it is a superset of in PACKAGE_EXTRA_ARCHS, with the lowest priority tunes first (like ARM tunings). This allows (for example) a 'riscv64gcv' machine to install 'riscv64gc' packages, and an 'rva23u64' machine to install packages built for: - riscv64gc - riscv64gcv - rva20u64 - rva22u64 Signed-off-by: Trevor Gamblin --- meta/conf/machine/include/riscv/tune-riscv.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meta/conf/machine/include/riscv/tune-riscv.inc b/meta/conf/machine/include/riscv/tune-riscv.inc index d2657d8dad..496dbdd722 100644 --- a/meta/conf/machine/include/riscv/tune-riscv.inc +++ b/meta/conf/machine/include/riscv/tune-riscv.inc @@ -11,7 +11,7 @@ PACKAGE_EXTRA_ARCHS:tune-riscv64gc = "${RISCVPKGARCH:tune-riscv64gc}" TUNE_FEATURES:tune-riscv64gcv := "${@oe.tune.riscv_isa_to_tune("rv64gcv")}" RISCVPKGARCH:tune-riscv64gcv ?= "riscv64imafdcv_zicsr_zifencei" -PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${RISCVPKGARCH:tune-riscv64gcv}" +PACKAGE_EXTRA_ARCHS:tune-riscv64gcv = "${PACKAGE_EXTRA_ARCHS:tune-riscv64gc} ${RISCVPKGARCH:tune-riscv64gcv}" TUNE_FEATURES:tune-riscv32gc := "${@oe.tune.riscv_isa_to_tune("rv32gc")}" RISCVPKGARCH:tune-riscv32gc ?= "riscv32imafdc_zicsr_zifencei" @@ -41,14 +41,18 @@ 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. +# +# Each profile tune's PACKAGE_EXTRA_ARCHS lists the package archs of the tunes +# that it's a superset of (with the same lp64d ABI), lowest priority first. 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}" +PACKAGE_EXTRA_ARCHS:tune-rva20u64 = "${PACKAGE_EXTRA_ARCHS:tune-riscv64gc} ${RISCVPKGARCH:tune-rva20u64}" TUNE_FEATURES:tune-rva22u64 := "${@oe.tune.riscv_isa_to_tune("rva22u64")} zifencei" RISCVPKGARCH:tune-rva22u64 ?= "rva22u64_zifencei" -PACKAGE_EXTRA_ARCHS:tune-rva22u64 = "${RISCVPKGARCH:tune-rva22u64}" +PACKAGE_EXTRA_ARCHS:tune-rva22u64 = "${PACKAGE_EXTRA_ARCHS:tune-rva20u64} ${RISCVPKGARCH:tune-rva22u64}" TUNE_FEATURES:tune-rva23u64 := "${@oe.tune.riscv_isa_to_tune("rva23u64")} zifencei" RISCVPKGARCH:tune-rva23u64 ?= "rva23u64_zifencei" -PACKAGE_EXTRA_ARCHS:tune-rva23u64 = "${RISCVPKGARCH:tune-rva23u64}" +# Unlike rva20u64 and rva22u64, rva23u64 is a superset of riscv64gcv +PACKAGE_EXTRA_ARCHS:tune-rva23u64 = "${PACKAGE_EXTRA_ARCHS:tune-riscv64gcv} ${RISCVPKGARCH:tune-rva20u64} ${RISCVPKGARCH:tune-rva22u64} ${RISCVPKGARCH:tune-rva23u64}" From patchwork Wed Nov 18 20:48:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104803 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.609.1795034979107971508 for ; Wed, 18 Nov 2026 12:49:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=iT/624QV; spf=pass (domain: baylibre.com, ip: 209.85.160.182, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-536717a4d83so12045981cf.2 for ; Wed, 18 Nov 2026 12:49:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034978; x=1795639778; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hOHrnJAUciQsAENFBTTOV7OmE4PMlS3XuHf6xMvyoeY=; b=iT/624QVUg7S2e2HSnC4z9Y1rkggJnog54srR8v/gsN9FmuJwJzlWl74gCAt5tE6bv PD/IItEacrgmx6ZyT0BAFhmBDMnqyLzbrI51dXfYxGuTswqVYmQDlgK8FKKXk5gpCWuv 0kDB32GeFpPKgF6J5UXWMlRxexzkUr/WP8fn5d8z/UtRfmATZa0+tfjK2pgJrHZe8OEg QpIY/a/Gk8J2srcRFwaMJp06Ne0izLRqOodEoVbzkw8rHDVNXmSkoPk//ArPuHkroB3e fDKiGMuAJhMHnFx1RiZxciRr5Ka9cpnod+ZsbpHd3m6FHIP4/I3fMEL9Rm4q1JgS84On GPDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034978; x=1795639778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hOHrnJAUciQsAENFBTTOV7OmE4PMlS3XuHf6xMvyoeY=; b=pNQXQok0OQcL60O878W/dreXAGjlFSN0kXndUX/j3QHuWJkUD/sq5nbS7RzhXs+950 f5bned/aIBqRtpHZouq7ow/8TpB2wrgAJBx/pGnMFRMT68DXaXO7VfhHNVZTaP9TbsA+ Nc/AjG5lOl3I4LU/VgdgKUYexu9GfINbGqI4H+kSoN25AugJRHLIjkYwDD5wNjfyAdM+ 8z9WCjzcmW1RXeYSo/hBZvmCMvJO2B2QG6N/tPdfODZYCIKGeNFnfLxZD9xfMs7SCJ0B VwzFUbtpCQmZSJcpgDb4ni6O5+qg2NUHZlzShd8Ec/2FXewfCXEAuTHS4g6wX9nF94d9 cBSw== X-Gm-Message-State: APuU4Z+FoRteL83XJaDk+AbkU0v6Rz3RdvZQm03zUyLn6ByZxmPSE+iN 18f8CV6O7ZUS30PK6omevhP/pPGu4NDvPNsQk8tWM6t7JiO9fVZU6ztMtqNBu7CCMf7a1IkCFCw SXgIs X-Gm-Gg: AYBFou1x+G3dXX80nQ37w+BuzfA8aY7SqAEhz9ociR2XMkl3ixqOXCjeIqifEOF/v/7 USUsz9joa0AUez30YC+bBB56RD5Q9vIrrEw+Rt92akRbfWitaIOcS8Mw9h7ugqQlI6TCpTCmgcU cQI/H48zbH15EgsErCwrWzq+Bic4+sSqA9XtNcQZjv8S+quaDEQVL9b/YAwZOG4JKuVp0MAQQWA XixXeDpZxEErD8miOqZ75wbAa2dPfzRsbZANyd9I+cIjRAlHb46Qx0lvUn9w8ElEQnL0bIwYp2n eRR/a8Fvr3uuXNqE0jhrBovH5V17+ab94iRLkZi3C7REfYPs3bLvDLohKYXBjDc8r/rDHEr9dvy 1xecHIumqjc0DGiotFPAe77Ad04a8w88DSZS6bN9gf2vI6IHcZTBdws21JH7RHVrPfyb3JlMIZE jHZXDoDk6NPMbpmlU64Qnl1hZoGXjePY8wvZXL1ogQRzn/MuumNRNIXC8HteRbBtbc9C83gxy59 C9fzwlVg/hOQI9jzQwtS20xrD9vz4MlSB5EC5Tejllh+c7E6VGhb8/Z8HC4ZnAreP809sTlS8Rx 4wPomnmp6Gc+rlNz5yFk/9Ythj7RQn5OVy67fJOxxe3QzaAVp6JzS8+mKepN/JnhFUjJLrkak9T YtJr8 X-Received: by 2002:a05:622a:5c07:b0:533:22c2:6e11 with SMTP id d75a77b69052e-55d5a5b3551mr53423861cf.33.1795034977843; Wed, 18 Nov 2026 12:49:37 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:37 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 09/12] meta/conf/machine/include/riscv/arch-riscv.inc: error on very long package archs Date: Wed, 18 Nov 2026 15:48:50 -0500 Message-ID: <20261118204853.2155173-10-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250592 Tunes that don't set RISCVPKGARCH:tune- fall back to TUNE_RISCV_PKGARCH, which grows with every extension enabled. This can easily exceed allowable maximums for build and sstate paths, so make it a fatal error when it's longer than 64 characters and inform the user to set RISCVPKGARCH:tune- instead. Existing tunes already set RISCVPKGARCH:tune-, so they are unaffected. The longest known fallback is currently Microblaze-V's riscv64imafdc_zicsr_zifencei_zba_zbb_zbs at 41 characters, which is well under the set limit. Signed-off-by: Trevor Gamblin --- meta/conf/machine/include/riscv/README | 3 ++- meta/conf/machine/include/riscv/arch-riscv.inc | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meta/conf/machine/include/riscv/README b/meta/conf/machine/include/riscv/README index ef7a484f25..c66925eb83 100644 --- a/meta/conf/machine/include/riscv/README +++ b/meta/conf/machine/include/riscv/README @@ -93,7 +93,8 @@ RISCVPKGARCH - This is the package arch actually used. As with ARMPKGARCH on arm, each tune sets it as a literal in RISCVPKGARCH:tune-, so that it only changes when deliberately changed. Tunes that don't set it fall back to - TUNE_RISCV_PKGARCH. + TUNE_RISCV_PKGARCH, which is an error if that is longer + than 64 characters. The standard variables are defined as: diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc index ff14f94deb..cde35ce56d 100644 --- a/meta/conf/machine/include/riscv/arch-riscv.inc +++ b/meta/conf/machine/include/riscv/arch-riscv.inc @@ -301,7 +301,13 @@ TUNE_ARCH = "${TUNE_RISCV_ARCH}" # Tunes that don't set it fall back to TUNE_RISCV_PKGARCH, which is built from # TUNE_FEATURES above, e.g.: # riscv32imac -RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or d.getVar('TUNE_RISCV_PKGARCH')}" +# However, TUNE_RISCV_PKGARCH grows with every extension the tune enables, so to +# keep build and sstate paths manageable, RISCVPKGARCH:tune- should be set +# for a custom tune. For TUNE_RISCV_PKGARCH longer than 64 characters, throw an +# error. +RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or \ + ('${TUNE_RISCV_PKGARCH}' if len('${TUNE_RISCV_PKGARCH}') <= 64 else \ + bb.fatal('The package arch for tune ${DEFAULTTUNE} would be ${TUNE_RISCV_PKGARCH}, which is longer than 64 characters. Set RISCVPKGARCH:tune-${DEFAULTTUNE} to a shorter name.'))}" TUNE_PKGARCH = "${RISCVPKGARCH}" # Misc settings From patchwork Wed Nov 18 20:48:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104804 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.611.1795034980495361060 for ; Wed, 18 Nov 2026 12:49:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=dO5YrleV; spf=pass (domain: baylibre.com, ip: 209.85.160.172, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-5430f70c827so20546791cf.2 for ; Wed, 18 Nov 2026 12:49:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034979; x=1795639779; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QpbuFl1AXRZi4YQKU00JiUYdEbHc8UFgUi0as2HnWWY=; b=dO5YrleVdhAZ6EyWzqDh5+vfzJ343htRKxSRpInBOO+m7uxsS8nXXs1JOS4D3oHFHB aA+Zp6QJuT+rvTHO2GXjJEnPaSHOfbt4BV4+TzqMy7iuWfISY2xAYgbaBLkCxQlLoN7K MjumBdmb8601k3wzWmrEP5cX0KUIcV+a3SiQLTiuTMBh8EJk8Fv51/eyGD/HxQax5lYh 3Wvo1d7xOCSV89YyNL6F6Rkly6vVY/ocnLjrZNb1HqdApOmEYs1IRDBtbUWrqpNJzKNT ZnmYVvE/H3JrVPUlBkndTY2f2ZjpAU86DaqAR0UeEb8OwbNtjTGAagh2K0FS2QJu86yL GMfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034979; x=1795639779; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=QpbuFl1AXRZi4YQKU00JiUYdEbHc8UFgUi0as2HnWWY=; b=2D6j2bHjGezYZGYBiQJx/nqzZ1RLtxni5Fm56sade22A/nBoPFSun9qvCC92mOly8t B+Uxb7pVnU2AR4AWXdC9svXshirY0HhnWS5CoKtuAIQUEEaFvRVd0Uyy4+V5c2JA/eaE PUcwmknQuslNoYWXBj/XcKO/3quC1I/aliM3oYiyRswDedOA0GHLvPcL8qpwSI+jrpZb X9oul8+hVTTbsBx9n3Ry+n4V8emEFmjuwvqitoaIBLrfVzzncQ6Iq+h/CPkys3EDPUh5 sQyjkhge9jO8zxKNo+9vWrVUOu6NcH4VcNj0CQWtBdJFJ1uCktcblAtMSt5Kta0Qh4Pa t0UA== X-Gm-Message-State: APuU4Z/CZFh/0T9Df+enSo91np/rmVLSvFnYZVxZMYTDlJcLBc+iYa5D 1u39dwYys49IZh+yPCp9r22pkTRxyCB5yk3tlR2JgnMpo11EnVhE/bTVf36o2ZHNhxyRRSTNidQ kXM1x X-Gm-Gg: AYBFou3xFtiZTdtXb12nWVUmzyNw9B04q7mvfS8xdvZf2JzvLo6PnAemVzZUBIdFsor lAaSKtuy6hSaH5RR6HE1Ub3Bp6Mm81WfMDc+qitXaV/0Er1j7yy7gc/khd0DVtIBmMk4tVAjkvS RpZj/S6YZKgv33v9kNLbGS9jcHMDm1UwEN5QZDSV+diziuexfJGxGT+1kaw/J6lZpigfUtyfTAy 2D0jm2hFsUugMs/75UAkULgQmr7hMkI3wkI2tfG2Vdnsj5ZH6xyys9dA1tXVipAnXBCMQ5vFB1d N04bCvaMVWba7FuMn2Gxuy+rqCCq+880zOtV2T8C1OJ2YnTh9ZYoeTHBZlrBVCNg6ahQJ4hKMc4 IpUay4ErDs4SBTRffU+LQWEpmRXDPlSgTy3agkBPTZhIFdBonNcnNaqw18o2EOFX/CxAWqkyGh/ RepjMAVIIGLXeoP06/gs8vxnlDp3/1ZG8lpg9WLT6DlbCstWEJxlxAgd3aNYNluNiFxzTAS11sX pnQnZre61kU7dtXnpyXPX83LGJdhTiWu3rFF5fnRTPrTRmMB6KkZ5MgJ65wBdY0WOZSZbMavFO9 uk9bxQPQAo1KD7pjJBNMwVchFkZCIOVVhG1UsdGQdkFy2uLnYU2GPQj9PGg+bGZyTh2cjpLdrbN Qy8Q5 X-Received: by 2002:a05:622a:2447:b0:55d:36a7:81c2 with SMTP id d75a77b69052e-55d5a2d1ef5mr61362851cf.5.1795034979306; Wed, 18 Nov 2026 12:49:39 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:38 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 10/12] lib/oeqa/selftest/cases/riscvtunes.py: add RISC-V tune selftests Date: Wed, 18 Nov 2026 15:48:51 -0500 Message-ID: <20261118204853.2155173-11-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250593 Add selftests for the RISC-V tunes in oe-core, covering: - Every tune in tune-riscv.inc has a package arch that's in PACKAGE_ARCHS - PACKAGE_EXTRA_ARCHS only lists package archs for tunes that each tune is a superset of, with its own coming last - Package archs for profile tunes and their '-march' and '-mabi' options - Existing tunes' package archs don't change - The 'riscv64' and 'riscv32' aliases match 'riscv64gc' and 'riscv32gc' respectively - Custom tunes that don't set RISCVPKGARCH:tune- fall back to TUNE_RISCV_PKGARCH, and error if they're too long - Custom tunes with unusual extension sets build, i.e. the compiler accepts their respective '-march', and the package arch works for build/sstate paths AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Trevor Gamblin --- meta/lib/oeqa/selftest/cases/riscvtunes.py | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 meta/lib/oeqa/selftest/cases/riscvtunes.py diff --git a/meta/lib/oeqa/selftest/cases/riscvtunes.py b/meta/lib/oeqa/selftest/cases/riscvtunes.py new file mode 100644 index 0000000000..daee22a51e --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/riscvtunes.py @@ -0,0 +1,148 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +from oe.tune import riscv_isa_to_tune +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars + +class RiscvTunesTests(OESelftestTestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.orig_machine = get_bb_var('MACHINE') + + def _machine_config(self, machine='qemuriscv64'): + # Builds set up by bitbake-setup select the machine with a builtin + # fragment, which is fatal alongside a MACHINE assignment, so drop it + return 'OE_FRAGMENTS:remove = "machine/%s"\nMACHINE = "%s"\n' % (self.orig_machine, machine) + + def test_riscv_default_tunes(self): + """ + Parse every RISC-V tune and check it yields a usable package arch, and + that PACKAGE_EXTRA_ARCHS only lists archs of other tunes whose + extensions are all available in this one. + """ + # Only variables are checked here, so the riscv32 tunes can use the same + # machine + self.write_config(self._machine_config()) + tunes = get_bb_var('AVAILTUNES').split() + + vars = {} + for tune in tunes: + self.write_config(self._machine_config() + 'DEFAULTTUNE = "%s"\n' % tune) + vars[tune] = get_bb_vars(['TUNE_FEATURES', 'TUNE_PKGARCH', 'PACKAGE_EXTRA_ARCHS', 'PACKAGE_ARCHS']) + + pkgarch_features = {v['TUNE_PKGARCH']: set(v['TUNE_FEATURES'].split()) for v in vars.values()} + + for tune, v in vars.items(): + with self.subTest(tune=tune): + self.assertTrue(v['TUNE_FEATURES'], 'empty TUNE_FEATURES') + self.assertTrue(v['TUNE_PKGARCH'], 'empty TUNE_PKGARCH') + self.assertIn(v['TUNE_PKGARCH'], v['PACKAGE_ARCHS'].split()) + + features = set(v['TUNE_FEATURES'].split()) + # za64rs is a stricter za128rs, which RVA20U64 requires + if 'za64rs' in features: + features.add('za128rs') + for arch in v['PACKAGE_EXTRA_ARCHS'].split(): + self.assertIn(arch, pkgarch_features, '%s is not the package arch of any tune' % arch) + self.assertLessEqual(pkgarch_features[arch], features, '%s needs extensions %s lacks' % (arch, tune)) + # The tune's own package arch has the highest priority + self.assertEqual(v['PACKAGE_EXTRA_ARCHS'].split()[-1], v['TUNE_PKGARCH']) + + # Profile tunes are named after the profile + for profile in ['rva20u64', 'rva22u64', 'rva23u64']: + with self.subTest(profile=profile): + self.assertEqual(vars[profile]['TUNE_PKGARCH'], profile + '_zifencei') + self.assertEqual(vars[profile]['TUNE_FEATURES'], riscv_isa_to_tune(profile) + ' zifencei') + + # The package archs of the existing tunes must not change + self.assertEqual(vars['riscv64gc']['TUNE_PKGARCH'], 'riscv64imafdc_zicsr_zifencei') + self.assertEqual(vars['riscv32gc']['TUNE_PKGARCH'], 'riscv32imafdc_zicsr_zifencei') + + # Legacy tune names behave exactly like the tunes they alias + for alias, target in [('riscv64', 'riscv64gc'), ('riscv32', 'riscv32gc')]: + with self.subTest(alias=alias): + self.assertIn(alias, tunes) + self.assertEqual(vars[alias], vars[target]) + + def test_riscv_profile_ccargs(self): + """ + Check the -march and -mabi options of the profile tunes. + """ + for profile in ['rva20u64', 'rva22u64', 'rva23u64']: + with self.subTest(profile=profile): + self.write_config(self._machine_config() + 'DEFAULTTUNE = "%s"\n' % profile) + ccargs = get_bb_var('TUNE_CCARGS').split() + self.assertIn('-mabi=lp64d', ccargs) + march = [a for a in ccargs if a.startswith('-march=')] + self.assertEqual(len(march), 1, ccargs) + exts = march[0][len('-march='):].split('_') + self.assertTrue(exts[0].startswith('rv64imafdc'), exts[0]) + # Every multi-letter extension of the profile is passed on + for f in riscv_isa_to_tune(profile).split() + ['zifencei']: + if len(f) > 1 and f not in ('rv', '64'): + self.assertIn(f, exts) + + def test_riscv_pkgarch_fallback(self): + """ + Check that custom tunes which don't set RISCVPKGARCH:tune- get + TUNE_RISCV_PKGARCH as their package arch, and that it's an error if + that is too long. + """ + def config(tune, features): + return self._machine_config() + \ + 'AVAILTUNES += "%s"\n' \ + 'TUNE_FEATURES:tune-%s = "%s"\n' \ + 'DEFAULTTUNE = "%s"\n' % (tune, tune, features, tune) + + self.write_config(config('rv64imac-zicond', riscv_isa_to_tune('rv64imac_zicond'))) + self.assertEqual(get_bb_var('TUNE_PKGARCH'), 'riscv64imac_zicond') + + self.write_config(config('rva22-zicond', riscv_isa_to_tune('rva22u64') + ' zicond')) + result = bitbake('-e', ignore_status=True) + self.assertNotEqual(result.status, 0) + self.assertIn('Set RISCVPKGARCH:tune-rva22-zicond to a shorter name', result.output) + + def test_riscv_unusual_tunes(self): + """ + Define custom tunes with unusual extension combinations, as a BSP + might, and check each one builds: the sanity checks accept the + package arch, gcc and binutils accept the -march string, and the + package arch works in the build and sstate paths. + """ + def profile(name, drop=None): + return ' '.join(f for f in riscv_isa_to_tune(name).split() if f != drop) + ' zifencei' + tunes = { + # no float (lp64 ABI), with bitmanip. Short enough to use the + # fallback package arch. + 'rv64-nofloat-bitmanip': riscv_isa_to_tune('rv64imac_zicsr_zifencei_zba_zbb_zbs'), + # no profile, scalar extensions on top of gc + 'rv64gc-scalar-extras': riscv_isa_to_tune('rv64gc_zicbom_zicboz_zicond_zfa_zfhmin'), + # profile plus vector crypto extensions + 'rva20-vector-crypto': profile('rva20u64') + ' v zvbb zvkt', + # a profile missing one extension + 'rva22-no-zkt': profile('rva22u64', 'zkt'), + # rva23u64 without the full vector extension + 'rva23-no-v': profile('rva23u64', 'v'), + } + + config = self._machine_config() + for tune, features in tunes.items(): + config += 'AVAILTUNES += "%s"\n' % tune + config += 'TUNE_FEATURES:tune-%s = "%s"\n' % (tune, features) + # The rest are too long for the fallback, so name them as a BSP + # would have to + if tune != 'rv64-nofloat-bitmanip': + config += 'RISCVPKGARCH:tune-%s = "%s"\n' % (tune, tune.replace('-', '_')) + config += 'PACKAGE_EXTRA_ARCHS:tune-%s = "${RISCVPKGARCH}"\n' % tune + + for tune in tunes: + with self.subTest(tune=tune): + self.write_config(config + 'DEFAULTTUNE = "%s"\n' % tune) + # small, and compiled with TUNE_CCARGS. It has no do_build, and + # populate_sysroot also writes an sstate object. + bitbake('libgcc-initial -c populate_sysroot') From patchwork Wed Nov 18 20:48:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104805 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.601.1795034982247255720 for ; Wed, 18 Nov 2026 12:49:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=cQA9BD1p; spf=pass (domain: baylibre.com, ip: 209.85.160.172, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-53644b28706so20672701cf.3 for ; Wed, 18 Nov 2026 12:49:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034981; x=1795639781; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=llNptmDc4hWntECWnVTSJZK16dFIG1YtE8mlD/TV02Q=; b=cQA9BD1pCLsGd6bN+3/DNVkvOcNzrqwkYQFNe4QjDenGSkuQUAdddw63qVNjmnjPIO t8Pei1rO8Au6I4pFdSE0O1V+UKRJkvDlq0XEbxzRgXGhqFsBc6cWcAThI0J4yCKS0Qbg AhwL12R4qNPVUSUCnrt9io/3ZJv0EnB0pp5A/VNlPsbjmNPro/JjEe3ef0vecM/TKHnM gY1bBJfS27dJ/JIw6FxLsLjR3/KABB1Tlv8sqehcAlKhK9BKxKc5L/W8cVgcBkRRRe12 2iJ0K7zZOU6SURqGeMgpxB2KosLn0z5A1CitOYyVkIlzZlBxF4HOJ92tVhAjPJp0exEE tdXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034981; x=1795639781; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=llNptmDc4hWntECWnVTSJZK16dFIG1YtE8mlD/TV02Q=; b=cSVhGEzemlRFd/vsB+vGoAXdJc1+hHh/T1SFiQGjRNIwGv/dIbMtdZPGRAQkj8y8I7 nXyNUoLz6YjcdrgxSg0zFpMsjdSGWdT/L7JEYLdnT3HmRTLKdcg+7RSbyL/Cd2ynVsjT j5C7VrDunkQevnj2GCBQenzCT5MSLIV4zYWAYCgj8ps6KbjAtrZMtTHofb20JaCPv2xn d4WFGEWSX8z8IesPVJ02qnEfXGmHuorxv89PbKpMX0koLizqMt01DQbBJkx76TJly1n1 USztPb6OJQywq1gfKZWMPK3jufLZWpKQjfTibV+ZxMayZrp+Me5exkS2wdAcfCGrK6wa wYcg== X-Gm-Message-State: APuU4Z9Lm9F1oqNbRZxXxIko6x/2llbZIAvYURLW0jTVazZmB1eIA5v+ KuzK/FhSxKKvROMmvNCzXGG9IEvxUBZtMqg15AYwy/JDsesVv7o7fzpfrxxYyD0k6gB8Ju6vhjC odxyn X-Gm-Gg: AYBFou3f2IivwnqhK3Hd7ZJGNeurj7wz2jcwpgi4J+D5n7op/mHZD049UjT0YxltoB4 wddlEiSG8SWiLkWTLrqou8i0OLDbkIt0jnutKpuVnEDGD1h83/hWijPPk4Iz1Kxwo0lGdPWIQDX CjFT02bC/PDi0xbax2jkVyMKar7j2zY1XOs4gLDUaWQ30j1G4Njq/Anu9+LTNaADYbq84lPNFvc EdYVWLW295lZxfd+OwS94/j2Z7RYoyl6fYzZUX+AVKgd61WAnIvr90EhLybjDXE8u04cKAy3mdD /V0U+6NgET/24SIYvMEdYVmPGzfSmlVzgfSNgzXzECJOPsMYFPnzrlHz/9xhSpcwh7g/ydLg9SA Y9RVAG5+iLzsiWtfi4bUdbUSHQwF6B4dbe1OjMuqNDwUmr/u6wdOB2IG1Mo2zz3u7lS4YWw0mIi +8VZQYzOw74TCtHdIQuvwOOHvtDMUgyvlI5Cq81CwCyYVsKQtlXPKdkPk125UbVOmpBt8/eYaAD xuT0MaQjQYJLN28PzOHqgfyiBWmTOIbYuQO+qVo/xRViKnJiOh9rhaY1SOgX1MW0spd0uIquXIl WXv7IqtJNWy6Tqbc8aF1LF11D7rQ6xAyZrh54iNRFqJsZqmqGI8zL0y1avDwKyk7wMHY8fWbFDs XUWOWYw== X-Received: by 2002:a05:622a:418a:b0:536:72b4:b84a with SMTP id d75a77b69052e-55d5a5d835bmr63457561cf.42.1795034981179; Wed, 18 Nov 2026 12:49:41 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:40 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 11/12] rust-target-config.bbclass: pass on all RISC-V extensions to LLVM Date: Wed, 18 Nov 2026 15:48:52 -0500 Message-ID: <20261118204853.2155173-12-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250594 llvm_features_from_tune() doesn't pass on all RISC-V extensions listed in TUNE_FEATURES, but rather has a fixed subset listed, and ignores others. This means that with new profiles and custom tunes, Rust code still gets compiled for riscv64gc plus a handful of extras. LLVM's RISC-V extension names match those we use for TUNE_FEATURES, so we can instead pass on each extension in the same order. Signed-off-by: Trevor Gamblin --- .../classes-recipe/rust-target-config.bbclass | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass index 2faecd55f9..89fbd19374 100644 --- a/meta/classes-recipe/rust-target-config.bbclass +++ b/meta/classes-recipe/rust-target-config.bbclass @@ -83,32 +83,14 @@ def llvm_features_from_tune(d): if 'cortexa57' in feat: f.append("+v8a") if 'rv' in feat: - if 'm' in feat: - f.append("+m") - if 'a' in feat: - f.append("+a") - if 'f' in feat: - f.append("+f") - if 'd' in feat: - f.append("+d") - if 'c' in feat: - f.append("+c") - if 'v' in feat: - f.append("+v") - if 'zicbom' in feat: - f.append("+zicbom") - if 'zicsr' in feat: - f.append("+zicsr") - if 'zifencei' in feat: - f.append("+zifencei") - if 'zba' in feat: - f.append("+zba") - if 'zbb' in feat: - f.append("+zbb") - if 'zbc' in feat: - f.append("+zbc") - if 'zbs' in feat: - f.append("+zbs") + # LLVM uses the same names as TUNE_FEATURES for RISC-V extensions, so + # pass on every single-letter (except the base i) and z, s or x + # extension, in TUNE_FEATURES order to keep the result stable. Other + # tune flags (e.g. "rv", "64" or core names) aren't extensions. + for e in dict.fromkeys(d.getVar('TUNE_FEATURES').split()): + if (len(e) == 1 and e.isalpha() and e != 'i') or \ + (len(e) > 1 and e[0] in 'zsx' and e.isalnum()): + f.append("+" + e) return f llvm_features_from_tune[vardepvalue] = "${@llvm_features_from_tune(d)}" From patchwork Wed Nov 18 20:48:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 104806 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.612.1795034983958883527 for ; Wed, 18 Nov 2026 12:49:44 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@baylibre.com header.s=google header.b=JM4ijkHB; spf=pass (domain: baylibre.com, ip: 209.85.160.173, mailfrom: tgamblin@baylibre.com) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-55d360ca878so11410251cf.2 for ; Wed, 18 Nov 2026 12:49:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1795034983; x=1795639783; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=L7JkTliFzS5WvPJhDVP5EAgraUaPezqqRb0XRZ+in6E=; b=JM4ijkHBiByBHbUD78bFUAS4Htmq/k/qRpoZSTfb9S3guMEZj4mcYsa9yKXqa0dFCx Ccez8j+u9FlTCcY32acQKCHPjEXhJbYacCYBoD1KNFvCfTGJJH/oRJ+/cdKWdql12gLE SIUtw22oDdmloLLeIhOudCmSfkLvAq2McE6JtEKkTXIkHWl0SYI6IEFVuOYex5GIbbXC ZyhuMceaYoIKtH//D7Yimw/BnzPmZeV8Ado1UBvjh9LlIy5ZoQWbGKuoLFA5KFPZlFtt 7Ku04shlKONPSO5vdLlGQLTbMqG1UhgDw4GYL4xAF1u6DjT8+TPBNJcCYa5DXInvPPXH ajCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795034983; x=1795639783; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=L7JkTliFzS5WvPJhDVP5EAgraUaPezqqRb0XRZ+in6E=; b=Rb1/nzqXswo0PyHeJ2daWFHD/r9OfqFnP2mSO4HbdtiUnnPsls39vVAytGJZeiN2QM xcsuUnuFwb+8nh+AcMsXPzypixKX8SsQ02YHW0GryIS+D6c4Zv1nEepT3DG5aWMwSveQ QmibQ2rLTmBgxWJDLcht3fiOfxQbaTCsv+s2sIwdcEThWHDpku7i/4r8h0tJT78B0NKs 0N7HzcVQ3u7K4nRL3xSxHV+jyhJE7JJOhRawAqKYbQLIgJjU1UEO1Xbj9rew+YnpL6YD 3bhU608yDdcDiftKcZqdhldYeiY4RaeLhHgIHER/5e86WrfnKHkspC7PBTVnQb09cVq7 52eA== X-Gm-Message-State: APuU4Z84lBB9YXKnDbaDslMF0MVETW+HfiP4169SimwitIBJLNPRDDi/ fKV5988Jx6wEJBiFpzdaGXE1Nq+KI2aypza4TTpKI3su69I/wQBa9HqekbPC0hRarpnw+54lgQj fLUxw X-Gm-Gg: AYBFou2EKC8x/NIC0jfBACR5j0187gLwk9uZAfUjas2WSbjk0YyucJ7Uw5PAdhn9q+k 1+4BrpqAI2G0OfToPlxgLvywP4TTkCiQS88sTvHK84usAXYwNVeVcydpwUEP+LTlcTSK6KcoxBY svL/k73ZzGF1WAWE4UECtJDC1+goVas8/OVcJZ6BGnEvYTozPDvgBnrHWaqU16AY+KJhfmzLplv oS8eXDLo3Nz/peXE/CfHSHR5iyyUL3KvwGVOGiAX1QyZrZgklB5qVDL2drVkGceToNG9nYwS/Gn opBLmfwt/VSamQd5ne6gnNXOAGsnMztms8sONjBKLyi/3yjr3hQp9ibInlVZNJykUXV8kh4+Tx5 VZQCqNzvZwKoNzQg9CmnbG3N7WkFZIzZuCcQ2YNIGYsrIz4eoiUQiQoZhdo1tyrgSafJsXZCYqt f+r1zeBtEr1AT26Qip7lCDzxnDIrO6k2W9293DoO8nkdcyv0+hXXzfi0YolyQVi7ISMij9wMd8c y/qO2tYKNE7W2Km55OrpGmn14GiSm5/C0Z2N/vpHyuGOMaQ57EUcvCpHBV1k0CerwZXTa3cAVRu T/0NHbM3noD7ksuYhEPZbL9YmgZKwakye1gZhhIca1+L2uM2Gklr3WzoR4ofMTQCM0rA/U1euQy iD+Vj X-Received: by 2002:a05:622a:647:b0:55c:cdb4:9e73 with SMTP id d75a77b69052e-55d5a6333cbmr62065561cf.48.1795034982769; Wed, 18 Nov 2026 12:49:42 -0800 (PST) Return-Path: Received: from megalith.cgocable.net ([2001:1970:3847:e000:e8bd:ca0f:c232:9f10]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66bca072sm8637541cf.17.2026.11.18.12.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 12:49:41 -0800 (PST) From: Trevor Gamblin To: openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com, mark.hatle@kernel.crashing.org, paul@pbarker.dev Subject: [OE-core][PATCH 12/12] lib/oeqa/selftest/cases/riscvtunes.py: test Rust target features Date: Wed, 18 Nov 2026 15:48:53 -0500 Message-ID: <20261118204853.2155173-13-tgamblin@baylibre.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118204853.2155173-1-tgamblin@baylibre.com> References: <20261118204853.2155173-1-tgamblin@baylibre.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 18 Nov 2026 20:49:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/250595 Add test_riscv_rust_target_features(), which generates the Rust target spec for hello-rs with the 'riscv64gc' and 'rva23u64' tunes, then checks that its 'features' pass each extension in TUNE_FEATURES to LLVM in order. Also check that riscv64gc's feature set remains unchanged. AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Trevor Gamblin --- meta/lib/oeqa/selftest/cases/riscvtunes.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/riscvtunes.py b/meta/lib/oeqa/selftest/cases/riscvtunes.py index daee22a51e..b2ff2cc739 100644 --- a/meta/lib/oeqa/selftest/cases/riscvtunes.py +++ b/meta/lib/oeqa/selftest/cases/riscvtunes.py @@ -4,6 +4,9 @@ # SPDX-License-Identifier: MIT # +import json +import os + from oe.tune import riscv_isa_to_tune from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars @@ -146,3 +149,26 @@ class RiscvTunesTests(OESelftestTestCase): # small, and compiled with TUNE_CCARGS. It has no do_build, and # populate_sysroot also writes an sstate object. bitbake('libgcc-initial -c populate_sysroot') + + def test_riscv_rust_target_features(self): + """ + Check that the Rust target spec passes every extension in the tune's + TUNE_FEATURES on to LLVM, in TUNE_FEATURES order. + """ + for tune in ['riscv64gc', 'rva23u64']: + with self.subTest(tune=tune): + self.write_config(self._machine_config() + 'DEFAULTTUNE = "%s"\n' % tune) + # hello-rs is a small cargo recipe in meta-selftest, and + # do_rust_gen_targets runs right after do_patch, so neither + # the toolchain nor Rust has to be built + bitbake('hello-rs -c rust_gen_targets') + v = get_bb_vars(['WORKDIR', 'RUST_TARGET_SYS', 'TUNE_FEATURES'], 'hello-rs') + with open(os.path.join(v['WORKDIR'], 'rust-targets', v['RUST_TARGET_SYS'] + '.json')) as f: + features = json.load(f)['features'].split(',') + + # Everything but the base ISA and its width + expected = ['+' + e for e in v['TUNE_FEATURES'].split() if e not in ('rv', '64', 'i')] + self.assertEqual(features, expected) + if tune == 'riscv64gc': + # The features of the existing tunes must not change + self.assertEqual(features, ['+m', '+a', '+f', '+d', '+c', '+zicsr', '+zifencei'])