Re: [PATCH v3 12/17] drm/spacemit: add Innosilicon DP/eDP controller bridge driver

From: Guodong Xu

Date: Wed Nov 25 2026 - 20:16:43 EST


Hi Cody,

On Sat, 21 Nov 2026 15:40:51 +0800, Cody Kang via B4 Relay wrote:
[...]
> diff --git a/drivers/gpu/drm/spacemit/Kconfig b/drivers/gpu/drm/spacemit/Kconfig
> index 8326a7b98151a..4667cb624401a 100644
> --- a/drivers/gpu/drm/spacemit/Kconfig
> +++ b/drivers/gpu/drm/spacemit/Kconfig
> @@ -16,3 +16,22 @@ config DRM_SPACEMIT
[...]
> +config SPACEMIT_INNO_DP
> + tristate "SpacemiT Innosilicon DP/eDP controller support"
[...]
> diff --git a/drivers/gpu/drm/spacemit/Makefile b/drivers/gpu/drm/spacemit/Makefile
> index b3b148000cf7b..260d316a271b5 100644
> --- a/drivers/gpu/drm/spacemit/Makefile
> +++ b/drivers/gpu/drm/spacemit/Makefile
> @@ -9,4 +9,7 @@ spacemit-drm-y := spacemit_drm.o \
> dpu/dpu_saturn_hee.o \
> dpu/saturn_fbcmem.o
>
> +spacemit-inno-dp-y := spacemit_inno_dp.o
> +
> obj-$(CONFIG_DRM_SPACEMIT) += spacemit-drm.o
> +obj-$(CONFIG_SPACEMIT_INNO_DP) += spacemit-inno-dp.o

I noticed a corner case when testing module unload on v3.
spacemit_inno_dp can be removed while a process still has cardN open
(say Xorg or kmscube is running and somebody does rmmod
spacemit_inno_dp), and the DRM device then still holds references on
the bridge. When that process closes cardN later, the kernel oopses. On
a CoM260-IFX:

sleep 20 < /dev/dri/card0 &
rmmod spacemit_inno_dp

Unable to handle kernel paging request at virtual address ffffffff01ac5188
Modules linked in: spacemit_drm [...] [last unloaded: spacemit_inno_dp]
epc : drm_bridge_put.part.0+0x72/0xb6 [drm]
[...]
[<ffffffff01b0b142>] drm_bridge_put.part.0+0x72/0xb6 [drm]
[<ffffffff01b0b19e>] drm_bridge_put+0x18/0x22 [drm]
[<ffffffff01c41318>] drm_bridge_connector_put_bridges+0x34/0x7a [drm_display_helper]
[<ffffffff01b23400>] drm_managed_release+0x86/0x116 [drm]
[<ffffffff01b13cce>] drm_minor_release+0x68/0x80 [drm]
[<ffffffff01b1ce2a>] drm_release+0xd2/0x102 [drm]
[<ffffffff802b325c>] __fput+0xa8/0x248

An open cardN pins spacemit-drm only. The last drm_bridge_put() comes
at the final close and reads bridge->funcs, which was in the module
of spacemit_inno_dp that is already gone.

Other DRM drivers with the same structure, rockchipdrm for example,
put the bridge driver and the DRM driver into one module. I think doing
the same here (add spacemit_inno_dp.o to spacemit-drm) is the better
solution.

Luca (added to Cc), is module unload something your bridge hotplug
series [1] is meant to cover?

[1] https://lore.kernel.org/r/20261118-drm-bridge-hotplug-v3-0-44bb3b4a828f@xxxxxxxxxxx

Guodong