Skip to content

drm/vc4: Fix hotplug for vc4

Maxime Ripard dri-devel 5 versions – Applied

Status from this message: Applied to drm/drm-misc (drm-misc-next).

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest69 patches 1 replyApplied
  2. v469 patches 0 repliesSuperseded
  3. v371 patches 6 repliesApplied
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v268 patches11 repliesSuperseded
v164 patches59 repliesSuperseded

Changes in v5 from the cover letter

- Rebased on next-20220711
- Fixed a few W=1 warnings reported by the kernel test bot

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/69drm/mipi-dsi: Detach devices when removing the hostdrivers/gpu/drm/drm_mipi_dsi.c+1 -00 replies
2/69drm/crtc: Introduce drmm_crtc_init_with_planesdrivers/gpu/drm/drm_crtc.c include/drm/drm_crtc.h+91 -120 replies
3/69drm/encoder: Introduce drmm_encoder_initdrivers/gpu/drm/drm_encoder.c include/drm/drm_encoder.h+70 -110 replies
4/69drm/connector: Reorder headersdrivers/gpu/drm/drm_connector.c+3 -30 replies
5/69drm/connector: Mention the cleanup after drm_connector_initdrivers/gpu/drm/drm_connector.c+8 -00 replies
6/69drm/connector: Clarify when drm_connector_unregister is neededdrivers/gpu/drm/drm_connector.c+5 -30 replies
7/69drm/connector: Consolidate Connector Initializationdrivers/gpu/drm/drm_connector.c+34 -310 replies
8/69drm/connector: Check for destroy implementationdrivers/gpu/drm/drm_connector.c+6 -00 replies
9/69drm/connector: Introduce drmm_connector_initdrivers/gpu/drm/drm_connector.c include/drm/drm_connector.h+65 -00 replies
10/69drm/bridge: panel: Introduce drmm_panel_bridge_adddrivers/gpu/drm/bridge/panel.c include/drm/drm_bridge.h+41 -00 replies
11/69drm/bridge: panel: Introduce drmm_of_get_bridgedrivers/gpu/drm/bridge/panel.c include/drm/drm_bridge.h+37 -00 replies
12/69drm/vc4: drv: Call component_unbind_all()drivers/gpu/drm/vc4/vc4_drv.c drivers/gpu/drm/vc4/vc4_drv.h+13 -20 replies
13/69drm/vc4: drv: Use drm_dev_unplugdrivers/gpu/drm/vc4/vc4_drv.c+1 -20 replies
14/69drm/vc4: crtc: Create vblank reporting functiondrivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_drv.h+16 -80 replies
15/69drm/vc4: hvs: Protect device resources after removaldrivers/gpu/drm/vc4/vc4_hvs.c+93 -60 replies
16/69drm/vc4: hvs: Remove planes currently allocated before taking downdrivers/gpu/drm/vc4/vc4_hvs.c+7 -00 replies
17/69drm/vc4: plane: Take possible_crtcs as an argumentdrivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_drv.h drivers/gpu/drm/vc4/vc4_plane.c+10 -100 replies
18/69drm/vc4: crtc: Remove manual plane removal on errordrivers/gpu/drm/vc4/vc4_crtc.c+1 -100 replies
19/69drm/vc4: plane: Switch to drmm_universal_plane_alloc()drivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_plane.c+8 -160 replies
20/69drm/vc4: crtc: Move debugfs_name to crtc_datadrivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_drv.h drivers/gpu/drm/vc4/vc4_txp.c+12 -110 replies
21/69drm/vc4: crtc: Switch to drmm_kzallocdrivers/gpu/drm/vc4/vc4_crtc.c+1 -10 replies
22/69drm/vc4: crtc: Switch to DRM-managed CRTC initializationdrivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_drv.h drivers/gpu/drm/vc4/vc4_txp.c+6 -120 replies
23/69drm/vc4: dpi: Remove vc4_dev dpi pointerdrivers/gpu/drm/vc4/vc4_dpi.c drivers/gpu/drm/vc4/vc4_drv.h+0 -80 replies
24/69drm/vc4: dpi: Embed DRM structures into the private structuredrivers/gpu/drm/vc4/vc4_dpi.c+16 -330 replies
25/69drm/vc4: dpi: Switch to drmm_kzallocdrivers/gpu/drm/vc4/vc4_dpi.c+2 -10 replies
26/69drm/vc4: dpi: Return an error if we can't enable our clockdrivers/gpu/drm/vc4/vc4_dpi.c+4 -10 replies
27/69drm/vc4: dpi: Remove unnecessary drm_of_panel_bridge_remove calldrivers/gpu/drm/vc4/vc4_dpi.c+0 -20 replies
28/69drm/vc4: dpi: Add action to disable the clockdrivers/gpu/drm/vc4/vc4_dpi.c+11 -30 replies
29/69drm/vc4: dpi: Switch to DRM-managed encoder initializationdrivers/gpu/drm/vc4/vc4_dpi.c+8 -150 replies
30/69drm/vc4: dpi: Switch to drmm_of_get_bridgedrivers/gpu/drm/vc4/vc4_dpi.c+2 -10 replies
31/69drm/vc4: dpi: Protect device resourcesdrivers/gpu/drm/vc4/vc4_dpi.c+14 -00 replies
32/69drm/vc4: dsi: Embed DRM structures into the private structuredrivers/gpu/drm/vc4/vc4_dsi.c+23 -370 replies
33/69drm/vc4: dsi: Switch to DRM-managed encoder initializationdrivers/gpu/drm/vc4/vc4_dsi.c+7 -20 replies
34/69drm/vc4: dsi: Switch to drmm_of_get_bridgedrivers/gpu/drm/vc4/vc4_dsi.c+1 -10 replies
35/69drm/vc4: dsi: Fix the driver structure lifetimedrivers/gpu/drm/vc4/vc4_dsi.c+37 -10 replies
36/69drm/vc4: dsi: Switch to devm_pm_runtime_enabledrivers/gpu/drm/vc4/vc4_dsi.c+4 -40 replies
37/69drm/vc4: hdmi: Switch to drmm_kzallocdrivers/gpu/drm/vc4/vc4_hdmi.c+2 -10 replies
38/69drm/vc4: hdmi: Remove call to drm_connector_unregister()drivers/gpu/drm/vc4/vc4_hdmi.c+3 -90 replies
39/69drm/vc4: hdmi: Switch to DRM-managed encoder initializationdrivers/gpu/drm/vc4/vc4_hdmi.c+9 -50 replies
40/69drm/vc4: hdmi: Switch to DRM-managed connector initializationdrivers/gpu/drm/vc4/vc4_hdmi.c+8 -90 replies
41/69drm/vc4: hdmi: Switch to device-managed ALSA initializationdrivers/gpu/drm/vc4/vc4_hdmi.c+36 -70 replies
42/69drm/vc4: hdmi: Switch to device-managed CEC initializationdrivers/gpu/drm/vc4/vc4_hdmi.c+50 -440 replies
43/69drm/vc4: hdmi: Use a device-managed action for DDCdrivers/gpu/drm/vc4/vc4_hdmi.c+12 -60 replies
44/69drm/vc4: hdmi: Switch to DRM-managed kfree to build regsetsdrivers/gpu/drm/vc4/vc4_hdmi.c drivers/gpu/drm/vc4/vc4_hdmi.h+31 -180 replies
45/69drm/vc4: hdmi: Use devm to register hotplug interruptsdrivers/gpu/drm/vc4/vc4_hdmi.c+11 -300 replies
46/69drm/vc4: hdmi: Move audio structure offset checksdrivers/gpu/drm/vc4/vc4_hdmi.c+20 -200 replies
47/69drm/vc4: hdmi: Protect device resources after removaldrivers/gpu/drm/vc4/vc4_hdmi.c+291 -170 replies
48/69drm/vc4: hdmi: Switch to devm_pm_runtime_enabledrivers/gpu/drm/vc4/vc4_hdmi.c+4 -110 replies
49/69drm/vc4: txp: Remove vc4_dev txp pointerdrivers/gpu/drm/vc4/vc4_drv.h drivers/gpu/drm/vc4/vc4_txp.c+0 -70 replies
50/69drm/vc4: txp: Remove duplicate regsetdrivers/gpu/drm/vc4/vc4_txp.c+4 -50 replies
51/69drm/vc4: txp: Switch to drmm_kzallocdrivers/gpu/drm/vc4/vc4_txp.c+1 -10 replies
52/69drm/vc4: txp: Remove call to drm_connector_unregister()drivers/gpu/drm/vc4/vc4_txp.c+2 -80 replies
53/69drm/vc4: txp: Protect device resourcesdrivers/gpu/drm/vc4/vc4_txp.c+25 -00 replies
54/69drm/vc4: vec: Remove vc4_dev vec pointerdrivers/gpu/drm/vc4/vc4_drv.h drivers/gpu/drm/vc4/vc4_vec.c+0 -80 replies
55/69drm/vc4: vec: Embed DRM structures into the private structuredrivers/gpu/drm/vc4/vc4_vec.c+21 -620 replies
56/69drm/vc4: vec: Switch to drmm_kzallocdrivers/gpu/drm/vc4/vc4_vec.c+1 -10 replies
57/69drm/vc4: vec: Remove call to drm_connector_unregister()drivers/gpu/drm/vc4/vc4_vec.c+2 -80 replies
58/69drm/vc4: vec: Switch to DRM-managed encoder initializationdrivers/gpu/drm/vc4/vc4_vec.c+9 -50 replies
59/69drm/vc4: vec: Switch to DRM-managed connector initializationdrivers/gpu/drm/vc4/vc4_vec.c+5 -60 replies
60/69drm/vc4: vec: Protect device resources after removaldrivers/gpu/drm/vc4/vc4_vec.c+61 -60 replies
61/69drm/vc4: vec: Switch to devm_pm_runtime_enabledrivers/gpu/drm/vc4/vc4_vec.c+5 -150 replies
62/69drm/vc4: debugfs: Protect device resourcesdrivers/gpu/drm/vc4/vc4_debugfs.c+9 -00 replies
63/69drm/vc4: debugfs: Return an error on failuredrivers/gpu/drm/vc4/vc4_debugfs.c drivers/gpu/drm/vc4/vc4_drv.h+27 -230 replies
64/69drm/vc4: debugfs: Simplify debugfs registrationdrivers/gpu/drm/vc4/vc4_bo.c drivers/gpu/drm/vc4/vc4_crtc.c drivers/gpu/drm/vc4/vc4_debugfs.c +8 more+191 -690 replies
65/69drm/vc4: Switch to drmm_mutex_initdrivers/gpu/drm/vc4/vc4_bo.c drivers/gpu/drm/vc4/vc4_drv.c drivers/gpu/drm/vc4/vc4_gem.c +1 more+28 -60 replies
66/69drm/vc4: perfmon: Add missing mutex_destroydrivers/gpu/drm/vc4/vc4_perfmon.c+1 -00 replies
67/69drm/vc4: v3d: Stop disabling interruptsdrivers/gpu/drm/vc4/vc4_irq.c drivers/gpu/drm/vc4/vc4_v3d.c+1 -30 replies
68/69drm/vc4: v3d: Rework the runtime_pm setupdrivers/gpu/drm/vc4/vc4_v3d.c+22 -150 replies
69/69drm/vc4: v3d: Switch to devm_pm_runtime_enabledrivers/gpu/drm/vc4/vc4_v3d.c+4 -70 replies

Reviews trailers per patch

All 69 patches have a Reviewed-by or Acked-by.

PatchThomas ZimmermannSam RavnborgDave Stevenson
1/69A-b
2/69A-b
3/69A-b
4/69A-b A-b
5/69A-b A-b
6/69A-b A-b
7/69A-b
8/69A-b
9/69A-b A-b
10/69A-b A-b
11/69A-b A-b
12/69A-b R-b
13/69A-b
14/69A-b
15/69A-b R-b
16/69A-b R-b
17/69A-b R-b
18/69A-b
19/69A-b R-b
20/69A-b R-b
21/69A-b R-b
22/69A-b R-b
23/69A-b R-b
24/69A-b R-b
25/69A-b R-b
26/69A-b R-b
27/69A-b R-b
28/69A-b R-b
29/69A-b R-b
30/69A-b R-b
31/69A-b R-b
32/69A-b
33/69A-b R-b
34/69A-b R-b
35/69A-b
36/69A-b
37/69A-b
38/69A-b
39/69A-b
40/69A-b
41/69A-b
42/69A-b
43/69A-b
44/69A-b
45/69A-b
46/69A-b
47/69A-b
48/69A-b
49/69A-b
50/69A-b
51/69A-b
52/69A-b
53/69A-b
54/69A-b
55/69A-b
56/69A-b
57/69A-b
58/69A-b
59/69A-b
60/69A-b
61/69A-b
62/69A-b
63/69A-b
64/69A-b
65/69A-b
66/69A-b
67/69A-b
68/69A-b
69/69A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/69] drm/vc4: Fix hotplug for vc4

Hi,

Here is a series that address multiple issues when trying to unbind/rebind vc4-related devices to their drivers.

Most of these issues involve either use-after-free, improper resource liberation or similar.

It has been tested on the Pi3 and Pi4, with X and glxgears running and KASAN enabled to properly validate our memory accesses.

Pi3 isn't functional after a rebind though, with vblank timeouts occuring. I'm not quite sure why at this point, but at least the kernel doesn't completely crash now.

Let me know what you think,
Maxime

---
Changes from v4:
- Rebased on next-20220711
- Fixed a few W=1 warnings reported by the kernel test bot

Changes from v3:
- Rebased on top of next-20220708
- Switched WARN_ON to drm_WARN_ON
- Added Thomas tags

Changes from v2:
- Rebased on top of next-20220629
- Fix va arguments on the crtc and encoder init
- Removed drmm_connector_init_with_ddc and consolidated drm_connector_init*
- Reworked the doc for drmm_of_get_bridge

Changes from v1:
- Rebased on top on next-20220622
- Consolidated the new drmm init helpers with their alloc counterparts
- Dropped the drmm writeback and simple encoder helpers
- Clarified the documentation of drm_connector_unregister
- Removed the drm_connector_unregister usage
- Fixed a vblank timeout when unbinding
- Renamed the kref functions in vc4_dsi
- Collected the tags

Maxime Ripard (69):
drm/mipi-dsi: Detach devices when removing the host drm/crtc: Introduce drmm_crtc_init_with_planes drm/encoder: Introduce drmm_encoder_init
drm/connector: Reorder headers
drm/connector: Mention the cleanup after drm_connector_init drm/connector: Clarify when drm_connector_unregister is needed drm/connector: Consolidate Connector Initialization drm/connector: Check for destroy implementation drm/connector: Introduce drmm_connector_init drm/bridge: panel: Introduce drmm_panel_bridge_add drm/bridge: panel: Introduce drmm_of_get_bridge drm/vc4: drv: Call component_unbind_all()
drm/vc4: drv: Use drm_dev_unplug
drm/vc4: crtc: Create vblank reporting function drm/vc4: hvs: Protect device resources after removal drm/vc4: hvs: Remove planes currently allocated before taking down drm/vc4: plane: Take possible_crtcs as an argument drm/vc4: crtc: Remove manual plane removal on error drm/vc4: plane: Switch to drmm_universal_plane_alloc() drm/vc4: crtc: Move debugfs_name to crtc_data
drm/vc4: crtc: Switch to drmm_kzalloc
drm/vc4: crtc: Switch to DRM-managed CRTC initialization drm/vc4: dpi: Remove vc4_dev dpi pointer
drm/vc4: dpi: Embed DRM structures into the private structure drm/vc4: dpi: Switch to drmm_kzalloc
drm/vc4: dpi: Return an error if we can't enable our clock drm/vc4: dpi: Remove unnecessary drm_of_panel_bridge_remove call drm/vc4: dpi: Add action to disable the clock
drm/vc4: dpi: Switch to DRM-managed encoder initialization drm/vc4: dpi: Switch to drmm_of_get_bridge
drm/vc4: dpi: Protect device resources
drm/vc4: dsi: Embed DRM structures into the private structure drm/vc4: dsi: Switch to DRM-managed encoder initialization drm/vc4: dsi: Switch to drmm_of_get_bridge
drm/vc4: dsi: Fix the driver structure lifetime drm/vc4: dsi: Switch to devm_pm_runtime_enable
drm/vc4: hdmi: Switch to drmm_kzalloc
drm/vc4: hdmi: Remove call to drm_connector_unregister() drm/vc4: hdmi: Switch to DRM-managed encoder initialization drm/vc4: hdmi: Switch to DRM-managed connector initialization drm/vc4: hdmi: Switch to device-managed ALSA initialization drm/vc4: hdmi: Switch to device-managed CEC initialization drm/vc4: hdmi: Use a device-managed action for DDC drm/vc4: hdmi: Switch to DRM-managed kfree to build regsets drm/vc4: hdmi: Use devm to register hotplug interrupts drm/vc4: hdmi: Move audio structure offset checks drm/vc4: hdmi: Protect device resources after removal drm/vc4: hdmi: Switch to devm_pm_runtime_enable drm/vc4: txp: Remove vc4_dev txp pointer
drm/vc4: txp: Remove duplicate regset
drm/vc4: txp: Switch to drmm_kzalloc
drm/vc4: txp: Remove call to drm_connector_unregister() drm/vc4: txp: Protect device resources
drm/vc4: vec: Remove vc4_dev vec pointer
drm/vc4: vec: Embed DRM structures into the private structure drm/vc4: vec: Switch to drmm_kzalloc
drm/vc4: vec: Remove call to drm_connector_unregister() drm/vc4: vec: Switch to DRM-managed encoder initialization drm/vc4: vec: Switch to DRM-managed connector initialization drm/vc4: vec: Protect device resources after removal drm/vc4: vec: Switch to devm_pm_runtime_enable
drm/vc4: debugfs: Protect device resources
drm/vc4: debugfs: Return an error on failure
drm/vc4: debugfs: Simplify debugfs registration drm/vc4: Switch to drmm_mutex_init
drm/vc4: perfmon: Add missing mutex_destroy
drm/vc4: v3d: Stop disabling interrupts
drm/vc4: v3d: Rework the runtime_pm setup
drm/vc4: v3d: Switch to devm_pm_runtime_enable

 drivers/gpu/drm/bridge/panel.c    |  74 ++++
 drivers/gpu/drm/drm_connector.c   | 143 +++++--
 drivers/gpu/drm/drm_crtc.c        |  94 ++++-
 drivers/gpu/drm/drm_encoder.c     |  75 +++-
 drivers/gpu/drm/drm_mipi_dsi.c    |   1 +
 drivers/gpu/drm/vc4/vc4_bo.c      |  33 +-
 drivers/gpu/drm/vc4/vc4_crtc.c    |  90 ++--
 drivers/gpu/drm/vc4/vc4_debugfs.c |  72 ++--
 drivers/gpu/drm/vc4/vc4_dpi.c     | 131 +++---
 drivers/gpu/drm/vc4/vc4_drv.c     |  21 +-
 drivers/gpu/drm/vc4/vc4_drv.h     |  47 ++-
 drivers/gpu/drm/vc4/vc4_dsi.c     | 133 ++++--
 drivers/gpu/drm/vc4/vc4_gem.c     |  10 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 672 ++++++++++++++++++++++--------
 drivers/gpu/drm/vc4/vc4_hdmi.h    |   3 +-
 drivers/gpu/drm/vc4/vc4_hvs.c     | 145 ++++++-
 drivers/gpu/drm/vc4/vc4_irq.c     |   2 +-
 drivers/gpu/drm/vc4/vc4_perfmon.c |   1 +
 drivers/gpu/drm/vc4/vc4_plane.c   |  36 +-
 drivers/gpu/drm/vc4/vc4_txp.c     |  55 ++-
 drivers/gpu/drm/vc4/vc4_v3d.c     |  65 ++-
 drivers/gpu/drm/vc4/vc4_vec.c     | 216 +++++-----
 include/drm/drm_bridge.h          |   4 +
 include/drm/drm_connector.h       |   5 +
 include/drm/drm_crtc.h            |   9 +
 include/drm/drm_encoder.h         |   6 +
 26 files changed, 1509 insertions(+), 634 deletions(-)
Signature · 1 line
2.36.1