From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Cc: Quentin Schulz <quentin.schulz@cherry.de>
Subject: [meta-rockchip][PATCH v2] rknpu: gate the NPU support on a machine feature
Date: Tue, 1 Dec 2026 06:47:24 -0500 [thread overview]
Message-ID: <20261201114724.2719940-1-twoerner@gmail.com> (raw)
In-Reply-To: <20261127114049.3566943-1-twoerner@gmail.com>
ENABLE_UPSTREAM_RKNPU added the NPU kernel fragment on every rockchip
machine, so setting it for a multi-machine build made the kernel config
audit warn on all those whose NPU the driver does not support.
The RK3588(S) include now declares an "rknpu" machine feature, which
becomes a machine override under which the kernel and mesa additions
apply. The knob is then safe to set in local.conf, a board can opt out
with MACHINE_FEATURES:remove, and supporting another SoC only needs the
feature added to its include.
Cc: Quentin Schulz <quentin.schulz@cherry.de>
AI-Generated: codex/claude-opus 5.5 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v2:
- replace the rk3588s override with an "rknpu" machine feature, so
neither the kernel nor the mesa line names an SoC; v1 was "kernel:
only add the rocket NPU fragment on rk3588s"
- document in the README that the knob may go in local.conf
---
README | 7 +++++++
conf/machine/include/rk3588s.inc | 3 +++
conf/machine/include/rockchip-defaults.inc | 2 ++
recipes-graphics/mesa/mesa.bbappend | 2 +-
recipes-kernel/linux/linux-rockchip.inc | 2 +-
5 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/README b/README
index 6d9db9b31e6e..3e4c94044235 100644
--- a/README
+++ b/README
@@ -234,6 +234,13 @@ Notes:
ENABLE_UPSTREAM_RKNPU = "1"
+ in the configuration (e.g. conf/local.conf). It only takes effect on
+ machines whose MACHINE_FEATURES contain "rknpu", which the RK3588(S)
+ include sets, so it is safe to set for a multi-machine build. A board
+ whose Device Tree does not declare the NPU can opt out with:
+
+ MACHINE_FEATURES:remove = "rknpu"
+
This requires a kernel driver (CONFIG_DRM_ACCEL_ROCKET, v6.18+) and
RKNN Device Tree nodes
(e.g. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=640366d644b1e282771a09c72be37162b6eda438).
diff --git a/conf/machine/include/rk3588s.inc b/conf/machine/include/rk3588s.inc
index 18c2fb2ecef8..a972cd61247e 100644
--- a/conf/machine/include/rk3588s.inc
+++ b/conf/machine/include/rk3588s.inc
@@ -20,3 +20,6 @@ TFA_PLATFORM = "rk3588"
TFA_BUILD_TARGET = "bl31"
ENABLE_STATELESS_VPU_GST ?= "1"
+
+# NPU supported by the upstream Rocket driver (see ENABLE_UPSTREAM_RKNPU)
+MACHINE_FEATURES += "rknpu"
diff --git a/conf/machine/include/rockchip-defaults.inc b/conf/machine/include/rockchip-defaults.inc
index 9a5cf3a4cdc7..59773ec2360c 100644
--- a/conf/machine/include/rockchip-defaults.inc
+++ b/conf/machine/include/rockchip-defaults.inc
@@ -1,6 +1,8 @@
# meta-rockchip default settings
MACHINEOVERRIDES =. "${@bb.utils.contains('ROCKCHIP_CLOSED_TPL', '1', 'closed-tpl:', '', d)}"
MACHINEOVERRIDES =. "rockchip:"
+# 'rknpu' marks an NPU supported by the upstream Rocket driver
+MACHINEOVERRIDES .= "${@bb.utils.contains('MACHINE_FEATURES', 'rknpu', ':rknpu', '', d)}"
# kernel
# RK_KERNEL_FITIMAGE needs to be set before the next "require ..."
diff --git a/recipes-graphics/mesa/mesa.bbappend b/recipes-graphics/mesa/mesa.bbappend
index 362eced535f9..3c1134b57539 100644
--- a/recipes-graphics/mesa/mesa.bbappend
+++ b/recipes-graphics/mesa/mesa.bbappend
@@ -12,7 +12,7 @@ PACKAGECONFIG:append:rockchip = "${@bb.utils.contains('MALI_DRIVER', 'panfrost',
# Enable teflon for upstream RKNPU/rocket support
# Requires CONFIG_DRM_ACCEL_ROCKET in Linux kernel to actually work
-PACKAGECONFIG:append:rk3588s = "${@' teflon rocket' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
+PACKAGECONFIG:append:rknpu = "${@' teflon rocket' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
# Mali Gen10 (Valhall, supported by Panthor) requires a firmware blob
RRECOMMENDS:mesa-megadriver:append:rk3588s = " linux-firmware-mali-csffw-arch108"
diff --git a/recipes-kernel/linux/linux-rockchip.inc b/recipes-kernel/linux/linux-rockchip.inc
index f91492ee7968..cba82aa1c886 100644
--- a/recipes-kernel/linux/linux-rockchip.inc
+++ b/recipes-kernel/linux/linux-rockchip.inc
@@ -37,4 +37,4 @@ SRC_URI:append:nanopi-r4s = " file://realtek-r8169.cfg"
KERNEL_FEATURES:append:rockchip = " bsp/rockchip/lttng.scc"
KERNEL_FEATURES:append:rockchip:arm = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
KERNEL_FEATURES:append:rockchip:aarch64 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
-KERNEL_FEATURES:append:rockchip = "${@' bsp/rockchip/rocket-npu.scc' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
+KERNEL_FEATURES:append:rknpu = "${@' bsp/rockchip/rocket-npu.scc' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
--
2.50.0.173.g8b6f19ccfc3a
prev parent reply other threads:[~2026-12-01 11:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 11:40 [meta-rockchip][PATCH 1/2] kernel: only add the rocket NPU fragment on rk3588s Trevor Woerner
2026-11-27 11:40 ` [meta-rockchip][PATCH 2/2] kernel: build the rocket NPU driver as a module Trevor Woerner
2026-11-27 12:03 ` Quentin Schulz
2026-12-01 11:49 ` Trevor Woerner
2026-11-27 11:52 ` [meta-rockchip][PATCH 1/2] kernel: only add the rocket NPU fragment on rk3588s Quentin Schulz
2026-11-27 12:11 ` Trevor Woerner
2026-11-27 12:32 ` [yocto-patches] " Quentin Schulz
2026-12-01 11:47 ` Trevor Woerner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201114724.2719940-1-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=quentin.schulz@cherry.de \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.