From patchwork Tue Dec 1 11:47:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Woerner X-Patchwork-Id: 106781 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.9090.1796125648581162408 for ; Tue, 01 Dec 2026 03:47:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=aegPvTy/; spf=pass (domain: gmail.com, ip: 209.85.222.170, mailfrom: twoerner@gmail.com) Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-949589c1495so1055518185a.3 for ; Tue, 01 Dec 2026 03:47:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796125647; x=1796730447; darn=lists.yoctoproject.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=VcZbNRnpW2KNIDN5lX/z7SZ6XU2g1HefMs7TG3d40C0=; b=aegPvTy/Zo50kgHJNArEKoklRneBkHbp3dg+UXoEE3jrHp9CM1h2prvoYs8pnriouW T9IdtBlxAlzj4O12ygho4+Y5HNLER6TD+hGjpGtWF7H3PV0jPFFH2eUmdlkpSbgXiGx2 63B7gGufcLx6mIjWexnIgfw4erRd5GnpwGITwnGY5bA9l57TJH9LX+j4AxyMdNJwo6Je s8cFCXUnDmCvl1cG+sX/LTowfdQ8ENJBIkq0O2MaAGwDGKUEXvtZdRUtrdgS5QUrMqbT 5Y7ENVls4IsECsXHdts2xAP6YcZtABcXpdf3zmgOBE08PhJc+Inbk3iGlXr7nz3qPJaI tURQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796125647; x=1796730447; 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=VcZbNRnpW2KNIDN5lX/z7SZ6XU2g1HefMs7TG3d40C0=; b=2G9hfTba+UtMnSCKhXVBvqKJwOu5571H08/JpSnWbWXoK4gerpE2NSVsaGy53pkyvC Tssk2Cd/rx5y3ktLOyv00ECK7LbpUa5+6Lxz9CKzdrZMuhI3HdIv1nbMgQCXl/RdLTwH W5KHBZzRs1H6WKEhCE47bH6zwecX67MZtbXuwyDwrKwUnPoc2GZg2ecTYh9SwXZT+Opd GwryIu1hnpA7LDS19FKEphTS8h9n8mcewoE4X+haLQAE5dEoggKql6qpRoc46sgIghOf x0JdTsTPaRdugHKW1d3hfGTKPsbxm60icc/x3JfIK1MpCFqsmF2Qud+QyfJeaGAtNmgN 5SQA== X-Gm-Message-State: APuU4Z8FiCsOPFugXpdXr91ZuIs25Gw/BUE8hYEn56URtM9mJ8vQD7ZF TT6QRzYwWqj3o3wLHyHi7Qxitj24HuvyYDF2P0LllOcCP9uZXTlbkzXoMNhlFQ== X-Gm-Gg: AZFdTZccg7FAQW1vN2fYKCc3RQdHIvAaUdjpsMvSLAUNRxfsV0HlWjMsdcdK4orf1Y4 guA6wW8S4easTQs5BdjmQayp45nZAZycO/pqtSXHkV5OaQ+dN5DXJNs62w4ju2fJahppcDIjq7x AELUdCUIpCSC/dQvOYYtJURXvDe+17FPOx50NyQiVAdeKYtAXIDqjnqbRPmiqMvUbcVfPDjGGuv IRko5rdt0AbMLexG72R4obK+XbGksxJeAQFYaOiJp7VhWQrfxnQpLqoe9J8KE8BYGDiIGRH9Nib tTXspDXTMKkZ7E8z3UNj5lx1z20epPr7a2he+V26VY/KEHOJz1kWT9lQw9tyGp4EOWhNlUx5qF7 e94lKyNm7zrnOejWlVCfuGFTH5Z4Od+DemgkvQmx4aTtZ9ECd5tBbe9AvfVUQYf3WcDZVm+827k YMXQVXE80wJ55OXeW1pLf9hWGwMJdiVmicohKz0iZS9SsxHwzJ8cPoOvwNh+t8TgT6TwqHyFVea h1eEw3+/j3aMNQKS2fwuC4HBTrdyfpiEbwnSZ2/seaeuVDyQ0JN+UU/OFjKIGxA5Av8Uxi/iUDi KKdYYXW+8oVtfAxIF8pO5oSxFXQWcz52L5qe8vSO3p+4U6HSCvAeZNL5/bNqB8QKmrKLkPyR+Xv /qxhJUVEcObgIEBK2c/IEWv6EuAVp0xA= X-Received: by 2002:a05:620a:460d:b0:93f:4d4e:ff6b with SMTP id af79cd13be357-949ba81a543mr6580543885a.12.1796125647423; Tue, 01 Dec 2026 03:47:27 -0800 (PST) Return-Path: Received: from localhost.localdomain (pppoe-209-91-167-254.vianet.ca. [209.91.167.254]) by smtp.gmail.com with ESMTPSA id af79cd13be357-949bb427388sm2791510885a.42.2026.12.01.03.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 03:47:26 -0800 (PST) From: Trevor Woerner To: yocto-patches@lists.yoctoproject.org Cc: Quentin Schulz Subject: [meta-rockchip][PATCH v2] rknpu: gate the NPU support on a machine feature Date: Tue, 1 Dec 2026 06:47:24 -0500 Message-ID: <20261201114724.2719940-1-twoerner@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20261127114049.3566943-1-twoerner@gmail.com> References: <20261127114049.3566943-1-twoerner@gmail.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 ; Tue, 01 Dec 2026 11:47:35 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5642 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 AI-Generated: codex/claude-opus 5.5 (xhigh) Signed-off-by: Trevor Woerner --- 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 ''}"