Skip to contentSkip to conversation

kernel: only add the rocket NPU fragment on rk3588s

PATCH In review Trevor Woerner 2 participants 6 messages Nov 27 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kernel: only add the rocket NPU fragment on rk3588s

The fragment was appended for every rockchip machine, so setting ENABLE_UPSTREAM_RKNPU made the kernel config audit warn on all the
others: the driver only supports RK3588's NPU, and on 32-bit machines it cannot be enabled at all. Use the rk3588s override, as the mesa PACKAGECONFIG already does.

Cc: Quentin Schulz <[email protected]>
AI-Generated: codex/claude-opus 5.5 (xhigh)

---
 recipes-kernel/linux/linux-rockchip.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-kernel/linux/linux-rockchip.inc +1 -1
index f91492ee7968..006d9f0ecf14 100644
@@ -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:rk3588s = "${@' bsp/rockchip/rocket-npu.scc' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
#1 lore raw

PATCH 2/2 kernel: build the rocket NPU driver as a module

DRM_ACCEL_ROCKET depends on DRM, which the arm64 defconfig builds as a module, so the fragment's =y always ended up as =m and the kernel config audit warned about the mismatch. Ask for =m.

Cc: Quentin Schulz <[email protected]>
AI-Generated: codex/claude-opus 5.5 (xhigh)

---
 .../linux-rockchip/rockchip-kmeta/bsp/rockchip/rocket-npu.cfg   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-kernel/linux/linux-rockchip/rockchip-kmeta/bsp/rockchip/rocket-npu.cfg +1 -1
index 9f6af63928c6..18dcdc469904 100644
@@ -1,2 +1,2 @@
 CONFIG_DRM_ACCEL=y
-CONFIG_DRM_ACCEL_ROCKET=y
+CONFIG_DRM_ACCEL_ROCKET=m
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
#3 lore raw
In reply to Trevor Woerner

Hi Trevor,

Quoted 1 line · Trevor Woerner

The fragment was appended for every rockchip machine, so setting

No? It's clearly only added when you set ENABLE_UPSTREAM_RKNPU boolean. Don't set it for SoCs that don't support it?

Quoted 5 lines

ENABLE_UPSTREAM_RKNPU made the kernel config audit warn on all the
others: the driver only supports RK3588's NPU, and on 32-bit machines it cannot be enabled at all. Use the rk3588s override, as the mesa PACKAGECONFIG already does.

Mesa probably should be using :rockchip as well. The knob is enough. Otherwise every time there'll be a new SoC supported by Rocket, we'll need to enable ENABLE_UPSTREAM_RKNPU (or document it's supported) in the SoC .inc file, then update linux-rockchip.inc as well as mesa.bbappend to add an SoC-specific override, which is totally unnecessary.

The same logic applies to the stateless VPU for example (c.f. ENABLE_STATELESS_VPU_GST). We probably also should have a kernel config fragment to enable the appropriate stateless video codecs in the kernel (hantro, rkvdec, rkvdec2, ...).

Quoted 17 lines

Cc: Quentin Schulz <[email protected]>
AI-Generated: codex/claude-opus 5.5 (xhigh)

---
  recipes-kernel/linux/linux-rockchip.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
recipes-kernel/linux/linux-rockchip.inc +1 -1
index f91492ee7968..006d9f0ecf14 100644
@@ -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:rk3588s = "${@' bsp/rockchip/rocket-npu.scc' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
Reviewed-by on v1 2/2
#2 lore raw

Re: [meta-rockchip][PATCH 2/2] kernel: build the rocket NPU driver as a module

In reply to Trevor Woerner
Quoted 7 lines · Trevor Woerner

DRM_ACCEL_ROCKET depends on DRM, which the arm64 defconfig builds as a module, so the fragment's =y always ended up as =m and the kernel config audit warned about the mismatch. Ask for =m.

Cc: Quentin Schulz <[email protected]>
AI-Generated: codex/claude-opus 5.5 (xhigh)

Thanks!
Quentin

#4 lore raw
In reply to Quentin Schulz
Quoted 7 lines · Quentin Schulz

Hi Trevor,

Quoted 1 line · Trevor Woerner

The fragment was appended for every rockchip machine, so setting

No? It's clearly only added when you set ENABLE_UPSTREAM_RKNPU boolean. Don't set it for SoCs that don't support it?

I just performed a build test where I set

ENABLE_UPSTREAM_RKNPU = "1"

in conf/local.conf then build for every MACHINE in meta-rockchip. All of them show either:

WARNING: linux-yocto-7.2.15+git-r0 do_kernel_configcheck: [kernel config]: specified values did not make it into the kernel's final configuration:

[NOTE]: 'CONFIG_DRM_ACCEL_ROCKET' last val (y) and .config val (n) do not match [INFO]: CONFIG_DRM_ACCEL_ROCKET : n
[INFO]: raw config text:

config DRM_ACCEL_ROCKET
tristate "Rocket (support for Rockchip NPUs)"
select DRM_SCHED
select DRM_GEM_SHMEM_HELPER
depends on DRM_ACCEL && ((ARCH_ROCKCHIP && ARM64) || COMPILE_TEST) && (ROCKCHIP_IOMMU || COMPILE_TEST) && MMU && DRM help
Choose this option if you have a Rockchip SoC that contains a
compatible Neural Processing Unit (NPU), such as the RK3588. Called by
Rockchip either RKNN or RKNPU, it accelerates inference of neural
networks.

The interface exposed to userspace is described in include/uapi/drm/rocket_accel.h and is used by the Rocket userspace driver in Mesa3D.

If unsure, say N.

To compile this driver as a module, choose M here: the module will be called rocket.

Config 'DRM_ACCEL_ROCKET' has the following Direct dependencies (DRM_ACCEL_ROCKET=n):
DRM_ACCEL(=y) && (ARCH_ROCKCHIP(=y) && ARM64(undefined/n)) || COMPILE_TEST(=n) (=n) && ROCKCHIP_IOMMU(=y) || COMPILE_TEST(=n) (=y) && MMU(=y) && DRM(=y)
Parent dependencies are:
ARCH_ROCKCHIP [y] MMU [y] DRM_ACCEL [y] COMPILE_TEST [n] DRM [y] ROCKCHIP_IOMMU [y] ARM64 [ARM64]
[INFO]: config 'CONFIG_DRM_ACCEL_ROCKET' was set, but it wasn't assignable, check (parent) dependencies

for the 32-bit MACHINEs or

WARNING: linux-yocto-7.2.15+git-r0 do_kernel_configcheck: [kernel config]: specified values did not make it into the kernel's final configuration:

[NOTE]: 'CONFIG_DRM_ACCEL_ROCKET' last val (y) and .config val (m) do not match [INFO]: CONFIG_DRM_ACCEL_ROCKET : m ## .config: 5561 :configs//bsp/rockchip/rocket-npu.cfg (y) [INFO]: raw config text:

config DRM_ACCEL_ROCKET
tristate "Rocket (support for Rockchip NPUs)"
select DRM_SCHED
select DRM_GEM_SHMEM_HELPER
depends on DRM_ACCEL && ((ARCH_ROCKCHIP && ARM64) || COMPILE_TEST) && (ROCKCHIP_IOMMU || COMPILE_TEST) && MMU && DRM help
Choose this option if you have a Rockchip SoC that contains a
compatible Neural Processing Unit (NPU), such as the RK3588. Called by
Rockchip either RKNN or RKNPU, it accelerates inference of neural
networks.

The interface exposed to userspace is described in include/uapi/drm/rocket_accel.h and is used by the Rocket userspace driver in Mesa3D.

If unsure, say N.

To compile this driver as a module, choose M here: the module will be called rocket.

Config 'DRM_ACCEL_ROCKET' has the following Direct dependencies (DRM_ACCEL_ROCKET=m):
DRM_ACCEL(=y) && (ARCH_ROCKCHIP(=y) && ARM64(=y)) || COMPILE_TEST(=n) (=y) && ROCKCHIP_IOMMU(=y) || COMPILE_TEST(=n) (=y) && MMU(=y) && DRM(=m)
Parent dependencies are:
MMU [y] ARCH_ROCKCHIP [y] COMPILE_TEST [n] DRM [m] ROCKCHIP_IOMMU [y] ARM64 [y] DRM_ACCEL [y]

for the 64-bit ones.

Quoted 35 lines
Quoted 5 lines

ENABLE_UPSTREAM_RKNPU made the kernel config audit warn on all the
others: the driver only supports RK3588's NPU, and on 32-bit machines it cannot be enabled at all. Use the rk3588s override, as the mesa PACKAGECONFIG already does.

Mesa probably should be using :rockchip as well. The knob is enough. Otherwise every time there'll be a new SoC supported by Rocket, we'll need to enable ENABLE_UPSTREAM_RKNPU (or document it's supported) in the SoC .inc file, then update linux-rockchip.inc as well as mesa.bbappend to add an SoC-specific override, which is totally unnecessary.

The same logic applies to the stateless VPU for example (c.f. ENABLE_STATELESS_VPU_GST). We probably also should have a kernel config fragment to enable the appropriate stateless video codecs in the kernel (hantro, rkvdec, rkvdec2, ...).

Quoted 17 lines

Cc: Quentin Schulz <[email protected]>
AI-Generated: codex/claude-opus 5.5 (xhigh)

---
  recipes-kernel/linux/linux-rockchip.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
recipes-kernel/linux/linux-rockchip.inc +1 -1
index f91492ee7968..006d9f0ecf14 100644
@@ -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:rk3588s = "${@' bsp/rockchip/rocket-npu.scc' if bb.utils.to_boolean(d.getVar('ENABLE_UPSTREAM_RKNPU'), False) else ''}"
#5 lore raw
Quoted 6 lines · Trevor Woerner via yocto-patches
Quoted 5 lines · Quentin Schulz

Hi Trevor,

Quoted 1 line · Trevor Woerner

The fragment was appended for every rockchip machine, so setting

Quoted 8 lines
Quoted 2 lines

No? It's clearly only added when you set ENABLE_UPSTREAM_RKNPU boolean. Don't set it for SoCs that don't support it?

I just performed a build test where I set

ENABLE_UPSTREAM_RKNPU = "1"

in conf/local.conf then build for every MACHINE in meta-rockchip. All of

Why would you do that? We clearly specify that ENABLE_UPSTREAM_RKNPU is only supported by RK3588, so its place is in a machine conf for an RK3588-based machine? Anything else is unsupported.

If you really want to use local.conf for that (why?), then use ENABLE_UPSTREAM_RKNPU:rk3588s = "1"?

Cheers,
Quentin