Skip to content

drm/img-rogue: allow building as a module & fix BUG on unload - #150

Open
OOHehir wants to merge 2 commits into
starfive-tech:JH7110_VisionFive2_6.12.y_develfrom
OOHehir:jh7110-pvr-module
Open

OOHehir wants to merge 2 commits into
starfive-tech:JH7110_VisionFive2_6.12.y_develfrom
OOHehir:jh7110-pvr-module

Conversation

@OOHehir

@OOHehir OOHehir commented Oct 12, 2026

Copy link
Copy Markdown

What

Two commits on JH7110_VisionFive2_6.12.y_devel:

  1. DRM_IMG_ROGUE becomes tristate, so pvrsrvkm can be built as a module. Andreas Cord-Landwehr's patch, carried in meta-riscv (the Yocto BSP layer for VisionFive 2) since 2023.
  2. A fix for the kernel BUG this exposes on module unload.

Why

Built as a module, pvr_exit() calls pvr_devices_unregister(), which starts with BUG_ON(!pvr_devices). pvr_init() no longer calls pvr_devices_register(), as the GPU comes from the device tree, so pvr_devices is always NULL & every unload panics:

kernel BUG at .../services/server/env/linux/pvr_platform_drv.c:156!
epc : pvr_exit+0x3a/0x74c [pvrsrvkm]
Kernel panic - not syncing: Fatal exception in interrupt

On Yocto images rc.pvr unloads the module at shutdown, so every reboot ends this way. starfive_visionfive2_defconfig builds the driver in, where the change has no effect.

Testing

VisionFive 2 v1.3B, 4cecf16 with both commits, built by meta-riscv (which also applies its compiler-fix patches), DRM_IMG_ROGUE=m:

Before the fix After
unload (modprobe -r pvrsrvkm) kernel BUG & panic module unloaded
reload, rgx_triangle_test — 1000 frames, 59.9 fps
reboot panic clean restart

Not tested: the built-in configuration. Commit 2 only changes code under #if defined(MODULE).

Related: riscv/meta-riscv#713

cordlandwehr and others added 2 commits October 12, 2026 21:16
Signed-off-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
Signed-off-by: OOHehir <40183643+OOHehir@users.noreply.github.com>
…tered

pvr_init() no longer calls pvr_devices_register(), as the GPU comes from the
device tree, so pvr_devices stays NULL. pvr_exit() still calls
pvr_devices_unregister(), whose BUG_ON(!pvr_devices) then fires on every
unload of the module: on a systemd image, rc.pvr.service runs
"modprobe -r pvrsrvkm" at shutdown & every reboot ends in a kernel panic.

The path exists only when the driver is built as a module;
starfive_visionfive2_defconfig builds it in. Return early instead, as there is
nothing to unregister.

Signed-off-by: OOHehir <40183643+OOHehir@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants