Skip to contentSkip to conversation

drm/vc4: Miscellaneous fixes and improvements

PATCH Applied Maíra Canal 2 participants 13 messages Mar 30 – Apr 2

Subsystems (3)
lore
Share & tools
lore

Maíra Canal

author reviewer
#0 lore raw

cover drm/vc4: Miscellaneous fixes and improvements

Hi,

This is a spin-off of the series "[PATCH 00/11] drm/vc4: Switch to DRM GPU scheduler" [1]. While I was writing the series, I noticed some small bugs in the driver code, so I compiled the fixes and code improvements in this series.

Patches #1 to #4 are bug-fixes related to PM reference unbalance, memory leaks, and race conditions. They will probably go through the drm-misc-fixes branch. Finally, patches #5 and #6 are minor clean-ups and common API adoption.

[1] https://lore.kernel.org/dri-devel/[email protected]/T/

Best regards,
- Maíra

---
Maíra Canal (6):
drm/vc4: Release runtime PM reference after binding V3D drm/vc4: Fix memory leak of BO array in hang state drm/vc4: Fix a memory leak in hang state error path drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock drm/vc4: Use devm_request_irq() for automatic cleanup drm/vc4: Clean-up UAPI header inclusion

 drivers/gpu/drm/vc4/vc4_bo.c        |  4 +++-
 drivers/gpu/drm/vc4/vc4_drv.c       |  2 --
 drivers/gpu/drm/vc4/vc4_gem.c       | 20 +++++++++++---------
 drivers/gpu/drm/vc4/vc4_irq.c       | 33 ++++++++++++---------------------
 drivers/gpu/drm/vc4/vc4_plane.c     |  2 --
 drivers/gpu/drm/vc4/vc4_render_cl.c |  1 -
 drivers/gpu/drm/vc4/vc4_v3d.c       |  1 +
 drivers/gpu/drm/vc4/vc4_validate.c  |  1 -
 8 files changed, 27 insertions(+), 37 deletions(-)

---
base-commit: dac97a6bd6c4a24e60a147cb2cf750eddb7594a8
change-id: 20260330-vc4-misc-fixes-9b874f854fcf

author reviewer
#1 lore raw

PATCH 1/6 drm/vc4: Release runtime PM reference after binding V3D

The vc4_v3d_bind() function acquires a runtime PM reference via pm_runtime_resume_and_get() to access V3D registers during setup. However, this reference is never released after a successful bind. This prevents the device from ever runtime suspending, since the reference count never reaches zero.

Release the runtime PM reference by adding pm_runtime_put_autosuspend() after autosuspend is configured, allowing the device to runtime suspend after the delay.

Fixes 266cff37d7fc ("drm/vc4: v3d: Rework the runtime_pm setup")
---
 drivers/gpu/drm/vc4/vc4_v3d.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_v3d.c +1 -0
index 3ffe09bc89d273c2ec598f391147425d9f6785bf..d31b906cb8e787517ba3ff72c236ffcf810522b1 100644
@@ -481,6 +481,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
 
 	pm_runtime_use_autosuspend(dev);
 	pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */
+	pm_runtime_put_autosuspend(dev);
 
 	return 0;
 
Signature · 1 line
2.53.0
author reviewer
#2 lore raw

PATCH 2/6 drm/vc4: Fix memory leak of BO array in hang state

In reply to Maíra Canal

The hang state's BO array is allocated separately with kzalloc() in vc4_save_hang_state() but never freed in vc4_free_hang_state(). Add the missing kfree() for the BO array before freeing the hang state struct.

Fixes 214613656b51 ("drm/vc4: Add an interface for capturing the GPU state after a hang.")
---
 drivers/gpu/drm/vc4/vc4_gem.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_gem.c +1 -0
index 2d3df5e621c1a2192656efd6fc8940ebb1ce991f..248c47665a193fa639a481f97ac2af634f415384 100644
@@ -62,6 +62,7 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state)
 	for (i = 0; i < state->user_state.bo_count; i++)
 		drm_gem_object_put(state->bo[i]);
 
+	kfree(state->bo);
 	kfree(state);
 }
 
Signature · 1 line
2.53.0
Reviewed-by on v1 2/6
#3 lore raw

Re: [PATCH 2/6] drm/vc4: Fix memory leak of BO array in hang state

Quoted 5 lines · Maíra Canal

The hang state's BO array is allocated separately with kzalloc() in vc4_save_hang_state() but never freed in vc4_free_hang_state(). Add the missing kfree() for the BO array before freeing the hang state struct.

Fixes 214613656b51 ("drm/vc4: Add an interface for capturing the GPU state after a hang.")
Quoted 18 lines
---
  drivers/gpu/drm/vc4/vc4_gem.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_gem.c +1 -0
index 2d3df5e621c1a2192656efd6fc8940ebb1ce991f..248c47665a193fa639a481f97ac2af634f415384 100644
@@ -62,6 +62,7 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state)
  	for (i = 0; i < state->user_state.bo_count; i++)
  		drm_gem_object_put(state->bo[i]);
 
+	kfree(state->bo);
  	kfree(state);
  }
 
author reviewer
#4 lore raw

PATCH 3/6 drm/vc4: Fix a memory leak in hang state error path

In reply to Maíra Canal

When vc4_save_hang_state() encounters an early return condition, it returns without freeing the previously allocated kernel_state, leaking memory.

Add the missing kfree() calls by consolidating the early return paths into a single place.

Fixes 214613656b51 ("drm/vc4: Add an interface for capturing the GPU state after a hang.")
---
 drivers/gpu/drm/vc4/vc4_gem.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +10 -8
index 248c47665a193fa639a481f97ac2af634f415384..ab3c6d5d4eb446804877d6b8da01c3a9f65800df 100644
@@ -171,10 +171,8 @@ vc4_save_hang_state(struct drm_device *dev)
 	spin_lock_irqsave(&vc4->job_lock, irqflags);
 	exec[0] = vc4_first_bin_job(vc4);
 	exec[1] = vc4_first_render_job(vc4);
-	if (!exec[0] && !exec[1]) {
-		spin_unlock_irqrestore(&vc4->job_lock, irqflags);
-		return;
-	}
+	if (!exec[0] && !exec[1])
+		goto err_free_state;
 
 	/* Get the bos from both binner and renderer into hang state. */
 	state->bo_count = 0;
@@ -191,10 +189,8 @@ vc4_save_hang_state(struct drm_device *dev)
 	kernel_state->bo = kzalloc_objs(*kernel_state->bo, state->bo_count,
 					GFP_ATOMIC);
 
-	if (!kernel_state->bo) {
-		spin_unlock_irqrestore(&vc4->job_lock, irqflags);
-		return;
-	}
+	if (!kernel_state->bo)
+		goto err_free_state;
 
 	k = 0;
 	for (i = 0; i < 2; i++) {
@@ -286,6 +282,12 @@ vc4_save_hang_state(struct drm_device *dev)
 		vc4->hang_state = kernel_state;
 		spin_unlock_irqrestore(&vc4->job_lock, irqflags);
 	}
+
+	return;
+
+err_free_state:
+	spin_unlock_irqrestore(&vc4->job_lock, irqflags);
+	kfree(kernel_state);
 }
 
 static void
Signature · 1 line
2.53.0
Reviewed-by on v1 3/6
#5 lore raw

Re: [PATCH 3/6] drm/vc4: Fix a memory leak in hang state error path

Quoted 6 lines · Maíra Canal

When vc4_save_hang_state() encounters an early return condition, it returns without freeing the previously allocated kernel_state, leaking memory.

Add the missing kfree() calls by consolidating the early return paths into a single place.

Nice catch!

Quoted 51 lines
Fixes 214613656b51 ("drm/vc4: Add an interface for capturing the GPU state after a hang.")
---
  drivers/gpu/drm/vc4/vc4_gem.c | 18 ++++++++++--------
  1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +10 -8
index 248c47665a193fa639a481f97ac2af634f415384..ab3c6d5d4eb446804877d6b8da01c3a9f65800df 100644
@@ -171,10 +171,8 @@ vc4_save_hang_state(struct drm_device *dev)
  	spin_lock_irqsave(&vc4->job_lock, irqflags);
  	exec[0] = vc4_first_bin_job(vc4);
  	exec[1] = vc4_first_render_job(vc4);
-	if (!exec[0] && !exec[1]) {
-		spin_unlock_irqrestore(&vc4->job_lock, irqflags);
-		return;
-	}
+	if (!exec[0] && !exec[1])
+		goto err_free_state;
 
  	/* Get the bos from both binner and renderer into hang state. */
  	state->bo_count = 0;
@@ -191,10 +189,8 @@ vc4_save_hang_state(struct drm_device *dev)
  	kernel_state->bo = kzalloc_objs(*kernel_state->bo, state->bo_count,
  					GFP_ATOMIC);
 
-	if (!kernel_state->bo) {
-		spin_unlock_irqrestore(&vc4->job_lock, irqflags);
-		return;
-	}
+	if (!kernel_state->bo)
+		goto err_free_state;
 
  	k = 0;
  	for (i = 0; i < 2; i++) {
@@ -286,6 +282,12 @@ vc4_save_hang_state(struct drm_device *dev)
  		vc4->hang_state = kernel_state;
  		spin_unlock_irqrestore(&vc4->job_lock, irqflags);
  	}
+
+	return;
+
+err_free_state:
+	spin_unlock_irqrestore(&vc4->job_lock, irqflags);
+	kfree(kernel_state);
  }
 
  static void
author reviewer
#6 lore raw

PATCH 4/6 drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock

In reply to Maíra Canal

The mmap callback reads bo->madv without holding madv_lock, racing with concurrent DRM_IOCTL_VC4_GEM_MADVISE calls that modify the field under the same lock. Add the missing locking to prevent the data race.

Fixes b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
---
 drivers/gpu/drm/vc4/vc4_bo.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/vc4/vc4_bo.c +3 -0
index f45ba47b4ba8645f371215c083d3ead3ddd5ffe8..9377e58f9bc256ea81e19cc442d04139feec20fe 100644
@@ -738,12 +738,15 @@ static int vc4_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct
 		return -EINVAL;
 	}
 
+	mutex_lock(&bo->madv_lock);
 	if (bo->madv != VC4_MADV_WILLNEED) {
 		DRM_DEBUG("mmapping of %s BO not allowed\n",
 			  bo->madv == VC4_MADV_DONTNEED ?
 			  "purgeable" : "purged");
+		mutex_unlock(&bo->madv_lock);
 		return -EINVAL;
 	}
+	mutex_unlock(&bo->madv_lock);
 
 	return drm_gem_dma_mmap(&bo->base, vma);
 }
Signature · 1 line
2.53.0
Reviewed-by on v1 4/6
#7 lore raw

Re: [PATCH 4/6] drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock

Quoted 5 lines · Maíra Canal

The mmap callback reads bo->madv without holding madv_lock, racing with concurrent DRM_IOCTL_VC4_GEM_MADVISE calls that modify the field under the same lock. Add the missing locking to prevent the data race.

Fixes b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
Quoted 26 lines
---
  drivers/gpu/drm/vc4/vc4_bo.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/vc4/vc4_bo.c +3 -0
index f45ba47b4ba8645f371215c083d3ead3ddd5ffe8..9377e58f9bc256ea81e19cc442d04139feec20fe 100644
@@ -738,12 +738,15 @@ static int vc4_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct
  		return -EINVAL;
  	}
 
+	mutex_lock(&bo->madv_lock);
  	if (bo->madv != VC4_MADV_WILLNEED) {
  		DRM_DEBUG("mmapping of %s BO not allowed\n",
  			  bo->madv == VC4_MADV_DONTNEED ?
  			  "purgeable" : "purged");
+		mutex_unlock(&bo->madv_lock);
  		return -EINVAL;
  	}
+	mutex_unlock(&bo->madv_lock);
 
  	return drm_gem_dma_mmap(&bo->base, vma);
  }
author reviewer
#8 lore raw

PATCH 5/6 drm/vc4: Use devm_request_irq() for automatic cleanup

In reply to Maíra Canal

Switch from request_irq()/free_irq() to the device-managed alternative devm_request_irq(), letting device-managed resource cleanup handle IRQ teardown automatically.

While here, inline vc4_irq_prepare() into vc4_irq_install() since it's the only caller.

---
 drivers/gpu/drm/vc4/vc4_irq.c | 33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)
drivers/gpu/drm/vc4/vc4_irq.c +12 -21
index 63e88f90eef7c0720e32547f4e8b5ed289b2427b..8e5141bb50759e19e03c911f75b78354b240406f 100644
@@ -47,7 +47,6 @@
 
 #include <linux/platform_device.h>
 
-#include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
 #include "vc4_drv.h"
@@ -242,23 +241,6 @@ vc4_irq(int irq, void *arg)
 	return status;
 }
 
-static void
-vc4_irq_prepare(struct drm_device *dev)
-{
-	struct vc4_dev *vc4 = to_vc4_dev(dev);
-
-	if (!vc4->v3d)
-		return;
-
-	init_waitqueue_head(&vc4->job_wait_queue);
-	INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work);
-
-	/* Clear any pending interrupts someone might have left around
-	 * for us.
-	 */
-	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
-}
-
 void
 vc4_irq_enable(struct drm_device *dev)
 {
@@ -307,12 +289,22 @@ int vc4_irq_install(struct drm_device *dev, int irq)
 	if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4))
 		return -ENODEV;
 
+	if (!vc4->v3d)
+		return -ENODEV;
+
 	if (irq == IRQ_NOTCONNECTED)
 		return -ENOTCONN;
 
-	vc4_irq_prepare(dev);
+	init_waitqueue_head(&vc4->job_wait_queue);
+	INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work);
 
-	ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev);
+	/* Clear any pending interrupts someone might have left around
+	 * for us.
+	 */
+	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
+
+	ret = devm_request_irq(dev->dev, irq, vc4_irq, 0,
+			       dev_name(dev->dev), dev);
 	if (ret)
 		return ret;
 
@@ -329,7 +321,6 @@ void vc4_irq_uninstall(struct drm_device *dev)
 		return;
 
 	vc4_irq_disable(dev);
-	free_irq(vc4->irq, dev);
 }
 
 /** Reinitializes interrupt registers when a GPU reset is performed. */
Signature · 1 line
2.53.0
Reviewed-by on v1 5/6
#9 lore raw

Re: [PATCH 5/6] drm/vc4: Use devm_request_irq() for automatic cleanup

Quoted 6 lines · Maíra Canal

Switch from request_irq()/free_irq() to the device-managed alternative devm_request_irq(), letting device-managed resource cleanup handle IRQ teardown automatically.

While here, inline vc4_irq_prepare() into vc4_irq_install() since it's the only caller.

Quoted 76 lines
---
  drivers/gpu/drm/vc4/vc4_irq.c | 33 ++++++++++++---------------------
  1 file changed, 12 insertions(+), 21 deletions(-)
drivers/gpu/drm/vc4/vc4_irq.c +12 -21
index 63e88f90eef7c0720e32547f4e8b5ed289b2427b..8e5141bb50759e19e03c911f75b78354b240406f 100644
@@ -47,7 +47,6 @@
 
  #include <linux/platform_device.h>
 
-#include <drm/drm_drv.h>
  #include <drm/drm_print.h>
 
  #include "vc4_drv.h"
@@ -242,23 +241,6 @@ vc4_irq(int irq, void *arg)
  	return status;
  }
 
-static void
-vc4_irq_prepare(struct drm_device *dev)
-{
-	struct vc4_dev *vc4 = to_vc4_dev(dev);
-
-	if (!vc4->v3d)
-		return;
-
-	init_waitqueue_head(&vc4->job_wait_queue);
-	INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work);
-
-	/* Clear any pending interrupts someone might have left around
-	 * for us.
-	 */
-	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
-}
-
  void
  vc4_irq_enable(struct drm_device *dev)
  {
@@ -307,12 +289,22 @@ int vc4_irq_install(struct drm_device *dev, int irq)
  	if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4))
  		return -ENODEV;
 
+	if (!vc4->v3d)
+		return -ENODEV;
+
  	if (irq == IRQ_NOTCONNECTED)
  		return -ENOTCONN;
 
-	vc4_irq_prepare(dev);
+	init_waitqueue_head(&vc4->job_wait_queue);
+	INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work);
 
-	ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev);
+	/* Clear any pending interrupts someone might have left around
+	 * for us.
+	 */
+	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
+
+	ret = devm_request_irq(dev->dev, irq, vc4_irq, 0,
+			       dev_name(dev->dev), dev);
  	if (ret)
  		return ret;
 
@@ -329,7 +321,6 @@ void vc4_irq_uninstall(struct drm_device *dev)
  		return;
 
  	vc4_irq_disable(dev);
-	free_irq(vc4->irq, dev);
  }
 
  /** Reinitializes interrupt registers when a GPU reset is performed. */
author reviewer
#10 lore raw

PATCH 6/6 drm/vc4: Clean-up UAPI header inclusion

In reply to Maíra Canal

"uapi/drm/vc4_drm.h" is already included through "vc4_drv.h". Therefore, remove its direct inclusion from several files.

---
 drivers/gpu/drm/vc4/vc4_bo.c        | 1 -
 drivers/gpu/drm/vc4/vc4_drv.c       | 2 --
 drivers/gpu/drm/vc4/vc4_gem.c       | 1 -
 drivers/gpu/drm/vc4/vc4_plane.c     | 2 --
 drivers/gpu/drm/vc4/vc4_render_cl.c | 1 -
 drivers/gpu/drm/vc4/vc4_validate.c  | 1 -
 6 files changed, 8 deletions(-)
drivers/gpu/drm/vc4/vc4_bo.c +0 -1
index 9377e58f9bc256ea81e19cc442d04139feec20fe..2161761b1f2215c3ce7054caf21019d4be5c70d9 100644
@@ -22,7 +22,6 @@
 #include <drm/drm_print.h>
 
 #include "vc4_drv.h"
-#include "uapi/drm/vc4_drm.h"
 
 static const struct drm_gem_object_funcs vc4_gem_object_funcs;
 
drivers/gpu/drm/vc4/vc4_drv.c +0 -2
index a14ecb7694613f15df3cfdb0195825d961fe1707..616caf9d9915b9ed7f614d6f0339fa6ee2cb80e3 100644
@@ -41,8 +41,6 @@
 
 #include <soc/bcm2835/raspberrypi-firmware.h>
 
-#include "uapi/drm/vc4_drm.h"
-
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
drivers/gpu/drm/vc4/vc4_gem.c +0 -1
index ab3c6d5d4eb446804877d6b8da01c3a9f65800df..e231c906709c1b15bd19e3f478ad86048700ba55 100644
@@ -33,7 +33,6 @@
 #include <drm/drm_print.h>
 #include <drm/drm_syncobj.h>
 
-#include "uapi/drm/vc4_drm.h"
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 #include "vc4_trace.h"
drivers/gpu/drm/vc4/vc4_plane.c +0 -2
index 91d499fefba2189131ff96270a9b001d694ab2ae..a81bad3519ccf3e8056a2ae37ddcfeccc2306a14 100644
@@ -26,8 +26,6 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_print.h>
 
-#include "uapi/drm/vc4_drm.h"
-
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
drivers/gpu/drm/vc4/vc4_render_cl.c +0 -1
index edc471e71c0eb1729c0dcf823ca6c9e0a7e207ed..c264d21bc3fe357ec28048760243b27b3dc26b1b 100644
@@ -37,7 +37,6 @@
 
 #include <drm/drm_print.h>
 
-#include "uapi/drm/vc4_drm.h"
 #include "vc4_drv.h"
 #include "vc4_packet.h"
 
drivers/gpu/drm/vc4/vc4_validate.c +0 -1
index 545c4c3608f5683209ea1462d61d9d0dd68d0bd7..7f2fadfde7a8ee63a531a98474a8447b37faaac1 100644
@@ -45,7 +45,6 @@
 
 #include <drm/drm_print.h>
 
-#include "uapi/drm/vc4_drm.h"
 #include "vc4_drv.h"
 #include "vc4_packet.h"
 
Signature · 1 line
2.53.0
Reviewed-by on v1 6/6
#11 lore raw

Re: [PATCH 6/6] drm/vc4: Clean-up UAPI header inclusion

Quoted 2 lines · Maíra Canal

"uapi/drm/vc4_drm.h" is already included through "vc4_drv.h". Therefore, remove its direct inclusion from several files.

Quoted 87 lines
---
  drivers/gpu/drm/vc4/vc4_bo.c        | 1 -
  drivers/gpu/drm/vc4/vc4_drv.c       | 2 --
  drivers/gpu/drm/vc4/vc4_gem.c       | 1 -
  drivers/gpu/drm/vc4/vc4_plane.c     | 2 --
  drivers/gpu/drm/vc4/vc4_render_cl.c | 1 -
  drivers/gpu/drm/vc4/vc4_validate.c  | 1 -
  6 files changed, 8 deletions(-)
drivers/gpu/drm/vc4/vc4_bo.c +0 -1
index 9377e58f9bc256ea81e19cc442d04139feec20fe..2161761b1f2215c3ce7054caf21019d4be5c70d9 100644
@@ -22,7 +22,6 @@
  #include <drm/drm_print.h>
 
  #include "vc4_drv.h"
-#include "uapi/drm/vc4_drm.h"
 
  static const struct drm_gem_object_funcs vc4_gem_object_funcs;
 
drivers/gpu/drm/vc4/vc4_drv.c +0 -2
index a14ecb7694613f15df3cfdb0195825d961fe1707..616caf9d9915b9ed7f614d6f0339fa6ee2cb80e3 100644
@@ -41,8 +41,6 @@
 
  #include <soc/bcm2835/raspberrypi-firmware.h>
 
-#include "uapi/drm/vc4_drm.h"
-
  #include "vc4_drv.h"
  #include "vc4_regs.h"
 
drivers/gpu/drm/vc4/vc4_gem.c +0 -1
index ab3c6d5d4eb446804877d6b8da01c3a9f65800df..e231c906709c1b15bd19e3f478ad86048700ba55 100644
@@ -33,7 +33,6 @@
  #include <drm/drm_print.h>
  #include <drm/drm_syncobj.h>
 
-#include "uapi/drm/vc4_drm.h"
  #include "vc4_drv.h"
  #include "vc4_regs.h"
  #include "vc4_trace.h"
drivers/gpu/drm/vc4/vc4_plane.c +0 -2
index 91d499fefba2189131ff96270a9b001d694ab2ae..a81bad3519ccf3e8056a2ae37ddcfeccc2306a14 100644
@@ -26,8 +26,6 @@
  #include <drm/drm_gem_atomic_helper.h>
  #include <drm/drm_print.h>
 
-#include "uapi/drm/vc4_drm.h"
-
  #include "vc4_drv.h"
  #include "vc4_regs.h"
 
drivers/gpu/drm/vc4/vc4_render_cl.c +0 -1
index edc471e71c0eb1729c0dcf823ca6c9e0a7e207ed..c264d21bc3fe357ec28048760243b27b3dc26b1b 100644
@@ -37,7 +37,6 @@
 
  #include <drm/drm_print.h>
 
-#include "uapi/drm/vc4_drm.h"
  #include "vc4_drv.h"
  #include "vc4_packet.h"
 
drivers/gpu/drm/vc4/vc4_validate.c +0 -1
index 545c4c3608f5683209ea1462d61d9d0dd68d0bd7..7f2fadfde7a8ee63a531a98474a8447b37faaac1 100644
@@ -45,7 +45,6 @@
 
  #include <drm/drm_print.h>
 
-#include "uapi/drm/vc4_drm.h"
  #include "vc4_drv.h"
  #include "vc4_packet.h"
 
author reviewer Applied
#12 lore raw
In reply to Maíra Canal
Quoted 17 lines · Maíra Canal

Hi,

This is a spin-off of the series "[PATCH 00/11] drm/vc4: Switch to DRM GPU scheduler" [1]. While I was writing the series, I noticed some small bugs in the driver code, so I compiled the fixes and code improvements in this series.

Patches #1 to #4 are bug-fixes related to PM reference unbalance, memory leaks, and race conditions. They will probably go through the drm-misc-fixes branch. Finally, patches #5 and #6 are minor clean-ups and common API adoption.

[1] https://lore.kernel.org/dri-devel/[email protected]/T/

Best regards,
- Maíra

Quoted 8 lines

---
Maíra Canal (6):
drm/vc4: Release runtime PM reference after binding V3D drm/vc4: Fix memory leak of BO array in hang state drm/vc4: Fix a memory leak in hang state error path drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock drm/vc4: Use devm_request_irq() for automatic cleanup drm/vc4: Clean-up UAPI header inclusion

Applied to drm-misc-fixes:

[1/6] drm/vc4: Release runtime PM reference after binding V3D

      commit: aaefbdde9abdc43699e110679c0e10972a5e1c59
[2/6] drm/vc4: Fix memory leak of BO array in hang state
      commit: f4dfd6847b3e5d24e336bca6057485116d17aea4
[3/6] drm/vc4: Fix a memory leak in hang state error path
      commit: 9525d169e5fd481538cf8c663cc5839e54f2e481
[4/6] drm/vc4: Protect madv read in vc4_gem_object_mmap() with madv_lock
      commit: 338c56050d8e892604da97f67bfa8cc4015a955f

Applied to drm-misc-next:

[5/6] drm/vc4: Use devm_request_irq() for automatic cleanup

      commit: 19e2815babd4c51a51ebabfe68daa90eb26309c3
[6/6] drm/vc4: Clean-up UAPI header inclusion
      commit: 4b9c36c83b34f710da9573291404f6a2246251c1

Thanks for the reviews!

Best regards,
- Maíra