mbox series

[v2,00/14] drm: Make DRM's IRQ helpers legacy

Message ID 20210803090704.32152-1-tzimmermann@suse.de
Headers show
Series drm: Make DRM's IRQ helpers legacy | expand

Message

Thomas Zimmermann Aug. 3, 2021, 9:06 a.m. UTC
DRM's IRQ helpers are only helpful for old, non-KMS drivers. Move
the code behind CONFIG_DRM_LEGACY. Convert KMS drivers to Linux
IRQ interfaces.

DRM provides IRQ helpers for setting up, receiving and removing IRQ
handlers. It's an abstraction over plain Linux functions. The code
is mid-layerish with several callbacks to hook into the rsp drivers.
Old UMS driver have their interrupts enabled via ioctl, so these
abstractions makes some sense. Modern KMS manage all their interrupts
internally. Using the DRM helpers adds indirection without benefits.

Most KMS drivers already use Linux IRQ functions instead of DRM's
abstraction layer. Patches 1 to 12 convert the remaining ones.
The patches also resolve a bug for devices without assigned interrupt
number. DRM helpers don't test for IRQ_NOTCONNECTED, so drivers do
not detect if the device has no interrupt assigned.

Patch 13 removes an unused function.

Patch 14 moves the DRM IRQ helpers behind CONFIG_DRM_LEGACY. Only
the old non-KMS drivers still use the functionality.

v2:
	* drop IRQ_NOTCONNECTED test from atmel-hlcdc (Sam)
	* use devm_request_irq() in atmel-hlcdc (Sam)
	* unify variable names in arm/hlcdc (Sam)

Thomas Zimmermann (14):
  drm/amdgpu: Convert to Linux IRQ interfaces
  drm/arm/hdlcd: Convert to Linux IRQ interfaces
  drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  drm/fsl-dcu: Convert to Linux IRQ interfaces
  drm/gma500: Convert to Linux IRQ interfaces
  drm/kmb: Convert to Linux IRQ interfaces
  drm/msm: Convert to Linux IRQ interfaces
  drm/mxsfb: Convert to Linux IRQ interfaces
  drm/radeon: Convert to Linux IRQ interfaces
  drm/tidss: Convert to Linux IRQ interfaces
  drm/tilcdc: Convert to Linux IRQ interfaces
  drm/vc4: Convert to Linux IRQ interfaces
  drm: Remove unused devm_drm_irq_install()
  drm: IRQ midlayer is now legacy

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c      |   1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c      |  21 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h      |   2 +-
 drivers/gpu/drm/arm/hdlcd_drv.c              | 174 ++++++++++---------
 drivers/gpu/drm/arm/hdlcd_drv.h              |   1 +
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |  80 +++++----
 drivers/gpu/drm/drm_irq.c                    |  95 +---------
 drivers/gpu/drm/drm_legacy_misc.c            |   3 +-
 drivers/gpu/drm/drm_vblank.c                 |   8 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c    |  78 +++++----
 drivers/gpu/drm/gma500/power.c               |   1 +
 drivers/gpu/drm/gma500/psb_drv.c             |   8 +-
 drivers/gpu/drm/gma500/psb_drv.h             |   5 -
 drivers/gpu/drm/gma500/psb_irq.c             |  26 ++-
 drivers/gpu/drm/gma500/psb_irq.h             |   4 +-
 drivers/gpu/drm/i810/i810_dma.c              |   3 +-
 drivers/gpu/drm/kmb/kmb_drv.c                |  26 ++-
 drivers/gpu/drm/mga/mga_dma.c                |   2 +-
 drivers/gpu/drm/mga/mga_drv.h                |   1 -
 drivers/gpu/drm/msm/msm_drv.c                | 113 +++++++-----
 drivers/gpu/drm/msm/msm_kms.h                |   2 +-
 drivers/gpu/drm/mxsfb/mxsfb_drv.c            |  81 +++++----
 drivers/gpu/drm/mxsfb/mxsfb_drv.h            |   2 +
 drivers/gpu/drm/r128/r128_cce.c              |   3 +-
 drivers/gpu/drm/radeon/radeon_drv.c          |   4 -
 drivers/gpu/drm/radeon/radeon_irq_kms.c      |  44 ++++-
 drivers/gpu/drm/radeon/radeon_kms.h          |   4 -
 drivers/gpu/drm/tidss/tidss_drv.c            |  15 +-
 drivers/gpu/drm/tidss/tidss_drv.h            |   2 +
 drivers/gpu/drm/tidss/tidss_irq.c            |  27 ++-
 drivers/gpu/drm/tidss/tidss_irq.h            |   4 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c          |  51 ++++--
 drivers/gpu/drm/tilcdc/tilcdc_drv.h          |   3 +
 drivers/gpu/drm/vc4/vc4_drv.c                |   4 -
 drivers/gpu/drm/vc4/vc4_drv.h                |   8 +-
 drivers/gpu/drm/vc4/vc4_irq.c                |  48 +++--
 drivers/gpu/drm/vc4/vc4_v3d.c                |  17 +-
 drivers/gpu/drm/via/via_mm.c                 |   3 +-
 include/drm/drm_device.h                     |  18 +-
 include/drm/drm_drv.h                        |  44 +----
 include/drm/drm_irq.h                        |  32 ----
 include/drm/drm_legacy.h                     |   3 +
 42 files changed, 567 insertions(+), 504 deletions(-)
 delete mode 100644 include/drm/drm_irq.h


base-commit: c9d6903562aa335593daf44b4a1edeaef6bf9206
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: c3f32630e1d2de2eb74316c930578847d4b83fb3
prerequisite-patch-id: b32ca0abfc255601f8a5052d3b88be09527dabcb
prerequisite-patch-id: 22a3f264168bacb04ef65306b32b86be8dc982ef
prerequisite-patch-id: 095a0acb604eb02956e1a7e53da41371c64eb813
prerequisite-patch-id: 7a2417d5d8d453204bd94aa873e3faae812f26fc
--
2.32.0

Comments

Dmitry Baryshkov Aug. 3, 2021, 9:37 a.m. UTC | #1
On 03/08/2021 12:06, Thomas Zimmermann wrote:
> Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
> IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
> don't benefit from using it.
> 
> DRM IRQ callbacks are now being called directly or inlined.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Rob should probably also give his blessing on this patch though.

> ---
>   drivers/gpu/drm/msm/msm_drv.c | 113 ++++++++++++++++++++--------------
>   drivers/gpu/drm/msm/msm_kms.h |   2 +-
>   2 files changed, 69 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 1594ae39d54f..a332b09a5a11 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -14,7 +14,6 @@
>   #include <drm/drm_drv.h>
>   #include <drm/drm_file.h>
>   #include <drm/drm_ioctl.h>
> -#include <drm/drm_irq.h>
>   #include <drm/drm_prime.h>
>   #include <drm/drm_of.h>
>   #include <drm/drm_vblank.h>
> @@ -201,6 +200,71 @@ void msm_rmw(void __iomem *addr, u32 mask, u32 or)
>   	msm_writel(val | or, addr);
>   }
>   
> +static irqreturn_t msm_irq(int irq, void *arg)
> +{
> +	struct drm_device *dev = arg;
> +	struct msm_drm_private *priv = dev->dev_private;
> +	struct msm_kms *kms = priv->kms;
> +
> +	BUG_ON(!kms);
> +
> +	return kms->funcs->irq(kms);
> +}
> +
> +static void msm_irq_preinstall(struct drm_device *dev)
> +{
> +	struct msm_drm_private *priv = dev->dev_private;
> +	struct msm_kms *kms = priv->kms;
> +
> +	BUG_ON(!kms);
> +
> +	kms->funcs->irq_preinstall(kms);
> +}
> +
> +static int msm_irq_postinstall(struct drm_device *dev)
> +{
> +	struct msm_drm_private *priv = dev->dev_private;
> +	struct msm_kms *kms = priv->kms;
> +
> +	BUG_ON(!kms);
> +
> +	if (kms->funcs->irq_postinstall)
> +		return kms->funcs->irq_postinstall(kms);
> +
> +	return 0;
> +}
> +
> +static int msm_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
> +
> +	msm_irq_preinstall(dev);
> +
> +	ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = msm_irq_postinstall(dev);
> +	if (ret) {
> +		free_irq(irq, dev);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void msm_irq_uninstall(struct drm_device *dev)
> +{
> +	struct msm_drm_private *priv = dev->dev_private;
> +	struct msm_kms *kms = priv->kms;
> +
> +	kms->funcs->irq_uninstall(kms);
> +	free_irq(kms->irq, dev);
> +}
> +
>   struct msm_vblank_work {
>   	struct work_struct work;
>   	int crtc_id;
> @@ -265,7 +329,7 @@ static int msm_drm_uninit(struct device *dev)
>   	}
>   
>   	/* We must cancel and cleanup any pending vblank enable/disable
> -	 * work before drm_irq_uninstall() to avoid work re-enabling an
> +	 * work before msm_irq_uninstall() to avoid work re-enabling an
>   	 * irq after uninstall has disabled it.
>   	 */
>   
> @@ -294,7 +358,7 @@ static int msm_drm_uninit(struct device *dev)
>   	drm_mode_config_cleanup(ddev);
>   
>   	pm_runtime_get_sync(dev);
> -	drm_irq_uninstall(ddev);
> +	msm_irq_uninstall(ddev);
>   	pm_runtime_put_sync(dev);
>   
>   	if (kms && kms->funcs)
> @@ -553,7 +617,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
>   
>   	if (kms) {
>   		pm_runtime_get_sync(dev);
> -		ret = drm_irq_install(ddev, kms->irq);
> +		ret = msm_irq_install(ddev, kms->irq);
>   		pm_runtime_put_sync(dev);
>   		if (ret < 0) {
>   			DRM_DEV_ERROR(dev, "failed to install IRQ handler\n");
> @@ -662,43 +726,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file)
>   	context_close(ctx);
>   }
>   
> -static irqreturn_t msm_irq(int irq, void *arg)
> -{
> -	struct drm_device *dev = arg;
> -	struct msm_drm_private *priv = dev->dev_private;
> -	struct msm_kms *kms = priv->kms;
> -	BUG_ON(!kms);
> -	return kms->funcs->irq(kms);
> -}
> -
> -static void msm_irq_preinstall(struct drm_device *dev)
> -{
> -	struct msm_drm_private *priv = dev->dev_private;
> -	struct msm_kms *kms = priv->kms;
> -	BUG_ON(!kms);
> -	kms->funcs->irq_preinstall(kms);
> -}
> -
> -static int msm_irq_postinstall(struct drm_device *dev)
> -{
> -	struct msm_drm_private *priv = dev->dev_private;
> -	struct msm_kms *kms = priv->kms;
> -	BUG_ON(!kms);
> -
> -	if (kms->funcs->irq_postinstall)
> -		return kms->funcs->irq_postinstall(kms);
> -
> -	return 0;
> -}
> -
> -static void msm_irq_uninstall(struct drm_device *dev)
> -{
> -	struct msm_drm_private *priv = dev->dev_private;
> -	struct msm_kms *kms = priv->kms;
> -	BUG_ON(!kms);
> -	kms->funcs->irq_uninstall(kms);
> -}
> -
>   int msm_crtc_enable_vblank(struct drm_crtc *crtc)
>   {
>   	struct drm_device *dev = crtc->dev;
> @@ -1051,10 +1078,6 @@ static const struct drm_driver msm_driver = {
>   	.open               = msm_open,
>   	.postclose           = msm_postclose,
>   	.lastclose          = drm_fb_helper_lastclose,
> -	.irq_handler        = msm_irq,
> -	.irq_preinstall     = msm_irq_preinstall,
> -	.irq_postinstall    = msm_irq_postinstall,
> -	.irq_uninstall      = msm_irq_uninstall,
>   	.dumb_create        = msm_gem_dumb_create,
>   	.dumb_map_offset    = msm_gem_dumb_map_offset,
>   	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
> index 086a2d59b8c8..9de7c42e1071 100644
> --- a/drivers/gpu/drm/msm/msm_kms.h
> +++ b/drivers/gpu/drm/msm/msm_kms.h
> @@ -150,7 +150,7 @@ struct msm_kms {
>   	const struct msm_kms_funcs *funcs;
>   	struct drm_device *dev;
>   
> -	/* irq number to be passed on to drm_irq_install */
> +	/* irq number to be passed on to msm_irq_install */
>   	int irq;
>   
>   	/* mapper-id used to request GEM buffer mapped for scanout: */
>
Thomas Zimmermann Aug. 4, 2021, 7:10 a.m. UTC | #2
Hi

Am 03.08.21 um 20:36 schrieb Chrisanthus, Anitha:
> Hi Thomas,

> Can you please hold off on applying the kmb patch, I am seeing some issues while testing. Modetest works, but video playback only plays once, and it fails the second time with this patch.


Sounds a bit like the testing issue at [1]. For testing, you need the 
latest drm-misc-next or drm-tip. Specifically, you need commit 
1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

Let me know whether this works for you.

Best regards
Thomas

[1] https://patchwork.freedesktop.org/patch/447057/?series=93078&rev=1

> 

> Thanks,

> Anitha

> 

> 

>> -----Original Message-----

>> From: Sam Ravnborg <sam@ravnborg.org>

>> Sent: Tuesday, August 3, 2021 8:05 AM

>> To: Thomas Zimmermann <tzimmermann@suse.de>

>> Cc: daniel@ffwll.ch; airlied@linux.ie; alexander.deucher@amd.com;

>> christian.koenig@amd.com; liviu.dudau@arm.com; brian.starkey@arm.com;

>> bbrezillon@kernel.org; nicolas.ferre@microchip.com;

>> maarten.lankhorst@linux.intel.com; mripard@kernel.org; stefan@agner.ch;

>> alison.wang@nxp.com; patrik.r.jakobsson@gmail.com; Chrisanthus, Anitha

>> <anitha.chrisanthus@intel.com>; robdclark@gmail.com; Dea, Edmund J

>> <edmund.j.dea@intel.com>; sean@poorly.run; shawnguo@kernel.org;

>> s.hauer@pengutronix.de; kernel@pengutronix.de; jyri.sarha@iki.fi;

>> tomba@kernel.org; Dan.Sneddon@microchip.com;

>> tomi.valkeinen@ideasonboard.com; amd-gfx@lists.freedesktop.org; dri-

>> devel@lists.freedesktop.org; linux-arm-kernel@lists.infradead.org; linux-arm-

>> msm@vger.kernel.org; freedreno@lists.freedesktop.org

>> Subject: Re: [PATCH v2 00/14] drm: Make DRM's IRQ helpers legacy

>>

>> Hi Thomas,

>>

>> On Tue, Aug 03, 2021 at 11:06:50AM +0200, Thomas Zimmermann wrote:

>>> DRM's IRQ helpers are only helpful for old, non-KMS drivers. Move

>>> the code behind CONFIG_DRM_LEGACY. Convert KMS drivers to Linux

>>> IRQ interfaces.

>>>

>>> DRM provides IRQ helpers for setting up, receiving and removing IRQ

>>> handlers. It's an abstraction over plain Linux functions. The code

>>> is mid-layerish with several callbacks to hook into the rsp drivers.

>>> Old UMS driver have their interrupts enabled via ioctl, so these

>>> abstractions makes some sense. Modern KMS manage all their interrupts

>>> internally. Using the DRM helpers adds indirection without benefits.

>>>

>>> Most KMS drivers already use Linux IRQ functions instead of DRM's

>>> abstraction layer. Patches 1 to 12 convert the remaining ones.

>>> The patches also resolve a bug for devices without assigned interrupt

>>> number. DRM helpers don't test for IRQ_NOTCONNECTED, so drivers do

>>> not detect if the device has no interrupt assigned.

>>>

>>> Patch 13 removes an unused function.

>>>

>>> Patch 14 moves the DRM IRQ helpers behind CONFIG_DRM_LEGACY. Only

>>> the old non-KMS drivers still use the functionality.

>>>

>>> v2:

>>> 	* drop IRQ_NOTCONNECTED test from atmel-hlcdc (Sam)

>>> 	* use devm_request_irq() in atmel-hlcdc (Sam)

>>> 	* unify variable names in arm/hlcdc (Sam)

>>>

>>> Thomas Zimmermann (14):

>>

>> The following patches are all:

>> Acked-by: Sam Ravnborg <sam@ravnborg.org>

>>

>>>    drm/fsl-dcu: Convert to Linux IRQ interfaces

>>>    drm/gma500: Convert to Linux IRQ interfaces

>>>    drm/kmb: Convert to Linux IRQ interfaces

>>>    drm/msm: Convert to Linux IRQ interfaces

>>>    drm/mxsfb: Convert to Linux IRQ interfaces

>>>    drm/tidss: Convert to Linux IRQ interfaces

>>>    drm/vc4: Convert to Linux IRQ interfaces

>>>    drm: Remove unused devm_drm_irq_install()

>>

>> The remaining patches I either skipped or already had a feedback from

>> me or I asked a question.

>>

>> 	Sam


-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Chrisanthus, Anitha Aug. 5, 2021, 11:59 p.m. UTC | #3
Hi Thomas,

> -----Original Message-----

> From: Thomas Zimmermann <tzimmermann@suse.de>

> Sent: Wednesday, August 4, 2021 12:11 AM

> To: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>; Sam Ravnborg

> <sam@ravnborg.org>

> Cc: daniel@ffwll.ch; airlied@linux.ie; alexander.deucher@amd.com;

> christian.koenig@amd.com; liviu.dudau@arm.com; brian.starkey@arm.com;

> bbrezillon@kernel.org; nicolas.ferre@microchip.com;

> maarten.lankhorst@linux.intel.com; mripard@kernel.org; stefan@agner.ch;

> alison.wang@nxp.com; patrik.r.jakobsson@gmail.com; robdclark@gmail.com;

> Dea, Edmund J <edmund.j.dea@intel.com>; sean@poorly.run;

> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;

> jyri.sarha@iki.fi; tomba@kernel.org; Dan.Sneddon@microchip.com;

> tomi.valkeinen@ideasonboard.com; amd-gfx@lists.freedesktop.org; dri-

> devel@lists.freedesktop.org; linux-arm-kernel@lists.infradead.org; linux-arm-

> msm@vger.kernel.org; freedreno@lists.freedesktop.org

> Subject: Re: [PATCH v2 00/14] drm: Make DRM's IRQ helpers legacy

> 

> Hi

> 

> Am 03.08.21 um 20:36 schrieb Chrisanthus, Anitha:

> > Hi Thomas,

> > Can you please hold off on applying the kmb patch, I am seeing some issues

> while testing. Modetest works, but video playback only plays once, and it fails

> the second time with this patch.

> 

> Sounds a bit like the testing issue at [1]. For testing, you need the

> latest drm-misc-next or drm-tip. Specifically, you need commit

> 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").



You are right, with the above patch video plays fine. It's all good now! Sorry about the confusion.
> 

> Let me know whether this works for you.

> 

> Best regards

> Thomas

> 

> [1] https://patchwork.freedesktop.org/patch/447057/?series=93078&rev=1

> 

> >

> > Thanks,

> > Anitha

> >

> >

> >> -----Original Message-----

> >> From: Sam Ravnborg <sam@ravnborg.org>

> >> Sent: Tuesday, August 3, 2021 8:05 AM

> >> To: Thomas Zimmermann <tzimmermann@suse.de>

> >> Cc: daniel@ffwll.ch; airlied@linux.ie; alexander.deucher@amd.com;

> >> christian.koenig@amd.com; liviu.dudau@arm.com;

> brian.starkey@arm.com;

> >> bbrezillon@kernel.org; nicolas.ferre@microchip.com;

> >> maarten.lankhorst@linux.intel.com; mripard@kernel.org;

> stefan@agner.ch;

> >> alison.wang@nxp.com; patrik.r.jakobsson@gmail.com; Chrisanthus, Anitha

> >> <anitha.chrisanthus@intel.com>; robdclark@gmail.com; Dea, Edmund J

> >> <edmund.j.dea@intel.com>; sean@poorly.run; shawnguo@kernel.org;

> >> s.hauer@pengutronix.de; kernel@pengutronix.de; jyri.sarha@iki.fi;

> >> tomba@kernel.org; Dan.Sneddon@microchip.com;

> >> tomi.valkeinen@ideasonboard.com; amd-gfx@lists.freedesktop.org; dri-

> >> devel@lists.freedesktop.org; linux-arm-kernel@lists.infradead.org; linux-

> arm-

> >> msm@vger.kernel.org; freedreno@lists.freedesktop.org

> >> Subject: Re: [PATCH v2 00/14] drm: Make DRM's IRQ helpers legacy

> >>

> >> Hi Thomas,

> >>

> >> On Tue, Aug 03, 2021 at 11:06:50AM +0200, Thomas Zimmermann wrote:

> >>> DRM's IRQ helpers are only helpful for old, non-KMS drivers. Move

> >>> the code behind CONFIG_DRM_LEGACY. Convert KMS drivers to Linux

> >>> IRQ interfaces.

> >>>

> >>> DRM provides IRQ helpers for setting up, receiving and removing IRQ

> >>> handlers. It's an abstraction over plain Linux functions. The code

> >>> is mid-layerish with several callbacks to hook into the rsp drivers.

> >>> Old UMS driver have their interrupts enabled via ioctl, so these

> >>> abstractions makes some sense. Modern KMS manage all their interrupts

> >>> internally. Using the DRM helpers adds indirection without benefits.

> >>>

> >>> Most KMS drivers already use Linux IRQ functions instead of DRM's

> >>> abstraction layer. Patches 1 to 12 convert the remaining ones.

> >>> The patches also resolve a bug for devices without assigned interrupt

> >>> number. DRM helpers don't test for IRQ_NOTCONNECTED, so drivers do

> >>> not detect if the device has no interrupt assigned.

> >>>

> >>> Patch 13 removes an unused function.

> >>>

> >>> Patch 14 moves the DRM IRQ helpers behind CONFIG_DRM_LEGACY. Only

> >>> the old non-KMS drivers still use the functionality.

> >>>

> >>> v2:

> >>> 	* drop IRQ_NOTCONNECTED test from atmel-hlcdc (Sam)

> >>> 	* use devm_request_irq() in atmel-hlcdc (Sam)

> >>> 	* unify variable names in arm/hlcdc (Sam)

> >>>

> >>> Thomas Zimmermann (14):

> >>

> >> The following patches are all:

> >> Acked-by: Sam Ravnborg <sam@ravnborg.org>

> >>

> >>>    drm/fsl-dcu: Convert to Linux IRQ interfaces

> >>>    drm/gma500: Convert to Linux IRQ interfaces

> >>>    drm/kmb: Convert to Linux IRQ interfaces

> >>>    drm/msm: Convert to Linux IRQ interfaces

> >>>    drm/mxsfb: Convert to Linux IRQ interfaces

> >>>    drm/tidss: Convert to Linux IRQ interfaces

> >>>    drm/vc4: Convert to Linux IRQ interfaces

> >>>    drm: Remove unused devm_drm_irq_install()

> >>

> >> The remaining patches I either skipped or already had a feedback from

> >> me or I asked a question.

> >>

> >> 	Sam

> 

> --

> Thomas Zimmermann

> Graphics Driver Developer

> SUSE Software Solutions Germany GmbH

> Maxfeldstr. 5, 90409 Nürnberg, Germany

> (HRB 36809, AG Nürnberg)

> Geschäftsführer: Felix Imendörffer
Thomas Zimmermann Aug. 7, 2021, 6:51 a.m. UTC | #4
Hi

Am 06.08.21 um 01:59 schrieb Chrisanthus, Anitha:
> Hi Thomas,

> 

>> -----Original Message-----

>> From: Thomas Zimmermann <tzimmermann@suse.de>

>> Sent: Wednesday, August 4, 2021 12:11 AM

>> To: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>; Sam Ravnborg

>> <sam@ravnborg.org>

>> Cc: daniel@ffwll.ch; airlied@linux.ie; alexander.deucher@amd.com;

>> christian.koenig@amd.com; liviu.dudau@arm.com; brian.starkey@arm.com;

>> bbrezillon@kernel.org; nicolas.ferre@microchip.com;

>> maarten.lankhorst@linux.intel.com; mripard@kernel.org; stefan@agner.ch;

>> alison.wang@nxp.com; patrik.r.jakobsson@gmail.com; robdclark@gmail.com;

>> Dea, Edmund J <edmund.j.dea@intel.com>; sean@poorly.run;

>> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;

>> jyri.sarha@iki.fi; tomba@kernel.org; Dan.Sneddon@microchip.com;

>> tomi.valkeinen@ideasonboard.com; amd-gfx@lists.freedesktop.org; dri-

>> devel@lists.freedesktop.org; linux-arm-kernel@lists.infradead.org; linux-arm-

>> msm@vger.kernel.org; freedreno@lists.freedesktop.org

>> Subject: Re: [PATCH v2 00/14] drm: Make DRM's IRQ helpers legacy

>>

>> Hi

>>

>> Am 03.08.21 um 20:36 schrieb Chrisanthus, Anitha:

>>> Hi Thomas,

>>> Can you please hold off on applying the kmb patch, I am seeing some issues

>> while testing. Modetest works, but video playback only plays once, and it fails

>> the second time with this patch.

>>

>> Sounds a bit like the testing issue at [1]. For testing, you need the

>> latest drm-misc-next or drm-tip. Specifically, you need commit

>> 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

> 

> 

> You are right, with the above patch video plays fine. It's all good now! Sorry about the confusion.


Thanks for trying. Can I add your Tested-by tag?

Best regards
Thomas

>>

>> Let me know whether this works for you.

>>

>> Best regards

>> Thomas

>>

>> [1] https://patchwork.freedesktop.org/patch/447057/?series=93078&rev=1

>>

>>>

>>> Thanks,

>>> Anitha

>>>

>>>

>>>> -----Original Message-----

>>>> From: Sam Ravnborg <sam@ravnborg.org>

>>>> Sent: Tuesday, August 3, 2021 8:05 AM

>>>> To: Thomas Zimmermann <tzimmermann@suse.de>

>>>> Cc: daniel@ffwll.ch; airlied@linux.ie; alexander.deucher@amd.com;

>>>> christian.koenig@amd.com; liviu.dudau@arm.com;

>> brian.starkey@arm.com;

>>>> bbrezillon@kernel.org; nicolas.ferre@microchip.com;

>>>> maarten.lankhorst@linux.intel.com; mripard@kernel.org;

>> stefan@agner.ch;

>>>> alison.wang@nxp.com; patrik.r.jakobsson@gmail.com; Chrisanthus, Anitha

>>>> <anitha.chrisanthus@intel.com>; robdclark@gmail.com; Dea, Edmund J

>>>> <edmund.j.dea@intel.com>; sean@poorly.run; shawnguo@kernel.org;

>>>> s.hauer@pengutronix.de; kernel@pengutronix.de; jyri.sarha@iki.fi;

>>>> tomba@kernel.org; Dan.Sneddon@microchip.com;

>>>> tomi.valkeinen@ideasonboard.com; amd-gfx@lists.freedesktop.org; dri-

>>>> devel@lists.freedesktop.org; linux-arm-kernel@lists.infradead.org; linux-

>> arm-

>>>> msm@vger.kernel.org; freedreno@lists.freedesktop.org

>>>> Subject: Re: [PATCH v2 00/14] drm: Make DRM's IRQ helpers legacy

>>>>

>>>> Hi Thomas,

>>>>

>>>> On Tue, Aug 03, 2021 at 11:06:50AM +0200, Thomas Zimmermann wrote:

>>>>> DRM's IRQ helpers are only helpful for old, non-KMS drivers. Move

>>>>> the code behind CONFIG_DRM_LEGACY. Convert KMS drivers to Linux

>>>>> IRQ interfaces.

>>>>>

>>>>> DRM provides IRQ helpers for setting up, receiving and removing IRQ

>>>>> handlers. It's an abstraction over plain Linux functions. The code

>>>>> is mid-layerish with several callbacks to hook into the rsp drivers.

>>>>> Old UMS driver have their interrupts enabled via ioctl, so these

>>>>> abstractions makes some sense. Modern KMS manage all their interrupts

>>>>> internally. Using the DRM helpers adds indirection without benefits.

>>>>>

>>>>> Most KMS drivers already use Linux IRQ functions instead of DRM's

>>>>> abstraction layer. Patches 1 to 12 convert the remaining ones.

>>>>> The patches also resolve a bug for devices without assigned interrupt

>>>>> number. DRM helpers don't test for IRQ_NOTCONNECTED, so drivers do

>>>>> not detect if the device has no interrupt assigned.

>>>>>

>>>>> Patch 13 removes an unused function.

>>>>>

>>>>> Patch 14 moves the DRM IRQ helpers behind CONFIG_DRM_LEGACY. Only

>>>>> the old non-KMS drivers still use the functionality.

>>>>>

>>>>> v2:

>>>>> 	* drop IRQ_NOTCONNECTED test from atmel-hlcdc (Sam)

>>>>> 	* use devm_request_irq() in atmel-hlcdc (Sam)

>>>>> 	* unify variable names in arm/hlcdc (Sam)

>>>>>

>>>>> Thomas Zimmermann (14):

>>>>

>>>> The following patches are all:

>>>> Acked-by: Sam Ravnborg <sam@ravnborg.org>

>>>>

>>>>>     drm/fsl-dcu: Convert to Linux IRQ interfaces

>>>>>     drm/gma500: Convert to Linux IRQ interfaces

>>>>>     drm/kmb: Convert to Linux IRQ interfaces

>>>>>     drm/msm: Convert to Linux IRQ interfaces

>>>>>     drm/mxsfb: Convert to Linux IRQ interfaces

>>>>>     drm/tidss: Convert to Linux IRQ interfaces

>>>>>     drm/vc4: Convert to Linux IRQ interfaces

>>>>>     drm: Remove unused devm_drm_irq_install()

>>>>

>>>> The remaining patches I either skipped or already had a feedback from

>>>> me or I asked a question.

>>>>

>>>> 	Sam

>>

>> --

>> Thomas Zimmermann

>> Graphics Driver Developer

>> SUSE Software Solutions Germany GmbH

>> Maxfeldstr. 5, 90409 Nürnberg, Germany

>> (HRB 36809, AG Nürnberg)

>> Geschäftsführer: Felix Imendörffer

> 


-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Rob Clark Aug. 7, 2021, 5:08 p.m. UTC | #5
On Tue, Aug 3, 2021 at 2:37 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On 03/08/2021 12:06, Thomas Zimmermann wrote:
> > Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
> > IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
> > don't benefit from using it.
> >
> > DRM IRQ callbacks are now being called directly or inlined.
> >
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
> Rob should probably also give his blessing on this patch though.
>

I've pushed this to msm-next-staging, but if Thomas would prefer to
merge the series together then I can drop it (in which case a-b for
this patch)

BR,
-R

> > ---
> >   drivers/gpu/drm/msm/msm_drv.c | 113 ++++++++++++++++++++--------------
> >   drivers/gpu/drm/msm/msm_kms.h |   2 +-
> >   2 files changed, 69 insertions(+), 46 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> > index 1594ae39d54f..a332b09a5a11 100644
> > --- a/drivers/gpu/drm/msm/msm_drv.c
> > +++ b/drivers/gpu/drm/msm/msm_drv.c
> > @@ -14,7 +14,6 @@
> >   #include <drm/drm_drv.h>
> >   #include <drm/drm_file.h>
> >   #include <drm/drm_ioctl.h>
> > -#include <drm/drm_irq.h>
> >   #include <drm/drm_prime.h>
> >   #include <drm/drm_of.h>
> >   #include <drm/drm_vblank.h>
> > @@ -201,6 +200,71 @@ void msm_rmw(void __iomem *addr, u32 mask, u32 or)
> >       msm_writel(val | or, addr);
> >   }
> >
> > +static irqreturn_t msm_irq(int irq, void *arg)
> > +{
> > +     struct drm_device *dev = arg;
> > +     struct msm_drm_private *priv = dev->dev_private;
> > +     struct msm_kms *kms = priv->kms;
> > +
> > +     BUG_ON(!kms);
> > +
> > +     return kms->funcs->irq(kms);
> > +}
> > +
> > +static void msm_irq_preinstall(struct drm_device *dev)
> > +{
> > +     struct msm_drm_private *priv = dev->dev_private;
> > +     struct msm_kms *kms = priv->kms;
> > +
> > +     BUG_ON(!kms);
> > +
> > +     kms->funcs->irq_preinstall(kms);
> > +}
> > +
> > +static int msm_irq_postinstall(struct drm_device *dev)
> > +{
> > +     struct msm_drm_private *priv = dev->dev_private;
> > +     struct msm_kms *kms = priv->kms;
> > +
> > +     BUG_ON(!kms);
> > +
> > +     if (kms->funcs->irq_postinstall)
> > +             return kms->funcs->irq_postinstall(kms);
> > +
> > +     return 0;
> > +}
> > +
> > +static int msm_irq_install(struct drm_device *dev, unsigned int irq)
> > +{
> > +     int ret;
> > +
> > +     if (irq == IRQ_NOTCONNECTED)
> > +             return -ENOTCONN;
> > +
> > +     msm_irq_preinstall(dev);
> > +
> > +     ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev);
> > +     if (ret)
> > +             return ret;
> > +
> > +     ret = msm_irq_postinstall(dev);
> > +     if (ret) {
> > +             free_irq(irq, dev);
> > +             return ret;
> > +     }
> > +
> > +     return 0;
> > +}
> > +
> > +static void msm_irq_uninstall(struct drm_device *dev)
> > +{
> > +     struct msm_drm_private *priv = dev->dev_private;
> > +     struct msm_kms *kms = priv->kms;
> > +
> > +     kms->funcs->irq_uninstall(kms);
> > +     free_irq(kms->irq, dev);
> > +}
> > +
> >   struct msm_vblank_work {
> >       struct work_struct work;
> >       int crtc_id;
> > @@ -265,7 +329,7 @@ static int msm_drm_uninit(struct device *dev)
> >       }
> >
> >       /* We must cancel and cleanup any pending vblank enable/disable
> > -      * work before drm_irq_uninstall() to avoid work re-enabling an
> > +      * work before msm_irq_uninstall() to avoid work re-enabling an
> >        * irq after uninstall has disabled it.
> >        */
> >
> > @@ -294,7 +358,7 @@ static int msm_drm_uninit(struct device *dev)
> >       drm_mode_config_cleanup(ddev);
> >
> >       pm_runtime_get_sync(dev);
> > -     drm_irq_uninstall(ddev);
> > +     msm_irq_uninstall(ddev);
> >       pm_runtime_put_sync(dev);
> >
> >       if (kms && kms->funcs)
> > @@ -553,7 +617,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
> >
> >       if (kms) {
> >               pm_runtime_get_sync(dev);
> > -             ret = drm_irq_install(ddev, kms->irq);
> > +             ret = msm_irq_install(ddev, kms->irq);
> >               pm_runtime_put_sync(dev);
> >               if (ret < 0) {
> >                       DRM_DEV_ERROR(dev, "failed to install IRQ handler\n");
> > @@ -662,43 +726,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file)
> >       context_close(ctx);
> >   }
> >
> > -static irqreturn_t msm_irq(int irq, void *arg)
> > -{
> > -     struct drm_device *dev = arg;
> > -     struct msm_drm_private *priv = dev->dev_private;
> > -     struct msm_kms *kms = priv->kms;
> > -     BUG_ON(!kms);
> > -     return kms->funcs->irq(kms);
> > -}
> > -
> > -static void msm_irq_preinstall(struct drm_device *dev)
> > -{
> > -     struct msm_drm_private *priv = dev->dev_private;
> > -     struct msm_kms *kms = priv->kms;
> > -     BUG_ON(!kms);
> > -     kms->funcs->irq_preinstall(kms);
> > -}
> > -
> > -static int msm_irq_postinstall(struct drm_device *dev)
> > -{
> > -     struct msm_drm_private *priv = dev->dev_private;
> > -     struct msm_kms *kms = priv->kms;
> > -     BUG_ON(!kms);
> > -
> > -     if (kms->funcs->irq_postinstall)
> > -             return kms->funcs->irq_postinstall(kms);
> > -
> > -     return 0;
> > -}
> > -
> > -static void msm_irq_uninstall(struct drm_device *dev)
> > -{
> > -     struct msm_drm_private *priv = dev->dev_private;
> > -     struct msm_kms *kms = priv->kms;
> > -     BUG_ON(!kms);
> > -     kms->funcs->irq_uninstall(kms);
> > -}
> > -
> >   int msm_crtc_enable_vblank(struct drm_crtc *crtc)
> >   {
> >       struct drm_device *dev = crtc->dev;
> > @@ -1051,10 +1078,6 @@ static const struct drm_driver msm_driver = {
> >       .open               = msm_open,
> >       .postclose           = msm_postclose,
> >       .lastclose          = drm_fb_helper_lastclose,
> > -     .irq_handler        = msm_irq,
> > -     .irq_preinstall     = msm_irq_preinstall,
> > -     .irq_postinstall    = msm_irq_postinstall,
> > -     .irq_uninstall      = msm_irq_uninstall,
> >       .dumb_create        = msm_gem_dumb_create,
> >       .dumb_map_offset    = msm_gem_dumb_map_offset,
> >       .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> > diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
> > index 086a2d59b8c8..9de7c42e1071 100644
> > --- a/drivers/gpu/drm/msm/msm_kms.h
> > +++ b/drivers/gpu/drm/msm/msm_kms.h
> > @@ -150,7 +150,7 @@ struct msm_kms {
> >       const struct msm_kms_funcs *funcs;
> >       struct drm_device *dev;
> >
> > -     /* irq number to be passed on to drm_irq_install */
> > +     /* irq number to be passed on to msm_irq_install */
> >       int irq;
> >
> >       /* mapper-id used to request GEM buffer mapped for scanout: */
> >
>
>
> --
> With best wishes
> Dmitry
Thomas Zimmermann Aug. 7, 2021, 6:40 p.m. UTC | #6
Hi

Am 07.08.21 um 19:08 schrieb Rob Clark:
> On Tue, Aug 3, 2021 at 2:37 AM Dmitry Baryshkov

> <dmitry.baryshkov@linaro.org> wrote:

>>

>> On 03/08/2021 12:06, Thomas Zimmermann wrote:

>>> Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's

>>> IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers

>>> don't benefit from using it.

>>>

>>> DRM IRQ callbacks are now being called directly or inlined.

>>>

>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

>>

>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

>>

>> Rob should probably also give his blessing on this patch though.

>>

> 

> I've pushed this to msm-next-staging, but if Thomas would prefer to

> merge the series together then I can drop it (in which case a-b for

> this patch)


Yes, please. I'd prefer to merge the whole patchset at once through 
drm-misc-next.

Best regards
Thomas

> 

> BR,

> -R

> 

>>> ---

>>>    drivers/gpu/drm/msm/msm_drv.c | 113 ++++++++++++++++++++--------------

>>>    drivers/gpu/drm/msm/msm_kms.h |   2 +-

>>>    2 files changed, 69 insertions(+), 46 deletions(-)

>>>

>>> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c

>>> index 1594ae39d54f..a332b09a5a11 100644

>>> --- a/drivers/gpu/drm/msm/msm_drv.c

>>> +++ b/drivers/gpu/drm/msm/msm_drv.c

>>> @@ -14,7 +14,6 @@

>>>    #include <drm/drm_drv.h>

>>>    #include <drm/drm_file.h>

>>>    #include <drm/drm_ioctl.h>

>>> -#include <drm/drm_irq.h>

>>>    #include <drm/drm_prime.h>

>>>    #include <drm/drm_of.h>

>>>    #include <drm/drm_vblank.h>

>>> @@ -201,6 +200,71 @@ void msm_rmw(void __iomem *addr, u32 mask, u32 or)

>>>        msm_writel(val | or, addr);

>>>    }

>>>

>>> +static irqreturn_t msm_irq(int irq, void *arg)

>>> +{

>>> +     struct drm_device *dev = arg;

>>> +     struct msm_drm_private *priv = dev->dev_private;

>>> +     struct msm_kms *kms = priv->kms;

>>> +

>>> +     BUG_ON(!kms);

>>> +

>>> +     return kms->funcs->irq(kms);

>>> +}

>>> +

>>> +static void msm_irq_preinstall(struct drm_device *dev)

>>> +{

>>> +     struct msm_drm_private *priv = dev->dev_private;

>>> +     struct msm_kms *kms = priv->kms;

>>> +

>>> +     BUG_ON(!kms);

>>> +

>>> +     kms->funcs->irq_preinstall(kms);

>>> +}

>>> +

>>> +static int msm_irq_postinstall(struct drm_device *dev)

>>> +{

>>> +     struct msm_drm_private *priv = dev->dev_private;

>>> +     struct msm_kms *kms = priv->kms;

>>> +

>>> +     BUG_ON(!kms);

>>> +

>>> +     if (kms->funcs->irq_postinstall)

>>> +             return kms->funcs->irq_postinstall(kms);

>>> +

>>> +     return 0;

>>> +}

>>> +

>>> +static int msm_irq_install(struct drm_device *dev, unsigned int irq)

>>> +{

>>> +     int ret;

>>> +

>>> +     if (irq == IRQ_NOTCONNECTED)

>>> +             return -ENOTCONN;

>>> +

>>> +     msm_irq_preinstall(dev);

>>> +

>>> +     ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev);

>>> +     if (ret)

>>> +             return ret;

>>> +

>>> +     ret = msm_irq_postinstall(dev);

>>> +     if (ret) {

>>> +             free_irq(irq, dev);

>>> +             return ret;

>>> +     }

>>> +

>>> +     return 0;

>>> +}

>>> +

>>> +static void msm_irq_uninstall(struct drm_device *dev)

>>> +{

>>> +     struct msm_drm_private *priv = dev->dev_private;

>>> +     struct msm_kms *kms = priv->kms;

>>> +

>>> +     kms->funcs->irq_uninstall(kms);

>>> +     free_irq(kms->irq, dev);

>>> +}

>>> +

>>>    struct msm_vblank_work {

>>>        struct work_struct work;

>>>        int crtc_id;

>>> @@ -265,7 +329,7 @@ static int msm_drm_uninit(struct device *dev)

>>>        }

>>>

>>>        /* We must cancel and cleanup any pending vblank enable/disable

>>> -      * work before drm_irq_uninstall() to avoid work re-enabling an

>>> +      * work before msm_irq_uninstall() to avoid work re-enabling an

>>>         * irq after uninstall has disabled it.

>>>         */

>>>

>>> @@ -294,7 +358,7 @@ static int msm_drm_uninit(struct device *dev)

>>>        drm_mode_config_cleanup(ddev);

>>>

>>>        pm_runtime_get_sync(dev);

>>> -     drm_irq_uninstall(ddev);

>>> +     msm_irq_uninstall(ddev);

>>>        pm_runtime_put_sync(dev);

>>>

>>>        if (kms && kms->funcs)

>>> @@ -553,7 +617,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)

>>>

>>>        if (kms) {

>>>                pm_runtime_get_sync(dev);

>>> -             ret = drm_irq_install(ddev, kms->irq);

>>> +             ret = msm_irq_install(ddev, kms->irq);

>>>                pm_runtime_put_sync(dev);

>>>                if (ret < 0) {

>>>                        DRM_DEV_ERROR(dev, "failed to install IRQ handler\n");

>>> @@ -662,43 +726,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file)

>>>        context_close(ctx);

>>>    }

>>>

>>> -static irqreturn_t msm_irq(int irq, void *arg)

>>> -{

>>> -     struct drm_device *dev = arg;

>>> -     struct msm_drm_private *priv = dev->dev_private;

>>> -     struct msm_kms *kms = priv->kms;

>>> -     BUG_ON(!kms);

>>> -     return kms->funcs->irq(kms);

>>> -}

>>> -

>>> -static void msm_irq_preinstall(struct drm_device *dev)

>>> -{

>>> -     struct msm_drm_private *priv = dev->dev_private;

>>> -     struct msm_kms *kms = priv->kms;

>>> -     BUG_ON(!kms);

>>> -     kms->funcs->irq_preinstall(kms);

>>> -}

>>> -

>>> -static int msm_irq_postinstall(struct drm_device *dev)

>>> -{

>>> -     struct msm_drm_private *priv = dev->dev_private;

>>> -     struct msm_kms *kms = priv->kms;

>>> -     BUG_ON(!kms);

>>> -

>>> -     if (kms->funcs->irq_postinstall)

>>> -             return kms->funcs->irq_postinstall(kms);

>>> -

>>> -     return 0;

>>> -}

>>> -

>>> -static void msm_irq_uninstall(struct drm_device *dev)

>>> -{

>>> -     struct msm_drm_private *priv = dev->dev_private;

>>> -     struct msm_kms *kms = priv->kms;

>>> -     BUG_ON(!kms);

>>> -     kms->funcs->irq_uninstall(kms);

>>> -}

>>> -

>>>    int msm_crtc_enable_vblank(struct drm_crtc *crtc)

>>>    {

>>>        struct drm_device *dev = crtc->dev;

>>> @@ -1051,10 +1078,6 @@ static const struct drm_driver msm_driver = {

>>>        .open               = msm_open,

>>>        .postclose           = msm_postclose,

>>>        .lastclose          = drm_fb_helper_lastclose,

>>> -     .irq_handler        = msm_irq,

>>> -     .irq_preinstall     = msm_irq_preinstall,

>>> -     .irq_postinstall    = msm_irq_postinstall,

>>> -     .irq_uninstall      = msm_irq_uninstall,

>>>        .dumb_create        = msm_gem_dumb_create,

>>>        .dumb_map_offset    = msm_gem_dumb_map_offset,

>>>        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,

>>> diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h

>>> index 086a2d59b8c8..9de7c42e1071 100644

>>> --- a/drivers/gpu/drm/msm/msm_kms.h

>>> +++ b/drivers/gpu/drm/msm/msm_kms.h

>>> @@ -150,7 +150,7 @@ struct msm_kms {

>>>        const struct msm_kms_funcs *funcs;

>>>        struct drm_device *dev;

>>>

>>> -     /* irq number to be passed on to drm_irq_install */

>>> +     /* irq number to be passed on to msm_irq_install */

>>>        int irq;

>>>

>>>        /* mapper-id used to request GEM buffer mapped for scanout: */

>>>

>>

>>

>> --

>> With best wishes

>> Dmitry


-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
Rob Clark Aug. 7, 2021, 6:50 p.m. UTC | #7
On Sat, Aug 7, 2021 at 11:40 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>

> Hi

>

> Am 07.08.21 um 19:08 schrieb Rob Clark:

> > On Tue, Aug 3, 2021 at 2:37 AM Dmitry Baryshkov

> > <dmitry.baryshkov@linaro.org> wrote:

> >>

> >> On 03/08/2021 12:06, Thomas Zimmermann wrote:

> >>> Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's

> >>> IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers

> >>> don't benefit from using it.

> >>>

> >>> DRM IRQ callbacks are now being called directly or inlined.

> >>>

> >>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

> >>

> >> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> >>

> >> Rob should probably also give his blessing on this patch though.

> >>

> >

> > I've pushed this to msm-next-staging, but if Thomas would prefer to

> > merge the series together then I can drop it (in which case a-b for

> > this patch)

>

> Yes, please. I'd prefer to merge the whole patchset at once through

> drm-misc-next.


Ok, I've dropped from msm-next-staging..  for merging via drm-msm-next:

Acked-by: Rob Clark <robdclark@chromium.org>


>

> Best regards

> Thomas

>

> >

> > BR,

> > -R

> >

> >>> ---

> >>>    drivers/gpu/drm/msm/msm_drv.c | 113 ++++++++++++++++++++--------------

> >>>    drivers/gpu/drm/msm/msm_kms.h |   2 +-

> >>>    2 files changed, 69 insertions(+), 46 deletions(-)

> >>>

> >>> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c

> >>> index 1594ae39d54f..a332b09a5a11 100644

> >>> --- a/drivers/gpu/drm/msm/msm_drv.c

> >>> +++ b/drivers/gpu/drm/msm/msm_drv.c

> >>> @@ -14,7 +14,6 @@

> >>>    #include <drm/drm_drv.h>

> >>>    #include <drm/drm_file.h>

> >>>    #include <drm/drm_ioctl.h>

> >>> -#include <drm/drm_irq.h>

> >>>    #include <drm/drm_prime.h>

> >>>    #include <drm/drm_of.h>

> >>>    #include <drm/drm_vblank.h>

> >>> @@ -201,6 +200,71 @@ void msm_rmw(void __iomem *addr, u32 mask, u32 or)

> >>>        msm_writel(val | or, addr);

> >>>    }

> >>>

> >>> +static irqreturn_t msm_irq(int irq, void *arg)

> >>> +{

> >>> +     struct drm_device *dev = arg;

> >>> +     struct msm_drm_private *priv = dev->dev_private;

> >>> +     struct msm_kms *kms = priv->kms;

> >>> +

> >>> +     BUG_ON(!kms);

> >>> +

> >>> +     return kms->funcs->irq(kms);

> >>> +}

> >>> +

> >>> +static void msm_irq_preinstall(struct drm_device *dev)

> >>> +{

> >>> +     struct msm_drm_private *priv = dev->dev_private;

> >>> +     struct msm_kms *kms = priv->kms;

> >>> +

> >>> +     BUG_ON(!kms);

> >>> +

> >>> +     kms->funcs->irq_preinstall(kms);

> >>> +}

> >>> +

> >>> +static int msm_irq_postinstall(struct drm_device *dev)

> >>> +{

> >>> +     struct msm_drm_private *priv = dev->dev_private;

> >>> +     struct msm_kms *kms = priv->kms;

> >>> +

> >>> +     BUG_ON(!kms);

> >>> +

> >>> +     if (kms->funcs->irq_postinstall)

> >>> +             return kms->funcs->irq_postinstall(kms);

> >>> +

> >>> +     return 0;

> >>> +}

> >>> +

> >>> +static int msm_irq_install(struct drm_device *dev, unsigned int irq)

> >>> +{

> >>> +     int ret;

> >>> +

> >>> +     if (irq == IRQ_NOTCONNECTED)

> >>> +             return -ENOTCONN;

> >>> +

> >>> +     msm_irq_preinstall(dev);

> >>> +

> >>> +     ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev);

> >>> +     if (ret)

> >>> +             return ret;

> >>> +

> >>> +     ret = msm_irq_postinstall(dev);

> >>> +     if (ret) {

> >>> +             free_irq(irq, dev);

> >>> +             return ret;

> >>> +     }

> >>> +

> >>> +     return 0;

> >>> +}

> >>> +

> >>> +static void msm_irq_uninstall(struct drm_device *dev)

> >>> +{

> >>> +     struct msm_drm_private *priv = dev->dev_private;

> >>> +     struct msm_kms *kms = priv->kms;

> >>> +

> >>> +     kms->funcs->irq_uninstall(kms);

> >>> +     free_irq(kms->irq, dev);

> >>> +}

> >>> +

> >>>    struct msm_vblank_work {

> >>>        struct work_struct work;

> >>>        int crtc_id;

> >>> @@ -265,7 +329,7 @@ static int msm_drm_uninit(struct device *dev)

> >>>        }

> >>>

> >>>        /* We must cancel and cleanup any pending vblank enable/disable

> >>> -      * work before drm_irq_uninstall() to avoid work re-enabling an

> >>> +      * work before msm_irq_uninstall() to avoid work re-enabling an

> >>>         * irq after uninstall has disabled it.

> >>>         */

> >>>

> >>> @@ -294,7 +358,7 @@ static int msm_drm_uninit(struct device *dev)

> >>>        drm_mode_config_cleanup(ddev);

> >>>

> >>>        pm_runtime_get_sync(dev);

> >>> -     drm_irq_uninstall(ddev);

> >>> +     msm_irq_uninstall(ddev);

> >>>        pm_runtime_put_sync(dev);

> >>>

> >>>        if (kms && kms->funcs)

> >>> @@ -553,7 +617,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)

> >>>

> >>>        if (kms) {

> >>>                pm_runtime_get_sync(dev);

> >>> -             ret = drm_irq_install(ddev, kms->irq);

> >>> +             ret = msm_irq_install(ddev, kms->irq);

> >>>                pm_runtime_put_sync(dev);

> >>>                if (ret < 0) {

> >>>                        DRM_DEV_ERROR(dev, "failed to install IRQ handler\n");

> >>> @@ -662,43 +726,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file)

> >>>        context_close(ctx);

> >>>    }

> >>>

> >>> -static irqreturn_t msm_irq(int irq, void *arg)

> >>> -{

> >>> -     struct drm_device *dev = arg;

> >>> -     struct msm_drm_private *priv = dev->dev_private;

> >>> -     struct msm_kms *kms = priv->kms;

> >>> -     BUG_ON(!kms);

> >>> -     return kms->funcs->irq(kms);

> >>> -}

> >>> -

> >>> -static void msm_irq_preinstall(struct drm_device *dev)

> >>> -{

> >>> -     struct msm_drm_private *priv = dev->dev_private;

> >>> -     struct msm_kms *kms = priv->kms;

> >>> -     BUG_ON(!kms);

> >>> -     kms->funcs->irq_preinstall(kms);

> >>> -}

> >>> -

> >>> -static int msm_irq_postinstall(struct drm_device *dev)

> >>> -{

> >>> -     struct msm_drm_private *priv = dev->dev_private;

> >>> -     struct msm_kms *kms = priv->kms;

> >>> -     BUG_ON(!kms);

> >>> -

> >>> -     if (kms->funcs->irq_postinstall)

> >>> -             return kms->funcs->irq_postinstall(kms);

> >>> -

> >>> -     return 0;

> >>> -}

> >>> -

> >>> -static void msm_irq_uninstall(struct drm_device *dev)

> >>> -{

> >>> -     struct msm_drm_private *priv = dev->dev_private;

> >>> -     struct msm_kms *kms = priv->kms;

> >>> -     BUG_ON(!kms);

> >>> -     kms->funcs->irq_uninstall(kms);

> >>> -}

> >>> -

> >>>    int msm_crtc_enable_vblank(struct drm_crtc *crtc)

> >>>    {

> >>>        struct drm_device *dev = crtc->dev;

> >>> @@ -1051,10 +1078,6 @@ static const struct drm_driver msm_driver = {

> >>>        .open               = msm_open,

> >>>        .postclose           = msm_postclose,

> >>>        .lastclose          = drm_fb_helper_lastclose,

> >>> -     .irq_handler        = msm_irq,

> >>> -     .irq_preinstall     = msm_irq_preinstall,

> >>> -     .irq_postinstall    = msm_irq_postinstall,

> >>> -     .irq_uninstall      = msm_irq_uninstall,

> >>>        .dumb_create        = msm_gem_dumb_create,

> >>>        .dumb_map_offset    = msm_gem_dumb_map_offset,

> >>>        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,

> >>> diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h

> >>> index 086a2d59b8c8..9de7c42e1071 100644

> >>> --- a/drivers/gpu/drm/msm/msm_kms.h

> >>> +++ b/drivers/gpu/drm/msm/msm_kms.h

> >>> @@ -150,7 +150,7 @@ struct msm_kms {

> >>>        const struct msm_kms_funcs *funcs;

> >>>        struct drm_device *dev;

> >>>

> >>> -     /* irq number to be passed on to drm_irq_install */

> >>> +     /* irq number to be passed on to msm_irq_install */

> >>>        int irq;

> >>>

> >>>        /* mapper-id used to request GEM buffer mapped for scanout: */

> >>>

> >>

> >>

> >> --

> >> With best wishes

> >> Dmitry

>

> --

> Thomas Zimmermann

> Graphics Driver Developer

> SUSE Software Solutions Germany GmbH

> Maxfeldstr. 5, 90409 Nürnberg, Germany

> (HRB 36809, AG Nürnberg)

> Geschäftsführer: Felix Imendörffer

>