All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-27 18:27 ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

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 |  85 +++++----
 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, 572 insertions(+), 504 deletions(-)
 delete mode 100644 include/drm/drm_irq.h


base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
--
2.32.0


^ permalink raw reply	[flat|nested] 172+ messages in thread

* [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-27 18:27 ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

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 |  85 +++++----
 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, 572 insertions(+), 504 deletions(-)
 delete mode 100644 include/drm/drm_irq.h


base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
--
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-27 18:27 ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

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 |  85 +++++----
 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, 572 insertions(+), 504 deletions(-)
 delete mode 100644 include/drm/drm_irq.h


base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
--
2.32.0


^ permalink raw reply	[flat|nested] 172+ messages in thread

* [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-27 18:27 ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

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 |  85 +++++----
 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, 572 insertions(+), 504 deletions(-)
 delete mode 100644 include/drm/drm_irq.h


base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
--
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

The interrupt number returned by pci_msi_vector() is now stored
in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
midlayer does not handle this correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 2bd13fc2541a..1e05b5aa94e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
-	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 0d01cfaca77e..a36cdc7323f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -46,7 +46,6 @@
 #include <linux/pci.h>
 
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_vblank.h>
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_drv.h>
@@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
  * Returns:
  * result of handling the IRQ, as defined by &irqreturn_t
  */
-irqreturn_t amdgpu_irq_handler(int irq, void *arg)
+static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct amdgpu_device *adev = drm_to_adev(dev);
@@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
 int amdgpu_irq_init(struct amdgpu_device *adev)
 {
 	int r = 0;
+	unsigned int irq;
 
 	spin_lock_init(&adev->irq.lock);
 
@@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
 	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
 
-	adev->irq.installed = true;
-	/* Use vector 0 for MSI-X */
-	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
+	/* Use vector 0 for MSI-X. */
+	r = pci_irq_vector(adev->pdev, 0);
+	if (r < 0)
+		return r;
+	irq = r;
+
+	/* PCI devices require shared interrupts. */
+	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
+			adev_to_drm(adev));
 	if (r) {
-		adev->irq.installed = false;
 		if (!amdgpu_device_has_dc_support(adev))
 			flush_work(&adev->hotplug_work);
 		return r;
 	}
+	adev->irq.installed = true;
+	adev->irq.irq = irq;
 	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
 
 	DRM_DEBUG("amdgpu: irq initialized.\n");
@@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
 {
 	if (adev->irq.installed) {
-		drm_irq_uninstall(&adev->ddev);
+		free_irq(adev->irq.irq, adev_to_drm(adev));
 		adev->irq.installed = false;
 		if (adev->irq.msi_enabled)
 			pci_free_irq_vectors(adev->pdev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
index 78ad4784cc74..e9f2c11ea416 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
@@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
 
 struct amdgpu_irq {
 	bool				installed;
+	unsigned int			irq;
 	spinlock_t			lock;
 	/* interrupt sources */
 	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
@@ -100,7 +101,6 @@ struct amdgpu_irq {
 };
 
 void amdgpu_irq_disable_all(struct amdgpu_device *adev);
-irqreturn_t amdgpu_irq_handler(int irq, void *arg);
 
 int amdgpu_irq_init(struct amdgpu_device *adev);
 void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

The interrupt number returned by pci_msi_vector() is now stored
in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
midlayer does not handle this correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 2bd13fc2541a..1e05b5aa94e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
-	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 0d01cfaca77e..a36cdc7323f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -46,7 +46,6 @@
 #include <linux/pci.h>
 
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_vblank.h>
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_drv.h>
@@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
  * Returns:
  * result of handling the IRQ, as defined by &irqreturn_t
  */
-irqreturn_t amdgpu_irq_handler(int irq, void *arg)
+static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct amdgpu_device *adev = drm_to_adev(dev);
@@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
 int amdgpu_irq_init(struct amdgpu_device *adev)
 {
 	int r = 0;
+	unsigned int irq;
 
 	spin_lock_init(&adev->irq.lock);
 
@@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
 	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
 
-	adev->irq.installed = true;
-	/* Use vector 0 for MSI-X */
-	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
+	/* Use vector 0 for MSI-X. */
+	r = pci_irq_vector(adev->pdev, 0);
+	if (r < 0)
+		return r;
+	irq = r;
+
+	/* PCI devices require shared interrupts. */
+	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
+			adev_to_drm(adev));
 	if (r) {
-		adev->irq.installed = false;
 		if (!amdgpu_device_has_dc_support(adev))
 			flush_work(&adev->hotplug_work);
 		return r;
 	}
+	adev->irq.installed = true;
+	adev->irq.irq = irq;
 	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
 
 	DRM_DEBUG("amdgpu: irq initialized.\n");
@@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
 {
 	if (adev->irq.installed) {
-		drm_irq_uninstall(&adev->ddev);
+		free_irq(adev->irq.irq, adev_to_drm(adev));
 		adev->irq.installed = false;
 		if (adev->irq.msi_enabled)
 			pci_free_irq_vectors(adev->pdev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
index 78ad4784cc74..e9f2c11ea416 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
@@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
 
 struct amdgpu_irq {
 	bool				installed;
+	unsigned int			irq;
 	spinlock_t			lock;
 	/* interrupt sources */
 	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
@@ -100,7 +101,6 @@ struct amdgpu_irq {
 };
 
 void amdgpu_irq_disable_all(struct amdgpu_device *adev);
-irqreturn_t amdgpu_irq_handler(int irq, void *arg);
 
 int amdgpu_irq_init(struct amdgpu_device *adev);
 void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

The interrupt number returned by pci_msi_vector() is now stored
in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
midlayer does not handle this correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 2bd13fc2541a..1e05b5aa94e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
-	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 0d01cfaca77e..a36cdc7323f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -46,7 +46,6 @@
 #include <linux/pci.h>
 
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_vblank.h>
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_drv.h>
@@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
  * Returns:
  * result of handling the IRQ, as defined by &irqreturn_t
  */
-irqreturn_t amdgpu_irq_handler(int irq, void *arg)
+static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct amdgpu_device *adev = drm_to_adev(dev);
@@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
 int amdgpu_irq_init(struct amdgpu_device *adev)
 {
 	int r = 0;
+	unsigned int irq;
 
 	spin_lock_init(&adev->irq.lock);
 
@@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
 	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
 
-	adev->irq.installed = true;
-	/* Use vector 0 for MSI-X */
-	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
+	/* Use vector 0 for MSI-X. */
+	r = pci_irq_vector(adev->pdev, 0);
+	if (r < 0)
+		return r;
+	irq = r;
+
+	/* PCI devices require shared interrupts. */
+	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
+			adev_to_drm(adev));
 	if (r) {
-		adev->irq.installed = false;
 		if (!amdgpu_device_has_dc_support(adev))
 			flush_work(&adev->hotplug_work);
 		return r;
 	}
+	adev->irq.installed = true;
+	adev->irq.irq = irq;
 	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
 
 	DRM_DEBUG("amdgpu: irq initialized.\n");
@@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
 {
 	if (adev->irq.installed) {
-		drm_irq_uninstall(&adev->ddev);
+		free_irq(adev->irq.irq, adev_to_drm(adev));
 		adev->irq.installed = false;
 		if (adev->irq.msi_enabled)
 			pci_free_irq_vectors(adev->pdev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
index 78ad4784cc74..e9f2c11ea416 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
@@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
 
 struct amdgpu_irq {
 	bool				installed;
+	unsigned int			irq;
 	spinlock_t			lock;
 	/* interrupt sources */
 	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
@@ -100,7 +101,6 @@ struct amdgpu_irq {
 };
 
 void amdgpu_irq_disable_all(struct amdgpu_device *adev);
-irqreturn_t amdgpu_irq_handler(int irq, void *arg);
 
 int amdgpu_irq_init(struct amdgpu_device *adev);
 void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

The interrupt number returned by pci_msi_vector() is now stored
in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
midlayer does not handle this correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 2bd13fc2541a..1e05b5aa94e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
-	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 0d01cfaca77e..a36cdc7323f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -46,7 +46,6 @@
 #include <linux/pci.h>
 
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_vblank.h>
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_drv.h>
@@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
  * Returns:
  * result of handling the IRQ, as defined by &irqreturn_t
  */
-irqreturn_t amdgpu_irq_handler(int irq, void *arg)
+static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct amdgpu_device *adev = drm_to_adev(dev);
@@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
 int amdgpu_irq_init(struct amdgpu_device *adev)
 {
 	int r = 0;
+	unsigned int irq;
 
 	spin_lock_init(&adev->irq.lock);
 
@@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
 	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
 
-	adev->irq.installed = true;
-	/* Use vector 0 for MSI-X */
-	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
+	/* Use vector 0 for MSI-X. */
+	r = pci_irq_vector(adev->pdev, 0);
+	if (r < 0)
+		return r;
+	irq = r;
+
+	/* PCI devices require shared interrupts. */
+	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
+			adev_to_drm(adev));
 	if (r) {
-		adev->irq.installed = false;
 		if (!amdgpu_device_has_dc_support(adev))
 			flush_work(&adev->hotplug_work);
 		return r;
 	}
+	adev->irq.installed = true;
+	adev->irq.irq = irq;
 	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
 
 	DRM_DEBUG("amdgpu: irq initialized.\n");
@@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
 void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
 {
 	if (adev->irq.installed) {
-		drm_irq_uninstall(&adev->ddev);
+		free_irq(adev->irq.irq, adev_to_drm(adev));
 		adev->irq.installed = false;
 		if (adev->irq.msi_enabled)
 			pci_free_irq_vectors(adev->pdev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
index 78ad4784cc74..e9f2c11ea416 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
@@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
 
 struct amdgpu_irq {
 	bool				installed;
+	unsigned int			irq;
 	spinlock_t			lock;
 	/* interrupt sources */
 	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
@@ -100,7 +101,6 @@ struct amdgpu_irq {
 };
 
 void amdgpu_irq_disable_all(struct amdgpu_device *adev);
-irqreturn_t amdgpu_irq_handler(int irq, void *arg);
 
 int amdgpu_irq_init(struct amdgpu_device *adev);
 void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
 drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
 2 files changed, 97 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 81ae92390736..b9998fe3982f 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -29,7 +29,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -38,6 +37,94 @@
 #include "hdlcd_drv.h"
 #include "hdlcd_regs.h"
 
+static irqreturn_t hdlcd_irq(int irq, void *arg)
+{
+	struct drm_device *drm = arg;
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_status;
+
+	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
+
+#ifdef CONFIG_DEBUG_FS
+	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
+		atomic_inc(&hdlcd->buffer_underrun_count);
+
+	if (irq_status & HDLCD_INTERRUPT_DMA_END)
+		atomic_inc(&hdlcd->dma_end_count);
+
+	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
+		atomic_inc(&hdlcd->bus_error_count);
+
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		atomic_inc(&hdlcd->vsync_count);
+
+#endif
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		drm_crtc_handle_vblank(&hdlcd->crtc);
+
+	/* acknowledge interrupt(s) */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
+
+	return IRQ_HANDLED;
+}
+
+static void hdlcd_irq_preinstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* Ensure interrupts are disabled */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
+}
+
+static void hdlcd_irq_postinstall(struct drm_device *drm)
+{
+#ifdef CONFIG_DEBUG_FS
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+	/* enable debug interrupts */
+	irq_mask |= HDLCD_DEBUG_INT_MASK;
+
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+#endif
+}
+
+static int hdlcd_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	hdlcd_irq_preinstall(dev);
+
+	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	hdlcd_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void hdlcd_irq_uninstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* disable all the interrupts that we might have enabled */
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+#ifdef CONFIG_DEBUG_FS
+	/* disable debug interrupts */
+	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
+#endif
+
+	/* disable vsync interrupts */
+	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+
+	free_irq(hdlcd->irq, drm);
+}
+
 static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 {
 	struct hdlcd_drm_private *hdlcd = drm->dev_private;
@@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 		goto setup_fail;
 	}
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto irq_fail;
+	hdlcd->irq = ret;
+
+	ret = hdlcd_irq_install(drm, hdlcd->irq);
 	if (ret < 0) {
 		DRM_ERROR("failed to install IRQ handler\n");
 		goto irq_fail;
@@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
 	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
 }
 
-static irqreturn_t hdlcd_irq(int irq, void *arg)
-{
-	struct drm_device *drm = arg;
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_status;
-
-	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
-
-#ifdef CONFIG_DEBUG_FS
-	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
-		atomic_inc(&hdlcd->buffer_underrun_count);
-
-	if (irq_status & HDLCD_INTERRUPT_DMA_END)
-		atomic_inc(&hdlcd->dma_end_count);
-
-	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
-		atomic_inc(&hdlcd->bus_error_count);
-
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		atomic_inc(&hdlcd->vsync_count);
-
-#endif
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		drm_crtc_handle_vblank(&hdlcd->crtc);
-
-	/* acknowledge interrupt(s) */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
-
-	return IRQ_HANDLED;
-}
-
-static void hdlcd_irq_preinstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* Ensure interrupts are disabled */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
-}
-
-static int hdlcd_irq_postinstall(struct drm_device *drm)
-{
-#ifdef CONFIG_DEBUG_FS
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-	/* enable debug interrupts */
-	irq_mask |= HDLCD_DEBUG_INT_MASK;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-#endif
-	return 0;
-}
-
-static void hdlcd_irq_uninstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* disable all the interrupts that we might have enabled */
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-#ifdef CONFIG_DEBUG_FS
-	/* disable debug interrupts */
-	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
-#endif
-
-	/* disable vsync interrupts */
-	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-}
-
 #ifdef CONFIG_DEBUG_FS
 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
 {
@@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver hdlcd_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = hdlcd_irq,
-	.irq_preinstall = hdlcd_irq_preinstall,
-	.irq_postinstall = hdlcd_irq_postinstall,
-	.irq_uninstall = hdlcd_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = hdlcd_debugfs_init,
@@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
 err_unload:
 	of_node_put(hdlcd->crtc.port);
 	hdlcd->crtc.port = NULL;
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	of_reserved_mem_device_release(drm->dev);
 err_free:
 	drm_mode_config_cleanup(drm);
@@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
 	hdlcd->crtc.port = NULL;
 	pm_runtime_get_sync(dev);
 	drm_atomic_helper_shutdown(drm);
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	pm_runtime_put(dev);
 	if (pm_runtime_enabled(dev))
 		pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index fd438d177b64..909c39c28487 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -11,6 +11,7 @@ struct hdlcd_drm_private {
 	struct clk			*clk;
 	struct drm_crtc			crtc;
 	struct drm_plane		*plane;
+	unsigned int			irq;
 #ifdef CONFIG_DEBUG_FS
 	atomic_t buffer_underrun_count;
 	atomic_t bus_error_count;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
 drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
 2 files changed, 97 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 81ae92390736..b9998fe3982f 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -29,7 +29,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -38,6 +37,94 @@
 #include "hdlcd_drv.h"
 #include "hdlcd_regs.h"
 
+static irqreturn_t hdlcd_irq(int irq, void *arg)
+{
+	struct drm_device *drm = arg;
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_status;
+
+	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
+
+#ifdef CONFIG_DEBUG_FS
+	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
+		atomic_inc(&hdlcd->buffer_underrun_count);
+
+	if (irq_status & HDLCD_INTERRUPT_DMA_END)
+		atomic_inc(&hdlcd->dma_end_count);
+
+	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
+		atomic_inc(&hdlcd->bus_error_count);
+
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		atomic_inc(&hdlcd->vsync_count);
+
+#endif
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		drm_crtc_handle_vblank(&hdlcd->crtc);
+
+	/* acknowledge interrupt(s) */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
+
+	return IRQ_HANDLED;
+}
+
+static void hdlcd_irq_preinstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* Ensure interrupts are disabled */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
+}
+
+static void hdlcd_irq_postinstall(struct drm_device *drm)
+{
+#ifdef CONFIG_DEBUG_FS
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+	/* enable debug interrupts */
+	irq_mask |= HDLCD_DEBUG_INT_MASK;
+
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+#endif
+}
+
+static int hdlcd_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	hdlcd_irq_preinstall(dev);
+
+	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	hdlcd_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void hdlcd_irq_uninstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* disable all the interrupts that we might have enabled */
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+#ifdef CONFIG_DEBUG_FS
+	/* disable debug interrupts */
+	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
+#endif
+
+	/* disable vsync interrupts */
+	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+
+	free_irq(hdlcd->irq, drm);
+}
+
 static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 {
 	struct hdlcd_drm_private *hdlcd = drm->dev_private;
@@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 		goto setup_fail;
 	}
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto irq_fail;
+	hdlcd->irq = ret;
+
+	ret = hdlcd_irq_install(drm, hdlcd->irq);
 	if (ret < 0) {
 		DRM_ERROR("failed to install IRQ handler\n");
 		goto irq_fail;
@@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
 	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
 }
 
-static irqreturn_t hdlcd_irq(int irq, void *arg)
-{
-	struct drm_device *drm = arg;
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_status;
-
-	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
-
-#ifdef CONFIG_DEBUG_FS
-	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
-		atomic_inc(&hdlcd->buffer_underrun_count);
-
-	if (irq_status & HDLCD_INTERRUPT_DMA_END)
-		atomic_inc(&hdlcd->dma_end_count);
-
-	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
-		atomic_inc(&hdlcd->bus_error_count);
-
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		atomic_inc(&hdlcd->vsync_count);
-
-#endif
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		drm_crtc_handle_vblank(&hdlcd->crtc);
-
-	/* acknowledge interrupt(s) */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
-
-	return IRQ_HANDLED;
-}
-
-static void hdlcd_irq_preinstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* Ensure interrupts are disabled */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
-}
-
-static int hdlcd_irq_postinstall(struct drm_device *drm)
-{
-#ifdef CONFIG_DEBUG_FS
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-	/* enable debug interrupts */
-	irq_mask |= HDLCD_DEBUG_INT_MASK;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-#endif
-	return 0;
-}
-
-static void hdlcd_irq_uninstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* disable all the interrupts that we might have enabled */
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-#ifdef CONFIG_DEBUG_FS
-	/* disable debug interrupts */
-	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
-#endif
-
-	/* disable vsync interrupts */
-	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-}
-
 #ifdef CONFIG_DEBUG_FS
 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
 {
@@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver hdlcd_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = hdlcd_irq,
-	.irq_preinstall = hdlcd_irq_preinstall,
-	.irq_postinstall = hdlcd_irq_postinstall,
-	.irq_uninstall = hdlcd_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = hdlcd_debugfs_init,
@@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
 err_unload:
 	of_node_put(hdlcd->crtc.port);
 	hdlcd->crtc.port = NULL;
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	of_reserved_mem_device_release(drm->dev);
 err_free:
 	drm_mode_config_cleanup(drm);
@@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
 	hdlcd->crtc.port = NULL;
 	pm_runtime_get_sync(dev);
 	drm_atomic_helper_shutdown(drm);
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	pm_runtime_put(dev);
 	if (pm_runtime_enabled(dev))
 		pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index fd438d177b64..909c39c28487 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -11,6 +11,7 @@ struct hdlcd_drm_private {
 	struct clk			*clk;
 	struct drm_crtc			crtc;
 	struct drm_plane		*plane;
+	unsigned int			irq;
 #ifdef CONFIG_DEBUG_FS
 	atomic_t buffer_underrun_count;
 	atomic_t bus_error_count;
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
 drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
 2 files changed, 97 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 81ae92390736..b9998fe3982f 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -29,7 +29,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -38,6 +37,94 @@
 #include "hdlcd_drv.h"
 #include "hdlcd_regs.h"
 
+static irqreturn_t hdlcd_irq(int irq, void *arg)
+{
+	struct drm_device *drm = arg;
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_status;
+
+	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
+
+#ifdef CONFIG_DEBUG_FS
+	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
+		atomic_inc(&hdlcd->buffer_underrun_count);
+
+	if (irq_status & HDLCD_INTERRUPT_DMA_END)
+		atomic_inc(&hdlcd->dma_end_count);
+
+	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
+		atomic_inc(&hdlcd->bus_error_count);
+
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		atomic_inc(&hdlcd->vsync_count);
+
+#endif
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		drm_crtc_handle_vblank(&hdlcd->crtc);
+
+	/* acknowledge interrupt(s) */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
+
+	return IRQ_HANDLED;
+}
+
+static void hdlcd_irq_preinstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* Ensure interrupts are disabled */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
+}
+
+static void hdlcd_irq_postinstall(struct drm_device *drm)
+{
+#ifdef CONFIG_DEBUG_FS
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+	/* enable debug interrupts */
+	irq_mask |= HDLCD_DEBUG_INT_MASK;
+
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+#endif
+}
+
+static int hdlcd_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	hdlcd_irq_preinstall(dev);
+
+	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	hdlcd_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void hdlcd_irq_uninstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* disable all the interrupts that we might have enabled */
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+#ifdef CONFIG_DEBUG_FS
+	/* disable debug interrupts */
+	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
+#endif
+
+	/* disable vsync interrupts */
+	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+
+	free_irq(hdlcd->irq, drm);
+}
+
 static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 {
 	struct hdlcd_drm_private *hdlcd = drm->dev_private;
@@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 		goto setup_fail;
 	}
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto irq_fail;
+	hdlcd->irq = ret;
+
+	ret = hdlcd_irq_install(drm, hdlcd->irq);
 	if (ret < 0) {
 		DRM_ERROR("failed to install IRQ handler\n");
 		goto irq_fail;
@@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
 	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
 }
 
-static irqreturn_t hdlcd_irq(int irq, void *arg)
-{
-	struct drm_device *drm = arg;
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_status;
-
-	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
-
-#ifdef CONFIG_DEBUG_FS
-	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
-		atomic_inc(&hdlcd->buffer_underrun_count);
-
-	if (irq_status & HDLCD_INTERRUPT_DMA_END)
-		atomic_inc(&hdlcd->dma_end_count);
-
-	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
-		atomic_inc(&hdlcd->bus_error_count);
-
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		atomic_inc(&hdlcd->vsync_count);
-
-#endif
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		drm_crtc_handle_vblank(&hdlcd->crtc);
-
-	/* acknowledge interrupt(s) */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
-
-	return IRQ_HANDLED;
-}
-
-static void hdlcd_irq_preinstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* Ensure interrupts are disabled */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
-}
-
-static int hdlcd_irq_postinstall(struct drm_device *drm)
-{
-#ifdef CONFIG_DEBUG_FS
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-	/* enable debug interrupts */
-	irq_mask |= HDLCD_DEBUG_INT_MASK;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-#endif
-	return 0;
-}
-
-static void hdlcd_irq_uninstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* disable all the interrupts that we might have enabled */
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-#ifdef CONFIG_DEBUG_FS
-	/* disable debug interrupts */
-	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
-#endif
-
-	/* disable vsync interrupts */
-	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-}
-
 #ifdef CONFIG_DEBUG_FS
 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
 {
@@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver hdlcd_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = hdlcd_irq,
-	.irq_preinstall = hdlcd_irq_preinstall,
-	.irq_postinstall = hdlcd_irq_postinstall,
-	.irq_uninstall = hdlcd_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = hdlcd_debugfs_init,
@@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
 err_unload:
 	of_node_put(hdlcd->crtc.port);
 	hdlcd->crtc.port = NULL;
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	of_reserved_mem_device_release(drm->dev);
 err_free:
 	drm_mode_config_cleanup(drm);
@@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
 	hdlcd->crtc.port = NULL;
 	pm_runtime_get_sync(dev);
 	drm_atomic_helper_shutdown(drm);
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	pm_runtime_put(dev);
 	if (pm_runtime_enabled(dev))
 		pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index fd438d177b64..909c39c28487 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -11,6 +11,7 @@ struct hdlcd_drm_private {
 	struct clk			*clk;
 	struct drm_crtc			crtc;
 	struct drm_plane		*plane;
+	unsigned int			irq;
 #ifdef CONFIG_DEBUG_FS
 	atomic_t buffer_underrun_count;
 	atomic_t bus_error_count;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
 drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
 2 files changed, 97 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 81ae92390736..b9998fe3982f 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -29,7 +29,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -38,6 +37,94 @@
 #include "hdlcd_drv.h"
 #include "hdlcd_regs.h"
 
+static irqreturn_t hdlcd_irq(int irq, void *arg)
+{
+	struct drm_device *drm = arg;
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_status;
+
+	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
+
+#ifdef CONFIG_DEBUG_FS
+	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
+		atomic_inc(&hdlcd->buffer_underrun_count);
+
+	if (irq_status & HDLCD_INTERRUPT_DMA_END)
+		atomic_inc(&hdlcd->dma_end_count);
+
+	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
+		atomic_inc(&hdlcd->bus_error_count);
+
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		atomic_inc(&hdlcd->vsync_count);
+
+#endif
+	if (irq_status & HDLCD_INTERRUPT_VSYNC)
+		drm_crtc_handle_vblank(&hdlcd->crtc);
+
+	/* acknowledge interrupt(s) */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
+
+	return IRQ_HANDLED;
+}
+
+static void hdlcd_irq_preinstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* Ensure interrupts are disabled */
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
+	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
+}
+
+static void hdlcd_irq_postinstall(struct drm_device *drm)
+{
+#ifdef CONFIG_DEBUG_FS
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+	/* enable debug interrupts */
+	irq_mask |= HDLCD_DEBUG_INT_MASK;
+
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+#endif
+}
+
+static int hdlcd_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	hdlcd_irq_preinstall(dev);
+
+	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	hdlcd_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void hdlcd_irq_uninstall(struct drm_device *drm)
+{
+	struct hdlcd_drm_private *hdlcd = drm->dev_private;
+	/* disable all the interrupts that we might have enabled */
+	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
+
+#ifdef CONFIG_DEBUG_FS
+	/* disable debug interrupts */
+	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
+#endif
+
+	/* disable vsync interrupts */
+	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
+	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
+
+	free_irq(hdlcd->irq, drm);
+}
+
 static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 {
 	struct hdlcd_drm_private *hdlcd = drm->dev_private;
@@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
 		goto setup_fail;
 	}
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto irq_fail;
+	hdlcd->irq = ret;
+
+	ret = hdlcd_irq_install(drm, hdlcd->irq);
 	if (ret < 0) {
 		DRM_ERROR("failed to install IRQ handler\n");
 		goto irq_fail;
@@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
 	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
 }
 
-static irqreturn_t hdlcd_irq(int irq, void *arg)
-{
-	struct drm_device *drm = arg;
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_status;
-
-	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
-
-#ifdef CONFIG_DEBUG_FS
-	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
-		atomic_inc(&hdlcd->buffer_underrun_count);
-
-	if (irq_status & HDLCD_INTERRUPT_DMA_END)
-		atomic_inc(&hdlcd->dma_end_count);
-
-	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
-		atomic_inc(&hdlcd->bus_error_count);
-
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		atomic_inc(&hdlcd->vsync_count);
-
-#endif
-	if (irq_status & HDLCD_INTERRUPT_VSYNC)
-		drm_crtc_handle_vblank(&hdlcd->crtc);
-
-	/* acknowledge interrupt(s) */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
-
-	return IRQ_HANDLED;
-}
-
-static void hdlcd_irq_preinstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* Ensure interrupts are disabled */
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
-	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
-}
-
-static int hdlcd_irq_postinstall(struct drm_device *drm)
-{
-#ifdef CONFIG_DEBUG_FS
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-	/* enable debug interrupts */
-	irq_mask |= HDLCD_DEBUG_INT_MASK;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-#endif
-	return 0;
-}
-
-static void hdlcd_irq_uninstall(struct drm_device *drm)
-{
-	struct hdlcd_drm_private *hdlcd = drm->dev_private;
-	/* disable all the interrupts that we might have enabled */
-	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
-
-#ifdef CONFIG_DEBUG_FS
-	/* disable debug interrupts */
-	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
-#endif
-
-	/* disable vsync interrupts */
-	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
-
-	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
-}
-
 #ifdef CONFIG_DEBUG_FS
 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
 {
@@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver hdlcd_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = hdlcd_irq,
-	.irq_preinstall = hdlcd_irq_preinstall,
-	.irq_postinstall = hdlcd_irq_postinstall,
-	.irq_uninstall = hdlcd_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init = hdlcd_debugfs_init,
@@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
 err_unload:
 	of_node_put(hdlcd->crtc.port);
 	hdlcd->crtc.port = NULL;
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	of_reserved_mem_device_release(drm->dev);
 err_free:
 	drm_mode_config_cleanup(drm);
@@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
 	hdlcd->crtc.port = NULL;
 	pm_runtime_get_sync(dev);
 	drm_atomic_helper_shutdown(drm);
-	drm_irq_uninstall(drm);
+	hdlcd_irq_uninstall(drm);
 	pm_runtime_put(dev);
 	if (pm_runtime_enabled(dev))
 		pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index fd438d177b64..909c39c28487 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -11,6 +11,7 @@ struct hdlcd_drm_private {
 	struct clk			*clk;
 	struct drm_crtc			crtc;
 	struct drm_plane		*plane;
+	unsigned int			irq;
 #ifdef CONFIG_DEBUG_FS
 	atomic_t buffer_underrun_count;
 	atomic_t bus_error_count;
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
 1 file changed, 52 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index f09b6dd8754c..cfa8c2c9c8aa 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -22,7 +22,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int cfg = 0;
+	int i;
+
+	/* Enable interrupts on activated layers */
+	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
+		if (dc->layers[i])
+			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
+	}
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
+}
+
+static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int isr;
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
+	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
+}
+
+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+
+	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	atmel_hlcdc_dc_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+	free_irq(dc->hlcdc->irq, dev);
+}
+
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
 	.atomic_check = drm_atomic_helper_check,
@@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
 	drm_mode_config_reset(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	ret = drm_irq_install(dev, dc->hlcdc->irq);
+	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
 	pm_runtime_put_sync(dev->dev);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
@@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	drm_mode_config_cleanup(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	drm_irq_uninstall(dev);
+	atmel_hlcdc_dc_irq_uninstall(dev);
 	pm_runtime_put_sync(dev->dev);
 
 	dev->dev_private = NULL;
@@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	clk_disable_unprepare(dc->hlcdc->periph_clk);
 }
 
-static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int cfg = 0;
-	int i;
-
-	/* Enable interrupts on activated layers */
-	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
-		if (dc->layers[i])
-			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
-	}
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
-
-	return 0;
-}
-
-static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int isr;
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
-	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = atmel_hlcdc_dc_irq_handler,
-	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
-	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
-	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
 	.name = "atmel-hlcdc",
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
 1 file changed, 52 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index f09b6dd8754c..cfa8c2c9c8aa 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -22,7 +22,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int cfg = 0;
+	int i;
+
+	/* Enable interrupts on activated layers */
+	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
+		if (dc->layers[i])
+			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
+	}
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
+}
+
+static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int isr;
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
+	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
+}
+
+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+
+	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	atmel_hlcdc_dc_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+	free_irq(dc->hlcdc->irq, dev);
+}
+
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
 	.atomic_check = drm_atomic_helper_check,
@@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
 	drm_mode_config_reset(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	ret = drm_irq_install(dev, dc->hlcdc->irq);
+	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
 	pm_runtime_put_sync(dev->dev);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
@@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	drm_mode_config_cleanup(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	drm_irq_uninstall(dev);
+	atmel_hlcdc_dc_irq_uninstall(dev);
 	pm_runtime_put_sync(dev->dev);
 
 	dev->dev_private = NULL;
@@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	clk_disable_unprepare(dc->hlcdc->periph_clk);
 }
 
-static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int cfg = 0;
-	int i;
-
-	/* Enable interrupts on activated layers */
-	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
-		if (dc->layers[i])
-			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
-	}
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
-
-	return 0;
-}
-
-static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int isr;
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
-	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = atmel_hlcdc_dc_irq_handler,
-	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
-	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
-	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
 	.name = "atmel-hlcdc",
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
 1 file changed, 52 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index f09b6dd8754c..cfa8c2c9c8aa 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -22,7 +22,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int cfg = 0;
+	int i;
+
+	/* Enable interrupts on activated layers */
+	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
+		if (dc->layers[i])
+			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
+	}
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
+}
+
+static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int isr;
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
+	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
+}
+
+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+
+	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	atmel_hlcdc_dc_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+	free_irq(dc->hlcdc->irq, dev);
+}
+
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
 	.atomic_check = drm_atomic_helper_check,
@@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
 	drm_mode_config_reset(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	ret = drm_irq_install(dev, dc->hlcdc->irq);
+	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
 	pm_runtime_put_sync(dev->dev);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
@@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	drm_mode_config_cleanup(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	drm_irq_uninstall(dev);
+	atmel_hlcdc_dc_irq_uninstall(dev);
 	pm_runtime_put_sync(dev->dev);
 
 	dev->dev_private = NULL;
@@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	clk_disable_unprepare(dc->hlcdc->periph_clk);
 }
 
-static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int cfg = 0;
-	int i;
-
-	/* Enable interrupts on activated layers */
-	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
-		if (dc->layers[i])
-			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
-	}
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
-
-	return 0;
-}
-
-static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int isr;
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
-	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = atmel_hlcdc_dc_irq_handler,
-	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
-	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
-	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
 	.name = "atmel-hlcdc",
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
 1 file changed, 52 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index f09b6dd8754c..cfa8c2c9c8aa 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -22,7 +22,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int cfg = 0;
+	int i;
+
+	/* Enable interrupts on activated layers */
+	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
+		if (dc->layers[i])
+			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
+	}
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
+}
+
+static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+	unsigned int isr;
+
+	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
+	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
+}
+
+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+
+	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	atmel_hlcdc_dc_irq_postinstall(dev);
+
+	return 0;
+}
+
+static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
+{
+	struct atmel_hlcdc_dc *dc = dev->dev_private;
+
+	atmel_hlcdc_dc_irq_disable(dev);
+	free_irq(dc->hlcdc->irq, dev);
+}
+
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
 	.atomic_check = drm_atomic_helper_check,
@@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
 	drm_mode_config_reset(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	ret = drm_irq_install(dev, dc->hlcdc->irq);
+	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
 	pm_runtime_put_sync(dev->dev);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
@@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	drm_mode_config_cleanup(dev);
 
 	pm_runtime_get_sync(dev->dev);
-	drm_irq_uninstall(dev);
+	atmel_hlcdc_dc_irq_uninstall(dev);
 	pm_runtime_put_sync(dev->dev);
 
 	dev->dev_private = NULL;
@@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	clk_disable_unprepare(dc->hlcdc->periph_clk);
 }
 
-static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int cfg = 0;
-	int i;
-
-	/* Enable interrupts on activated layers */
-	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
-		if (dc->layers[i])
-			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
-	}
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
-
-	return 0;
-}
-
-static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
-{
-	struct atmel_hlcdc_dc *dc = dev->dev_private;
-	unsigned int isr;
-
-	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
-	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = atmel_hlcdc_dc_irq_handler,
-	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
-	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
-	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
 	.name = "atmel-hlcdc",
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 04/14] drm/fsl-dcu: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 78 +++++++++++++----------
 1 file changed, 46 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 7528e8a2d359..660fe573db96 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -51,7 +50,7 @@ static const struct regmap_config fsl_dcu_regmap_config = {
 	.volatile_reg = fsl_dcu_drm_is_volatile_reg,
 };
 
-static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+static void fsl_dcu_irq_reset(struct drm_device *dev)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
 
@@ -59,6 +58,45 @@ static void fsl_dcu_irq_uninstall(struct drm_device *dev)
 	regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0);
 }
 
+static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	unsigned int int_status;
+	int ret;
+
+	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
+	if (ret) {
+		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
+		return IRQ_NONE;
+	}
+
+	if (int_status & DCU_INT_STATUS_VBLANK)
+		drm_handle_vblank(dev, 0);
+
+	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
+
+	return IRQ_HANDLED;
+}
+
+static int fsl_dcu_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	fsl_dcu_irq_reset(dev);
+
+	return request_irq(irq, fsl_dcu_drm_irq, 0, dev->driver->name, dev);
+}
+
+static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+{
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+
+	fsl_dcu_irq_reset(dev);
+	free_irq(fsl_dev->irq, dev);
+}
+
 static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
@@ -73,13 +111,13 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to initialize vblank\n");
-		goto done;
+		goto done_vblank;
 	}
 
-	ret = drm_irq_install(dev, fsl_dev->irq);
+	ret = fsl_dcu_irq_install(dev, fsl_dev->irq);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
-		goto done;
+		goto done_irq;
 	}
 
 	if (legacyfb_depth != 16 && legacyfb_depth != 24 &&
@@ -90,11 +128,11 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	}
 
 	return 0;
-done:
+done_irq:
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+done_vblank:
 	dev->dev_private = NULL;
 
 	return ret;
@@ -106,41 +144,17 @@ static void fsl_dcu_unload(struct drm_device *dev)
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+	fsl_dcu_irq_uninstall(dev);
 
 	dev->dev_private = NULL;
 }
 
-static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-	unsigned int int_status;
-	int ret;
-
-	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
-	if (ret) {
-		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
-		return IRQ_NONE;
-	}
-
-	if (int_status & DCU_INT_STATUS_VBLANK)
-		drm_handle_vblank(dev, 0);
-
-	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 
 static const struct drm_driver fsl_dcu_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
-	.irq_handler		= fsl_dcu_drm_irq,
-	.irq_preinstall		= fsl_dcu_irq_uninstall,
-	.irq_uninstall		= fsl_dcu_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &fsl_dcu_drm_fops,
 	.name			= "fsl-dcu-drm",
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 04/14] drm/fsl-dcu: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 78 +++++++++++++----------
 1 file changed, 46 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 7528e8a2d359..660fe573db96 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -51,7 +50,7 @@ static const struct regmap_config fsl_dcu_regmap_config = {
 	.volatile_reg = fsl_dcu_drm_is_volatile_reg,
 };
 
-static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+static void fsl_dcu_irq_reset(struct drm_device *dev)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
 
@@ -59,6 +58,45 @@ static void fsl_dcu_irq_uninstall(struct drm_device *dev)
 	regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0);
 }
 
+static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	unsigned int int_status;
+	int ret;
+
+	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
+	if (ret) {
+		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
+		return IRQ_NONE;
+	}
+
+	if (int_status & DCU_INT_STATUS_VBLANK)
+		drm_handle_vblank(dev, 0);
+
+	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
+
+	return IRQ_HANDLED;
+}
+
+static int fsl_dcu_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	fsl_dcu_irq_reset(dev);
+
+	return request_irq(irq, fsl_dcu_drm_irq, 0, dev->driver->name, dev);
+}
+
+static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+{
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+
+	fsl_dcu_irq_reset(dev);
+	free_irq(fsl_dev->irq, dev);
+}
+
 static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
@@ -73,13 +111,13 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to initialize vblank\n");
-		goto done;
+		goto done_vblank;
 	}
 
-	ret = drm_irq_install(dev, fsl_dev->irq);
+	ret = fsl_dcu_irq_install(dev, fsl_dev->irq);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
-		goto done;
+		goto done_irq;
 	}
 
 	if (legacyfb_depth != 16 && legacyfb_depth != 24 &&
@@ -90,11 +128,11 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	}
 
 	return 0;
-done:
+done_irq:
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+done_vblank:
 	dev->dev_private = NULL;
 
 	return ret;
@@ -106,41 +144,17 @@ static void fsl_dcu_unload(struct drm_device *dev)
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+	fsl_dcu_irq_uninstall(dev);
 
 	dev->dev_private = NULL;
 }
 
-static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-	unsigned int int_status;
-	int ret;
-
-	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
-	if (ret) {
-		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
-		return IRQ_NONE;
-	}
-
-	if (int_status & DCU_INT_STATUS_VBLANK)
-		drm_handle_vblank(dev, 0);
-
-	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 
 static const struct drm_driver fsl_dcu_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
-	.irq_handler		= fsl_dcu_drm_irq,
-	.irq_preinstall		= fsl_dcu_irq_uninstall,
-	.irq_uninstall		= fsl_dcu_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &fsl_dcu_drm_fops,
 	.name			= "fsl-dcu-drm",
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 04/14] drm/fsl-dcu: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 78 +++++++++++++----------
 1 file changed, 46 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 7528e8a2d359..660fe573db96 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -51,7 +50,7 @@ static const struct regmap_config fsl_dcu_regmap_config = {
 	.volatile_reg = fsl_dcu_drm_is_volatile_reg,
 };
 
-static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+static void fsl_dcu_irq_reset(struct drm_device *dev)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
 
@@ -59,6 +58,45 @@ static void fsl_dcu_irq_uninstall(struct drm_device *dev)
 	regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0);
 }
 
+static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	unsigned int int_status;
+	int ret;
+
+	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
+	if (ret) {
+		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
+		return IRQ_NONE;
+	}
+
+	if (int_status & DCU_INT_STATUS_VBLANK)
+		drm_handle_vblank(dev, 0);
+
+	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
+
+	return IRQ_HANDLED;
+}
+
+static int fsl_dcu_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	fsl_dcu_irq_reset(dev);
+
+	return request_irq(irq, fsl_dcu_drm_irq, 0, dev->driver->name, dev);
+}
+
+static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+{
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+
+	fsl_dcu_irq_reset(dev);
+	free_irq(fsl_dev->irq, dev);
+}
+
 static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
@@ -73,13 +111,13 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to initialize vblank\n");
-		goto done;
+		goto done_vblank;
 	}
 
-	ret = drm_irq_install(dev, fsl_dev->irq);
+	ret = fsl_dcu_irq_install(dev, fsl_dev->irq);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
-		goto done;
+		goto done_irq;
 	}
 
 	if (legacyfb_depth != 16 && legacyfb_depth != 24 &&
@@ -90,11 +128,11 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	}
 
 	return 0;
-done:
+done_irq:
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+done_vblank:
 	dev->dev_private = NULL;
 
 	return ret;
@@ -106,41 +144,17 @@ static void fsl_dcu_unload(struct drm_device *dev)
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+	fsl_dcu_irq_uninstall(dev);
 
 	dev->dev_private = NULL;
 }
 
-static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-	unsigned int int_status;
-	int ret;
-
-	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
-	if (ret) {
-		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
-		return IRQ_NONE;
-	}
-
-	if (int_status & DCU_INT_STATUS_VBLANK)
-		drm_handle_vblank(dev, 0);
-
-	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 
 static const struct drm_driver fsl_dcu_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
-	.irq_handler		= fsl_dcu_drm_irq,
-	.irq_preinstall		= fsl_dcu_irq_uninstall,
-	.irq_uninstall		= fsl_dcu_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &fsl_dcu_drm_fops,
 	.name			= "fsl-dcu-drm",
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 04/14] drm/fsl-dcu: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 78 +++++++++++++----------
 1 file changed, 46 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 7528e8a2d359..660fe573db96 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -51,7 +50,7 @@ static const struct regmap_config fsl_dcu_regmap_config = {
 	.volatile_reg = fsl_dcu_drm_is_volatile_reg,
 };
 
-static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+static void fsl_dcu_irq_reset(struct drm_device *dev)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
 
@@ -59,6 +58,45 @@ static void fsl_dcu_irq_uninstall(struct drm_device *dev)
 	regmap_write(fsl_dev->regmap, DCU_INT_MASK, ~0);
 }
 
+static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+	unsigned int int_status;
+	int ret;
+
+	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
+	if (ret) {
+		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
+		return IRQ_NONE;
+	}
+
+	if (int_status & DCU_INT_STATUS_VBLANK)
+		drm_handle_vblank(dev, 0);
+
+	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
+
+	return IRQ_HANDLED;
+}
+
+static int fsl_dcu_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	fsl_dcu_irq_reset(dev);
+
+	return request_irq(irq, fsl_dcu_drm_irq, 0, dev->driver->name, dev);
+}
+
+static void fsl_dcu_irq_uninstall(struct drm_device *dev)
+{
+	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
+
+	fsl_dcu_irq_reset(dev);
+	free_irq(fsl_dev->irq, dev);
+}
+
 static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 {
 	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
@@ -73,13 +111,13 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to initialize vblank\n");
-		goto done;
+		goto done_vblank;
 	}
 
-	ret = drm_irq_install(dev, fsl_dev->irq);
+	ret = fsl_dcu_irq_install(dev, fsl_dev->irq);
 	if (ret < 0) {
 		dev_err(dev->dev, "failed to install IRQ handler\n");
-		goto done;
+		goto done_irq;
 	}
 
 	if (legacyfb_depth != 16 && legacyfb_depth != 24 &&
@@ -90,11 +128,11 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
 	}
 
 	return 0;
-done:
+done_irq:
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+done_vblank:
 	dev->dev_private = NULL;
 
 	return ret;
@@ -106,41 +144,17 @@ static void fsl_dcu_unload(struct drm_device *dev)
 	drm_kms_helper_poll_fini(dev);
 
 	drm_mode_config_cleanup(dev);
-	drm_irq_uninstall(dev);
+	fsl_dcu_irq_uninstall(dev);
 
 	dev->dev_private = NULL;
 }
 
-static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-	unsigned int int_status;
-	int ret;
-
-	ret = regmap_read(fsl_dev->regmap, DCU_INT_STATUS, &int_status);
-	if (ret) {
-		dev_err(dev->dev, "read DCU_INT_STATUS failed\n");
-		return IRQ_NONE;
-	}
-
-	if (int_status & DCU_INT_STATUS_VBLANK)
-		drm_handle_vblank(dev, 0);
-
-	regmap_write(fsl_dev->regmap, DCU_INT_STATUS, int_status);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 
 static const struct drm_driver fsl_dcu_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
-	.irq_handler		= fsl_dcu_drm_irq,
-	.irq_preinstall		= fsl_dcu_irq_uninstall,
-	.irq_uninstall		= fsl_dcu_irq_uninstall,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &fsl_dcu_drm_fops,
 	.name			= "fsl-dcu-drm",
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 05/14] drm/gma500: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 ++--
 5 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c
index f07641dfa5a4..20ace6010f9f 100644
--- a/drivers/gpu/drm/gma500/power.c
+++ b/drivers/gpu/drm/gma500/power.c
@@ -32,6 +32,7 @@
 #include "psb_drv.h"
 #include "psb_reg.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include <linux/mutex.h>
 #include <linux/pm_runtime.h>
 
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 3850842d58f3..58bce1a60a4d 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_pciids.h>
 #include <drm/drm_vblank.h>
 
@@ -33,6 +32,7 @@
 #include "power.h"
 #include "psb_drv.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include "psb_reg.h"
 
 static const struct drm_driver driver;
@@ -380,7 +380,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 
-	drm_irq_install(dev, pdev->irq);
+	psb_irq_install(dev, pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
 
@@ -515,10 +515,6 @@ static const struct drm_driver driver = {
 	.lastclose = drm_fb_helper_lastclose,
 
 	.num_ioctls = ARRAY_SIZE(psb_ioctls),
-	.irq_preinstall = psb_irq_preinstall,
-	.irq_postinstall = psb_irq_postinstall,
-	.irq_uninstall = psb_irq_uninstall,
-	.irq_handler = psb_irq_handler,
 
 	.dumb_create = psb_gem_dumb_create,
 	.ioctls = psb_ioctls,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index d6e7c2c2c947..f2bae270ca7b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -624,11 +624,6 @@ static inline struct drm_psb_private *psb_priv(struct drm_device *dev)
 }
 
 /* psb_irq.c */
-extern irqreturn_t psb_irq_handler(int irq, void *arg);
-extern void psb_irq_preinstall(struct drm_device *dev);
-extern int psb_irq_postinstall(struct drm_device *dev);
-extern void psb_irq_uninstall(struct drm_device *dev);
-
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 104009e78487..deb1fbc1f748 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -8,6 +8,7 @@
  *
  **************************************************************************/
 
+#include <drm/drm_drv.h>
 #include <drm/drm_vblank.h>
 
 #include "power.h"
@@ -222,7 +223,7 @@ static void psb_sgx_interrupt(struct drm_device *dev, u32 stat_1, u32 stat_2)
 	PSB_RSGX32(PSB_CR_EVENT_HOST_CLEAR2);
 }
 
-irqreturn_t psb_irq_handler(int irq, void *arg)
+static irqreturn_t psb_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
 	struct drm_psb_private *dev_priv = dev->dev_private;
@@ -304,7 +305,7 @@ void psb_irq_preinstall(struct drm_device *dev)
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 }
 
-int psb_irq_postinstall(struct drm_device *dev)
+void psb_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
@@ -332,12 +333,31 @@ int psb_irq_postinstall(struct drm_device *dev)
 		dev_priv->ops->hotplug_enable(dev, true);
 
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+}
+
+int psb_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	psb_irq_preinstall(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, psb_irq_handler, IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	psb_irq_postinstall(dev);
+
 	return 0;
 }
 
 void psb_irq_uninstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	unsigned long irqflags;
 	unsigned int i;
 
@@ -366,6 +386,8 @@ void psb_irq_uninstall(struct drm_device *dev)
 	/* This register is safe even if display island is off */
 	PSB_WVDC32(PSB_RVDC32(PSB_INT_IDENTITY_R), PSB_INT_IDENTITY_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+
+	free_irq(pdev->irq, dev);
 }
 
 /*
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 17c9b0b62471..a97cb49393d8 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -19,9 +19,9 @@ bool sysirq_init(struct drm_device *dev);
 void sysirq_uninit(struct drm_device *dev);
 
 void psb_irq_preinstall(struct drm_device *dev);
-int  psb_irq_postinstall(struct drm_device *dev);
+void psb_irq_postinstall(struct drm_device *dev);
+int  psb_irq_install(struct drm_device *dev, unsigned int irq);
 void psb_irq_uninstall(struct drm_device *dev);
-irqreturn_t psb_irq_handler(int irq, void *arg);
 
 int  psb_enable_vblank(struct drm_crtc *crtc);
 void psb_disable_vblank(struct drm_crtc *crtc);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 05/14] drm/gma500: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 ++--
 5 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c
index f07641dfa5a4..20ace6010f9f 100644
--- a/drivers/gpu/drm/gma500/power.c
+++ b/drivers/gpu/drm/gma500/power.c
@@ -32,6 +32,7 @@
 #include "psb_drv.h"
 #include "psb_reg.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include <linux/mutex.h>
 #include <linux/pm_runtime.h>
 
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 3850842d58f3..58bce1a60a4d 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_pciids.h>
 #include <drm/drm_vblank.h>
 
@@ -33,6 +32,7 @@
 #include "power.h"
 #include "psb_drv.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include "psb_reg.h"
 
 static const struct drm_driver driver;
@@ -380,7 +380,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 
-	drm_irq_install(dev, pdev->irq);
+	psb_irq_install(dev, pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
 
@@ -515,10 +515,6 @@ static const struct drm_driver driver = {
 	.lastclose = drm_fb_helper_lastclose,
 
 	.num_ioctls = ARRAY_SIZE(psb_ioctls),
-	.irq_preinstall = psb_irq_preinstall,
-	.irq_postinstall = psb_irq_postinstall,
-	.irq_uninstall = psb_irq_uninstall,
-	.irq_handler = psb_irq_handler,
 
 	.dumb_create = psb_gem_dumb_create,
 	.ioctls = psb_ioctls,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index d6e7c2c2c947..f2bae270ca7b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -624,11 +624,6 @@ static inline struct drm_psb_private *psb_priv(struct drm_device *dev)
 }
 
 /* psb_irq.c */
-extern irqreturn_t psb_irq_handler(int irq, void *arg);
-extern void psb_irq_preinstall(struct drm_device *dev);
-extern int psb_irq_postinstall(struct drm_device *dev);
-extern void psb_irq_uninstall(struct drm_device *dev);
-
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 104009e78487..deb1fbc1f748 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -8,6 +8,7 @@
  *
  **************************************************************************/
 
+#include <drm/drm_drv.h>
 #include <drm/drm_vblank.h>
 
 #include "power.h"
@@ -222,7 +223,7 @@ static void psb_sgx_interrupt(struct drm_device *dev, u32 stat_1, u32 stat_2)
 	PSB_RSGX32(PSB_CR_EVENT_HOST_CLEAR2);
 }
 
-irqreturn_t psb_irq_handler(int irq, void *arg)
+static irqreturn_t psb_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
 	struct drm_psb_private *dev_priv = dev->dev_private;
@@ -304,7 +305,7 @@ void psb_irq_preinstall(struct drm_device *dev)
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 }
 
-int psb_irq_postinstall(struct drm_device *dev)
+void psb_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
@@ -332,12 +333,31 @@ int psb_irq_postinstall(struct drm_device *dev)
 		dev_priv->ops->hotplug_enable(dev, true);
 
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+}
+
+int psb_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	psb_irq_preinstall(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, psb_irq_handler, IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	psb_irq_postinstall(dev);
+
 	return 0;
 }
 
 void psb_irq_uninstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	unsigned long irqflags;
 	unsigned int i;
 
@@ -366,6 +386,8 @@ void psb_irq_uninstall(struct drm_device *dev)
 	/* This register is safe even if display island is off */
 	PSB_WVDC32(PSB_RVDC32(PSB_INT_IDENTITY_R), PSB_INT_IDENTITY_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+
+	free_irq(pdev->irq, dev);
 }
 
 /*
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 17c9b0b62471..a97cb49393d8 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -19,9 +19,9 @@ bool sysirq_init(struct drm_device *dev);
 void sysirq_uninit(struct drm_device *dev);
 
 void psb_irq_preinstall(struct drm_device *dev);
-int  psb_irq_postinstall(struct drm_device *dev);
+void psb_irq_postinstall(struct drm_device *dev);
+int  psb_irq_install(struct drm_device *dev, unsigned int irq);
 void psb_irq_uninstall(struct drm_device *dev);
-irqreturn_t psb_irq_handler(int irq, void *arg);
 
 int  psb_enable_vblank(struct drm_crtc *crtc);
 void psb_disable_vblank(struct drm_crtc *crtc);
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 05/14] drm/gma500: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 ++--
 5 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c
index f07641dfa5a4..20ace6010f9f 100644
--- a/drivers/gpu/drm/gma500/power.c
+++ b/drivers/gpu/drm/gma500/power.c
@@ -32,6 +32,7 @@
 #include "psb_drv.h"
 #include "psb_reg.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include <linux/mutex.h>
 #include <linux/pm_runtime.h>
 
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 3850842d58f3..58bce1a60a4d 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_pciids.h>
 #include <drm/drm_vblank.h>
 
@@ -33,6 +32,7 @@
 #include "power.h"
 #include "psb_drv.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include "psb_reg.h"
 
 static const struct drm_driver driver;
@@ -380,7 +380,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 
-	drm_irq_install(dev, pdev->irq);
+	psb_irq_install(dev, pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
 
@@ -515,10 +515,6 @@ static const struct drm_driver driver = {
 	.lastclose = drm_fb_helper_lastclose,
 
 	.num_ioctls = ARRAY_SIZE(psb_ioctls),
-	.irq_preinstall = psb_irq_preinstall,
-	.irq_postinstall = psb_irq_postinstall,
-	.irq_uninstall = psb_irq_uninstall,
-	.irq_handler = psb_irq_handler,
 
 	.dumb_create = psb_gem_dumb_create,
 	.ioctls = psb_ioctls,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index d6e7c2c2c947..f2bae270ca7b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -624,11 +624,6 @@ static inline struct drm_psb_private *psb_priv(struct drm_device *dev)
 }
 
 /* psb_irq.c */
-extern irqreturn_t psb_irq_handler(int irq, void *arg);
-extern void psb_irq_preinstall(struct drm_device *dev);
-extern int psb_irq_postinstall(struct drm_device *dev);
-extern void psb_irq_uninstall(struct drm_device *dev);
-
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 104009e78487..deb1fbc1f748 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -8,6 +8,7 @@
  *
  **************************************************************************/
 
+#include <drm/drm_drv.h>
 #include <drm/drm_vblank.h>
 
 #include "power.h"
@@ -222,7 +223,7 @@ static void psb_sgx_interrupt(struct drm_device *dev, u32 stat_1, u32 stat_2)
 	PSB_RSGX32(PSB_CR_EVENT_HOST_CLEAR2);
 }
 
-irqreturn_t psb_irq_handler(int irq, void *arg)
+static irqreturn_t psb_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
 	struct drm_psb_private *dev_priv = dev->dev_private;
@@ -304,7 +305,7 @@ void psb_irq_preinstall(struct drm_device *dev)
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 }
 
-int psb_irq_postinstall(struct drm_device *dev)
+void psb_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
@@ -332,12 +333,31 @@ int psb_irq_postinstall(struct drm_device *dev)
 		dev_priv->ops->hotplug_enable(dev, true);
 
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+}
+
+int psb_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	psb_irq_preinstall(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, psb_irq_handler, IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	psb_irq_postinstall(dev);
+
 	return 0;
 }
 
 void psb_irq_uninstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	unsigned long irqflags;
 	unsigned int i;
 
@@ -366,6 +386,8 @@ void psb_irq_uninstall(struct drm_device *dev)
 	/* This register is safe even if display island is off */
 	PSB_WVDC32(PSB_RVDC32(PSB_INT_IDENTITY_R), PSB_INT_IDENTITY_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+
+	free_irq(pdev->irq, dev);
 }
 
 /*
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 17c9b0b62471..a97cb49393d8 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -19,9 +19,9 @@ bool sysirq_init(struct drm_device *dev);
 void sysirq_uninit(struct drm_device *dev);
 
 void psb_irq_preinstall(struct drm_device *dev);
-int  psb_irq_postinstall(struct drm_device *dev);
+void psb_irq_postinstall(struct drm_device *dev);
+int  psb_irq_install(struct drm_device *dev, unsigned int irq);
 void psb_irq_uninstall(struct drm_device *dev);
-irqreturn_t psb_irq_handler(int irq, void *arg);
 
 int  psb_enable_vblank(struct drm_crtc *crtc);
 void psb_disable_vblank(struct drm_crtc *crtc);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 05/14] drm/gma500: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 ++--
 5 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c
index f07641dfa5a4..20ace6010f9f 100644
--- a/drivers/gpu/drm/gma500/power.c
+++ b/drivers/gpu/drm/gma500/power.c
@@ -32,6 +32,7 @@
 #include "psb_drv.h"
 #include "psb_reg.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include <linux/mutex.h>
 #include <linux/pm_runtime.h>
 
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 3850842d58f3..58bce1a60a4d 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -23,7 +23,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_pciids.h>
 #include <drm/drm_vblank.h>
 
@@ -33,6 +32,7 @@
 #include "power.h"
 #include "psb_drv.h"
 #include "psb_intel_reg.h"
+#include "psb_irq.h"
 #include "psb_reg.h"
 
 static const struct drm_driver driver;
@@ -380,7 +380,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 	PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 
-	drm_irq_install(dev, pdev->irq);
+	psb_irq_install(dev, pdev->irq);
 
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
 
@@ -515,10 +515,6 @@ static const struct drm_driver driver = {
 	.lastclose = drm_fb_helper_lastclose,
 
 	.num_ioctls = ARRAY_SIZE(psb_ioctls),
-	.irq_preinstall = psb_irq_preinstall,
-	.irq_postinstall = psb_irq_postinstall,
-	.irq_uninstall = psb_irq_uninstall,
-	.irq_handler = psb_irq_handler,
 
 	.dumb_create = psb_gem_dumb_create,
 	.ioctls = psb_ioctls,
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index d6e7c2c2c947..f2bae270ca7b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -624,11 +624,6 @@ static inline struct drm_psb_private *psb_priv(struct drm_device *dev)
 }
 
 /* psb_irq.c */
-extern irqreturn_t psb_irq_handler(int irq, void *arg);
-extern void psb_irq_preinstall(struct drm_device *dev);
-extern int psb_irq_postinstall(struct drm_device *dev);
-extern void psb_irq_uninstall(struct drm_device *dev);
-
 extern void psb_irq_uninstall_islands(struct drm_device *dev, int hw_islands);
 extern int psb_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
 extern int psb_vblank_wait(struct drm_device *dev, unsigned int *sequence);
diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 104009e78487..deb1fbc1f748 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -8,6 +8,7 @@
  *
  **************************************************************************/
 
+#include <drm/drm_drv.h>
 #include <drm/drm_vblank.h>
 
 #include "power.h"
@@ -222,7 +223,7 @@ static void psb_sgx_interrupt(struct drm_device *dev, u32 stat_1, u32 stat_2)
 	PSB_RSGX32(PSB_CR_EVENT_HOST_CLEAR2);
 }
 
-irqreturn_t psb_irq_handler(int irq, void *arg)
+static irqreturn_t psb_irq_handler(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
 	struct drm_psb_private *dev_priv = dev->dev_private;
@@ -304,7 +305,7 @@ void psb_irq_preinstall(struct drm_device *dev)
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 }
 
-int psb_irq_postinstall(struct drm_device *dev)
+void psb_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long irqflags;
@@ -332,12 +333,31 @@ int psb_irq_postinstall(struct drm_device *dev)
 		dev_priv->ops->hotplug_enable(dev, true);
 
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+}
+
+int psb_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	psb_irq_preinstall(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, psb_irq_handler, IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	psb_irq_postinstall(dev);
+
 	return 0;
 }
 
 void psb_irq_uninstall(struct drm_device *dev)
 {
 	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
 	unsigned long irqflags;
 	unsigned int i;
 
@@ -366,6 +386,8 @@ void psb_irq_uninstall(struct drm_device *dev)
 	/* This register is safe even if display island is off */
 	PSB_WVDC32(PSB_RVDC32(PSB_INT_IDENTITY_R), PSB_INT_IDENTITY_R);
 	spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
+
+	free_irq(pdev->irq, dev);
 }
 
 /*
diff --git a/drivers/gpu/drm/gma500/psb_irq.h b/drivers/gpu/drm/gma500/psb_irq.h
index 17c9b0b62471..a97cb49393d8 100644
--- a/drivers/gpu/drm/gma500/psb_irq.h
+++ b/drivers/gpu/drm/gma500/psb_irq.h
@@ -19,9 +19,9 @@ bool sysirq_init(struct drm_device *dev);
 void sysirq_uninit(struct drm_device *dev);
 
 void psb_irq_preinstall(struct drm_device *dev);
-int  psb_irq_postinstall(struct drm_device *dev);
+void psb_irq_postinstall(struct drm_device *dev);
+int  psb_irq_install(struct drm_device *dev, unsigned int irq);
 void psb_irq_uninstall(struct drm_device *dev);
-irqreturn_t psb_irq_handler(int irq, void *arg);
 
 int  psb_enable_vblank(struct drm_crtc *crtc);
 void psb_disable_vblank(struct drm_crtc *crtc);
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 06/14] drm/kmb: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 96ea1a2c11dd..be192f6da9f1 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -17,7 +17,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -399,14 +398,29 @@ static void kmb_irq_reset(struct drm_device *drm)
 	kmb_write_lcd(to_kmb(drm), LCD_INT_ENABLE, 0);
 }
 
+static int kmb_irq_install(struct drm_device *drm, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	kmb_irq_reset(drm);
+
+	return request_irq(irq, kmb_isr, 0, drm->driver->name, drm);
+}
+
+static void kmb_irq_uninstall(struct drm_device *drm)
+{
+	struct kmb_drm_private *kmb = to_kmb(drm);
+
+	kmb_irq_reset(drm);
+	free_irq(kmb->irq_lcd, drm);
+}
+
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver kmb_driver = {
 	.driver_features = DRIVER_GEM |
 	    DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = kmb_isr,
-	.irq_preinstall = kmb_irq_reset,
-	.irq_uninstall = kmb_irq_reset,
 	/* GEM Operations */
 	.fops = &fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
@@ -428,7 +442,7 @@ static int kmb_remove(struct platform_device *pdev)
 	of_node_put(kmb->crtc.port);
 	kmb->crtc.port = NULL;
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	kmb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 	pm_runtime_disable(drm->dev);
 
@@ -518,7 +532,7 @@ static int kmb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_free;
 
-	ret = drm_irq_install(&kmb->drm, kmb->irq_lcd);
+	ret = kmb_irq_install(&kmb->drm, kmb->irq_lcd);
 	if (ret < 0) {
 		drm_err(&kmb->drm, "failed to install IRQ handler\n");
 		goto err_irq;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 06/14] drm/kmb: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 96ea1a2c11dd..be192f6da9f1 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -17,7 +17,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -399,14 +398,29 @@ static void kmb_irq_reset(struct drm_device *drm)
 	kmb_write_lcd(to_kmb(drm), LCD_INT_ENABLE, 0);
 }
 
+static int kmb_irq_install(struct drm_device *drm, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	kmb_irq_reset(drm);
+
+	return request_irq(irq, kmb_isr, 0, drm->driver->name, drm);
+}
+
+static void kmb_irq_uninstall(struct drm_device *drm)
+{
+	struct kmb_drm_private *kmb = to_kmb(drm);
+
+	kmb_irq_reset(drm);
+	free_irq(kmb->irq_lcd, drm);
+}
+
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver kmb_driver = {
 	.driver_features = DRIVER_GEM |
 	    DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = kmb_isr,
-	.irq_preinstall = kmb_irq_reset,
-	.irq_uninstall = kmb_irq_reset,
 	/* GEM Operations */
 	.fops = &fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
@@ -428,7 +442,7 @@ static int kmb_remove(struct platform_device *pdev)
 	of_node_put(kmb->crtc.port);
 	kmb->crtc.port = NULL;
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	kmb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 	pm_runtime_disable(drm->dev);
 
@@ -518,7 +532,7 @@ static int kmb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_free;
 
-	ret = drm_irq_install(&kmb->drm, kmb->irq_lcd);
+	ret = kmb_irq_install(&kmb->drm, kmb->irq_lcd);
 	if (ret < 0) {
 		drm_err(&kmb->drm, "failed to install IRQ handler\n");
 		goto err_irq;
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 06/14] drm/kmb: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 96ea1a2c11dd..be192f6da9f1 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -17,7 +17,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -399,14 +398,29 @@ static void kmb_irq_reset(struct drm_device *drm)
 	kmb_write_lcd(to_kmb(drm), LCD_INT_ENABLE, 0);
 }
 
+static int kmb_irq_install(struct drm_device *drm, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	kmb_irq_reset(drm);
+
+	return request_irq(irq, kmb_isr, 0, drm->driver->name, drm);
+}
+
+static void kmb_irq_uninstall(struct drm_device *drm)
+{
+	struct kmb_drm_private *kmb = to_kmb(drm);
+
+	kmb_irq_reset(drm);
+	free_irq(kmb->irq_lcd, drm);
+}
+
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver kmb_driver = {
 	.driver_features = DRIVER_GEM |
 	    DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = kmb_isr,
-	.irq_preinstall = kmb_irq_reset,
-	.irq_uninstall = kmb_irq_reset,
 	/* GEM Operations */
 	.fops = &fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
@@ -428,7 +442,7 @@ static int kmb_remove(struct platform_device *pdev)
 	of_node_put(kmb->crtc.port);
 	kmb->crtc.port = NULL;
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	kmb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 	pm_runtime_disable(drm->dev);
 
@@ -518,7 +532,7 @@ static int kmb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_free;
 
-	ret = drm_irq_install(&kmb->drm, kmb->irq_lcd);
+	ret = kmb_irq_install(&kmb->drm, kmb->irq_lcd);
 	if (ret < 0) {
 		drm_err(&kmb->drm, "failed to install IRQ handler\n");
 		goto err_irq;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 06/14] drm/kmb: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 96ea1a2c11dd..be192f6da9f1 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -17,7 +17,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -399,14 +398,29 @@ static void kmb_irq_reset(struct drm_device *drm)
 	kmb_write_lcd(to_kmb(drm), LCD_INT_ENABLE, 0);
 }
 
+static int kmb_irq_install(struct drm_device *drm, unsigned int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	kmb_irq_reset(drm);
+
+	return request_irq(irq, kmb_isr, 0, drm->driver->name, drm);
+}
+
+static void kmb_irq_uninstall(struct drm_device *drm)
+{
+	struct kmb_drm_private *kmb = to_kmb(drm);
+
+	kmb_irq_reset(drm);
+	free_irq(kmb->irq_lcd, drm);
+}
+
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver kmb_driver = {
 	.driver_features = DRIVER_GEM |
 	    DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler = kmb_isr,
-	.irq_preinstall = kmb_irq_reset,
-	.irq_uninstall = kmb_irq_reset,
 	/* GEM Operations */
 	.fops = &fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
@@ -428,7 +442,7 @@ static int kmb_remove(struct platform_device *pdev)
 	of_node_put(kmb->crtc.port);
 	kmb->crtc.port = NULL;
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	kmb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 	pm_runtime_disable(drm->dev);
 
@@ -518,7 +532,7 @@ static int kmb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_free;
 
-	ret = drm_irq_install(&kmb->drm, kmb->irq_lcd);
+	ret = kmb_irq_install(&kmb->drm, kmb->irq_lcd);
 	if (ret < 0) {
 		drm_err(&kmb->drm, "failed to install IRQ handler\n");
 		goto err_irq;
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 07/14] drm/msm: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 9b8fa2ad0d84..6180cba5da32 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;
@@ -1025,10 +1052,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: */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 07/14] drm/msm: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 9b8fa2ad0d84..6180cba5da32 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;
@@ -1025,10 +1052,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: */
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 07/14] drm/msm: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 9b8fa2ad0d84..6180cba5da32 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;
@@ -1025,10 +1052,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: */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 07/14] drm/msm: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 9b8fa2ad0d84..6180cba5da32 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;
@@ -1025,10 +1052,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: */
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 08/14] drm/mxsfb: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 81 +++++++++++++++++++------------
 drivers/gpu/drm/mxsfb/mxsfb_drv.h |  2 +
 2 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 6da93551e2e5..b5212f5bf04a 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -24,7 +24,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mode_config.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -150,6 +149,49 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)
 	return 0;
 }
 
+static irqreturn_t mxsfb_irq_handler(int irq, void *data)
+{
+	struct drm_device *drm = data;
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+	u32 reg;
+
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+
+	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
+		drm_crtc_handle_vblank(&mxsfb->crtc);
+
+	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+
+	return IRQ_HANDLED;
+}
+
+static void mxsfb_irq_disable(struct drm_device *drm)
+{
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+
+	mxsfb_enable_axi_clk(mxsfb);
+	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
+	mxsfb_disable_axi_clk(mxsfb);
+}
+
+static int mxsfb_irq_install(struct drm_device *dev, int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	mxsfb_irq_disable(dev);
+
+	return request_irq(irq, mxsfb_irq_handler, 0,  dev->driver->name, dev);
+}
+
+static void mxsfb_irq_uninstall(struct drm_device *dev)
+{
+	struct mxsfb_drm_private *mxsfb = dev->dev_private;
+
+	mxsfb_irq_disable(dev);
+	free_irq(mxsfb->irq, dev);
+}
+
 static int mxsfb_load(struct drm_device *drm,
 		      const struct mxsfb_devdata *devdata)
 {
@@ -223,8 +265,13 @@ static int mxsfb_load(struct drm_device *drm,
 
 	drm_mode_config_reset(drm);
 
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto err_vblank;
+	mxsfb->irq = ret;
+
 	pm_runtime_get_sync(drm->dev);
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = mxsfb_irq_install(drm, mxsfb->irq);
 	pm_runtime_put_sync(drm->dev);
 
 	if (ret < 0) {
@@ -252,7 +299,7 @@ static void mxsfb_unload(struct drm_device *drm)
 	drm_mode_config_cleanup(drm);
 
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	mxsfb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 
 	drm->dev_private = NULL;
@@ -260,38 +307,10 @@ static void mxsfb_unload(struct drm_device *drm)
 	pm_runtime_disable(drm->dev);
 }
 
-static void mxsfb_irq_disable(struct drm_device *drm)
-{
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-	mxsfb_enable_axi_clk(mxsfb);
-	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
-	mxsfb_disable_axi_clk(mxsfb);
-}
-
-static irqreturn_t mxsfb_irq_handler(int irq, void *data)
-{
-	struct drm_device *drm = data;
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-	u32 reg;
-
-	reg = readl(mxsfb->base + LCDC_CTRL1);
-
-	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
-		drm_crtc_handle_vblank(&mxsfb->crtc);
-
-	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver mxsfb_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler		= mxsfb_irq_handler,
-	.irq_preinstall		= mxsfb_irq_disable,
-	.irq_uninstall		= mxsfb_irq_disable,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops	= &fops,
 	.name	= "mxsfb-drm",
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
index 399d23e91ed1..75f426e89b10 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
@@ -32,6 +32,8 @@ struct mxsfb_drm_private {
 	struct clk			*clk_axi;
 	struct clk			*clk_disp_axi;
 
+	unsigned int			irq;
+
 	struct drm_device		*drm;
 	struct {
 		struct drm_plane	primary;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 08/14] drm/mxsfb: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 81 +++++++++++++++++++------------
 drivers/gpu/drm/mxsfb/mxsfb_drv.h |  2 +
 2 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 6da93551e2e5..b5212f5bf04a 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -24,7 +24,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mode_config.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -150,6 +149,49 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)
 	return 0;
 }
 
+static irqreturn_t mxsfb_irq_handler(int irq, void *data)
+{
+	struct drm_device *drm = data;
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+	u32 reg;
+
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+
+	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
+		drm_crtc_handle_vblank(&mxsfb->crtc);
+
+	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+
+	return IRQ_HANDLED;
+}
+
+static void mxsfb_irq_disable(struct drm_device *drm)
+{
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+
+	mxsfb_enable_axi_clk(mxsfb);
+	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
+	mxsfb_disable_axi_clk(mxsfb);
+}
+
+static int mxsfb_irq_install(struct drm_device *dev, int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	mxsfb_irq_disable(dev);
+
+	return request_irq(irq, mxsfb_irq_handler, 0,  dev->driver->name, dev);
+}
+
+static void mxsfb_irq_uninstall(struct drm_device *dev)
+{
+	struct mxsfb_drm_private *mxsfb = dev->dev_private;
+
+	mxsfb_irq_disable(dev);
+	free_irq(mxsfb->irq, dev);
+}
+
 static int mxsfb_load(struct drm_device *drm,
 		      const struct mxsfb_devdata *devdata)
 {
@@ -223,8 +265,13 @@ static int mxsfb_load(struct drm_device *drm,
 
 	drm_mode_config_reset(drm);
 
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto err_vblank;
+	mxsfb->irq = ret;
+
 	pm_runtime_get_sync(drm->dev);
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = mxsfb_irq_install(drm, mxsfb->irq);
 	pm_runtime_put_sync(drm->dev);
 
 	if (ret < 0) {
@@ -252,7 +299,7 @@ static void mxsfb_unload(struct drm_device *drm)
 	drm_mode_config_cleanup(drm);
 
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	mxsfb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 
 	drm->dev_private = NULL;
@@ -260,38 +307,10 @@ static void mxsfb_unload(struct drm_device *drm)
 	pm_runtime_disable(drm->dev);
 }
 
-static void mxsfb_irq_disable(struct drm_device *drm)
-{
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-	mxsfb_enable_axi_clk(mxsfb);
-	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
-	mxsfb_disable_axi_clk(mxsfb);
-}
-
-static irqreturn_t mxsfb_irq_handler(int irq, void *data)
-{
-	struct drm_device *drm = data;
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-	u32 reg;
-
-	reg = readl(mxsfb->base + LCDC_CTRL1);
-
-	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
-		drm_crtc_handle_vblank(&mxsfb->crtc);
-
-	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver mxsfb_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler		= mxsfb_irq_handler,
-	.irq_preinstall		= mxsfb_irq_disable,
-	.irq_uninstall		= mxsfb_irq_disable,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops	= &fops,
 	.name	= "mxsfb-drm",
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
index 399d23e91ed1..75f426e89b10 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
@@ -32,6 +32,8 @@ struct mxsfb_drm_private {
 	struct clk			*clk_axi;
 	struct clk			*clk_disp_axi;
 
+	unsigned int			irq;
+
 	struct drm_device		*drm;
 	struct {
 		struct drm_plane	primary;
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 08/14] drm/mxsfb: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 81 +++++++++++++++++++------------
 drivers/gpu/drm/mxsfb/mxsfb_drv.h |  2 +
 2 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 6da93551e2e5..b5212f5bf04a 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -24,7 +24,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mode_config.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -150,6 +149,49 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)
 	return 0;
 }
 
+static irqreturn_t mxsfb_irq_handler(int irq, void *data)
+{
+	struct drm_device *drm = data;
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+	u32 reg;
+
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+
+	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
+		drm_crtc_handle_vblank(&mxsfb->crtc);
+
+	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+
+	return IRQ_HANDLED;
+}
+
+static void mxsfb_irq_disable(struct drm_device *drm)
+{
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+
+	mxsfb_enable_axi_clk(mxsfb);
+	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
+	mxsfb_disable_axi_clk(mxsfb);
+}
+
+static int mxsfb_irq_install(struct drm_device *dev, int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	mxsfb_irq_disable(dev);
+
+	return request_irq(irq, mxsfb_irq_handler, 0,  dev->driver->name, dev);
+}
+
+static void mxsfb_irq_uninstall(struct drm_device *dev)
+{
+	struct mxsfb_drm_private *mxsfb = dev->dev_private;
+
+	mxsfb_irq_disable(dev);
+	free_irq(mxsfb->irq, dev);
+}
+
 static int mxsfb_load(struct drm_device *drm,
 		      const struct mxsfb_devdata *devdata)
 {
@@ -223,8 +265,13 @@ static int mxsfb_load(struct drm_device *drm,
 
 	drm_mode_config_reset(drm);
 
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto err_vblank;
+	mxsfb->irq = ret;
+
 	pm_runtime_get_sync(drm->dev);
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = mxsfb_irq_install(drm, mxsfb->irq);
 	pm_runtime_put_sync(drm->dev);
 
 	if (ret < 0) {
@@ -252,7 +299,7 @@ static void mxsfb_unload(struct drm_device *drm)
 	drm_mode_config_cleanup(drm);
 
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	mxsfb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 
 	drm->dev_private = NULL;
@@ -260,38 +307,10 @@ static void mxsfb_unload(struct drm_device *drm)
 	pm_runtime_disable(drm->dev);
 }
 
-static void mxsfb_irq_disable(struct drm_device *drm)
-{
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-	mxsfb_enable_axi_clk(mxsfb);
-	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
-	mxsfb_disable_axi_clk(mxsfb);
-}
-
-static irqreturn_t mxsfb_irq_handler(int irq, void *data)
-{
-	struct drm_device *drm = data;
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-	u32 reg;
-
-	reg = readl(mxsfb->base + LCDC_CTRL1);
-
-	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
-		drm_crtc_handle_vblank(&mxsfb->crtc);
-
-	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver mxsfb_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler		= mxsfb_irq_handler,
-	.irq_preinstall		= mxsfb_irq_disable,
-	.irq_uninstall		= mxsfb_irq_disable,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops	= &fops,
 	.name	= "mxsfb-drm",
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
index 399d23e91ed1..75f426e89b10 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
@@ -32,6 +32,8 @@ struct mxsfb_drm_private {
 	struct clk			*clk_axi;
 	struct clk			*clk_disp_axi;
 
+	unsigned int			irq;
+
 	struct drm_device		*drm;
 	struct {
 		struct drm_plane	primary;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 08/14] drm/mxsfb: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 81 +++++++++++++++++++------------
 drivers/gpu/drm/mxsfb/mxsfb_drv.h |  2 +
 2 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 6da93551e2e5..b5212f5bf04a 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -24,7 +24,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mode_config.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -150,6 +149,49 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)
 	return 0;
 }
 
+static irqreturn_t mxsfb_irq_handler(int irq, void *data)
+{
+	struct drm_device *drm = data;
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+	u32 reg;
+
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+
+	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
+		drm_crtc_handle_vblank(&mxsfb->crtc);
+
+	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+
+	return IRQ_HANDLED;
+}
+
+static void mxsfb_irq_disable(struct drm_device *drm)
+{
+	struct mxsfb_drm_private *mxsfb = drm->dev_private;
+
+	mxsfb_enable_axi_clk(mxsfb);
+	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
+	mxsfb_disable_axi_clk(mxsfb);
+}
+
+static int mxsfb_irq_install(struct drm_device *dev, int irq)
+{
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	mxsfb_irq_disable(dev);
+
+	return request_irq(irq, mxsfb_irq_handler, 0,  dev->driver->name, dev);
+}
+
+static void mxsfb_irq_uninstall(struct drm_device *dev)
+{
+	struct mxsfb_drm_private *mxsfb = dev->dev_private;
+
+	mxsfb_irq_disable(dev);
+	free_irq(mxsfb->irq, dev);
+}
+
 static int mxsfb_load(struct drm_device *drm,
 		      const struct mxsfb_devdata *devdata)
 {
@@ -223,8 +265,13 @@ static int mxsfb_load(struct drm_device *drm,
 
 	drm_mode_config_reset(drm);
 
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto err_vblank;
+	mxsfb->irq = ret;
+
 	pm_runtime_get_sync(drm->dev);
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = mxsfb_irq_install(drm, mxsfb->irq);
 	pm_runtime_put_sync(drm->dev);
 
 	if (ret < 0) {
@@ -252,7 +299,7 @@ static void mxsfb_unload(struct drm_device *drm)
 	drm_mode_config_cleanup(drm);
 
 	pm_runtime_get_sync(drm->dev);
-	drm_irq_uninstall(drm);
+	mxsfb_irq_uninstall(drm);
 	pm_runtime_put_sync(drm->dev);
 
 	drm->dev_private = NULL;
@@ -260,38 +307,10 @@ static void mxsfb_unload(struct drm_device *drm)
 	pm_runtime_disable(drm->dev);
 }
 
-static void mxsfb_irq_disable(struct drm_device *drm)
-{
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-	mxsfb_enable_axi_clk(mxsfb);
-	mxsfb->crtc.funcs->disable_vblank(&mxsfb->crtc);
-	mxsfb_disable_axi_clk(mxsfb);
-}
-
-static irqreturn_t mxsfb_irq_handler(int irq, void *data)
-{
-	struct drm_device *drm = data;
-	struct mxsfb_drm_private *mxsfb = drm->dev_private;
-	u32 reg;
-
-	reg = readl(mxsfb->base + LCDC_CTRL1);
-
-	if (reg & CTRL1_CUR_FRAME_DONE_IRQ)
-		drm_crtc_handle_vblank(&mxsfb->crtc);
-
-	writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
-
-	return IRQ_HANDLED;
-}
-
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver mxsfb_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler		= mxsfb_irq_handler,
-	.irq_preinstall		= mxsfb_irq_disable,
-	.irq_uninstall		= mxsfb_irq_disable,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops	= &fops,
 	.name	= "mxsfb-drm",
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
index 399d23e91ed1..75f426e89b10 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
@@ -32,6 +32,8 @@ struct mxsfb_drm_private {
 	struct clk			*clk_axi;
 	struct clk			*clk_disp_axi;
 
+	unsigned int			irq;
+
 	struct drm_device		*drm;
 	struct {
 		struct drm_plane	primary;
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 ---
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index c8dd68152d65..b74cebca1f89 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.irq_preinstall = radeon_driver_irq_preinstall_kms,
-	.irq_postinstall = radeon_driver_irq_postinstall_kms,
-	.irq_uninstall = radeon_driver_irq_uninstall_kms,
-	.irq_handler = radeon_driver_irq_handler_kms,
 	.ioctls = radeon_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
 	.dumb_create = radeon_mode_dumb_create,
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index a36ce826d0c0..3907785d0798 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -31,7 +31,7 @@
 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_device.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
@@ -51,7 +51,7 @@
  * radeon_irq_process is a macro that points to the per-asic
  * irq handler callback.
  */
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
+static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct radeon_device *rdev = dev->dev_private;
@@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
  * Gets the hw ready to enable irqs (all asics).
  * This function disables all interrupt sources on the GPU.
  */
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
  * Handles stuff to be done after enabling irqs (all asics).
  * Returns 0 on success.
  */
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
+static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 
@@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
  *
  * This function disables all interrupt sources on the GPU (all asics).
  */
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
 
+static int radeon_irq_install(struct radeon_device *rdev, int irq)
+{
+	struct drm_device *dev = rdev->ddev;
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	radeon_driver_irq_preinstall_kms(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, radeon_driver_irq_handler_kms,
+			  IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	radeon_driver_irq_postinstall_kms(dev);
+
+	return 0;
+}
+
+static void radeon_irq_uninstall(struct radeon_device *rdev)
+{
+	struct drm_device *dev = rdev->ddev;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
+
+	radeon_driver_irq_uninstall_kms(dev);
+	free_irq(pdev->irq, dev);
+}
+
 /**
  * radeon_msi_ok - asic specific msi checks
  *
@@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 	INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
 
 	rdev->irq.installed = true;
-	r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
+	r = radeon_irq_install(rdev, rdev->pdev->irq);
 	if (r) {
 		rdev->irq.installed = false;
 		flush_delayed_work(&rdev->hotplug_work);
@@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 void radeon_irq_kms_fini(struct radeon_device *rdev)
 {
 	if (rdev->irq.installed) {
-		drm_irq_uninstall(rdev->ddev);
+		radeon_irq_uninstall(rdev);
 		rdev->irq.installed = false;
 		if (rdev->msi_enabled)
 			pci_disable_msi(rdev->pdev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
index 9b97bf38acd4..36e73cea9215 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.h
+++ b/drivers/gpu/drm/radeon/radeon_kms.h
@@ -31,9 +31,5 @@
 u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
 int radeon_enable_vblank_kms(struct drm_crtc *crtc);
 void radeon_disable_vblank_kms(struct drm_crtc *crtc);
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
 
 #endif				/* __RADEON_KMS_H__ */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 ---
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index c8dd68152d65..b74cebca1f89 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.irq_preinstall = radeon_driver_irq_preinstall_kms,
-	.irq_postinstall = radeon_driver_irq_postinstall_kms,
-	.irq_uninstall = radeon_driver_irq_uninstall_kms,
-	.irq_handler = radeon_driver_irq_handler_kms,
 	.ioctls = radeon_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
 	.dumb_create = radeon_mode_dumb_create,
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index a36ce826d0c0..3907785d0798 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -31,7 +31,7 @@
 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_device.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
@@ -51,7 +51,7 @@
  * radeon_irq_process is a macro that points to the per-asic
  * irq handler callback.
  */
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
+static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct radeon_device *rdev = dev->dev_private;
@@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
  * Gets the hw ready to enable irqs (all asics).
  * This function disables all interrupt sources on the GPU.
  */
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
  * Handles stuff to be done after enabling irqs (all asics).
  * Returns 0 on success.
  */
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
+static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 
@@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
  *
  * This function disables all interrupt sources on the GPU (all asics).
  */
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
 
+static int radeon_irq_install(struct radeon_device *rdev, int irq)
+{
+	struct drm_device *dev = rdev->ddev;
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	radeon_driver_irq_preinstall_kms(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, radeon_driver_irq_handler_kms,
+			  IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	radeon_driver_irq_postinstall_kms(dev);
+
+	return 0;
+}
+
+static void radeon_irq_uninstall(struct radeon_device *rdev)
+{
+	struct drm_device *dev = rdev->ddev;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
+
+	radeon_driver_irq_uninstall_kms(dev);
+	free_irq(pdev->irq, dev);
+}
+
 /**
  * radeon_msi_ok - asic specific msi checks
  *
@@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 	INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
 
 	rdev->irq.installed = true;
-	r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
+	r = radeon_irq_install(rdev, rdev->pdev->irq);
 	if (r) {
 		rdev->irq.installed = false;
 		flush_delayed_work(&rdev->hotplug_work);
@@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 void radeon_irq_kms_fini(struct radeon_device *rdev)
 {
 	if (rdev->irq.installed) {
-		drm_irq_uninstall(rdev->ddev);
+		radeon_irq_uninstall(rdev);
 		rdev->irq.installed = false;
 		if (rdev->msi_enabled)
 			pci_disable_msi(rdev->pdev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
index 9b97bf38acd4..36e73cea9215 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.h
+++ b/drivers/gpu/drm/radeon/radeon_kms.h
@@ -31,9 +31,5 @@
 u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
 int radeon_enable_vblank_kms(struct drm_crtc *crtc);
 void radeon_disable_vblank_kms(struct drm_crtc *crtc);
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
 
 #endif				/* __RADEON_KMS_H__ */
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 ---
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index c8dd68152d65..b74cebca1f89 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.irq_preinstall = radeon_driver_irq_preinstall_kms,
-	.irq_postinstall = radeon_driver_irq_postinstall_kms,
-	.irq_uninstall = radeon_driver_irq_uninstall_kms,
-	.irq_handler = radeon_driver_irq_handler_kms,
 	.ioctls = radeon_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
 	.dumb_create = radeon_mode_dumb_create,
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index a36ce826d0c0..3907785d0798 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -31,7 +31,7 @@
 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_device.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
@@ -51,7 +51,7 @@
  * radeon_irq_process is a macro that points to the per-asic
  * irq handler callback.
  */
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
+static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct radeon_device *rdev = dev->dev_private;
@@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
  * Gets the hw ready to enable irqs (all asics).
  * This function disables all interrupt sources on the GPU.
  */
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
  * Handles stuff to be done after enabling irqs (all asics).
  * Returns 0 on success.
  */
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
+static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 
@@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
  *
  * This function disables all interrupt sources on the GPU (all asics).
  */
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
 
+static int radeon_irq_install(struct radeon_device *rdev, int irq)
+{
+	struct drm_device *dev = rdev->ddev;
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	radeon_driver_irq_preinstall_kms(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, radeon_driver_irq_handler_kms,
+			  IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	radeon_driver_irq_postinstall_kms(dev);
+
+	return 0;
+}
+
+static void radeon_irq_uninstall(struct radeon_device *rdev)
+{
+	struct drm_device *dev = rdev->ddev;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
+
+	radeon_driver_irq_uninstall_kms(dev);
+	free_irq(pdev->irq, dev);
+}
+
 /**
  * radeon_msi_ok - asic specific msi checks
  *
@@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 	INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
 
 	rdev->irq.installed = true;
-	r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
+	r = radeon_irq_install(rdev, rdev->pdev->irq);
 	if (r) {
 		rdev->irq.installed = false;
 		flush_delayed_work(&rdev->hotplug_work);
@@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 void radeon_irq_kms_fini(struct radeon_device *rdev)
 {
 	if (rdev->irq.installed) {
-		drm_irq_uninstall(rdev->ddev);
+		radeon_irq_uninstall(rdev);
 		rdev->irq.installed = false;
 		if (rdev->msi_enabled)
 			pci_disable_msi(rdev->pdev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
index 9b97bf38acd4..36e73cea9215 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.h
+++ b/drivers/gpu/drm/radeon/radeon_kms.h
@@ -31,9 +31,5 @@
 u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
 int radeon_enable_vblank_kms(struct drm_crtc *crtc);
 void radeon_disable_vblank_kms(struct drm_crtc *crtc);
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
 
 #endif				/* __RADEON_KMS_H__ */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 ---
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index c8dd68152d65..b74cebca1f89 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
 	.postclose = radeon_driver_postclose_kms,
 	.lastclose = radeon_driver_lastclose_kms,
 	.unload = radeon_driver_unload_kms,
-	.irq_preinstall = radeon_driver_irq_preinstall_kms,
-	.irq_postinstall = radeon_driver_irq_postinstall_kms,
-	.irq_uninstall = radeon_driver_irq_uninstall_kms,
-	.irq_handler = radeon_driver_irq_handler_kms,
 	.ioctls = radeon_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
 	.dumb_create = radeon_mode_dumb_create,
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index a36ce826d0c0..3907785d0798 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -31,7 +31,7 @@
 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_device.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/radeon_drm.h>
@@ -51,7 +51,7 @@
  * radeon_irq_process is a macro that points to the per-asic
  * irq handler callback.
  */
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
+static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
 	struct radeon_device *rdev = dev->dev_private;
@@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
  * Gets the hw ready to enable irqs (all asics).
  * This function disables all interrupt sources on the GPU.
  */
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
  * Handles stuff to be done after enabling irqs (all asics).
  * Returns 0 on success.
  */
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
+static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 
@@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
  *
  * This function disables all interrupt sources on the GPU (all asics).
  */
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
+static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned long irqflags;
@@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
 	spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
 }
 
+static int radeon_irq_install(struct radeon_device *rdev, int irq)
+{
+	struct drm_device *dev = rdev->ddev;
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	radeon_driver_irq_preinstall_kms(dev);
+
+	/* PCI devices require shared interrupts. */
+	ret = request_irq(irq, radeon_driver_irq_handler_kms,
+			  IRQF_SHARED, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	radeon_driver_irq_postinstall_kms(dev);
+
+	return 0;
+}
+
+static void radeon_irq_uninstall(struct radeon_device *rdev)
+{
+	struct drm_device *dev = rdev->ddev;
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
+
+	radeon_driver_irq_uninstall_kms(dev);
+	free_irq(pdev->irq, dev);
+}
+
 /**
  * radeon_msi_ok - asic specific msi checks
  *
@@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 	INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
 
 	rdev->irq.installed = true;
-	r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
+	r = radeon_irq_install(rdev, rdev->pdev->irq);
 	if (r) {
 		rdev->irq.installed = false;
 		flush_delayed_work(&rdev->hotplug_work);
@@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 void radeon_irq_kms_fini(struct radeon_device *rdev)
 {
 	if (rdev->irq.installed) {
-		drm_irq_uninstall(rdev->ddev);
+		radeon_irq_uninstall(rdev);
 		rdev->irq.installed = false;
 		if (rdev->msi_enabled)
 			pci_disable_msi(rdev->pdev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
index 9b97bf38acd4..36e73cea9215 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.h
+++ b/drivers/gpu/drm/radeon/radeon_kms.h
@@ -31,9 +31,5 @@
 u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
 int radeon_enable_vblank_kms(struct drm_crtc *crtc);
 void radeon_disable_vblank_kms(struct drm_crtc *crtc);
-irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
-void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
-int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
-void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
 
 #endif				/* __RADEON_KMS_H__ */
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 +---
 4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index 66e3c86eb5c7..d620f35688da 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -16,7 +16,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
@@ -118,11 +117,6 @@ static const struct drm_driver tidss_driver = {
 	.date			= "20180215",
 	.major			= 1,
 	.minor			= 0,
-
-	.irq_preinstall		= tidss_irq_preinstall,
-	.irq_postinstall	= tidss_irq_postinstall,
-	.irq_handler		= tidss_irq_handler,
-	.irq_uninstall		= tidss_irq_uninstall,
 };
 
 static int tidss_probe(struct platform_device *pdev)
@@ -172,10 +166,11 @@ static int tidss_probe(struct platform_device *pdev)
 		ret = irq;
 		goto err_runtime_suspend;
 	}
+	tidss->irq = irq;
 
-	ret = drm_irq_install(ddev, irq);
+	ret = tidss_irq_install(ddev, irq);
 	if (ret) {
-		dev_err(dev, "drm_irq_install failed: %d\n", ret);
+		dev_err(dev, "tidss_irq_install failed: %d\n", ret);
 		goto err_runtime_suspend;
 	}
 
@@ -196,7 +191,7 @@ static int tidss_probe(struct platform_device *pdev)
 	return 0;
 
 err_irq_uninstall:
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 err_runtime_suspend:
 #ifndef CONFIG_PM
@@ -219,7 +214,7 @@ static int tidss_remove(struct platform_device *pdev)
 
 	drm_atomic_helper_shutdown(ddev);
 
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 #ifndef CONFIG_PM
 	/* If we don't have PM, we need to call suspend manually */
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h
index 7de4bba52e6f..d7f27b0b0315 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.h
+++ b/drivers/gpu/drm/tidss/tidss_drv.h
@@ -27,6 +27,8 @@ struct tidss_device {
 	unsigned int num_planes;
 	struct drm_plane *planes[TIDSS_MAX_PLANES];
 
+	unsigned int irq;
+
 	spinlock_t wait_lock;	/* protects the irq masks */
 	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
 };
diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
index 2ed3e3296776..0c681c7600bc 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.c
+++ b/drivers/gpu/drm/tidss/tidss_irq.c
@@ -4,6 +4,9 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
 #include "tidss_crtc.h"
@@ -50,7 +53,7 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-irqreturn_t tidss_irq_handler(int irq, void *arg)
+static irqreturn_t tidss_irq_handler(int irq, void *arg)
 {
 	struct drm_device *ddev = (struct drm_device *)arg;
 	struct tidss_device *tidss = to_tidss(ddev);
@@ -90,7 +93,7 @@ void tidss_irq_resume(struct tidss_device *tidss)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-void tidss_irq_preinstall(struct drm_device *ddev)
+static void tidss_irq_preinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 
@@ -104,7 +107,7 @@ void tidss_irq_preinstall(struct drm_device *ddev)
 	tidss_runtime_put(tidss);
 }
 
-int tidss_irq_postinstall(struct drm_device *ddev)
+static void tidss_irq_postinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 	unsigned long flags;
@@ -129,6 +132,22 @@ int tidss_irq_postinstall(struct drm_device *ddev)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 
 	tidss_runtime_put(tidss);
+}
+
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	tidss_irq_preinstall(ddev);
+
+	ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev);
+	if (ret)
+		return ret;
+
+	tidss_irq_postinstall(ddev);
 
 	return 0;
 }
@@ -140,4 +159,6 @@ void tidss_irq_uninstall(struct drm_device *ddev)
 	tidss_runtime_get(tidss);
 	dispc_set_irqenable(tidss->dispc, 0);
 	tidss_runtime_put(tidss);
+
+	free_irq(tidss->irq, ddev);
 }
diff --git a/drivers/gpu/drm/tidss/tidss_irq.h b/drivers/gpu/drm/tidss/tidss_irq.h
index 4aaad5dfd7c2..b512614d5863 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.h
+++ b/drivers/gpu/drm/tidss/tidss_irq.h
@@ -67,10 +67,8 @@ struct tidss_device;
 void tidss_irq_enable_vblank(struct drm_crtc *crtc);
 void tidss_irq_disable_vblank(struct drm_crtc *crtc);
 
-void tidss_irq_preinstall(struct drm_device *ddev);
-int tidss_irq_postinstall(struct drm_device *ddev);
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
 void tidss_irq_uninstall(struct drm_device *ddev);
-irqreturn_t tidss_irq_handler(int irq, void *arg);
 
 void tidss_irq_resume(struct tidss_device *tidss);
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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>
---
 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 +---
 4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index 66e3c86eb5c7..d620f35688da 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -16,7 +16,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
@@ -118,11 +117,6 @@ static const struct drm_driver tidss_driver = {
 	.date			= "20180215",
 	.major			= 1,
 	.minor			= 0,
-
-	.irq_preinstall		= tidss_irq_preinstall,
-	.irq_postinstall	= tidss_irq_postinstall,
-	.irq_handler		= tidss_irq_handler,
-	.irq_uninstall		= tidss_irq_uninstall,
 };
 
 static int tidss_probe(struct platform_device *pdev)
@@ -172,10 +166,11 @@ static int tidss_probe(struct platform_device *pdev)
 		ret = irq;
 		goto err_runtime_suspend;
 	}
+	tidss->irq = irq;
 
-	ret = drm_irq_install(ddev, irq);
+	ret = tidss_irq_install(ddev, irq);
 	if (ret) {
-		dev_err(dev, "drm_irq_install failed: %d\n", ret);
+		dev_err(dev, "tidss_irq_install failed: %d\n", ret);
 		goto err_runtime_suspend;
 	}
 
@@ -196,7 +191,7 @@ static int tidss_probe(struct platform_device *pdev)
 	return 0;
 
 err_irq_uninstall:
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 err_runtime_suspend:
 #ifndef CONFIG_PM
@@ -219,7 +214,7 @@ static int tidss_remove(struct platform_device *pdev)
 
 	drm_atomic_helper_shutdown(ddev);
 
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 #ifndef CONFIG_PM
 	/* If we don't have PM, we need to call suspend manually */
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h
index 7de4bba52e6f..d7f27b0b0315 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.h
+++ b/drivers/gpu/drm/tidss/tidss_drv.h
@@ -27,6 +27,8 @@ struct tidss_device {
 	unsigned int num_planes;
 	struct drm_plane *planes[TIDSS_MAX_PLANES];
 
+	unsigned int irq;
+
 	spinlock_t wait_lock;	/* protects the irq masks */
 	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
 };
diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
index 2ed3e3296776..0c681c7600bc 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.c
+++ b/drivers/gpu/drm/tidss/tidss_irq.c
@@ -4,6 +4,9 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
 #include "tidss_crtc.h"
@@ -50,7 +53,7 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-irqreturn_t tidss_irq_handler(int irq, void *arg)
+static irqreturn_t tidss_irq_handler(int irq, void *arg)
 {
 	struct drm_device *ddev = (struct drm_device *)arg;
 	struct tidss_device *tidss = to_tidss(ddev);
@@ -90,7 +93,7 @@ void tidss_irq_resume(struct tidss_device *tidss)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-void tidss_irq_preinstall(struct drm_device *ddev)
+static void tidss_irq_preinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 
@@ -104,7 +107,7 @@ void tidss_irq_preinstall(struct drm_device *ddev)
 	tidss_runtime_put(tidss);
 }
 
-int tidss_irq_postinstall(struct drm_device *ddev)
+static void tidss_irq_postinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 	unsigned long flags;
@@ -129,6 +132,22 @@ int tidss_irq_postinstall(struct drm_device *ddev)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 
 	tidss_runtime_put(tidss);
+}
+
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	tidss_irq_preinstall(ddev);
+
+	ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev);
+	if (ret)
+		return ret;
+
+	tidss_irq_postinstall(ddev);
 
 	return 0;
 }
@@ -140,4 +159,6 @@ void tidss_irq_uninstall(struct drm_device *ddev)
 	tidss_runtime_get(tidss);
 	dispc_set_irqenable(tidss->dispc, 0);
 	tidss_runtime_put(tidss);
+
+	free_irq(tidss->irq, ddev);
 }
diff --git a/drivers/gpu/drm/tidss/tidss_irq.h b/drivers/gpu/drm/tidss/tidss_irq.h
index 4aaad5dfd7c2..b512614d5863 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.h
+++ b/drivers/gpu/drm/tidss/tidss_irq.h
@@ -67,10 +67,8 @@ struct tidss_device;
 void tidss_irq_enable_vblank(struct drm_crtc *crtc);
 void tidss_irq_disable_vblank(struct drm_crtc *crtc);
 
-void tidss_irq_preinstall(struct drm_device *ddev);
-int tidss_irq_postinstall(struct drm_device *ddev);
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
 void tidss_irq_uninstall(struct drm_device *ddev);
-irqreturn_t tidss_irq_handler(int irq, void *arg);
 
 void tidss_irq_resume(struct tidss_device *tidss);
 
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 +---
 4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index 66e3c86eb5c7..d620f35688da 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -16,7 +16,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
@@ -118,11 +117,6 @@ static const struct drm_driver tidss_driver = {
 	.date			= "20180215",
 	.major			= 1,
 	.minor			= 0,
-
-	.irq_preinstall		= tidss_irq_preinstall,
-	.irq_postinstall	= tidss_irq_postinstall,
-	.irq_handler		= tidss_irq_handler,
-	.irq_uninstall		= tidss_irq_uninstall,
 };
 
 static int tidss_probe(struct platform_device *pdev)
@@ -172,10 +166,11 @@ static int tidss_probe(struct platform_device *pdev)
 		ret = irq;
 		goto err_runtime_suspend;
 	}
+	tidss->irq = irq;
 
-	ret = drm_irq_install(ddev, irq);
+	ret = tidss_irq_install(ddev, irq);
 	if (ret) {
-		dev_err(dev, "drm_irq_install failed: %d\n", ret);
+		dev_err(dev, "tidss_irq_install failed: %d\n", ret);
 		goto err_runtime_suspend;
 	}
 
@@ -196,7 +191,7 @@ static int tidss_probe(struct platform_device *pdev)
 	return 0;
 
 err_irq_uninstall:
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 err_runtime_suspend:
 #ifndef CONFIG_PM
@@ -219,7 +214,7 @@ static int tidss_remove(struct platform_device *pdev)
 
 	drm_atomic_helper_shutdown(ddev);
 
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 #ifndef CONFIG_PM
 	/* If we don't have PM, we need to call suspend manually */
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h
index 7de4bba52e6f..d7f27b0b0315 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.h
+++ b/drivers/gpu/drm/tidss/tidss_drv.h
@@ -27,6 +27,8 @@ struct tidss_device {
 	unsigned int num_planes;
 	struct drm_plane *planes[TIDSS_MAX_PLANES];
 
+	unsigned int irq;
+
 	spinlock_t wait_lock;	/* protects the irq masks */
 	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
 };
diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
index 2ed3e3296776..0c681c7600bc 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.c
+++ b/drivers/gpu/drm/tidss/tidss_irq.c
@@ -4,6 +4,9 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
 #include "tidss_crtc.h"
@@ -50,7 +53,7 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-irqreturn_t tidss_irq_handler(int irq, void *arg)
+static irqreturn_t tidss_irq_handler(int irq, void *arg)
 {
 	struct drm_device *ddev = (struct drm_device *)arg;
 	struct tidss_device *tidss = to_tidss(ddev);
@@ -90,7 +93,7 @@ void tidss_irq_resume(struct tidss_device *tidss)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-void tidss_irq_preinstall(struct drm_device *ddev)
+static void tidss_irq_preinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 
@@ -104,7 +107,7 @@ void tidss_irq_preinstall(struct drm_device *ddev)
 	tidss_runtime_put(tidss);
 }
 
-int tidss_irq_postinstall(struct drm_device *ddev)
+static void tidss_irq_postinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 	unsigned long flags;
@@ -129,6 +132,22 @@ int tidss_irq_postinstall(struct drm_device *ddev)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 
 	tidss_runtime_put(tidss);
+}
+
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	tidss_irq_preinstall(ddev);
+
+	ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev);
+	if (ret)
+		return ret;
+
+	tidss_irq_postinstall(ddev);
 
 	return 0;
 }
@@ -140,4 +159,6 @@ void tidss_irq_uninstall(struct drm_device *ddev)
 	tidss_runtime_get(tidss);
 	dispc_set_irqenable(tidss->dispc, 0);
 	tidss_runtime_put(tidss);
+
+	free_irq(tidss->irq, ddev);
 }
diff --git a/drivers/gpu/drm/tidss/tidss_irq.h b/drivers/gpu/drm/tidss/tidss_irq.h
index 4aaad5dfd7c2..b512614d5863 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.h
+++ b/drivers/gpu/drm/tidss/tidss_irq.h
@@ -67,10 +67,8 @@ struct tidss_device;
 void tidss_irq_enable_vblank(struct drm_crtc *crtc);
 void tidss_irq_disable_vblank(struct drm_crtc *crtc);
 
-void tidss_irq_preinstall(struct drm_device *ddev);
-int tidss_irq_postinstall(struct drm_device *ddev);
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
 void tidss_irq_uninstall(struct drm_device *ddev);
-irqreturn_t tidss_irq_handler(int irq, void *arg);
 
 void tidss_irq_resume(struct tidss_device *tidss);
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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>
---
 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 +---
 4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index 66e3c86eb5c7..d620f35688da 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -16,7 +16,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
@@ -118,11 +117,6 @@ static const struct drm_driver tidss_driver = {
 	.date			= "20180215",
 	.major			= 1,
 	.minor			= 0,
-
-	.irq_preinstall		= tidss_irq_preinstall,
-	.irq_postinstall	= tidss_irq_postinstall,
-	.irq_handler		= tidss_irq_handler,
-	.irq_uninstall		= tidss_irq_uninstall,
 };
 
 static int tidss_probe(struct platform_device *pdev)
@@ -172,10 +166,11 @@ static int tidss_probe(struct platform_device *pdev)
 		ret = irq;
 		goto err_runtime_suspend;
 	}
+	tidss->irq = irq;
 
-	ret = drm_irq_install(ddev, irq);
+	ret = tidss_irq_install(ddev, irq);
 	if (ret) {
-		dev_err(dev, "drm_irq_install failed: %d\n", ret);
+		dev_err(dev, "tidss_irq_install failed: %d\n", ret);
 		goto err_runtime_suspend;
 	}
 
@@ -196,7 +191,7 @@ static int tidss_probe(struct platform_device *pdev)
 	return 0;
 
 err_irq_uninstall:
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 err_runtime_suspend:
 #ifndef CONFIG_PM
@@ -219,7 +214,7 @@ static int tidss_remove(struct platform_device *pdev)
 
 	drm_atomic_helper_shutdown(ddev);
 
-	drm_irq_uninstall(ddev);
+	tidss_irq_uninstall(ddev);
 
 #ifndef CONFIG_PM
 	/* If we don't have PM, we need to call suspend manually */
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h
index 7de4bba52e6f..d7f27b0b0315 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.h
+++ b/drivers/gpu/drm/tidss/tidss_drv.h
@@ -27,6 +27,8 @@ struct tidss_device {
 	unsigned int num_planes;
 	struct drm_plane *planes[TIDSS_MAX_PLANES];
 
+	unsigned int irq;
+
 	spinlock_t wait_lock;	/* protects the irq masks */
 	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
 };
diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
index 2ed3e3296776..0c681c7600bc 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.c
+++ b/drivers/gpu/drm/tidss/tidss_irq.c
@@ -4,6 +4,9 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
 #include "tidss_crtc.h"
@@ -50,7 +53,7 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-irqreturn_t tidss_irq_handler(int irq, void *arg)
+static irqreturn_t tidss_irq_handler(int irq, void *arg)
 {
 	struct drm_device *ddev = (struct drm_device *)arg;
 	struct tidss_device *tidss = to_tidss(ddev);
@@ -90,7 +93,7 @@ void tidss_irq_resume(struct tidss_device *tidss)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-void tidss_irq_preinstall(struct drm_device *ddev)
+static void tidss_irq_preinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 
@@ -104,7 +107,7 @@ void tidss_irq_preinstall(struct drm_device *ddev)
 	tidss_runtime_put(tidss);
 }
 
-int tidss_irq_postinstall(struct drm_device *ddev)
+static void tidss_irq_postinstall(struct drm_device *ddev)
 {
 	struct tidss_device *tidss = to_tidss(ddev);
 	unsigned long flags;
@@ -129,6 +132,22 @@ int tidss_irq_postinstall(struct drm_device *ddev)
 	spin_unlock_irqrestore(&tidss->wait_lock, flags);
 
 	tidss_runtime_put(tidss);
+}
+
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	tidss_irq_preinstall(ddev);
+
+	ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev);
+	if (ret)
+		return ret;
+
+	tidss_irq_postinstall(ddev);
 
 	return 0;
 }
@@ -140,4 +159,6 @@ void tidss_irq_uninstall(struct drm_device *ddev)
 	tidss_runtime_get(tidss);
 	dispc_set_irqenable(tidss->dispc, 0);
 	tidss_runtime_put(tidss);
+
+	free_irq(tidss->irq, ddev);
 }
diff --git a/drivers/gpu/drm/tidss/tidss_irq.h b/drivers/gpu/drm/tidss/tidss_irq.h
index 4aaad5dfd7c2..b512614d5863 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.h
+++ b/drivers/gpu/drm/tidss/tidss_irq.h
@@ -67,10 +67,8 @@ struct tidss_device;
 void tidss_irq_enable_vblank(struct drm_crtc *crtc);
 void tidss_irq_disable_vblank(struct drm_crtc *crtc);
 
-void tidss_irq_preinstall(struct drm_device *ddev);
-int tidss_irq_postinstall(struct drm_device *ddev);
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
 void tidss_irq_uninstall(struct drm_device *ddev);
-irqreturn_t tidss_irq_handler(int irq, void *arg);
 
 void tidss_irq_resume(struct tidss_device *tidss);
 
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 11/14] drm/tilcdc: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 51 ++++++++++++++++++++++-------
 drivers/gpu/drm/tilcdc/tilcdc_drv.h |  3 ++
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f1d3a9f919fd..6b03f89a98d4 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -20,7 +20,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mm.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -124,6 +123,39 @@ static int cpufreq_transition(struct notifier_block *nb,
 }
 #endif
 
+static irqreturn_t tilcdc_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	return tilcdc_crtc_irq(priv->crtc);
+}
+
+static int tilcdc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+	int ret;
+
+	ret = request_irq(irq, tilcdc_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	priv->irq_enabled = false;
+
+	return 0;
+}
+
+static void tilcdc_irq_uninstall(struct drm_device *dev)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	if (!priv->irq_enabled)
+		return;
+
+	free_irq(priv->irq, dev);
+	priv->irq_enabled = false;
+}
+
 /*
  * DRM operations:
  */
@@ -145,7 +177,7 @@ static void tilcdc_fini(struct drm_device *dev)
 		drm_dev_unregister(dev);
 
 	drm_kms_helper_poll_fini(dev);
-	drm_irq_uninstall(dev);
+	tilcdc_irq_uninstall(dev);
 	drm_mode_config_cleanup(dev);
 
 	if (priv->clk)
@@ -336,7 +368,12 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 		goto init_failed;
 	}
 
-	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto init_failed;
+	priv->irq = ret;
+
+	ret = tilcdc_irq_install(ddev, priv->irq);
 	if (ret < 0) {
 		dev_err(dev, "failed to install IRQ handler\n");
 		goto init_failed;
@@ -360,13 +397,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 	return ret;
 }
 
-static irqreturn_t tilcdc_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	return tilcdc_crtc_irq(priv->crtc);
-}
-
 #if defined(CONFIG_DEBUG_FS)
 static const struct {
 	const char *name;
@@ -454,7 +484,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver tilcdc_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler        = tilcdc_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init       = tilcdc_debugfs_init,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index d29806ca8817..b818448c83f6 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -46,6 +46,8 @@ struct tilcdc_drm_private {
 	struct clk *clk;         /* functional clock */
 	int rev;                 /* IP revision */
 
+	unsigned int irq;
+
 	/* don't attempt resolutions w/ higher W * H * Hz: */
 	uint32_t max_bandwidth;
 	/*
@@ -82,6 +84,7 @@ struct tilcdc_drm_private {
 
 	bool is_registered;
 	bool is_componentized;
+	bool irq_enabled;
 };
 
 /* Sub-module for display.  Since we don't know at compile time what panels
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 11/14] drm/tilcdc: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 51 ++++++++++++++++++++++-------
 drivers/gpu/drm/tilcdc/tilcdc_drv.h |  3 ++
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f1d3a9f919fd..6b03f89a98d4 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -20,7 +20,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mm.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -124,6 +123,39 @@ static int cpufreq_transition(struct notifier_block *nb,
 }
 #endif
 
+static irqreturn_t tilcdc_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	return tilcdc_crtc_irq(priv->crtc);
+}
+
+static int tilcdc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+	int ret;
+
+	ret = request_irq(irq, tilcdc_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	priv->irq_enabled = false;
+
+	return 0;
+}
+
+static void tilcdc_irq_uninstall(struct drm_device *dev)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	if (!priv->irq_enabled)
+		return;
+
+	free_irq(priv->irq, dev);
+	priv->irq_enabled = false;
+}
+
 /*
  * DRM operations:
  */
@@ -145,7 +177,7 @@ static void tilcdc_fini(struct drm_device *dev)
 		drm_dev_unregister(dev);
 
 	drm_kms_helper_poll_fini(dev);
-	drm_irq_uninstall(dev);
+	tilcdc_irq_uninstall(dev);
 	drm_mode_config_cleanup(dev);
 
 	if (priv->clk)
@@ -336,7 +368,12 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 		goto init_failed;
 	}
 
-	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto init_failed;
+	priv->irq = ret;
+
+	ret = tilcdc_irq_install(ddev, priv->irq);
 	if (ret < 0) {
 		dev_err(dev, "failed to install IRQ handler\n");
 		goto init_failed;
@@ -360,13 +397,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 	return ret;
 }
 
-static irqreturn_t tilcdc_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	return tilcdc_crtc_irq(priv->crtc);
-}
-
 #if defined(CONFIG_DEBUG_FS)
 static const struct {
 	const char *name;
@@ -454,7 +484,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver tilcdc_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler        = tilcdc_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init       = tilcdc_debugfs_init,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index d29806ca8817..b818448c83f6 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -46,6 +46,8 @@ struct tilcdc_drm_private {
 	struct clk *clk;         /* functional clock */
 	int rev;                 /* IP revision */
 
+	unsigned int irq;
+
 	/* don't attempt resolutions w/ higher W * H * Hz: */
 	uint32_t max_bandwidth;
 	/*
@@ -82,6 +84,7 @@ struct tilcdc_drm_private {
 
 	bool is_registered;
 	bool is_componentized;
+	bool irq_enabled;
 };
 
 /* Sub-module for display.  Since we don't know at compile time what panels
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 11/14] drm/tilcdc: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 51 ++++++++++++++++++++++-------
 drivers/gpu/drm/tilcdc/tilcdc_drv.h |  3 ++
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f1d3a9f919fd..6b03f89a98d4 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -20,7 +20,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mm.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -124,6 +123,39 @@ static int cpufreq_transition(struct notifier_block *nb,
 }
 #endif
 
+static irqreturn_t tilcdc_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	return tilcdc_crtc_irq(priv->crtc);
+}
+
+static int tilcdc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+	int ret;
+
+	ret = request_irq(irq, tilcdc_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	priv->irq_enabled = false;
+
+	return 0;
+}
+
+static void tilcdc_irq_uninstall(struct drm_device *dev)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	if (!priv->irq_enabled)
+		return;
+
+	free_irq(priv->irq, dev);
+	priv->irq_enabled = false;
+}
+
 /*
  * DRM operations:
  */
@@ -145,7 +177,7 @@ static void tilcdc_fini(struct drm_device *dev)
 		drm_dev_unregister(dev);
 
 	drm_kms_helper_poll_fini(dev);
-	drm_irq_uninstall(dev);
+	tilcdc_irq_uninstall(dev);
 	drm_mode_config_cleanup(dev);
 
 	if (priv->clk)
@@ -336,7 +368,12 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 		goto init_failed;
 	}
 
-	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto init_failed;
+	priv->irq = ret;
+
+	ret = tilcdc_irq_install(ddev, priv->irq);
 	if (ret < 0) {
 		dev_err(dev, "failed to install IRQ handler\n");
 		goto init_failed;
@@ -360,13 +397,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 	return ret;
 }
 
-static irqreturn_t tilcdc_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	return tilcdc_crtc_irq(priv->crtc);
-}
-
 #if defined(CONFIG_DEBUG_FS)
 static const struct {
 	const char *name;
@@ -454,7 +484,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver tilcdc_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler        = tilcdc_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init       = tilcdc_debugfs_init,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index d29806ca8817..b818448c83f6 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -46,6 +46,8 @@ struct tilcdc_drm_private {
 	struct clk *clk;         /* functional clock */
 	int rev;                 /* IP revision */
 
+	unsigned int irq;
+
 	/* don't attempt resolutions w/ higher W * H * Hz: */
 	uint32_t max_bandwidth;
 	/*
@@ -82,6 +84,7 @@ struct tilcdc_drm_private {
 
 	bool is_registered;
 	bool is_componentized;
+	bool irq_enabled;
 };
 
 /* Sub-module for display.  Since we don't know at compile time what panels
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 11/14] drm/tilcdc: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 51 ++++++++++++++++++++++-------
 drivers/gpu/drm/tilcdc/tilcdc_drv.h |  3 ++
 2 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f1d3a9f919fd..6b03f89a98d4 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -20,7 +20,6 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_mm.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -124,6 +123,39 @@ static int cpufreq_transition(struct notifier_block *nb,
 }
 #endif
 
+static irqreturn_t tilcdc_irq(int irq, void *arg)
+{
+	struct drm_device *dev = arg;
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	return tilcdc_crtc_irq(priv->crtc);
+}
+
+static int tilcdc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+	int ret;
+
+	ret = request_irq(irq, tilcdc_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	priv->irq_enabled = false;
+
+	return 0;
+}
+
+static void tilcdc_irq_uninstall(struct drm_device *dev)
+{
+	struct tilcdc_drm_private *priv = dev->dev_private;
+
+	if (!priv->irq_enabled)
+		return;
+
+	free_irq(priv->irq, dev);
+	priv->irq_enabled = false;
+}
+
 /*
  * DRM operations:
  */
@@ -145,7 +177,7 @@ static void tilcdc_fini(struct drm_device *dev)
 		drm_dev_unregister(dev);
 
 	drm_kms_helper_poll_fini(dev);
-	drm_irq_uninstall(dev);
+	tilcdc_irq_uninstall(dev);
 	drm_mode_config_cleanup(dev);
 
 	if (priv->clk)
@@ -336,7 +368,12 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 		goto init_failed;
 	}
 
-	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto init_failed;
+	priv->irq = ret;
+
+	ret = tilcdc_irq_install(ddev, priv->irq);
 	if (ret < 0) {
 		dev_err(dev, "failed to install IRQ handler\n");
 		goto init_failed;
@@ -360,13 +397,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 	return ret;
 }
 
-static irqreturn_t tilcdc_irq(int irq, void *arg)
-{
-	struct drm_device *dev = arg;
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	return tilcdc_crtc_irq(priv->crtc);
-}
-
 #if defined(CONFIG_DEBUG_FS)
 static const struct {
 	const char *name;
@@ -454,7 +484,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static const struct drm_driver tilcdc_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
-	.irq_handler        = tilcdc_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init       = tilcdc_debugfs_init,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
index d29806ca8817..b818448c83f6 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h
@@ -46,6 +46,8 @@ struct tilcdc_drm_private {
 	struct clk *clk;         /* functional clock */
 	int rev;                 /* IP revision */
 
+	unsigned int irq;
+
 	/* don't attempt resolutions w/ higher W * H * Hz: */
 	uint32_t max_bandwidth;
 	/*
@@ -82,6 +84,7 @@ struct tilcdc_drm_private {
 
 	bool is_registered;
 	bool is_componentized;
+	bool irq_enabled;
 };
 
 /* Sub-module for display.  Since we don't know at compile time what panels
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 12/14] drm/vc4: Convert to Linux IRQ interfaces
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++++++-----
 4 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 73335feb712f..f6c16c5aee68 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -168,10 +168,6 @@ static struct drm_driver vc4_drm_driver = {
 			    DRIVER_SYNCOBJ),
 	.open = vc4_open,
 	.postclose = vc4_close,
-	.irq_handler = vc4_irq,
-	.irq_preinstall = vc4_irq_preinstall,
-	.irq_postinstall = vc4_irq_postinstall,
-	.irq_uninstall = vc4_irq_uninstall,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 5dceadc61600..ef73e0aaf726 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -74,6 +74,8 @@ struct vc4_perfmon {
 struct vc4_dev {
 	struct drm_device base;
 
+	unsigned int irq;
+
 	struct vc4_hvs *hvs;
 	struct vc4_v3d *v3d;
 	struct vc4_dpi *dpi;
@@ -895,9 +897,9 @@ extern struct platform_driver vc4_vec_driver;
 extern struct platform_driver vc4_txp_driver;
 
 /* vc4_irq.c */
-irqreturn_t vc4_irq(int irq, void *arg);
-void vc4_irq_preinstall(struct drm_device *dev);
-int vc4_irq_postinstall(struct drm_device *dev);
+void vc4_irq_enable(struct drm_device *dev);
+void vc4_irq_disable(struct drm_device *dev);
+int vc4_irq_install(struct drm_device *dev, int irq);
 void vc4_irq_uninstall(struct drm_device *dev);
 void vc4_irq_reset(struct drm_device *dev);
 
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index e226c24e543f..20fa8e34c20b 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -45,6 +45,10 @@
  * current job can make progress.
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
+
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -192,7 +196,7 @@ vc4_irq_finish_render_job(struct drm_device *dev)
 	schedule_work(&vc4->job_done_work);
 }
 
-irqreturn_t
+static irqreturn_t
 vc4_irq(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -234,8 +238,8 @@ vc4_irq(int irq, void *arg)
 	return status;
 }
 
-void
-vc4_irq_preinstall(struct drm_device *dev)
+static void
+vc4_irq_prepare(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -251,24 +255,22 @@ vc4_irq_preinstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 }
 
-int
-vc4_irq_postinstall(struct drm_device *dev)
+void
+vc4_irq_enable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
 	if (!vc4->v3d)
-		return 0;
+		return;
 
 	/* Enable the render done interrupts. The out-of-memory interrupt is
 	 * enabled as soon as we have a binner BO allocated.
 	 */
 	V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE);
-
-	return 0;
 }
 
 void
-vc4_irq_uninstall(struct drm_device *dev)
+vc4_irq_disable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -282,11 +284,37 @@ vc4_irq_uninstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 
 	/* Finish any interrupt handler still in flight. */
-	disable_irq(dev->irq);
+	disable_irq(vc4->irq);
 
 	cancel_work_sync(&vc4->overflow_mem_work);
 }
 
+int vc4_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	vc4_irq_prepare(dev);
+
+	ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	vc4_irq_enable(dev);
+
+	return 0;
+}
+
+void vc4_irq_uninstall(struct drm_device *dev)
+{
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+	vc4_irq_disable(dev);
+	free_irq(vc4->irq, dev);
+}
+
 /** Reinitializes interrupt registers when a GPU reset is performed. */
 void vc4_irq_reset(struct drm_device *dev)
 {
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 73d63d72575b..7bb3067f8425 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -10,8 +10,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 
-#include <drm/drm_irq.h>
-
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -361,7 +359,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev)
 	struct vc4_v3d *v3d = dev_get_drvdata(dev);
 	struct vc4_dev *vc4 = v3d->vc4;
 
-	vc4_irq_uninstall(&vc4->base);
+	vc4_irq_disable(&vc4->base);
 
 	clk_disable_unprepare(v3d->clk);
 
@@ -381,8 +379,8 @@ static int vc4_v3d_runtime_resume(struct device *dev)
 	vc4_v3d_init_hw(&vc4->base);
 
 	/* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
-	enable_irq(vc4->base.irq);
-	vc4_irq_postinstall(&vc4->base);
+	enable_irq(vc4->irq);
+	vc4_irq_enable(&vc4->base);
 
 	return 0;
 }
@@ -448,7 +446,12 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
 
 	vc4_v3d_init_hw(drm);
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+	vc4->irq = ret;
+
+	ret = vc4_irq_install(drm, vc4->irq);
 	if (ret) {
 		DRM_ERROR("Failed to install IRQ handler\n");
 		return ret;
@@ -473,7 +476,7 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master,
 
 	pm_runtime_disable(dev);
 
-	drm_irq_uninstall(drm);
+	vc4_irq_uninstall(drm);
 
 	/* Disable the binner's overflow memory address, so the next
 	 * driver probe (if any) doesn't try to reuse our old
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 12/14] drm/vc4: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++++++-----
 4 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 73335feb712f..f6c16c5aee68 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -168,10 +168,6 @@ static struct drm_driver vc4_drm_driver = {
 			    DRIVER_SYNCOBJ),
 	.open = vc4_open,
 	.postclose = vc4_close,
-	.irq_handler = vc4_irq,
-	.irq_preinstall = vc4_irq_preinstall,
-	.irq_postinstall = vc4_irq_postinstall,
-	.irq_uninstall = vc4_irq_uninstall,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 5dceadc61600..ef73e0aaf726 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -74,6 +74,8 @@ struct vc4_perfmon {
 struct vc4_dev {
 	struct drm_device base;
 
+	unsigned int irq;
+
 	struct vc4_hvs *hvs;
 	struct vc4_v3d *v3d;
 	struct vc4_dpi *dpi;
@@ -895,9 +897,9 @@ extern struct platform_driver vc4_vec_driver;
 extern struct platform_driver vc4_txp_driver;
 
 /* vc4_irq.c */
-irqreturn_t vc4_irq(int irq, void *arg);
-void vc4_irq_preinstall(struct drm_device *dev);
-int vc4_irq_postinstall(struct drm_device *dev);
+void vc4_irq_enable(struct drm_device *dev);
+void vc4_irq_disable(struct drm_device *dev);
+int vc4_irq_install(struct drm_device *dev, int irq);
 void vc4_irq_uninstall(struct drm_device *dev);
 void vc4_irq_reset(struct drm_device *dev);
 
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index e226c24e543f..20fa8e34c20b 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -45,6 +45,10 @@
  * current job can make progress.
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
+
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -192,7 +196,7 @@ vc4_irq_finish_render_job(struct drm_device *dev)
 	schedule_work(&vc4->job_done_work);
 }
 
-irqreturn_t
+static irqreturn_t
 vc4_irq(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -234,8 +238,8 @@ vc4_irq(int irq, void *arg)
 	return status;
 }
 
-void
-vc4_irq_preinstall(struct drm_device *dev)
+static void
+vc4_irq_prepare(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -251,24 +255,22 @@ vc4_irq_preinstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 }
 
-int
-vc4_irq_postinstall(struct drm_device *dev)
+void
+vc4_irq_enable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
 	if (!vc4->v3d)
-		return 0;
+		return;
 
 	/* Enable the render done interrupts. The out-of-memory interrupt is
 	 * enabled as soon as we have a binner BO allocated.
 	 */
 	V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE);
-
-	return 0;
 }
 
 void
-vc4_irq_uninstall(struct drm_device *dev)
+vc4_irq_disable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -282,11 +284,37 @@ vc4_irq_uninstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 
 	/* Finish any interrupt handler still in flight. */
-	disable_irq(dev->irq);
+	disable_irq(vc4->irq);
 
 	cancel_work_sync(&vc4->overflow_mem_work);
 }
 
+int vc4_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	vc4_irq_prepare(dev);
+
+	ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	vc4_irq_enable(dev);
+
+	return 0;
+}
+
+void vc4_irq_uninstall(struct drm_device *dev)
+{
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+	vc4_irq_disable(dev);
+	free_irq(vc4->irq, dev);
+}
+
 /** Reinitializes interrupt registers when a GPU reset is performed. */
 void vc4_irq_reset(struct drm_device *dev)
 {
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 73d63d72575b..7bb3067f8425 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -10,8 +10,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 
-#include <drm/drm_irq.h>
-
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -361,7 +359,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev)
 	struct vc4_v3d *v3d = dev_get_drvdata(dev);
 	struct vc4_dev *vc4 = v3d->vc4;
 
-	vc4_irq_uninstall(&vc4->base);
+	vc4_irq_disable(&vc4->base);
 
 	clk_disable_unprepare(v3d->clk);
 
@@ -381,8 +379,8 @@ static int vc4_v3d_runtime_resume(struct device *dev)
 	vc4_v3d_init_hw(&vc4->base);
 
 	/* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
-	enable_irq(vc4->base.irq);
-	vc4_irq_postinstall(&vc4->base);
+	enable_irq(vc4->irq);
+	vc4_irq_enable(&vc4->base);
 
 	return 0;
 }
@@ -448,7 +446,12 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
 
 	vc4_v3d_init_hw(drm);
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+	vc4->irq = ret;
+
+	ret = vc4_irq_install(drm, vc4->irq);
 	if (ret) {
 		DRM_ERROR("Failed to install IRQ handler\n");
 		return ret;
@@ -473,7 +476,7 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master,
 
 	pm_runtime_disable(dev);
 
-	drm_irq_uninstall(drm);
+	vc4_irq_uninstall(drm);
 
 	/* Disable the binner's overflow memory address, so the next
 	 * driver probe (if any) doesn't try to reuse our old
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 12/14] drm/vc4: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++++++-----
 4 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 73335feb712f..f6c16c5aee68 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -168,10 +168,6 @@ static struct drm_driver vc4_drm_driver = {
 			    DRIVER_SYNCOBJ),
 	.open = vc4_open,
 	.postclose = vc4_close,
-	.irq_handler = vc4_irq,
-	.irq_preinstall = vc4_irq_preinstall,
-	.irq_postinstall = vc4_irq_postinstall,
-	.irq_uninstall = vc4_irq_uninstall,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 5dceadc61600..ef73e0aaf726 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -74,6 +74,8 @@ struct vc4_perfmon {
 struct vc4_dev {
 	struct drm_device base;
 
+	unsigned int irq;
+
 	struct vc4_hvs *hvs;
 	struct vc4_v3d *v3d;
 	struct vc4_dpi *dpi;
@@ -895,9 +897,9 @@ extern struct platform_driver vc4_vec_driver;
 extern struct platform_driver vc4_txp_driver;
 
 /* vc4_irq.c */
-irqreturn_t vc4_irq(int irq, void *arg);
-void vc4_irq_preinstall(struct drm_device *dev);
-int vc4_irq_postinstall(struct drm_device *dev);
+void vc4_irq_enable(struct drm_device *dev);
+void vc4_irq_disable(struct drm_device *dev);
+int vc4_irq_install(struct drm_device *dev, int irq);
 void vc4_irq_uninstall(struct drm_device *dev);
 void vc4_irq_reset(struct drm_device *dev);
 
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index e226c24e543f..20fa8e34c20b 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -45,6 +45,10 @@
  * current job can make progress.
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
+
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -192,7 +196,7 @@ vc4_irq_finish_render_job(struct drm_device *dev)
 	schedule_work(&vc4->job_done_work);
 }
 
-irqreturn_t
+static irqreturn_t
 vc4_irq(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -234,8 +238,8 @@ vc4_irq(int irq, void *arg)
 	return status;
 }
 
-void
-vc4_irq_preinstall(struct drm_device *dev)
+static void
+vc4_irq_prepare(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -251,24 +255,22 @@ vc4_irq_preinstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 }
 
-int
-vc4_irq_postinstall(struct drm_device *dev)
+void
+vc4_irq_enable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
 	if (!vc4->v3d)
-		return 0;
+		return;
 
 	/* Enable the render done interrupts. The out-of-memory interrupt is
 	 * enabled as soon as we have a binner BO allocated.
 	 */
 	V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE);
-
-	return 0;
 }
 
 void
-vc4_irq_uninstall(struct drm_device *dev)
+vc4_irq_disable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -282,11 +284,37 @@ vc4_irq_uninstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 
 	/* Finish any interrupt handler still in flight. */
-	disable_irq(dev->irq);
+	disable_irq(vc4->irq);
 
 	cancel_work_sync(&vc4->overflow_mem_work);
 }
 
+int vc4_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	vc4_irq_prepare(dev);
+
+	ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	vc4_irq_enable(dev);
+
+	return 0;
+}
+
+void vc4_irq_uninstall(struct drm_device *dev)
+{
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+	vc4_irq_disable(dev);
+	free_irq(vc4->irq, dev);
+}
+
 /** Reinitializes interrupt registers when a GPU reset is performed. */
 void vc4_irq_reset(struct drm_device *dev)
 {
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 73d63d72575b..7bb3067f8425 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -10,8 +10,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 
-#include <drm/drm_irq.h>
-
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -361,7 +359,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev)
 	struct vc4_v3d *v3d = dev_get_drvdata(dev);
 	struct vc4_dev *vc4 = v3d->vc4;
 
-	vc4_irq_uninstall(&vc4->base);
+	vc4_irq_disable(&vc4->base);
 
 	clk_disable_unprepare(v3d->clk);
 
@@ -381,8 +379,8 @@ static int vc4_v3d_runtime_resume(struct device *dev)
 	vc4_v3d_init_hw(&vc4->base);
 
 	/* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
-	enable_irq(vc4->base.irq);
-	vc4_irq_postinstall(&vc4->base);
+	enable_irq(vc4->irq);
+	vc4_irq_enable(&vc4->base);
 
 	return 0;
 }
@@ -448,7 +446,12 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
 
 	vc4_v3d_init_hw(drm);
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+	vc4->irq = ret;
+
+	ret = vc4_irq_install(drm, vc4->irq);
 	if (ret) {
 		DRM_ERROR("Failed to install IRQ handler\n");
 		return ret;
@@ -473,7 +476,7 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master,
 
 	pm_runtime_disable(dev);
 
-	drm_irq_uninstall(drm);
+	vc4_irq_uninstall(drm);
 
 	/* Disable the binner's overflow memory address, so the next
 	 * driver probe (if any) doesn't try to reuse our old
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 12/14] drm/vc4: Convert to Linux IRQ interfaces
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

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.

Calls to platform_get_irq() can fail with a negative errno code.
Abort initialization in this case. The DRM IRQ midlayer does not
handle this case correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 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 ++++++++-----
 4 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 73335feb712f..f6c16c5aee68 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -168,10 +168,6 @@ static struct drm_driver vc4_drm_driver = {
 			    DRIVER_SYNCOBJ),
 	.open = vc4_open,
 	.postclose = vc4_close,
-	.irq_handler = vc4_irq,
-	.irq_preinstall = vc4_irq_preinstall,
-	.irq_postinstall = vc4_irq_postinstall,
-	.irq_uninstall = vc4_irq_uninstall,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = vc4_debugfs_init,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 5dceadc61600..ef73e0aaf726 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -74,6 +74,8 @@ struct vc4_perfmon {
 struct vc4_dev {
 	struct drm_device base;
 
+	unsigned int irq;
+
 	struct vc4_hvs *hvs;
 	struct vc4_v3d *v3d;
 	struct vc4_dpi *dpi;
@@ -895,9 +897,9 @@ extern struct platform_driver vc4_vec_driver;
 extern struct platform_driver vc4_txp_driver;
 
 /* vc4_irq.c */
-irqreturn_t vc4_irq(int irq, void *arg);
-void vc4_irq_preinstall(struct drm_device *dev);
-int vc4_irq_postinstall(struct drm_device *dev);
+void vc4_irq_enable(struct drm_device *dev);
+void vc4_irq_disable(struct drm_device *dev);
+int vc4_irq_install(struct drm_device *dev, int irq);
 void vc4_irq_uninstall(struct drm_device *dev);
 void vc4_irq_reset(struct drm_device *dev);
 
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index e226c24e543f..20fa8e34c20b 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -45,6 +45,10 @@
  * current job can make progress.
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
+
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -192,7 +196,7 @@ vc4_irq_finish_render_job(struct drm_device *dev)
 	schedule_work(&vc4->job_done_work);
 }
 
-irqreturn_t
+static irqreturn_t
 vc4_irq(int irq, void *arg)
 {
 	struct drm_device *dev = arg;
@@ -234,8 +238,8 @@ vc4_irq(int irq, void *arg)
 	return status;
 }
 
-void
-vc4_irq_preinstall(struct drm_device *dev)
+static void
+vc4_irq_prepare(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -251,24 +255,22 @@ vc4_irq_preinstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 }
 
-int
-vc4_irq_postinstall(struct drm_device *dev)
+void
+vc4_irq_enable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
 	if (!vc4->v3d)
-		return 0;
+		return;
 
 	/* Enable the render done interrupts. The out-of-memory interrupt is
 	 * enabled as soon as we have a binner BO allocated.
 	 */
 	V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE);
-
-	return 0;
 }
 
 void
-vc4_irq_uninstall(struct drm_device *dev)
+vc4_irq_disable(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -282,11 +284,37 @@ vc4_irq_uninstall(struct drm_device *dev)
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
 
 	/* Finish any interrupt handler still in flight. */
-	disable_irq(dev->irq);
+	disable_irq(vc4->irq);
 
 	cancel_work_sync(&vc4->overflow_mem_work);
 }
 
+int vc4_irq_install(struct drm_device *dev, int irq)
+{
+	int ret;
+
+	if (irq == IRQ_NOTCONNECTED)
+		return -ENOTCONN;
+
+	vc4_irq_prepare(dev);
+
+	ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev);
+	if (ret)
+		return ret;
+
+	vc4_irq_enable(dev);
+
+	return 0;
+}
+
+void vc4_irq_uninstall(struct drm_device *dev)
+{
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+	vc4_irq_disable(dev);
+	free_irq(vc4->irq, dev);
+}
+
 /** Reinitializes interrupt registers when a GPU reset is performed. */
 void vc4_irq_reset(struct drm_device *dev)
 {
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 73d63d72575b..7bb3067f8425 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -10,8 +10,6 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 
-#include <drm/drm_irq.h>
-
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
@@ -361,7 +359,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev)
 	struct vc4_v3d *v3d = dev_get_drvdata(dev);
 	struct vc4_dev *vc4 = v3d->vc4;
 
-	vc4_irq_uninstall(&vc4->base);
+	vc4_irq_disable(&vc4->base);
 
 	clk_disable_unprepare(v3d->clk);
 
@@ -381,8 +379,8 @@ static int vc4_v3d_runtime_resume(struct device *dev)
 	vc4_v3d_init_hw(&vc4->base);
 
 	/* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
-	enable_irq(vc4->base.irq);
-	vc4_irq_postinstall(&vc4->base);
+	enable_irq(vc4->irq);
+	vc4_irq_enable(&vc4->base);
 
 	return 0;
 }
@@ -448,7 +446,12 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
 
 	vc4_v3d_init_hw(drm);
 
-	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+	vc4->irq = ret;
+
+	ret = vc4_irq_install(drm, vc4->irq);
 	if (ret) {
 		DRM_ERROR("Failed to install IRQ handler\n");
 		return ret;
@@ -473,7 +476,7 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master,
 
 	pm_runtime_disable(dev);
 
-	drm_irq_uninstall(drm);
+	vc4_irq_uninstall(drm);
 
 	/* Disable the binner's overflow memory address, so the next
 	 * driver probe (if any) doesn't try to reuse our old
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 13/14] drm: Remove unused devm_drm_irq_install()
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

DRM IRQ helpers will become legacy. The function devm_drm_irq_install()
is unused and won't be required later.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c | 32 --------------------------------
 include/drm/drm_irq.h     |  1 -
 2 files changed, 33 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 201eae4bba6c..dc6e38fa8a48 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -209,38 +209,6 @@ int drm_irq_uninstall(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_irq_uninstall);
 
-static void devm_drm_irq_uninstall(void *data)
-{
-	drm_irq_uninstall(data);
-}
-
-/**
- * devm_drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * devm_drm_irq_install is a  help function of drm_irq_install.
- *
- * if the driver uses devm_drm_irq_install, there is no need
- * to call drm_irq_uninstall when the drm module get unloaded,
- * as this will done automagically.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int devm_drm_irq_install(struct drm_device *dev, int irq)
-{
-	int ret;
-
-	ret = drm_irq_install(dev, irq);
-	if (ret)
-		return ret;
-
-	return devm_add_action_or_reset(dev->dev,
-					devm_drm_irq_uninstall, dev);
-}
-EXPORT_SYMBOL(devm_drm_irq_install);
-
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
index 631b22f9757d..53634b988f57 100644
--- a/include/drm/drm_irq.h
+++ b/include/drm/drm_irq.h
@@ -28,5 +28,4 @@ struct drm_device;
 
 int drm_irq_install(struct drm_device *dev, int irq);
 int drm_irq_uninstall(struct drm_device *dev);
-int devm_drm_irq_install(struct drm_device *dev, int irq);
 #endif
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 13/14] drm: Remove unused devm_drm_irq_install()
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

DRM IRQ helpers will become legacy. The function devm_drm_irq_install()
is unused and won't be required later.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c | 32 --------------------------------
 include/drm/drm_irq.h     |  1 -
 2 files changed, 33 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 201eae4bba6c..dc6e38fa8a48 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -209,38 +209,6 @@ int drm_irq_uninstall(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_irq_uninstall);
 
-static void devm_drm_irq_uninstall(void *data)
-{
-	drm_irq_uninstall(data);
-}
-
-/**
- * devm_drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * devm_drm_irq_install is a  help function of drm_irq_install.
- *
- * if the driver uses devm_drm_irq_install, there is no need
- * to call drm_irq_uninstall when the drm module get unloaded,
- * as this will done automagically.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int devm_drm_irq_install(struct drm_device *dev, int irq)
-{
-	int ret;
-
-	ret = drm_irq_install(dev, irq);
-	if (ret)
-		return ret;
-
-	return devm_add_action_or_reset(dev->dev,
-					devm_drm_irq_uninstall, dev);
-}
-EXPORT_SYMBOL(devm_drm_irq_install);
-
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
index 631b22f9757d..53634b988f57 100644
--- a/include/drm/drm_irq.h
+++ b/include/drm/drm_irq.h
@@ -28,5 +28,4 @@ struct drm_device;
 
 int drm_irq_install(struct drm_device *dev, int irq);
 int drm_irq_uninstall(struct drm_device *dev);
-int devm_drm_irq_install(struct drm_device *dev, int irq);
 #endif
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 13/14] drm: Remove unused devm_drm_irq_install()
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

DRM IRQ helpers will become legacy. The function devm_drm_irq_install()
is unused and won't be required later.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c | 32 --------------------------------
 include/drm/drm_irq.h     |  1 -
 2 files changed, 33 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 201eae4bba6c..dc6e38fa8a48 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -209,38 +209,6 @@ int drm_irq_uninstall(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_irq_uninstall);
 
-static void devm_drm_irq_uninstall(void *data)
-{
-	drm_irq_uninstall(data);
-}
-
-/**
- * devm_drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * devm_drm_irq_install is a  help function of drm_irq_install.
- *
- * if the driver uses devm_drm_irq_install, there is no need
- * to call drm_irq_uninstall when the drm module get unloaded,
- * as this will done automagically.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int devm_drm_irq_install(struct drm_device *dev, int irq)
-{
-	int ret;
-
-	ret = drm_irq_install(dev, irq);
-	if (ret)
-		return ret;
-
-	return devm_add_action_or_reset(dev->dev,
-					devm_drm_irq_uninstall, dev);
-}
-EXPORT_SYMBOL(devm_drm_irq_install);
-
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
index 631b22f9757d..53634b988f57 100644
--- a/include/drm/drm_irq.h
+++ b/include/drm/drm_irq.h
@@ -28,5 +28,4 @@ struct drm_device;
 
 int drm_irq_install(struct drm_device *dev, int irq);
 int drm_irq_uninstall(struct drm_device *dev);
-int devm_drm_irq_install(struct drm_device *dev, int irq);
 #endif
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 13/14] drm: Remove unused devm_drm_irq_install()
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

DRM IRQ helpers will become legacy. The function devm_drm_irq_install()
is unused and won't be required later.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c | 32 --------------------------------
 include/drm/drm_irq.h     |  1 -
 2 files changed, 33 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 201eae4bba6c..dc6e38fa8a48 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -209,38 +209,6 @@ int drm_irq_uninstall(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_irq_uninstall);
 
-static void devm_drm_irq_uninstall(void *data)
-{
-	drm_irq_uninstall(data);
-}
-
-/**
- * devm_drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * devm_drm_irq_install is a  help function of drm_irq_install.
- *
- * if the driver uses devm_drm_irq_install, there is no need
- * to call drm_irq_uninstall when the drm module get unloaded,
- * as this will done automagically.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int devm_drm_irq_install(struct drm_device *dev, int irq)
-{
-	int ret;
-
-	ret = drm_irq_install(dev, irq);
-	if (ret)
-		return ret;
-
-	return devm_add_action_or_reset(dev->dev,
-					devm_drm_irq_uninstall, dev);
-}
-EXPORT_SYMBOL(devm_drm_irq_install);
-
 #if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
index 631b22f9757d..53634b988f57 100644
--- a/include/drm/drm_irq.h
+++ b/include/drm/drm_irq.h
@@ -28,5 +28,4 @@ struct drm_device;
 
 int drm_irq_install(struct drm_device *dev, int irq);
 int drm_irq_uninstall(struct drm_device *dev);
-int devm_drm_irq_install(struct drm_device *dev, int irq);
 #endif
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 14/14] drm: IRQ midlayer is now legacy
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-27 18:27   ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
the prefix drm_legacy_, and move declarations to drm_legacy.h.
In struct drm_device, move the fields irq and irq_enabled behind
CONFIG_DRM_LEGACY.

All callers have been updated.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------
 drivers/gpu/drm/drm_legacy_misc.c |  3 +-
 drivers/gpu/drm/drm_vblank.c      |  8 ++--
 drivers/gpu/drm/i810/i810_dma.c   |  3 +-
 drivers/gpu/drm/mga/mga_dma.c     |  2 +-
 drivers/gpu/drm/mga/mga_drv.h     |  1 -
 drivers/gpu/drm/r128/r128_cce.c   |  3 +-
 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             | 31 ---------------
 include/drm/drm_legacy.h          |  3 ++
 12 files changed, 27 insertions(+), 155 deletions(-)
 delete mode 100644 include/drm/drm_irq.h

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index dc6e38fa8a48..13e1d5c4ec82 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -60,46 +60,14 @@
 #include <drm/drm.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
 #include "drm_internal.h"
 
-/**
- * DOC: irq helpers
- *
- * The DRM core provides very simple support helpers to enable IRQ handling on a
- * device through the drm_irq_install() and drm_irq_uninstall() functions. This
- * only supports devices with a single interrupt on the main device stored in
- * &drm_device.dev and set as the device paramter in drm_dev_alloc().
- *
- * These IRQ helpers are strictly optional. Since these helpers don't automatically
- * clean up the requested interrupt like e.g. devm_request_irq() they're not really
- * recommended.
- */
-
-/**
- * drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * Initializes the IRQ related data. Installs the handler, calling the driver
- * &drm_driver.irq_preinstall and &drm_driver.irq_postinstall functions before
- * and after the installation.
- *
- * This is the simplified helper interface provided for drivers with no special
- * needs.
- *
- * @irq must match the interrupt number that would be passed to request_irq(),
- * if called directly instead of using this helper function.
- *
- * &drm_driver.irq_handler is called to handle the registered interrupt.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_install(struct drm_device *dev, int irq)
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 {
 	int ret;
 	unsigned long sh_flags = 0;
@@ -144,24 +112,8 @@ int drm_irq_install(struct drm_device *dev, int irq)
 
 	return ret;
 }
-EXPORT_SYMBOL(drm_irq_install);
 
-/**
- * drm_irq_uninstall - uninstall the IRQ handler
- * @dev: DRM device
- *
- * Calls the driver's &drm_driver.irq_uninstall function and unregisters the IRQ
- * handler.  This should only be called by drivers which used drm_irq_install()
- * to set up their interrupt handler.
- *
- * Note that for kernel modesetting drivers it is a bug if this function fails.
- * The sanity checks are only to catch buggy user modesetting drivers which call
- * the same function through an ioctl.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_uninstall(struct drm_device *dev)
+int drm_legacy_irq_uninstall(struct drm_device *dev)
 {
 	unsigned long irqflags;
 	bool irq_enabled;
@@ -207,9 +159,8 @@ int drm_irq_uninstall(struct drm_device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL(drm_irq_uninstall);
+EXPORT_SYMBOL(drm_legacy_irq_uninstall);
 
-#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
 {
@@ -238,13 +189,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data,
 		    ctl->irq != irq)
 			return -EINVAL;
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_install(dev, irq);
+		ret = drm_legacy_irq_install(dev, irq);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
 	case DRM_UNINST_HANDLER:
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_uninstall(dev);
+		ret = drm_legacy_irq_uninstall(dev);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
index 83db43b7a25e..d4c5434062d7 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -35,7 +35,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 
 #include "drm_internal.h"
@@ -78,7 +77,7 @@ int drm_legacy_setup(struct drm_device * dev)
 void drm_legacy_dev_reinit(struct drm_device *dev)
 {
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	mutex_lock(&dev->struct_mutex);
 
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index bba6781cc48f..3e260f3e2863 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1739,10 +1739,10 @@ static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
 
 static bool drm_wait_vblank_supported(struct drm_device *dev)
 {
-	if  (IS_ENABLED(CONFIG_DRM_LEGACY)) {
-		if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
-			return dev->irq_enabled;
-	}
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+	if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
+		return dev->irq_enabled;
+#endif
 	return drm_dev_has_vblank(dev);
 }
 
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index d78c82af367c..9fb4dd63342f 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -38,7 +38,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 #include <drm/i810_drm.h>
 
@@ -209,7 +208,7 @@ static int i810_dma_cleanup(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		int i;
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 403efc1f1a7c..331c2f0da57a 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -949,7 +949,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_mga_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 84395d81ab9b..f61401c70b90 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -38,7 +38,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_sarea.h>
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
index 2a2933c16308..c04d84a69dd2 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -39,7 +39,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/r128_drm.h>
@@ -603,7 +602,7 @@ int r128_do_cleanup_cce(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_r128_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index dae1bacd86c1..c9afa1a51f23 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -29,7 +29,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/via_drm.h>
 
 #include "via_drv.h"
@@ -86,7 +85,7 @@ int via_final_context(struct drm_device *dev, int context)
 	/* Last context, perform cleanup */
 	if (list_is_singular(&dev->ctxlist)) {
 		DRM_DEBUG("Last Context\n");
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 		via_cleanup_futex(dev_priv);
 		via_do_cleanup_map(dev);
 	}
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index f588f967bb14..604b1d1b2d72 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -191,20 +191,6 @@ struct drm_device {
 	 */
 	struct list_head clientlist;
 
-	/**
-	 * @irq_enabled:
-	 *
-	 * Indicates that interrupt handling is enabled, specifically vblank
-	 * handling. Drivers which don't use drm_irq_install() need to set this
-	 * to true manually.
-	 */
-	bool irq_enabled;
-
-	/**
-	 * @irq: Used by the drm_irq_install() and drm_irq_unistall() helpers.
-	 */
-	int irq;
-
 	/**
 	 * @vblank_disable_immediate:
 	 *
@@ -372,6 +358,10 @@ struct drm_device {
 
 	/* Scatter gather memory */
 	struct drm_sg_mem *sg;
+
+	/* IRQs */
+	bool irq_enabled;
+	int irq;
 #endif
 };
 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b439ae1921b8..0cd95953cdf5 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -137,10 +137,6 @@ enum drm_driver_feature {
 	 * @DRIVER_HAVE_IRQ:
 	 *
 	 * Legacy irq support. Only for legacy drivers. Do not use.
-	 *
-	 * New drivers can either use the drm_irq_install() and
-	 * drm_irq_uninstall() helper functions, or roll their own irq support
-	 * code by calling request_irq() directly.
 	 */
 	DRIVER_HAVE_IRQ			= BIT(30),
 	/**
@@ -271,42 +267,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @irq_handler:
-	 *
-	 * Interrupt handler called when using drm_irq_install(). Not used by
-	 * drivers which implement their own interrupt handling.
-	 */
-	irqreturn_t(*irq_handler) (int irq, void *arg);
-
-	/**
-	 * @irq_preinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called before
-	 * the interrupt handler is registered. This should be used to clear out
-	 * any pending interrupts (from e.g. firmware based drives) and reset
-	 * the interrupt handling registers.
-	 */
-	void (*irq_preinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_postinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called after
-	 * the interrupt handler is registered. This should be used to enable
-	 * interrupt generation in the hardware.
-	 */
-	int (*irq_postinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_uninstall:
-	 *
-	 * Optional callback used by drm_irq_uninstall() which is called before
-	 * the interrupt handler is unregistered. This should be used to disable
-	 * interrupt generation in the hardware.
-	 */
-	void (*irq_uninstall) (struct drm_device *dev);
-
 	/**
 	 * @master_set:
 	 *
@@ -504,6 +464,10 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	irqreturn_t (*irq_handler)(int irq, void *arg);
+	void (*irq_preinstall)(struct drm_device *dev);
+	int (*irq_postinstall)(struct drm_device *dev);
+	void (*irq_uninstall)(struct drm_device *dev);
 	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
 	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
 	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
deleted file mode 100644
index 53634b988f57..000000000000
--- a/include/drm/drm_irq.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016 Intel Corp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRM_IRQ_H_
-#define _DRM_IRQ_H_
-
-struct drm_device;
-
-int drm_irq_install(struct drm_device *dev, int irq);
-int drm_irq_uninstall(struct drm_device *dev);
-#endif
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
index b17e79e12bc2..58dc8d8cc907 100644
--- a/include/drm/drm_legacy.h
+++ b/include/drm/drm_legacy.h
@@ -192,6 +192,9 @@ do {										\
 void drm_legacy_idlelock_take(struct drm_lock_data *lock);
 void drm_legacy_idlelock_release(struct drm_lock_data *lock);
 
+/* drm_irq.c */
+int drm_legacy_irq_uninstall(struct drm_device *dev);
+
 /* drm_pci.c */
 
 #ifdef CONFIG_PCI
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 14/14] drm: IRQ midlayer is now legacy
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno,
	Thomas Zimmermann

Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
the prefix drm_legacy_, and move declarations to drm_legacy.h.
In struct drm_device, move the fields irq and irq_enabled behind
CONFIG_DRM_LEGACY.

All callers have been updated.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------
 drivers/gpu/drm/drm_legacy_misc.c |  3 +-
 drivers/gpu/drm/drm_vblank.c      |  8 ++--
 drivers/gpu/drm/i810/i810_dma.c   |  3 +-
 drivers/gpu/drm/mga/mga_dma.c     |  2 +-
 drivers/gpu/drm/mga/mga_drv.h     |  1 -
 drivers/gpu/drm/r128/r128_cce.c   |  3 +-
 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             | 31 ---------------
 include/drm/drm_legacy.h          |  3 ++
 12 files changed, 27 insertions(+), 155 deletions(-)
 delete mode 100644 include/drm/drm_irq.h

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index dc6e38fa8a48..13e1d5c4ec82 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -60,46 +60,14 @@
 #include <drm/drm.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
 #include "drm_internal.h"
 
-/**
- * DOC: irq helpers
- *
- * The DRM core provides very simple support helpers to enable IRQ handling on a
- * device through the drm_irq_install() and drm_irq_uninstall() functions. This
- * only supports devices with a single interrupt on the main device stored in
- * &drm_device.dev and set as the device paramter in drm_dev_alloc().
- *
- * These IRQ helpers are strictly optional. Since these helpers don't automatically
- * clean up the requested interrupt like e.g. devm_request_irq() they're not really
- * recommended.
- */
-
-/**
- * drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * Initializes the IRQ related data. Installs the handler, calling the driver
- * &drm_driver.irq_preinstall and &drm_driver.irq_postinstall functions before
- * and after the installation.
- *
- * This is the simplified helper interface provided for drivers with no special
- * needs.
- *
- * @irq must match the interrupt number that would be passed to request_irq(),
- * if called directly instead of using this helper function.
- *
- * &drm_driver.irq_handler is called to handle the registered interrupt.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_install(struct drm_device *dev, int irq)
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 {
 	int ret;
 	unsigned long sh_flags = 0;
@@ -144,24 +112,8 @@ int drm_irq_install(struct drm_device *dev, int irq)
 
 	return ret;
 }
-EXPORT_SYMBOL(drm_irq_install);
 
-/**
- * drm_irq_uninstall - uninstall the IRQ handler
- * @dev: DRM device
- *
- * Calls the driver's &drm_driver.irq_uninstall function and unregisters the IRQ
- * handler.  This should only be called by drivers which used drm_irq_install()
- * to set up their interrupt handler.
- *
- * Note that for kernel modesetting drivers it is a bug if this function fails.
- * The sanity checks are only to catch buggy user modesetting drivers which call
- * the same function through an ioctl.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_uninstall(struct drm_device *dev)
+int drm_legacy_irq_uninstall(struct drm_device *dev)
 {
 	unsigned long irqflags;
 	bool irq_enabled;
@@ -207,9 +159,8 @@ int drm_irq_uninstall(struct drm_device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL(drm_irq_uninstall);
+EXPORT_SYMBOL(drm_legacy_irq_uninstall);
 
-#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
 {
@@ -238,13 +189,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data,
 		    ctl->irq != irq)
 			return -EINVAL;
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_install(dev, irq);
+		ret = drm_legacy_irq_install(dev, irq);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
 	case DRM_UNINST_HANDLER:
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_uninstall(dev);
+		ret = drm_legacy_irq_uninstall(dev);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
index 83db43b7a25e..d4c5434062d7 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -35,7 +35,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 
 #include "drm_internal.h"
@@ -78,7 +77,7 @@ int drm_legacy_setup(struct drm_device * dev)
 void drm_legacy_dev_reinit(struct drm_device *dev)
 {
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	mutex_lock(&dev->struct_mutex);
 
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index bba6781cc48f..3e260f3e2863 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1739,10 +1739,10 @@ static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
 
 static bool drm_wait_vblank_supported(struct drm_device *dev)
 {
-	if  (IS_ENABLED(CONFIG_DRM_LEGACY)) {
-		if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
-			return dev->irq_enabled;
-	}
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+	if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
+		return dev->irq_enabled;
+#endif
 	return drm_dev_has_vblank(dev);
 }
 
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index d78c82af367c..9fb4dd63342f 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -38,7 +38,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 #include <drm/i810_drm.h>
 
@@ -209,7 +208,7 @@ static int i810_dma_cleanup(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		int i;
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 403efc1f1a7c..331c2f0da57a 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -949,7 +949,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_mga_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 84395d81ab9b..f61401c70b90 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -38,7 +38,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_sarea.h>
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
index 2a2933c16308..c04d84a69dd2 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -39,7 +39,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/r128_drm.h>
@@ -603,7 +602,7 @@ int r128_do_cleanup_cce(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_r128_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index dae1bacd86c1..c9afa1a51f23 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -29,7 +29,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/via_drm.h>
 
 #include "via_drv.h"
@@ -86,7 +85,7 @@ int via_final_context(struct drm_device *dev, int context)
 	/* Last context, perform cleanup */
 	if (list_is_singular(&dev->ctxlist)) {
 		DRM_DEBUG("Last Context\n");
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 		via_cleanup_futex(dev_priv);
 		via_do_cleanup_map(dev);
 	}
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index f588f967bb14..604b1d1b2d72 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -191,20 +191,6 @@ struct drm_device {
 	 */
 	struct list_head clientlist;
 
-	/**
-	 * @irq_enabled:
-	 *
-	 * Indicates that interrupt handling is enabled, specifically vblank
-	 * handling. Drivers which don't use drm_irq_install() need to set this
-	 * to true manually.
-	 */
-	bool irq_enabled;
-
-	/**
-	 * @irq: Used by the drm_irq_install() and drm_irq_unistall() helpers.
-	 */
-	int irq;
-
 	/**
 	 * @vblank_disable_immediate:
 	 *
@@ -372,6 +358,10 @@ struct drm_device {
 
 	/* Scatter gather memory */
 	struct drm_sg_mem *sg;
+
+	/* IRQs */
+	bool irq_enabled;
+	int irq;
 #endif
 };
 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b439ae1921b8..0cd95953cdf5 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -137,10 +137,6 @@ enum drm_driver_feature {
 	 * @DRIVER_HAVE_IRQ:
 	 *
 	 * Legacy irq support. Only for legacy drivers. Do not use.
-	 *
-	 * New drivers can either use the drm_irq_install() and
-	 * drm_irq_uninstall() helper functions, or roll their own irq support
-	 * code by calling request_irq() directly.
 	 */
 	DRIVER_HAVE_IRQ			= BIT(30),
 	/**
@@ -271,42 +267,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @irq_handler:
-	 *
-	 * Interrupt handler called when using drm_irq_install(). Not used by
-	 * drivers which implement their own interrupt handling.
-	 */
-	irqreturn_t(*irq_handler) (int irq, void *arg);
-
-	/**
-	 * @irq_preinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called before
-	 * the interrupt handler is registered. This should be used to clear out
-	 * any pending interrupts (from e.g. firmware based drives) and reset
-	 * the interrupt handling registers.
-	 */
-	void (*irq_preinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_postinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called after
-	 * the interrupt handler is registered. This should be used to enable
-	 * interrupt generation in the hardware.
-	 */
-	int (*irq_postinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_uninstall:
-	 *
-	 * Optional callback used by drm_irq_uninstall() which is called before
-	 * the interrupt handler is unregistered. This should be used to disable
-	 * interrupt generation in the hardware.
-	 */
-	void (*irq_uninstall) (struct drm_device *dev);
-
 	/**
 	 * @master_set:
 	 *
@@ -504,6 +464,10 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	irqreturn_t (*irq_handler)(int irq, void *arg);
+	void (*irq_preinstall)(struct drm_device *dev);
+	int (*irq_postinstall)(struct drm_device *dev);
+	void (*irq_uninstall)(struct drm_device *dev);
 	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
 	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
 	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
deleted file mode 100644
index 53634b988f57..000000000000
--- a/include/drm/drm_irq.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016 Intel Corp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRM_IRQ_H_
-#define _DRM_IRQ_H_
-
-struct drm_device;
-
-int drm_irq_install(struct drm_device *dev, int irq);
-int drm_irq_uninstall(struct drm_device *dev);
-#endif
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
index b17e79e12bc2..58dc8d8cc907 100644
--- a/include/drm/drm_legacy.h
+++ b/include/drm/drm_legacy.h
@@ -192,6 +192,9 @@ do {										\
 void drm_legacy_idlelock_take(struct drm_lock_data *lock);
 void drm_legacy_idlelock_release(struct drm_lock_data *lock);
 
+/* drm_irq.c */
+int drm_legacy_irq_uninstall(struct drm_device *dev);
+
 /* drm_pci.c */
 
 #ifdef CONFIG_PCI
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 14/14] drm: IRQ midlayer is now legacy
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
the prefix drm_legacy_, and move declarations to drm_legacy.h.
In struct drm_device, move the fields irq and irq_enabled behind
CONFIG_DRM_LEGACY.

All callers have been updated.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------
 drivers/gpu/drm/drm_legacy_misc.c |  3 +-
 drivers/gpu/drm/drm_vblank.c      |  8 ++--
 drivers/gpu/drm/i810/i810_dma.c   |  3 +-
 drivers/gpu/drm/mga/mga_dma.c     |  2 +-
 drivers/gpu/drm/mga/mga_drv.h     |  1 -
 drivers/gpu/drm/r128/r128_cce.c   |  3 +-
 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             | 31 ---------------
 include/drm/drm_legacy.h          |  3 ++
 12 files changed, 27 insertions(+), 155 deletions(-)
 delete mode 100644 include/drm/drm_irq.h

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index dc6e38fa8a48..13e1d5c4ec82 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -60,46 +60,14 @@
 #include <drm/drm.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
 #include "drm_internal.h"
 
-/**
- * DOC: irq helpers
- *
- * The DRM core provides very simple support helpers to enable IRQ handling on a
- * device through the drm_irq_install() and drm_irq_uninstall() functions. This
- * only supports devices with a single interrupt on the main device stored in
- * &drm_device.dev and set as the device paramter in drm_dev_alloc().
- *
- * These IRQ helpers are strictly optional. Since these helpers don't automatically
- * clean up the requested interrupt like e.g. devm_request_irq() they're not really
- * recommended.
- */
-
-/**
- * drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * Initializes the IRQ related data. Installs the handler, calling the driver
- * &drm_driver.irq_preinstall and &drm_driver.irq_postinstall functions before
- * and after the installation.
- *
- * This is the simplified helper interface provided for drivers with no special
- * needs.
- *
- * @irq must match the interrupt number that would be passed to request_irq(),
- * if called directly instead of using this helper function.
- *
- * &drm_driver.irq_handler is called to handle the registered interrupt.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_install(struct drm_device *dev, int irq)
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 {
 	int ret;
 	unsigned long sh_flags = 0;
@@ -144,24 +112,8 @@ int drm_irq_install(struct drm_device *dev, int irq)
 
 	return ret;
 }
-EXPORT_SYMBOL(drm_irq_install);
 
-/**
- * drm_irq_uninstall - uninstall the IRQ handler
- * @dev: DRM device
- *
- * Calls the driver's &drm_driver.irq_uninstall function and unregisters the IRQ
- * handler.  This should only be called by drivers which used drm_irq_install()
- * to set up their interrupt handler.
- *
- * Note that for kernel modesetting drivers it is a bug if this function fails.
- * The sanity checks are only to catch buggy user modesetting drivers which call
- * the same function through an ioctl.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_uninstall(struct drm_device *dev)
+int drm_legacy_irq_uninstall(struct drm_device *dev)
 {
 	unsigned long irqflags;
 	bool irq_enabled;
@@ -207,9 +159,8 @@ int drm_irq_uninstall(struct drm_device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL(drm_irq_uninstall);
+EXPORT_SYMBOL(drm_legacy_irq_uninstall);
 
-#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
 {
@@ -238,13 +189,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data,
 		    ctl->irq != irq)
 			return -EINVAL;
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_install(dev, irq);
+		ret = drm_legacy_irq_install(dev, irq);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
 	case DRM_UNINST_HANDLER:
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_uninstall(dev);
+		ret = drm_legacy_irq_uninstall(dev);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
index 83db43b7a25e..d4c5434062d7 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -35,7 +35,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 
 #include "drm_internal.h"
@@ -78,7 +77,7 @@ int drm_legacy_setup(struct drm_device * dev)
 void drm_legacy_dev_reinit(struct drm_device *dev)
 {
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	mutex_lock(&dev->struct_mutex);
 
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index bba6781cc48f..3e260f3e2863 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1739,10 +1739,10 @@ static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
 
 static bool drm_wait_vblank_supported(struct drm_device *dev)
 {
-	if  (IS_ENABLED(CONFIG_DRM_LEGACY)) {
-		if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
-			return dev->irq_enabled;
-	}
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+	if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
+		return dev->irq_enabled;
+#endif
 	return drm_dev_has_vblank(dev);
 }
 
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index d78c82af367c..9fb4dd63342f 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -38,7 +38,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 #include <drm/i810_drm.h>
 
@@ -209,7 +208,7 @@ static int i810_dma_cleanup(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		int i;
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 403efc1f1a7c..331c2f0da57a 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -949,7 +949,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_mga_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 84395d81ab9b..f61401c70b90 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -38,7 +38,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_sarea.h>
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
index 2a2933c16308..c04d84a69dd2 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -39,7 +39,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/r128_drm.h>
@@ -603,7 +602,7 @@ int r128_do_cleanup_cce(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_r128_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index dae1bacd86c1..c9afa1a51f23 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -29,7 +29,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/via_drm.h>
 
 #include "via_drv.h"
@@ -86,7 +85,7 @@ int via_final_context(struct drm_device *dev, int context)
 	/* Last context, perform cleanup */
 	if (list_is_singular(&dev->ctxlist)) {
 		DRM_DEBUG("Last Context\n");
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 		via_cleanup_futex(dev_priv);
 		via_do_cleanup_map(dev);
 	}
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index f588f967bb14..604b1d1b2d72 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -191,20 +191,6 @@ struct drm_device {
 	 */
 	struct list_head clientlist;
 
-	/**
-	 * @irq_enabled:
-	 *
-	 * Indicates that interrupt handling is enabled, specifically vblank
-	 * handling. Drivers which don't use drm_irq_install() need to set this
-	 * to true manually.
-	 */
-	bool irq_enabled;
-
-	/**
-	 * @irq: Used by the drm_irq_install() and drm_irq_unistall() helpers.
-	 */
-	int irq;
-
 	/**
 	 * @vblank_disable_immediate:
 	 *
@@ -372,6 +358,10 @@ struct drm_device {
 
 	/* Scatter gather memory */
 	struct drm_sg_mem *sg;
+
+	/* IRQs */
+	bool irq_enabled;
+	int irq;
 #endif
 };
 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b439ae1921b8..0cd95953cdf5 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -137,10 +137,6 @@ enum drm_driver_feature {
 	 * @DRIVER_HAVE_IRQ:
 	 *
 	 * Legacy irq support. Only for legacy drivers. Do not use.
-	 *
-	 * New drivers can either use the drm_irq_install() and
-	 * drm_irq_uninstall() helper functions, or roll their own irq support
-	 * code by calling request_irq() directly.
 	 */
 	DRIVER_HAVE_IRQ			= BIT(30),
 	/**
@@ -271,42 +267,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @irq_handler:
-	 *
-	 * Interrupt handler called when using drm_irq_install(). Not used by
-	 * drivers which implement their own interrupt handling.
-	 */
-	irqreturn_t(*irq_handler) (int irq, void *arg);
-
-	/**
-	 * @irq_preinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called before
-	 * the interrupt handler is registered. This should be used to clear out
-	 * any pending interrupts (from e.g. firmware based drives) and reset
-	 * the interrupt handling registers.
-	 */
-	void (*irq_preinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_postinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called after
-	 * the interrupt handler is registered. This should be used to enable
-	 * interrupt generation in the hardware.
-	 */
-	int (*irq_postinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_uninstall:
-	 *
-	 * Optional callback used by drm_irq_uninstall() which is called before
-	 * the interrupt handler is unregistered. This should be used to disable
-	 * interrupt generation in the hardware.
-	 */
-	void (*irq_uninstall) (struct drm_device *dev);
-
 	/**
 	 * @master_set:
 	 *
@@ -504,6 +464,10 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	irqreturn_t (*irq_handler)(int irq, void *arg);
+	void (*irq_preinstall)(struct drm_device *dev);
+	int (*irq_postinstall)(struct drm_device *dev);
+	void (*irq_uninstall)(struct drm_device *dev);
 	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
 	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
 	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
deleted file mode 100644
index 53634b988f57..000000000000
--- a/include/drm/drm_irq.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016 Intel Corp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRM_IRQ_H_
-#define _DRM_IRQ_H_
-
-struct drm_device;
-
-int drm_irq_install(struct drm_device *dev, int irq);
-int drm_irq_uninstall(struct drm_device *dev);
-#endif
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
index b17e79e12bc2..58dc8d8cc907 100644
--- a/include/drm/drm_legacy.h
+++ b/include/drm/drm_legacy.h
@@ -192,6 +192,9 @@ do {										\
 void drm_legacy_idlelock_take(struct drm_lock_data *lock);
 void drm_legacy_idlelock_release(struct drm_lock_data *lock);
 
+/* drm_irq.c */
+int drm_legacy_irq_uninstall(struct drm_device *dev);
+
 /* drm_pci.c */
 
 #ifdef CONFIG_PCI
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 172+ messages in thread

* [PATCH 14/14] drm: IRQ midlayer is now legacy
@ 2021-07-27 18:27   ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-27 18:27 UTC (permalink / raw)
  To: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-msm, dri-devel, amd-gfx, Thomas Zimmermann, freedreno,
	linux-arm-kernel

Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
the prefix drm_legacy_, and move declarations to drm_legacy.h.
In struct drm_device, move the fields irq and irq_enabled behind
CONFIG_DRM_LEGACY.

All callers have been updated.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------
 drivers/gpu/drm/drm_legacy_misc.c |  3 +-
 drivers/gpu/drm/drm_vblank.c      |  8 ++--
 drivers/gpu/drm/i810/i810_dma.c   |  3 +-
 drivers/gpu/drm/mga/mga_dma.c     |  2 +-
 drivers/gpu/drm/mga/mga_drv.h     |  1 -
 drivers/gpu/drm/r128/r128_cce.c   |  3 +-
 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             | 31 ---------------
 include/drm/drm_legacy.h          |  3 ++
 12 files changed, 27 insertions(+), 155 deletions(-)
 delete mode 100644 include/drm/drm_irq.h

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index dc6e38fa8a48..13e1d5c4ec82 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -60,46 +60,14 @@
 #include <drm/drm.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
+#include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_vblank.h>
 
 #include "drm_internal.h"
 
-/**
- * DOC: irq helpers
- *
- * The DRM core provides very simple support helpers to enable IRQ handling on a
- * device through the drm_irq_install() and drm_irq_uninstall() functions. This
- * only supports devices with a single interrupt on the main device stored in
- * &drm_device.dev and set as the device paramter in drm_dev_alloc().
- *
- * These IRQ helpers are strictly optional. Since these helpers don't automatically
- * clean up the requested interrupt like e.g. devm_request_irq() they're not really
- * recommended.
- */
-
-/**
- * drm_irq_install - install IRQ handler
- * @dev: DRM device
- * @irq: IRQ number to install the handler for
- *
- * Initializes the IRQ related data. Installs the handler, calling the driver
- * &drm_driver.irq_preinstall and &drm_driver.irq_postinstall functions before
- * and after the installation.
- *
- * This is the simplified helper interface provided for drivers with no special
- * needs.
- *
- * @irq must match the interrupt number that would be passed to request_irq(),
- * if called directly instead of using this helper function.
- *
- * &drm_driver.irq_handler is called to handle the registered interrupt.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_install(struct drm_device *dev, int irq)
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+static int drm_legacy_irq_install(struct drm_device *dev, int irq)
 {
 	int ret;
 	unsigned long sh_flags = 0;
@@ -144,24 +112,8 @@ int drm_irq_install(struct drm_device *dev, int irq)
 
 	return ret;
 }
-EXPORT_SYMBOL(drm_irq_install);
 
-/**
- * drm_irq_uninstall - uninstall the IRQ handler
- * @dev: DRM device
- *
- * Calls the driver's &drm_driver.irq_uninstall function and unregisters the IRQ
- * handler.  This should only be called by drivers which used drm_irq_install()
- * to set up their interrupt handler.
- *
- * Note that for kernel modesetting drivers it is a bug if this function fails.
- * The sanity checks are only to catch buggy user modesetting drivers which call
- * the same function through an ioctl.
- *
- * Returns:
- * Zero on success or a negative error code on failure.
- */
-int drm_irq_uninstall(struct drm_device *dev)
+int drm_legacy_irq_uninstall(struct drm_device *dev)
 {
 	unsigned long irqflags;
 	bool irq_enabled;
@@ -207,9 +159,8 @@ int drm_irq_uninstall(struct drm_device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL(drm_irq_uninstall);
+EXPORT_SYMBOL(drm_legacy_irq_uninstall);
 
-#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
 			   struct drm_file *file_priv)
 {
@@ -238,13 +189,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data,
 		    ctl->irq != irq)
 			return -EINVAL;
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_install(dev, irq);
+		ret = drm_legacy_irq_install(dev, irq);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
 	case DRM_UNINST_HANDLER:
 		mutex_lock(&dev->struct_mutex);
-		ret = drm_irq_uninstall(dev);
+		ret = drm_legacy_irq_uninstall(dev);
 		mutex_unlock(&dev->struct_mutex);
 
 		return ret;
diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
index 83db43b7a25e..d4c5434062d7 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -35,7 +35,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 
 #include "drm_internal.h"
@@ -78,7 +77,7 @@ int drm_legacy_setup(struct drm_device * dev)
 void drm_legacy_dev_reinit(struct drm_device *dev)
 {
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	mutex_lock(&dev->struct_mutex);
 
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index bba6781cc48f..3e260f3e2863 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1739,10 +1739,10 @@ static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
 
 static bool drm_wait_vblank_supported(struct drm_device *dev)
 {
-	if  (IS_ENABLED(CONFIG_DRM_LEGACY)) {
-		if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
-			return dev->irq_enabled;
-	}
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
+	if (unlikely(drm_core_check_feature(dev, DRIVER_LEGACY)))
+		return dev->irq_enabled;
+#endif
 	return drm_dev_has_vblank(dev);
 }
 
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index d78c82af367c..9fb4dd63342f 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -38,7 +38,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_print.h>
 #include <drm/i810_drm.h>
 
@@ -209,7 +208,7 @@ static int i810_dma_cleanup(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ) && dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		int i;
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 403efc1f1a7c..331c2f0da57a 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -949,7 +949,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_mga_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 84395d81ab9b..f61401c70b90 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -38,7 +38,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/drm_sarea.h>
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
index 2a2933c16308..c04d84a69dd2 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -39,7 +39,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_legacy.h>
 #include <drm/drm_print.h>
 #include <drm/r128_drm.h>
@@ -603,7 +602,7 @@ int r128_do_cleanup_cce(struct drm_device *dev)
 	 * is freed, it's too late.
 	 */
 	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 
 	if (dev->dev_private) {
 		drm_r128_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index dae1bacd86c1..c9afa1a51f23 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -29,7 +29,6 @@
 
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
-#include <drm/drm_irq.h>
 #include <drm/via_drm.h>
 
 #include "via_drv.h"
@@ -86,7 +85,7 @@ int via_final_context(struct drm_device *dev, int context)
 	/* Last context, perform cleanup */
 	if (list_is_singular(&dev->ctxlist)) {
 		DRM_DEBUG("Last Context\n");
-		drm_irq_uninstall(dev);
+		drm_legacy_irq_uninstall(dev);
 		via_cleanup_futex(dev_priv);
 		via_do_cleanup_map(dev);
 	}
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index f588f967bb14..604b1d1b2d72 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -191,20 +191,6 @@ struct drm_device {
 	 */
 	struct list_head clientlist;
 
-	/**
-	 * @irq_enabled:
-	 *
-	 * Indicates that interrupt handling is enabled, specifically vblank
-	 * handling. Drivers which don't use drm_irq_install() need to set this
-	 * to true manually.
-	 */
-	bool irq_enabled;
-
-	/**
-	 * @irq: Used by the drm_irq_install() and drm_irq_unistall() helpers.
-	 */
-	int irq;
-
 	/**
 	 * @vblank_disable_immediate:
 	 *
@@ -372,6 +358,10 @@ struct drm_device {
 
 	/* Scatter gather memory */
 	struct drm_sg_mem *sg;
+
+	/* IRQs */
+	bool irq_enabled;
+	int irq;
 #endif
 };
 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index b439ae1921b8..0cd95953cdf5 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -137,10 +137,6 @@ enum drm_driver_feature {
 	 * @DRIVER_HAVE_IRQ:
 	 *
 	 * Legacy irq support. Only for legacy drivers. Do not use.
-	 *
-	 * New drivers can either use the drm_irq_install() and
-	 * drm_irq_uninstall() helper functions, or roll their own irq support
-	 * code by calling request_irq() directly.
 	 */
 	DRIVER_HAVE_IRQ			= BIT(30),
 	/**
@@ -271,42 +267,6 @@ struct drm_driver {
 	 */
 	void (*release) (struct drm_device *);
 
-	/**
-	 * @irq_handler:
-	 *
-	 * Interrupt handler called when using drm_irq_install(). Not used by
-	 * drivers which implement their own interrupt handling.
-	 */
-	irqreturn_t(*irq_handler) (int irq, void *arg);
-
-	/**
-	 * @irq_preinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called before
-	 * the interrupt handler is registered. This should be used to clear out
-	 * any pending interrupts (from e.g. firmware based drives) and reset
-	 * the interrupt handling registers.
-	 */
-	void (*irq_preinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_postinstall:
-	 *
-	 * Optional callback used by drm_irq_install() which is called after
-	 * the interrupt handler is registered. This should be used to enable
-	 * interrupt generation in the hardware.
-	 */
-	int (*irq_postinstall) (struct drm_device *dev);
-
-	/**
-	 * @irq_uninstall:
-	 *
-	 * Optional callback used by drm_irq_uninstall() which is called before
-	 * the interrupt handler is unregistered. This should be used to disable
-	 * interrupt generation in the hardware.
-	 */
-	void (*irq_uninstall) (struct drm_device *dev);
-
 	/**
 	 * @master_set:
 	 *
@@ -504,6 +464,10 @@ struct drm_driver {
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
+	irqreturn_t (*irq_handler)(int irq, void *arg);
+	void (*irq_preinstall)(struct drm_device *dev);
+	int (*irq_postinstall)(struct drm_device *dev);
+	void (*irq_uninstall)(struct drm_device *dev);
 	u32 (*get_vblank_counter)(struct drm_device *dev, unsigned int pipe);
 	int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
 	void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h
deleted file mode 100644
index 53634b988f57..000000000000
--- a/include/drm/drm_irq.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2016 Intel Corp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRM_IRQ_H_
-#define _DRM_IRQ_H_
-
-struct drm_device;
-
-int drm_irq_install(struct drm_device *dev, int irq);
-int drm_irq_uninstall(struct drm_device *dev);
-#endif
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
index b17e79e12bc2..58dc8d8cc907 100644
--- a/include/drm/drm_legacy.h
+++ b/include/drm/drm_legacy.h
@@ -192,6 +192,9 @@ do {										\
 void drm_legacy_idlelock_take(struct drm_lock_data *lock);
 void drm_legacy_idlelock_release(struct drm_lock_data *lock);
 
+/* drm_irq.c */
+int drm_legacy_irq_uninstall(struct drm_device *dev);
+
 /* drm_pci.c */
 
 #ifdef CONFIG_PCI
-- 
2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
  2021-07-27 18:27 ` Thomas Zimmermann
  (?)
@ 2021-07-27 18:51   ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-27 18:51 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:07PM +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.

Before diving into a review of these..
Any specific reason devm_request_irq is not used?

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-27 18:51   ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-27 18:51 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:07PM +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.

Before diving into a review of these..
Any specific reason devm_request_irq is not used?

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-27 18:51   ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-27 18:51 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	nicolas.ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:07PM +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.

Before diving into a review of these..
Any specific reason devm_request_irq is not used?

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
  2021-07-27 18:51   ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28  5:19     ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28  5:19 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba,
	linux-arm-msm, dri-devel, amd-gfx, freedreno, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1717 bytes --]

Hi Sam

Am 27.07.21 um 20:51 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:07PM +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.
> 
> Before diving into a review of these..
> Any specific reason devm_request_irq is not used?

Thanks for looking at the patches.

Switching to devm_ definately makes sense in the longer term.
  I didn't do this here to not change the order of clean-up operations 
in general. And some of the drivers have dedicated IRQ clean-up code, 
which might depend on the correct order as well.

Best regards
Thomas

> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-28  5:19     ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28  5:19 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1717 bytes --]

Hi Sam

Am 27.07.21 um 20:51 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:07PM +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.
> 
> Before diving into a review of these..
> Any specific reason devm_request_irq is not used?

Thanks for looking at the patches.

Switching to devm_ definately makes sense in the longer term.
  I didn't do this here to not change the order of clean-up operations 
in general. And some of the drivers have dedicated IRQ clean-up code, 
which might depend on the correct order as well.

Best regards
Thomas

> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-28  5:19     ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28  5:19 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 1717 bytes --]

Hi Sam

Am 27.07.21 um 20:51 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:07PM +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.
> 
> Before diving into a review of these..
> Any specific reason devm_request_irq is not used?

Thanks for looking at the patches.

Switching to devm_ definately makes sense in the longer term.
  I didn't do this here to not change the order of clean-up operations 
in general. And some of the drivers have dedicated IRQ clean-up code, 
which might depend on the correct order as well.

Best regards
Thomas

> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-28  5:19     ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28  5:19 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	nicolas.ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1717 bytes --]

Hi Sam

Am 27.07.21 um 20:51 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:07PM +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.
> 
> Before diving into a review of these..
> Any specific reason devm_request_irq is not used?

Thanks for looking at the patches.

Switching to devm_ definately makes sense in the longer term.
  I didn't do this here to not change the order of clean-up operations 
in general. And some of the drivers have dedicated IRQ clean-up code, 
which might depend on the correct order as well.

Best regards
Thomas

> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
  2021-07-27 18:27   ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-28 10:27     ` Christian König
  -1 siblings, 0 replies; 172+ messages in thread
From: Christian König @ 2021-07-28 10:27 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> 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.
>
> The interrupt number returned by pci_msi_vector() is now stored
> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> midlayer does not handle this correctly.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Alex needs to take a look at this as well, but of hand the patch is 
Acked-by: Christian König <christian.koenig@amd.com>.

Thanks,
Christian.

> ---
>   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 +-
>   3 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 2bd13fc2541a..1e05b5aa94e7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>   	.open = amdgpu_driver_open_kms,
>   	.postclose = amdgpu_driver_postclose_kms,
>   	.lastclose = amdgpu_driver_lastclose_kms,
> -	.irq_handler = amdgpu_irq_handler,
>   	.ioctls = amdgpu_ioctls_kms,
>   	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>   	.dumb_create = amdgpu_mode_dumb_create,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 0d01cfaca77e..a36cdc7323f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -46,7 +46,6 @@
>   #include <linux/pci.h>
>   
>   #include <drm/drm_crtc_helper.h>
> -#include <drm/drm_irq.h>
>   #include <drm/drm_vblank.h>
>   #include <drm/amdgpu_drm.h>
>   #include <drm/drm_drv.h>
> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>    * Returns:
>    * result of handling the IRQ, as defined by &irqreturn_t
>    */
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>   {
>   	struct drm_device *dev = (struct drm_device *) arg;
>   	struct amdgpu_device *adev = drm_to_adev(dev);
> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>   int amdgpu_irq_init(struct amdgpu_device *adev)
>   {
>   	int r = 0;
> +	unsigned int irq;
>   
>   	spin_lock_init(&adev->irq.lock);
>   
> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>   	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>   
> -	adev->irq.installed = true;
> -	/* Use vector 0 for MSI-X */
> -	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> +	/* Use vector 0 for MSI-X. */
> +	r = pci_irq_vector(adev->pdev, 0);
> +	if (r < 0)
> +		return r;
> +	irq = r;
> +
> +	/* PCI devices require shared interrupts. */
> +	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> +			adev_to_drm(adev));
>   	if (r) {
> -		adev->irq.installed = false;
>   		if (!amdgpu_device_has_dc_support(adev))
>   			flush_work(&adev->hotplug_work);
>   		return r;
>   	}
> +	adev->irq.installed = true;
> +	adev->irq.irq = irq;
>   	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>   
>   	DRM_DEBUG("amdgpu: irq initialized.\n");
> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>   {
>   	if (adev->irq.installed) {
> -		drm_irq_uninstall(&adev->ddev);
> +		free_irq(adev->irq.irq, adev_to_drm(adev));
>   		adev->irq.installed = false;
>   		if (adev->irq.msi_enabled)
>   			pci_free_irq_vectors(adev->pdev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> index 78ad4784cc74..e9f2c11ea416 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>   
>   struct amdgpu_irq {
>   	bool				installed;
> +	unsigned int			irq;
>   	spinlock_t			lock;
>   	/* interrupt sources */
>   	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>   };
>   
>   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>   
>   int amdgpu_irq_init(struct amdgpu_device *adev);
>   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-28 10:27     ` Christian König
  0 siblings, 0 replies; 172+ messages in thread
From: Christian König @ 2021-07-28 10:27 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> 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.
>
> The interrupt number returned by pci_msi_vector() is now stored
> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> midlayer does not handle this correctly.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Alex needs to take a look at this as well, but of hand the patch is 
Acked-by: Christian König <christian.koenig@amd.com>.

Thanks,
Christian.

> ---
>   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 +-
>   3 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 2bd13fc2541a..1e05b5aa94e7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>   	.open = amdgpu_driver_open_kms,
>   	.postclose = amdgpu_driver_postclose_kms,
>   	.lastclose = amdgpu_driver_lastclose_kms,
> -	.irq_handler = amdgpu_irq_handler,
>   	.ioctls = amdgpu_ioctls_kms,
>   	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>   	.dumb_create = amdgpu_mode_dumb_create,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 0d01cfaca77e..a36cdc7323f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -46,7 +46,6 @@
>   #include <linux/pci.h>
>   
>   #include <drm/drm_crtc_helper.h>
> -#include <drm/drm_irq.h>
>   #include <drm/drm_vblank.h>
>   #include <drm/amdgpu_drm.h>
>   #include <drm/drm_drv.h>
> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>    * Returns:
>    * result of handling the IRQ, as defined by &irqreturn_t
>    */
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>   {
>   	struct drm_device *dev = (struct drm_device *) arg;
>   	struct amdgpu_device *adev = drm_to_adev(dev);
> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>   int amdgpu_irq_init(struct amdgpu_device *adev)
>   {
>   	int r = 0;
> +	unsigned int irq;
>   
>   	spin_lock_init(&adev->irq.lock);
>   
> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>   	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>   
> -	adev->irq.installed = true;
> -	/* Use vector 0 for MSI-X */
> -	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> +	/* Use vector 0 for MSI-X. */
> +	r = pci_irq_vector(adev->pdev, 0);
> +	if (r < 0)
> +		return r;
> +	irq = r;
> +
> +	/* PCI devices require shared interrupts. */
> +	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> +			adev_to_drm(adev));
>   	if (r) {
> -		adev->irq.installed = false;
>   		if (!amdgpu_device_has_dc_support(adev))
>   			flush_work(&adev->hotplug_work);
>   		return r;
>   	}
> +	adev->irq.installed = true;
> +	adev->irq.irq = irq;
>   	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>   
>   	DRM_DEBUG("amdgpu: irq initialized.\n");
> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>   {
>   	if (adev->irq.installed) {
> -		drm_irq_uninstall(&adev->ddev);
> +		free_irq(adev->irq.irq, adev_to_drm(adev));
>   		adev->irq.installed = false;
>   		if (adev->irq.msi_enabled)
>   			pci_free_irq_vectors(adev->pdev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> index 78ad4784cc74..e9f2c11ea416 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>   
>   struct amdgpu_irq {
>   	bool				installed;
> +	unsigned int			irq;
>   	spinlock_t			lock;
>   	/* interrupt sources */
>   	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>   };
>   
>   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>   
>   int amdgpu_irq_init(struct amdgpu_device *adev);
>   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-28 10:27     ` Christian König
  0 siblings, 0 replies; 172+ messages in thread
From: Christian König @ 2021-07-28 10:27 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-kernel, linux-arm-msm, freedreno, dri-devel, amd-gfx

Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> 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.
>
> The interrupt number returned by pci_msi_vector() is now stored
> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> midlayer does not handle this correctly.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Alex needs to take a look at this as well, but of hand the patch is 
Acked-by: Christian König <christian.koenig@amd.com>.

Thanks,
Christian.

> ---
>   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 +-
>   3 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 2bd13fc2541a..1e05b5aa94e7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>   	.open = amdgpu_driver_open_kms,
>   	.postclose = amdgpu_driver_postclose_kms,
>   	.lastclose = amdgpu_driver_lastclose_kms,
> -	.irq_handler = amdgpu_irq_handler,
>   	.ioctls = amdgpu_ioctls_kms,
>   	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>   	.dumb_create = amdgpu_mode_dumb_create,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 0d01cfaca77e..a36cdc7323f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -46,7 +46,6 @@
>   #include <linux/pci.h>
>   
>   #include <drm/drm_crtc_helper.h>
> -#include <drm/drm_irq.h>
>   #include <drm/drm_vblank.h>
>   #include <drm/amdgpu_drm.h>
>   #include <drm/drm_drv.h>
> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>    * Returns:
>    * result of handling the IRQ, as defined by &irqreturn_t
>    */
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>   {
>   	struct drm_device *dev = (struct drm_device *) arg;
>   	struct amdgpu_device *adev = drm_to_adev(dev);
> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>   int amdgpu_irq_init(struct amdgpu_device *adev)
>   {
>   	int r = 0;
> +	unsigned int irq;
>   
>   	spin_lock_init(&adev->irq.lock);
>   
> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>   	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>   
> -	adev->irq.installed = true;
> -	/* Use vector 0 for MSI-X */
> -	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> +	/* Use vector 0 for MSI-X. */
> +	r = pci_irq_vector(adev->pdev, 0);
> +	if (r < 0)
> +		return r;
> +	irq = r;
> +
> +	/* PCI devices require shared interrupts. */
> +	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> +			adev_to_drm(adev));
>   	if (r) {
> -		adev->irq.installed = false;
>   		if (!amdgpu_device_has_dc_support(adev))
>   			flush_work(&adev->hotplug_work);
>   		return r;
>   	}
> +	adev->irq.installed = true;
> +	adev->irq.irq = irq;
>   	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>   
>   	DRM_DEBUG("amdgpu: irq initialized.\n");
> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>   {
>   	if (adev->irq.installed) {
> -		drm_irq_uninstall(&adev->ddev);
> +		free_irq(adev->irq.irq, adev_to_drm(adev));
>   		adev->irq.installed = false;
>   		if (adev->irq.msi_enabled)
>   			pci_free_irq_vectors(adev->pdev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> index 78ad4784cc74..e9f2c11ea416 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>   
>   struct amdgpu_irq {
>   	bool				installed;
> +	unsigned int			irq;
>   	spinlock_t			lock;
>   	/* interrupt sources */
>   	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>   };
>   
>   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>   
>   int amdgpu_irq_init(struct amdgpu_device *adev);
>   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-28 10:27     ` Christian König
  0 siblings, 0 replies; 172+ messages in thread
From: Christian König @ 2021-07-28 10:27 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	liviu.dudau, brian.starkey, sam, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba
  Cc: linux-arm-kernel, linux-arm-msm, freedreno, dri-devel, amd-gfx

Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> 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.
>
> The interrupt number returned by pci_msi_vector() is now stored
> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> midlayer does not handle this correctly.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Alex needs to take a look at this as well, but of hand the patch is 
Acked-by: Christian König <christian.koenig@amd.com>.

Thanks,
Christian.

> ---
>   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 +-
>   3 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 2bd13fc2541a..1e05b5aa94e7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>   	.open = amdgpu_driver_open_kms,
>   	.postclose = amdgpu_driver_postclose_kms,
>   	.lastclose = amdgpu_driver_lastclose_kms,
> -	.irq_handler = amdgpu_irq_handler,
>   	.ioctls = amdgpu_ioctls_kms,
>   	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>   	.dumb_create = amdgpu_mode_dumb_create,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 0d01cfaca77e..a36cdc7323f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -46,7 +46,6 @@
>   #include <linux/pci.h>
>   
>   #include <drm/drm_crtc_helper.h>
> -#include <drm/drm_irq.h>
>   #include <drm/drm_vblank.h>
>   #include <drm/amdgpu_drm.h>
>   #include <drm/drm_drv.h>
> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>    * Returns:
>    * result of handling the IRQ, as defined by &irqreturn_t
>    */
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>   {
>   	struct drm_device *dev = (struct drm_device *) arg;
>   	struct amdgpu_device *adev = drm_to_adev(dev);
> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>   int amdgpu_irq_init(struct amdgpu_device *adev)
>   {
>   	int r = 0;
> +	unsigned int irq;
>   
>   	spin_lock_init(&adev->irq.lock);
>   
> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   	INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>   	INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>   
> -	adev->irq.installed = true;
> -	/* Use vector 0 for MSI-X */
> -	r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> +	/* Use vector 0 for MSI-X. */
> +	r = pci_irq_vector(adev->pdev, 0);
> +	if (r < 0)
> +		return r;
> +	irq = r;
> +
> +	/* PCI devices require shared interrupts. */
> +	r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> +			adev_to_drm(adev));
>   	if (r) {
> -		adev->irq.installed = false;
>   		if (!amdgpu_device_has_dc_support(adev))
>   			flush_work(&adev->hotplug_work);
>   		return r;
>   	}
> +	adev->irq.installed = true;
> +	adev->irq.irq = irq;
>   	adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>   
>   	DRM_DEBUG("amdgpu: irq initialized.\n");
> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>   {
>   	if (adev->irq.installed) {
> -		drm_irq_uninstall(&adev->ddev);
> +		free_irq(adev->irq.irq, adev_to_drm(adev));
>   		adev->irq.installed = false;
>   		if (adev->irq.msi_enabled)
>   			pci_free_irq_vectors(adev->pdev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> index 78ad4784cc74..e9f2c11ea416 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>   
>   struct amdgpu_irq {
>   	bool				installed;
> +	unsigned int			irq;
>   	spinlock_t			lock;
>   	/* interrupt sources */
>   	struct amdgpu_irq_client	client[AMDGPU_IRQ_CLIENTID_MAX];
> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>   };
>   
>   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>   
>   int amdgpu_irq_init(struct amdgpu_device *adev);
>   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
  2021-07-27 18:27   ` Thomas Zimmermann
  (?)
@ 2021-07-28 13:31     ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 13:31 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
> 
> Calls to platform_get_irq() can fail with a negative errno code.
> Abort initialization in this case. The DRM IRQ midlayer does not
> handle this case correctly.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>  drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>  2 files changed, 97 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 81ae92390736..b9998fe3982f 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -29,7 +29,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_modeset_helper.h>
>  #include <drm/drm_of.h>
>  #include <drm/drm_probe_helper.h>
> @@ -38,6 +37,94 @@
>  #include "hdlcd_drv.h"
>  #include "hdlcd_regs.h"
>  
> +static irqreturn_t hdlcd_irq(int irq, void *arg)
> +{
> +	struct drm_device *drm = arg;
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	unsigned long irq_status;
> +
> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
> +
> +#ifdef CONFIG_DEBUG_FS
> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
> +		atomic_inc(&hdlcd->buffer_underrun_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
> +		atomic_inc(&hdlcd->dma_end_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
> +		atomic_inc(&hdlcd->bus_error_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> +		atomic_inc(&hdlcd->vsync_count);
> +
> +#endif
> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> +		drm_crtc_handle_vblank(&hdlcd->crtc);
> +
> +	/* acknowledge interrupt(s) */
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static void hdlcd_irq_preinstall(struct drm_device *drm)
> +{
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	/* Ensure interrupts are disabled */
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
> +}
> +
> +static void hdlcd_irq_postinstall(struct drm_device *drm)
> +{
> +#ifdef CONFIG_DEBUG_FS
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> +
> +	/* enable debug interrupts */
> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
> +
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> +#endif
> +}
> +
> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
It is inconsistent that the drm_device * is named "dev", as similar
functions in this patch uses the name "drm".

> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
The code above is almost redundandt as request_irq has the same check.
The only benefit of this check is that we avoid calling
hdlcd_irq_preinstall().

And IRQ_NOTCONNECTED is only set for PCI devices which this is not.
So I would thing the if () should be dropped here. ??

With the inputs considered/addressed:
Acked-by: Sam Ravnborg <sam@ravnborg.org>


> +
> +	hdlcd_irq_preinstall(dev);
> +
> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	hdlcd_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void hdlcd_irq_uninstall(struct drm_device *drm)
> +{
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	/* disable all the interrupts that we might have enabled */
> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> +
> +#ifdef CONFIG_DEBUG_FS
> +	/* disable debug interrupts */
> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
> +#endif
> +
> +	/* disable vsync interrupts */
> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> +
> +	free_irq(hdlcd->irq, drm);
> +}
> +
>  static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  {
>  	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  		goto setup_fail;
>  	}
>  
> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		goto irq_fail;
> +	hdlcd->irq = ret;
> +
> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>  	if (ret < 0) {
>  		DRM_ERROR("failed to install IRQ handler\n");
>  		goto irq_fail;
> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>  	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>  }
>  
> -static irqreturn_t hdlcd_irq(int irq, void *arg)
> -{
> -	struct drm_device *drm = arg;
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	unsigned long irq_status;
> -
> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
> -
> -#ifdef CONFIG_DEBUG_FS
> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
> -		atomic_inc(&hdlcd->buffer_underrun_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
> -		atomic_inc(&hdlcd->dma_end_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
> -		atomic_inc(&hdlcd->bus_error_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> -		atomic_inc(&hdlcd->vsync_count);
> -
> -#endif
> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> -		drm_crtc_handle_vblank(&hdlcd->crtc);
> -
> -	/* acknowledge interrupt(s) */
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static void hdlcd_irq_preinstall(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	/* Ensure interrupts are disabled */
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
> -}
> -
> -static int hdlcd_irq_postinstall(struct drm_device *drm)
> -{
> -#ifdef CONFIG_DEBUG_FS
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> -
> -	/* enable debug interrupts */
> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
> -
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> -#endif
> -	return 0;
> -}
> -
> -static void hdlcd_irq_uninstall(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	/* disable all the interrupts that we might have enabled */
> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> -
> -#ifdef CONFIG_DEBUG_FS
> -	/* disable debug interrupts */
> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
> -#endif
> -
> -	/* disable vsync interrupts */
> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
> -
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> -}
> -
>  #ifdef CONFIG_DEBUG_FS
>  static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>  {
> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver hdlcd_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = hdlcd_irq,
> -	.irq_preinstall = hdlcd_irq_preinstall,
> -	.irq_postinstall = hdlcd_irq_postinstall,
> -	.irq_uninstall = hdlcd_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  #ifdef CONFIG_DEBUG_FS
>  	.debugfs_init = hdlcd_debugfs_init,
> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>  err_unload:
>  	of_node_put(hdlcd->crtc.port);
>  	hdlcd->crtc.port = NULL;
> -	drm_irq_uninstall(drm);
> +	hdlcd_irq_uninstall(drm);
>  	of_reserved_mem_device_release(drm->dev);
>  err_free:
>  	drm_mode_config_cleanup(drm);
> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>  	hdlcd->crtc.port = NULL;
>  	pm_runtime_get_sync(dev);
>  	drm_atomic_helper_shutdown(drm);
> -	drm_irq_uninstall(drm);
> +	hdlcd_irq_uninstall(drm);
>  	pm_runtime_put(dev);
>  	if (pm_runtime_enabled(dev))
>  		pm_runtime_disable(dev);
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
> index fd438d177b64..909c39c28487 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>  	struct clk			*clk;
>  	struct drm_crtc			crtc;
>  	struct drm_plane		*plane;
> +	unsigned int			irq;
>  #ifdef CONFIG_DEBUG_FS
>  	atomic_t buffer_underrun_count;
>  	atomic_t bus_error_count;
> -- 
> 2.32.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-28 13:31     ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 13:31 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
> 
> Calls to platform_get_irq() can fail with a negative errno code.
> Abort initialization in this case. The DRM IRQ midlayer does not
> handle this case correctly.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>  drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>  2 files changed, 97 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 81ae92390736..b9998fe3982f 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -29,7 +29,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_modeset_helper.h>
>  #include <drm/drm_of.h>
>  #include <drm/drm_probe_helper.h>
> @@ -38,6 +37,94 @@
>  #include "hdlcd_drv.h"
>  #include "hdlcd_regs.h"
>  
> +static irqreturn_t hdlcd_irq(int irq, void *arg)
> +{
> +	struct drm_device *drm = arg;
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	unsigned long irq_status;
> +
> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
> +
> +#ifdef CONFIG_DEBUG_FS
> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
> +		atomic_inc(&hdlcd->buffer_underrun_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
> +		atomic_inc(&hdlcd->dma_end_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
> +		atomic_inc(&hdlcd->bus_error_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> +		atomic_inc(&hdlcd->vsync_count);
> +
> +#endif
> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> +		drm_crtc_handle_vblank(&hdlcd->crtc);
> +
> +	/* acknowledge interrupt(s) */
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static void hdlcd_irq_preinstall(struct drm_device *drm)
> +{
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	/* Ensure interrupts are disabled */
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
> +}
> +
> +static void hdlcd_irq_postinstall(struct drm_device *drm)
> +{
> +#ifdef CONFIG_DEBUG_FS
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> +
> +	/* enable debug interrupts */
> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
> +
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> +#endif
> +}
> +
> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
It is inconsistent that the drm_device * is named "dev", as similar
functions in this patch uses the name "drm".

> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
The code above is almost redundandt as request_irq has the same check.
The only benefit of this check is that we avoid calling
hdlcd_irq_preinstall().

And IRQ_NOTCONNECTED is only set for PCI devices which this is not.
So I would thing the if () should be dropped here. ??

With the inputs considered/addressed:
Acked-by: Sam Ravnborg <sam@ravnborg.org>


> +
> +	hdlcd_irq_preinstall(dev);
> +
> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	hdlcd_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void hdlcd_irq_uninstall(struct drm_device *drm)
> +{
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	/* disable all the interrupts that we might have enabled */
> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> +
> +#ifdef CONFIG_DEBUG_FS
> +	/* disable debug interrupts */
> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
> +#endif
> +
> +	/* disable vsync interrupts */
> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> +
> +	free_irq(hdlcd->irq, drm);
> +}
> +
>  static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  {
>  	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  		goto setup_fail;
>  	}
>  
> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		goto irq_fail;
> +	hdlcd->irq = ret;
> +
> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>  	if (ret < 0) {
>  		DRM_ERROR("failed to install IRQ handler\n");
>  		goto irq_fail;
> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>  	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>  }
>  
> -static irqreturn_t hdlcd_irq(int irq, void *arg)
> -{
> -	struct drm_device *drm = arg;
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	unsigned long irq_status;
> -
> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
> -
> -#ifdef CONFIG_DEBUG_FS
> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
> -		atomic_inc(&hdlcd->buffer_underrun_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
> -		atomic_inc(&hdlcd->dma_end_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
> -		atomic_inc(&hdlcd->bus_error_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> -		atomic_inc(&hdlcd->vsync_count);
> -
> -#endif
> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> -		drm_crtc_handle_vblank(&hdlcd->crtc);
> -
> -	/* acknowledge interrupt(s) */
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static void hdlcd_irq_preinstall(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	/* Ensure interrupts are disabled */
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
> -}
> -
> -static int hdlcd_irq_postinstall(struct drm_device *drm)
> -{
> -#ifdef CONFIG_DEBUG_FS
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> -
> -	/* enable debug interrupts */
> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
> -
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> -#endif
> -	return 0;
> -}
> -
> -static void hdlcd_irq_uninstall(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	/* disable all the interrupts that we might have enabled */
> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> -
> -#ifdef CONFIG_DEBUG_FS
> -	/* disable debug interrupts */
> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
> -#endif
> -
> -	/* disable vsync interrupts */
> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
> -
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> -}
> -
>  #ifdef CONFIG_DEBUG_FS
>  static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>  {
> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver hdlcd_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = hdlcd_irq,
> -	.irq_preinstall = hdlcd_irq_preinstall,
> -	.irq_postinstall = hdlcd_irq_postinstall,
> -	.irq_uninstall = hdlcd_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  #ifdef CONFIG_DEBUG_FS
>  	.debugfs_init = hdlcd_debugfs_init,
> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>  err_unload:
>  	of_node_put(hdlcd->crtc.port);
>  	hdlcd->crtc.port = NULL;
> -	drm_irq_uninstall(drm);
> +	hdlcd_irq_uninstall(drm);
>  	of_reserved_mem_device_release(drm->dev);
>  err_free:
>  	drm_mode_config_cleanup(drm);
> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>  	hdlcd->crtc.port = NULL;
>  	pm_runtime_get_sync(dev);
>  	drm_atomic_helper_shutdown(drm);
> -	drm_irq_uninstall(drm);
> +	hdlcd_irq_uninstall(drm);
>  	pm_runtime_put(dev);
>  	if (pm_runtime_enabled(dev))
>  		pm_runtime_disable(dev);
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
> index fd438d177b64..909c39c28487 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>  	struct clk			*clk;
>  	struct drm_crtc			crtc;
>  	struct drm_plane		*plane;
> +	unsigned int			irq;
>  #ifdef CONFIG_DEBUG_FS
>  	atomic_t buffer_underrun_count;
>  	atomic_t bus_error_count;
> -- 
> 2.32.0

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-28 13:31     ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 13:31 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	nicolas.ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
> 
> Calls to platform_get_irq() can fail with a negative errno code.
> Abort initialization in this case. The DRM IRQ midlayer does not
> handle this case correctly.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>  drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>  2 files changed, 97 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 81ae92390736..b9998fe3982f 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -29,7 +29,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_modeset_helper.h>
>  #include <drm/drm_of.h>
>  #include <drm/drm_probe_helper.h>
> @@ -38,6 +37,94 @@
>  #include "hdlcd_drv.h"
>  #include "hdlcd_regs.h"
>  
> +static irqreturn_t hdlcd_irq(int irq, void *arg)
> +{
> +	struct drm_device *drm = arg;
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	unsigned long irq_status;
> +
> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
> +
> +#ifdef CONFIG_DEBUG_FS
> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
> +		atomic_inc(&hdlcd->buffer_underrun_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
> +		atomic_inc(&hdlcd->dma_end_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
> +		atomic_inc(&hdlcd->bus_error_count);
> +
> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> +		atomic_inc(&hdlcd->vsync_count);
> +
> +#endif
> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> +		drm_crtc_handle_vblank(&hdlcd->crtc);
> +
> +	/* acknowledge interrupt(s) */
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static void hdlcd_irq_preinstall(struct drm_device *drm)
> +{
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	/* Ensure interrupts are disabled */
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
> +}
> +
> +static void hdlcd_irq_postinstall(struct drm_device *drm)
> +{
> +#ifdef CONFIG_DEBUG_FS
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> +
> +	/* enable debug interrupts */
> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
> +
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> +#endif
> +}
> +
> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
It is inconsistent that the drm_device * is named "dev", as similar
functions in this patch uses the name "drm".

> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
The code above is almost redundandt as request_irq has the same check.
The only benefit of this check is that we avoid calling
hdlcd_irq_preinstall().

And IRQ_NOTCONNECTED is only set for PCI devices which this is not.
So I would thing the if () should be dropped here. ??

With the inputs considered/addressed:
Acked-by: Sam Ravnborg <sam@ravnborg.org>


> +
> +	hdlcd_irq_preinstall(dev);
> +
> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	hdlcd_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void hdlcd_irq_uninstall(struct drm_device *drm)
> +{
> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> +	/* disable all the interrupts that we might have enabled */
> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> +
> +#ifdef CONFIG_DEBUG_FS
> +	/* disable debug interrupts */
> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
> +#endif
> +
> +	/* disable vsync interrupts */
> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> +
> +	free_irq(hdlcd->irq, drm);
> +}
> +
>  static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  {
>  	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>  		goto setup_fail;
>  	}
>  
> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		goto irq_fail;
> +	hdlcd->irq = ret;
> +
> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>  	if (ret < 0) {
>  		DRM_ERROR("failed to install IRQ handler\n");
>  		goto irq_fail;
> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>  	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>  }
>  
> -static irqreturn_t hdlcd_irq(int irq, void *arg)
> -{
> -	struct drm_device *drm = arg;
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	unsigned long irq_status;
> -
> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
> -
> -#ifdef CONFIG_DEBUG_FS
> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
> -		atomic_inc(&hdlcd->buffer_underrun_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
> -		atomic_inc(&hdlcd->dma_end_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
> -		atomic_inc(&hdlcd->bus_error_count);
> -
> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> -		atomic_inc(&hdlcd->vsync_count);
> -
> -#endif
> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
> -		drm_crtc_handle_vblank(&hdlcd->crtc);
> -
> -	/* acknowledge interrupt(s) */
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static void hdlcd_irq_preinstall(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	/* Ensure interrupts are disabled */
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
> -}
> -
> -static int hdlcd_irq_postinstall(struct drm_device *drm)
> -{
> -#ifdef CONFIG_DEBUG_FS
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> -
> -	/* enable debug interrupts */
> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
> -
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> -#endif
> -	return 0;
> -}
> -
> -static void hdlcd_irq_uninstall(struct drm_device *drm)
> -{
> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
> -	/* disable all the interrupts that we might have enabled */
> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
> -
> -#ifdef CONFIG_DEBUG_FS
> -	/* disable debug interrupts */
> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
> -#endif
> -
> -	/* disable vsync interrupts */
> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
> -
> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
> -}
> -
>  #ifdef CONFIG_DEBUG_FS
>  static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>  {
> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver hdlcd_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = hdlcd_irq,
> -	.irq_preinstall = hdlcd_irq_preinstall,
> -	.irq_postinstall = hdlcd_irq_postinstall,
> -	.irq_uninstall = hdlcd_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  #ifdef CONFIG_DEBUG_FS
>  	.debugfs_init = hdlcd_debugfs_init,
> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>  err_unload:
>  	of_node_put(hdlcd->crtc.port);
>  	hdlcd->crtc.port = NULL;
> -	drm_irq_uninstall(drm);
> +	hdlcd_irq_uninstall(drm);
>  	of_reserved_mem_device_release(drm->dev);
>  err_free:
>  	drm_mode_config_cleanup(drm);
> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>  	hdlcd->crtc.port = NULL;
>  	pm_runtime_get_sync(dev);
>  	drm_atomic_helper_shutdown(drm);
> -	drm_irq_uninstall(drm);
> +	hdlcd_irq_uninstall(drm);
>  	pm_runtime_put(dev);
>  	if (pm_runtime_enabled(dev))
>  		pm_runtime_disable(dev);
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
> index fd438d177b64..909c39c28487 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>  	struct clk			*clk;
>  	struct drm_crtc			crtc;
>  	struct drm_plane		*plane;
> +	unsigned int			irq;
>  #ifdef CONFIG_DEBUG_FS
>  	atomic_t buffer_underrun_count;
>  	atomic_t bus_error_count;
> -- 
> 2.32.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-27 18:27   ` Thomas Zimmermann
  (?)
@ 2021-07-28 14:00     ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 14:00 UTC (permalink / raw)
  To: Thomas Zimmermann, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Dan,

I hope you can fine to test this patch from Thomas.
If this works then we can forget about my attempt to do the same.

Hi Thomas,

IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
already.

With that considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

We shall wait for testing from Dan before you apply it as I had made a
similar patch that failed to work. I assume my patch was buggy but I
prefer to be sure.

	Sam

On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>  1 file changed, 52 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index f09b6dd8754c..cfa8c2c9c8aa 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -22,7 +22,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int cfg = 0;
> +	int i;
> +
> +	/* Enable interrupts on activated layers */
> +	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> +		if (dc->layers[i])
> +			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> +	}
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> +}
> +
> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int isr;
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> +	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> +}
> +
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +
> +	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	atmel_hlcdc_dc_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +	free_irq(dc->hlcdc->irq, dev);
> +}
> +
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
>  	.atomic_check = drm_atomic_helper_check,
> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>  	drm_mode_config_reset(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	ret = drm_irq_install(dev, dc->hlcdc->irq);
> +	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>  	pm_runtime_put_sync(dev->dev);
>  	if (ret < 0) {
>  		dev_err(dev->dev, "failed to install IRQ handler\n");
> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	drm_mode_config_cleanup(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	drm_irq_uninstall(dev);
> +	atmel_hlcdc_dc_irq_uninstall(dev);
>  	pm_runtime_put_sync(dev->dev);
>  
>  	dev->dev_private = NULL;
> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	clk_disable_unprepare(dc->hlcdc->periph_clk);
>  }
>  
> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int cfg = 0;
> -	int i;
> -
> -	/* Enable interrupts on activated layers */
> -	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> -		if (dc->layers[i])
> -			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> -	}
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> -
> -	return 0;
> -}
> -
> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int isr;
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> -	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> -}
> -
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = atmel_hlcdc_dc_irq_handler,
> -	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
> -	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
> -	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
>  	.name = "atmel-hlcdc",
> -- 
> 2.32.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 14:00     ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 14:00 UTC (permalink / raw)
  To: Thomas Zimmermann, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

Hi Dan,

I hope you can fine to test this patch from Thomas.
If this works then we can forget about my attempt to do the same.

Hi Thomas,

IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
already.

With that considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

We shall wait for testing from Dan before you apply it as I had made a
similar patch that failed to work. I assume my patch was buggy but I
prefer to be sure.

	Sam

On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>  1 file changed, 52 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index f09b6dd8754c..cfa8c2c9c8aa 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -22,7 +22,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int cfg = 0;
> +	int i;
> +
> +	/* Enable interrupts on activated layers */
> +	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> +		if (dc->layers[i])
> +			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> +	}
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> +}
> +
> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int isr;
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> +	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> +}
> +
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +
> +	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	atmel_hlcdc_dc_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +	free_irq(dc->hlcdc->irq, dev);
> +}
> +
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
>  	.atomic_check = drm_atomic_helper_check,
> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>  	drm_mode_config_reset(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	ret = drm_irq_install(dev, dc->hlcdc->irq);
> +	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>  	pm_runtime_put_sync(dev->dev);
>  	if (ret < 0) {
>  		dev_err(dev->dev, "failed to install IRQ handler\n");
> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	drm_mode_config_cleanup(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	drm_irq_uninstall(dev);
> +	atmel_hlcdc_dc_irq_uninstall(dev);
>  	pm_runtime_put_sync(dev->dev);
>  
>  	dev->dev_private = NULL;
> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	clk_disable_unprepare(dc->hlcdc->periph_clk);
>  }
>  
> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int cfg = 0;
> -	int i;
> -
> -	/* Enable interrupts on activated layers */
> -	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> -		if (dc->layers[i])
> -			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> -	}
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> -
> -	return 0;
> -}
> -
> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int isr;
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> -	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> -}
> -
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = atmel_hlcdc_dc_irq_handler,
> -	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
> -	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
> -	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
>  	.name = "atmel-hlcdc",
> -- 
> 2.32.0

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 14:00     ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 14:00 UTC (permalink / raw)
  To: Thomas Zimmermann, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	nicolas.ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

I hope you can fine to test this patch from Thomas.
If this works then we can forget about my attempt to do the same.

Hi Thomas,

IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
already.

With that considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

We shall wait for testing from Dan before you apply it as I had made a
similar patch that failed to work. I assume my patch was buggy but I
prefer to be sure.

	Sam

On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>  1 file changed, 52 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index f09b6dd8754c..cfa8c2c9c8aa 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -22,7 +22,6 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_gem_framebuffer_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int cfg = 0;
> +	int i;
> +
> +	/* Enable interrupts on activated layers */
> +	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> +		if (dc->layers[i])
> +			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> +	}
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> +}
> +
> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +	unsigned int isr;
> +
> +	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> +	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> +}
> +
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +	int ret;
> +
> +	if (irq == IRQ_NOTCONNECTED)
> +		return -ENOTCONN;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +
> +	ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +	if (ret)
> +		return ret;
> +
> +	atmel_hlcdc_dc_irq_postinstall(dev);
> +
> +	return 0;
> +}
> +
> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> +{
> +	struct atmel_hlcdc_dc *dc = dev->dev_private;
> +
> +	atmel_hlcdc_dc_irq_disable(dev);
> +	free_irq(dc->hlcdc->irq, dev);
> +}
> +
>  static const struct drm_mode_config_funcs mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create,
>  	.atomic_check = drm_atomic_helper_check,
> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>  	drm_mode_config_reset(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	ret = drm_irq_install(dev, dc->hlcdc->irq);
> +	ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>  	pm_runtime_put_sync(dev->dev);
>  	if (ret < 0) {
>  		dev_err(dev->dev, "failed to install IRQ handler\n");
> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	drm_mode_config_cleanup(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> -	drm_irq_uninstall(dev);
> +	atmel_hlcdc_dc_irq_uninstall(dev);
>  	pm_runtime_put_sync(dev->dev);
>  
>  	dev->dev_private = NULL;
> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	clk_disable_unprepare(dc->hlcdc->periph_clk);
>  }
>  
> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int cfg = 0;
> -	int i;
> -
> -	/* Enable interrupts on activated layers */
> -	for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
> -		if (dc->layers[i])
> -			cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
> -	}
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
> -
> -	return 0;
> -}
> -
> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> -{
> -	struct atmel_hlcdc_dc *dc = dev->dev_private;
> -	unsigned int isr;
> -
> -	regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
> -	regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
> -}
> -
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
>  static const struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> -	.irq_handler = atmel_hlcdc_dc_irq_handler,
> -	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
> -	.irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
> -	.irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
>  	.name = "atmel-hlcdc",
> -- 
> 2.32.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
  2021-07-28 10:27     ` Christian König
  (?)
  (?)
@ 2021-07-28 14:03       ` Alex Deucher
  -1 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-07-28 14:03 UTC (permalink / raw)
  To: Christian König
  Cc: Thomas Zimmermann, Daniel Vetter, Dave Airlie, Deucher,
	Alexander, Liviu Dudau, Brian Starkey, Sam Ravnborg, bbrezillon,
	nicolas.ferre, Maarten Lankhorst, Maxime Ripard, Stefan Agner,
	alison.wang, Patrik Jakobsson, anitha.chrisanthus, Rob Clark,
	edmund.j.dea, Sean Paul, Shawn Guo, Sascha Hauer, Sascha Hauer,
	jyri.sarha, tomba, linux-arm-kernel, linux-arm-msm, freedreno,
	Maling list - DRI developers, amd-gfx list

On Wed, Jul 28, 2021 at 6:27 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> > 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.
> >
> > The interrupt number returned by pci_msi_vector() is now stored
> > in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> > a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> > midlayer does not handle this correctly.
> >
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Alex needs to take a look at this as well, but of hand the patch is
> Acked-by: Christian König <christian.koenig@amd.com>.

Looks good to me as well:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Thanks,
> Christian.
>
> > ---
> >   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 +-
> >   3 files changed, 15 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 2bd13fc2541a..1e05b5aa94e7 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
> >       .open = amdgpu_driver_open_kms,
> >       .postclose = amdgpu_driver_postclose_kms,
> >       .lastclose = amdgpu_driver_lastclose_kms,
> > -     .irq_handler = amdgpu_irq_handler,
> >       .ioctls = amdgpu_ioctls_kms,
> >       .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
> >       .dumb_create = amdgpu_mode_dumb_create,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > index 0d01cfaca77e..a36cdc7323f4 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -46,7 +46,6 @@
> >   #include <linux/pci.h>
> >
> >   #include <drm/drm_crtc_helper.h>
> > -#include <drm/drm_irq.h>
> >   #include <drm/drm_vblank.h>
> >   #include <drm/amdgpu_drm.h>
> >   #include <drm/drm_drv.h>
> > @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
> >    * Returns:
> >    * result of handling the IRQ, as defined by &irqreturn_t
> >    */
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> > +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> >   {
> >       struct drm_device *dev = (struct drm_device *) arg;
> >       struct amdgpu_device *adev = drm_to_adev(dev);
> > @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
> >   int amdgpu_irq_init(struct amdgpu_device *adev)
> >   {
> >       int r = 0;
> > +     unsigned int irq;
> >
> >       spin_lock_init(&adev->irq.lock);
> >
> > @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >       INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
> >       INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
> >
> > -     adev->irq.installed = true;
> > -     /* Use vector 0 for MSI-X */
> > -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> > +     /* Use vector 0 for MSI-X. */
> > +     r = pci_irq_vector(adev->pdev, 0);
> > +     if (r < 0)
> > +             return r;
> > +     irq = r;
> > +
> > +     /* PCI devices require shared interrupts. */
> > +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> > +                     adev_to_drm(adev));
> >       if (r) {
> > -             adev->irq.installed = false;
> >               if (!amdgpu_device_has_dc_support(adev))
> >                       flush_work(&adev->hotplug_work);
> >               return r;
> >       }
> > +     adev->irq.installed = true;
> > +     adev->irq.irq = irq;
> >       adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
> >
> >       DRM_DEBUG("amdgpu: irq initialized.\n");
> > @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
> >   {
> >       if (adev->irq.installed) {
> > -             drm_irq_uninstall(&adev->ddev);
> > +             free_irq(adev->irq.irq, adev_to_drm(adev));
> >               adev->irq.installed = false;
> >               if (adev->irq.msi_enabled)
> >                       pci_free_irq_vectors(adev->pdev);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > index 78ad4784cc74..e9f2c11ea416 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
> >
> >   struct amdgpu_irq {
> >       bool                            installed;
> > +     unsigned int                    irq;
> >       spinlock_t                      lock;
> >       /* interrupt sources */
> >       struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
> > @@ -100,7 +101,6 @@ struct amdgpu_irq {
> >   };
> >
> >   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
> >
> >   int amdgpu_irq_init(struct amdgpu_device *adev);
> >   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-28 14:03       ` Alex Deucher
  0 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-07-28 14:03 UTC (permalink / raw)
  To: Christian König
  Cc: Dave Airlie, Liviu Dudau, Stefan Agner, amd-gfx list,
	anitha.chrisanthus, Sam Ravnborg, Patrik Jakobsson,
	linux-arm-msm, freedreno, Sascha Hauer, edmund.j.dea,
	Sascha Hauer, alison.wang, Maarten Lankhorst, Maxime Ripard,
	Maling list - DRI developers, Daniel Vetter, Sean Paul,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Rob Clark,
	Thomas Zimmermann, Deucher, Alexander, Shawn Guo, Brian Starkey

On Wed, Jul 28, 2021 at 6:27 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> > 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.
> >
> > The interrupt number returned by pci_msi_vector() is now stored
> > in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> > a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> > midlayer does not handle this correctly.
> >
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Alex needs to take a look at this as well, but of hand the patch is
> Acked-by: Christian König <christian.koenig@amd.com>.

Looks good to me as well:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Thanks,
> Christian.
>
> > ---
> >   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 +-
> >   3 files changed, 15 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 2bd13fc2541a..1e05b5aa94e7 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
> >       .open = amdgpu_driver_open_kms,
> >       .postclose = amdgpu_driver_postclose_kms,
> >       .lastclose = amdgpu_driver_lastclose_kms,
> > -     .irq_handler = amdgpu_irq_handler,
> >       .ioctls = amdgpu_ioctls_kms,
> >       .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
> >       .dumb_create = amdgpu_mode_dumb_create,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > index 0d01cfaca77e..a36cdc7323f4 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -46,7 +46,6 @@
> >   #include <linux/pci.h>
> >
> >   #include <drm/drm_crtc_helper.h>
> > -#include <drm/drm_irq.h>
> >   #include <drm/drm_vblank.h>
> >   #include <drm/amdgpu_drm.h>
> >   #include <drm/drm_drv.h>
> > @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
> >    * Returns:
> >    * result of handling the IRQ, as defined by &irqreturn_t
> >    */
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> > +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> >   {
> >       struct drm_device *dev = (struct drm_device *) arg;
> >       struct amdgpu_device *adev = drm_to_adev(dev);
> > @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
> >   int amdgpu_irq_init(struct amdgpu_device *adev)
> >   {
> >       int r = 0;
> > +     unsigned int irq;
> >
> >       spin_lock_init(&adev->irq.lock);
> >
> > @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >       INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
> >       INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
> >
> > -     adev->irq.installed = true;
> > -     /* Use vector 0 for MSI-X */
> > -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> > +     /* Use vector 0 for MSI-X. */
> > +     r = pci_irq_vector(adev->pdev, 0);
> > +     if (r < 0)
> > +             return r;
> > +     irq = r;
> > +
> > +     /* PCI devices require shared interrupts. */
> > +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> > +                     adev_to_drm(adev));
> >       if (r) {
> > -             adev->irq.installed = false;
> >               if (!amdgpu_device_has_dc_support(adev))
> >                       flush_work(&adev->hotplug_work);
> >               return r;
> >       }
> > +     adev->irq.installed = true;
> > +     adev->irq.irq = irq;
> >       adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
> >
> >       DRM_DEBUG("amdgpu: irq initialized.\n");
> > @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
> >   {
> >       if (adev->irq.installed) {
> > -             drm_irq_uninstall(&adev->ddev);
> > +             free_irq(adev->irq.irq, adev_to_drm(adev));
> >               adev->irq.installed = false;
> >               if (adev->irq.msi_enabled)
> >                       pci_free_irq_vectors(adev->pdev);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > index 78ad4784cc74..e9f2c11ea416 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
> >
> >   struct amdgpu_irq {
> >       bool                            installed;
> > +     unsigned int                    irq;
> >       spinlock_t                      lock;
> >       /* interrupt sources */
> >       struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
> > @@ -100,7 +101,6 @@ struct amdgpu_irq {
> >   };
> >
> >   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
> >
> >   int amdgpu_irq_init(struct amdgpu_device *adev);
> >   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-28 14:03       ` Alex Deucher
  0 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-07-28 14:03 UTC (permalink / raw)
  To: Christian König
  Cc: Dave Airlie, Liviu Dudau, amd-gfx list, anitha.chrisanthus,
	Sam Ravnborg, linux-arm-msm, freedreno, Thomas Zimmermann,
	edmund.j.dea, Sascha Hauer, alison.wang,
	Maling list - DRI developers, Sean Paul, linux-arm-kernel, tomba,
	bbrezillon, jyri.sarha, nicolas.ferre, Sascha Hauer, Deucher,
	Alexander, Shawn Guo

On Wed, Jul 28, 2021 at 6:27 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> > 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.
> >
> > The interrupt number returned by pci_msi_vector() is now stored
> > in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> > a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> > midlayer does not handle this correctly.
> >
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Alex needs to take a look at this as well, but of hand the patch is
> Acked-by: Christian König <christian.koenig@amd.com>.

Looks good to me as well:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Thanks,
> Christian.
>
> > ---
> >   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 +-
> >   3 files changed, 15 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 2bd13fc2541a..1e05b5aa94e7 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
> >       .open = amdgpu_driver_open_kms,
> >       .postclose = amdgpu_driver_postclose_kms,
> >       .lastclose = amdgpu_driver_lastclose_kms,
> > -     .irq_handler = amdgpu_irq_handler,
> >       .ioctls = amdgpu_ioctls_kms,
> >       .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
> >       .dumb_create = amdgpu_mode_dumb_create,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > index 0d01cfaca77e..a36cdc7323f4 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -46,7 +46,6 @@
> >   #include <linux/pci.h>
> >
> >   #include <drm/drm_crtc_helper.h>
> > -#include <drm/drm_irq.h>
> >   #include <drm/drm_vblank.h>
> >   #include <drm/amdgpu_drm.h>
> >   #include <drm/drm_drv.h>
> > @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
> >    * Returns:
> >    * result of handling the IRQ, as defined by &irqreturn_t
> >    */
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> > +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> >   {
> >       struct drm_device *dev = (struct drm_device *) arg;
> >       struct amdgpu_device *adev = drm_to_adev(dev);
> > @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
> >   int amdgpu_irq_init(struct amdgpu_device *adev)
> >   {
> >       int r = 0;
> > +     unsigned int irq;
> >
> >       spin_lock_init(&adev->irq.lock);
> >
> > @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >       INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
> >       INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
> >
> > -     adev->irq.installed = true;
> > -     /* Use vector 0 for MSI-X */
> > -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> > +     /* Use vector 0 for MSI-X. */
> > +     r = pci_irq_vector(adev->pdev, 0);
> > +     if (r < 0)
> > +             return r;
> > +     irq = r;
> > +
> > +     /* PCI devices require shared interrupts. */
> > +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> > +                     adev_to_drm(adev));
> >       if (r) {
> > -             adev->irq.installed = false;
> >               if (!amdgpu_device_has_dc_support(adev))
> >                       flush_work(&adev->hotplug_work);
> >               return r;
> >       }
> > +     adev->irq.installed = true;
> > +     adev->irq.irq = irq;
> >       adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
> >
> >       DRM_DEBUG("amdgpu: irq initialized.\n");
> > @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
> >   {
> >       if (adev->irq.installed) {
> > -             drm_irq_uninstall(&adev->ddev);
> > +             free_irq(adev->irq.irq, adev_to_drm(adev));
> >               adev->irq.installed = false;
> >               if (adev->irq.msi_enabled)
> >                       pci_free_irq_vectors(adev->pdev);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > index 78ad4784cc74..e9f2c11ea416 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
> >
> >   struct amdgpu_irq {
> >       bool                            installed;
> > +     unsigned int                    irq;
> >       spinlock_t                      lock;
> >       /* interrupt sources */
> >       struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
> > @@ -100,7 +101,6 @@ struct amdgpu_irq {
> >   };
> >
> >   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
> >
> >   int amdgpu_irq_init(struct amdgpu_device *adev);
> >   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-07-28 14:03       ` Alex Deucher
  0 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-07-28 14:03 UTC (permalink / raw)
  To: Christian König
  Cc: Dave Airlie, Liviu Dudau, Stefan Agner, amd-gfx list,
	anitha.chrisanthus, Sam Ravnborg, Patrik Jakobsson,
	linux-arm-msm, freedreno, Thomas Zimmermann, edmund.j.dea,
	Sascha Hauer, alison.wang, Maarten Lankhorst, Maxime Ripard,
	Maling list - DRI developers, Daniel Vetter, Sean Paul,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	Rob Clark, Sascha Hauer, Deucher, Alexander, Shawn Guo,
	Brian Starkey

On Wed, Jul 28, 2021 at 6:27 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
> > 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.
> >
> > The interrupt number returned by pci_msi_vector() is now stored
> > in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
> > a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
> > midlayer does not handle this correctly.
> >
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Alex needs to take a look at this as well, but of hand the patch is
> Acked-by: Christian König <christian.koenig@amd.com>.

Looks good to me as well:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

>
> Thanks,
> Christian.
>
> > ---
> >   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 +-
> >   3 files changed, 15 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 2bd13fc2541a..1e05b5aa94e7 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
> >       .open = amdgpu_driver_open_kms,
> >       .postclose = amdgpu_driver_postclose_kms,
> >       .lastclose = amdgpu_driver_lastclose_kms,
> > -     .irq_handler = amdgpu_irq_handler,
> >       .ioctls = amdgpu_ioctls_kms,
> >       .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
> >       .dumb_create = amdgpu_mode_dumb_create,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > index 0d01cfaca77e..a36cdc7323f4 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -46,7 +46,6 @@
> >   #include <linux/pci.h>
> >
> >   #include <drm/drm_crtc_helper.h>
> > -#include <drm/drm_irq.h>
> >   #include <drm/drm_vblank.h>
> >   #include <drm/amdgpu_drm.h>
> >   #include <drm/drm_drv.h>
> > @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
> >    * Returns:
> >    * result of handling the IRQ, as defined by &irqreturn_t
> >    */
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> > +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
> >   {
> >       struct drm_device *dev = (struct drm_device *) arg;
> >       struct amdgpu_device *adev = drm_to_adev(dev);
> > @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
> >   int amdgpu_irq_init(struct amdgpu_device *adev)
> >   {
> >       int r = 0;
> > +     unsigned int irq;
> >
> >       spin_lock_init(&adev->irq.lock);
> >
> > @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >       INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
> >       INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
> >
> > -     adev->irq.installed = true;
> > -     /* Use vector 0 for MSI-X */
> > -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
> > +     /* Use vector 0 for MSI-X. */
> > +     r = pci_irq_vector(adev->pdev, 0);
> > +     if (r < 0)
> > +             return r;
> > +     irq = r;
> > +
> > +     /* PCI devices require shared interrupts. */
> > +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
> > +                     adev_to_drm(adev));
> >       if (r) {
> > -             adev->irq.installed = false;
> >               if (!amdgpu_device_has_dc_support(adev))
> >                       flush_work(&adev->hotplug_work);
> >               return r;
> >       }
> > +     adev->irq.installed = true;
> > +     adev->irq.irq = irq;
> >       adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
> >
> >       DRM_DEBUG("amdgpu: irq initialized.\n");
> > @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
> >   void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
> >   {
> >       if (adev->irq.installed) {
> > -             drm_irq_uninstall(&adev->ddev);
> > +             free_irq(adev->irq.irq, adev_to_drm(adev));
> >               adev->irq.installed = false;
> >               if (adev->irq.msi_enabled)
> >                       pci_free_irq_vectors(adev->pdev);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > index 78ad4784cc74..e9f2c11ea416 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
> > @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
> >
> >   struct amdgpu_irq {
> >       bool                            installed;
> > +     unsigned int                    irq;
> >       spinlock_t                      lock;
> >       /* interrupt sources */
> >       struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
> > @@ -100,7 +101,6 @@ struct amdgpu_irq {
> >   };
> >
> >   void amdgpu_irq_disable_all(struct amdgpu_device *adev);
> > -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
> >
> >   int amdgpu_irq_init(struct amdgpu_device *adev);
> >   void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 14/14] drm: IRQ midlayer is now legacy
  2021-07-27 18:27   ` Thomas Zimmermann
  (?)
@ 2021-07-28 14:10     ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 14:10 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:21PM +0200, Thomas Zimmermann wrote:
> Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
> the prefix drm_legacy_, and move declarations to drm_legacy.h.
> In struct drm_device, move the fields irq and irq_enabled behind
> CONFIG_DRM_LEGACY.
> 
> All callers have been updated.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------

You could have pulled it all into drm_legacy_misc.c.


>  drivers/gpu/drm/drm_legacy_misc.c |  3 +-
>  drivers/gpu/drm/drm_vblank.c      |  8 ++--
>  drivers/gpu/drm/i810/i810_dma.c   |  3 +-
>  drivers/gpu/drm/mga/mga_dma.c     |  2 +-
>  drivers/gpu/drm/mga/mga_drv.h     |  1 -
>  drivers/gpu/drm/r128/r128_cce.c   |  3 +-
>  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             | 31 ---------------
>  include/drm/drm_legacy.h          |  3 ++
>  12 files changed, 27 insertions(+), 155 deletions(-)
>  delete mode 100644 include/drm/drm_irq.h

Nice cleanup.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 14/14] drm: IRQ midlayer is now legacy
@ 2021-07-28 14:10     ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 14:10 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:21PM +0200, Thomas Zimmermann wrote:
> Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
> the prefix drm_legacy_, and move declarations to drm_legacy.h.
> In struct drm_device, move the fields irq and irq_enabled behind
> CONFIG_DRM_LEGACY.
> 
> All callers have been updated.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------

You could have pulled it all into drm_legacy_misc.c.


>  drivers/gpu/drm/drm_legacy_misc.c |  3 +-
>  drivers/gpu/drm/drm_vblank.c      |  8 ++--
>  drivers/gpu/drm/i810/i810_dma.c   |  3 +-
>  drivers/gpu/drm/mga/mga_dma.c     |  2 +-
>  drivers/gpu/drm/mga/mga_drv.h     |  1 -
>  drivers/gpu/drm/r128/r128_cce.c   |  3 +-
>  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             | 31 ---------------
>  include/drm/drm_legacy.h          |  3 ++
>  12 files changed, 27 insertions(+), 155 deletions(-)
>  delete mode 100644 include/drm/drm_irq.h

Nice cleanup.

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 14/14] drm: IRQ midlayer is now legacy
@ 2021-07-28 14:10     ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 14:10 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	nicolas.ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:21PM +0200, Thomas Zimmermann wrote:
> Hide the DRM midlayer behind CONFIG_DRM_LEGACY, make functions use
> the prefix drm_legacy_, and move declarations to drm_legacy.h.
> In struct drm_device, move the fields irq and irq_enabled behind
> CONFIG_DRM_LEGACY.
> 
> All callers have been updated.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/drm_irq.c         | 63 ++++---------------------------

You could have pulled it all into drm_legacy_misc.c.


>  drivers/gpu/drm/drm_legacy_misc.c |  3 +-
>  drivers/gpu/drm/drm_vblank.c      |  8 ++--
>  drivers/gpu/drm/i810/i810_dma.c   |  3 +-
>  drivers/gpu/drm/mga/mga_dma.c     |  2 +-
>  drivers/gpu/drm/mga/mga_drv.h     |  1 -
>  drivers/gpu/drm/r128/r128_cce.c   |  3 +-
>  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             | 31 ---------------
>  include/drm/drm_legacy.h          |  3 ++
>  12 files changed, 27 insertions(+), 155 deletions(-)
>  delete mode 100644 include/drm/drm_irq.h

Nice cleanup.

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 14:00     ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28 15:11       ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 15:11 UTC (permalink / raw)
  To: sam, tzimmermann, Dan.Sneddon
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> I hope you can fine to test this patch from Thomas.
> If this works then we can forget about my attempt to do the same.

I'll test this as soon as I can and let you know.

Thanks,
Dan
> 
> Hi Thomas,
> 
> IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
> already.
> 
> With that considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> We shall wait for testing from Dan before you apply it as I had made a
> similar patch that failed to work. I assume my patch was buggy but I
> prefer to be sure.
> 
>          Sam
> 
> On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
>> ---
>>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>>   1 file changed, 52 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> index f09b6dd8754c..cfa8c2c9c8aa 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> @@ -22,7 +22,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_probe_helper.h>
>>   #include <drm/drm_vblank.h>
>>
>> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>>        return IRQ_HANDLED;
>>   }
>>
>> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int cfg = 0;
>> +     int i;
>> +
>> +     /* Enable interrupts on activated layers */
>> +     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> +             if (dc->layers[i])
>> +                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> +     }
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int isr;
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> +     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> +}
>> +
>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>> +{
>> +     int ret;
>> +
>> +     if (irq == IRQ_NOTCONNECTED)
>> +             return -ENOTCONN;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +
>> +     ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     atmel_hlcdc_dc_irq_postinstall(dev);
>> +
>> +     return 0;
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +     free_irq(dc->hlcdc->irq, dev);
>> +}
>> +
>>   static const struct drm_mode_config_funcs mode_config_funcs = {
>>        .fb_create = drm_gem_fb_create,
>>        .atomic_check = drm_atomic_helper_check,
>> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>>        drm_mode_config_reset(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     ret = drm_irq_install(dev, dc->hlcdc->irq);
>> +     ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>>        pm_runtime_put_sync(dev->dev);
>>        if (ret < 0) {
>>                dev_err(dev->dev, "failed to install IRQ handler\n");
>> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        drm_mode_config_cleanup(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     drm_irq_uninstall(dev);
>> +     atmel_hlcdc_dc_irq_uninstall(dev);
>>        pm_runtime_put_sync(dev->dev);
>>
>>        dev->dev_private = NULL;
>> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        clk_disable_unprepare(dc->hlcdc->periph_clk);
>>   }
>>
>> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int cfg = 0;
>> -     int i;
>> -
>> -     /* Enable interrupts on activated layers */
>> -     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> -             if (dc->layers[i])
>> -                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> -     }
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> -
>> -     return 0;
>> -}
>> -
>> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int isr;
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> -     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> -}
>> -
>>   DEFINE_DRM_GEM_CMA_FOPS(fops);
>>
>>   static const struct drm_driver atmel_hlcdc_dc_driver = {
>>        .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -     .irq_handler = atmel_hlcdc_dc_irq_handler,
>> -     .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>> -     .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>> -     .irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>>        DRM_GEM_CMA_DRIVER_OPS,
>>        .fops = &fops,
>>        .name = "atmel-hlcdc",
>> --
>> 2.32.0


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 15:11       ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 15:11 UTC (permalink / raw)
  To: sam, tzimmermann, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> I hope you can fine to test this patch from Thomas.
> If this works then we can forget about my attempt to do the same.

I'll test this as soon as I can and let you know.

Thanks,
Dan
> 
> Hi Thomas,
> 
> IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
> already.
> 
> With that considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> We shall wait for testing from Dan before you apply it as I had made a
> similar patch that failed to work. I assume my patch was buggy but I
> prefer to be sure.
> 
>          Sam
> 
> On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
>> ---
>>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>>   1 file changed, 52 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> index f09b6dd8754c..cfa8c2c9c8aa 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> @@ -22,7 +22,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_probe_helper.h>
>>   #include <drm/drm_vblank.h>
>>
>> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>>        return IRQ_HANDLED;
>>   }
>>
>> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int cfg = 0;
>> +     int i;
>> +
>> +     /* Enable interrupts on activated layers */
>> +     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> +             if (dc->layers[i])
>> +                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> +     }
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int isr;
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> +     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> +}
>> +
>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>> +{
>> +     int ret;
>> +
>> +     if (irq == IRQ_NOTCONNECTED)
>> +             return -ENOTCONN;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +
>> +     ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     atmel_hlcdc_dc_irq_postinstall(dev);
>> +
>> +     return 0;
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +     free_irq(dc->hlcdc->irq, dev);
>> +}
>> +
>>   static const struct drm_mode_config_funcs mode_config_funcs = {
>>        .fb_create = drm_gem_fb_create,
>>        .atomic_check = drm_atomic_helper_check,
>> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>>        drm_mode_config_reset(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     ret = drm_irq_install(dev, dc->hlcdc->irq);
>> +     ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>>        pm_runtime_put_sync(dev->dev);
>>        if (ret < 0) {
>>                dev_err(dev->dev, "failed to install IRQ handler\n");
>> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        drm_mode_config_cleanup(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     drm_irq_uninstall(dev);
>> +     atmel_hlcdc_dc_irq_uninstall(dev);
>>        pm_runtime_put_sync(dev->dev);
>>
>>        dev->dev_private = NULL;
>> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        clk_disable_unprepare(dc->hlcdc->periph_clk);
>>   }
>>
>> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int cfg = 0;
>> -     int i;
>> -
>> -     /* Enable interrupts on activated layers */
>> -     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> -             if (dc->layers[i])
>> -                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> -     }
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> -
>> -     return 0;
>> -}
>> -
>> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int isr;
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> -     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> -}
>> -
>>   DEFINE_DRM_GEM_CMA_FOPS(fops);
>>
>>   static const struct drm_driver atmel_hlcdc_dc_driver = {
>>        .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -     .irq_handler = atmel_hlcdc_dc_irq_handler,
>> -     .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>> -     .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>> -     .irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>>        DRM_GEM_CMA_DRIVER_OPS,
>>        .fops = &fops,
>>        .name = "atmel-hlcdc",
>> --
>> 2.32.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 15:11       ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 15:11 UTC (permalink / raw)
  To: sam, tzimmermann, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> I hope you can fine to test this patch from Thomas.
> If this works then we can forget about my attempt to do the same.

I'll test this as soon as I can and let you know.

Thanks,
Dan
> 
> Hi Thomas,
> 
> IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
> already.
> 
> With that considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> We shall wait for testing from Dan before you apply it as I had made a
> similar patch that failed to work. I assume my patch was buggy but I
> prefer to be sure.
> 
>          Sam
> 
> On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
>> ---
>>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>>   1 file changed, 52 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> index f09b6dd8754c..cfa8c2c9c8aa 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> @@ -22,7 +22,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_probe_helper.h>
>>   #include <drm/drm_vblank.h>
>>
>> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>>        return IRQ_HANDLED;
>>   }
>>
>> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int cfg = 0;
>> +     int i;
>> +
>> +     /* Enable interrupts on activated layers */
>> +     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> +             if (dc->layers[i])
>> +                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> +     }
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int isr;
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> +     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> +}
>> +
>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>> +{
>> +     int ret;
>> +
>> +     if (irq == IRQ_NOTCONNECTED)
>> +             return -ENOTCONN;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +
>> +     ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     atmel_hlcdc_dc_irq_postinstall(dev);
>> +
>> +     return 0;
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +     free_irq(dc->hlcdc->irq, dev);
>> +}
>> +
>>   static const struct drm_mode_config_funcs mode_config_funcs = {
>>        .fb_create = drm_gem_fb_create,
>>        .atomic_check = drm_atomic_helper_check,
>> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>>        drm_mode_config_reset(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     ret = drm_irq_install(dev, dc->hlcdc->irq);
>> +     ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>>        pm_runtime_put_sync(dev->dev);
>>        if (ret < 0) {
>>                dev_err(dev->dev, "failed to install IRQ handler\n");
>> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        drm_mode_config_cleanup(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     drm_irq_uninstall(dev);
>> +     atmel_hlcdc_dc_irq_uninstall(dev);
>>        pm_runtime_put_sync(dev->dev);
>>
>>        dev->dev_private = NULL;
>> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        clk_disable_unprepare(dc->hlcdc->periph_clk);
>>   }
>>
>> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int cfg = 0;
>> -     int i;
>> -
>> -     /* Enable interrupts on activated layers */
>> -     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> -             if (dc->layers[i])
>> -                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> -     }
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> -
>> -     return 0;
>> -}
>> -
>> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int isr;
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> -     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> -}
>> -
>>   DEFINE_DRM_GEM_CMA_FOPS(fops);
>>
>>   static const struct drm_driver atmel_hlcdc_dc_driver = {
>>        .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -     .irq_handler = atmel_hlcdc_dc_irq_handler,
>> -     .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>> -     .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>> -     .irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>>        DRM_GEM_CMA_DRIVER_OPS,
>>        .fops = &fops,
>>        .name = "atmel-hlcdc",
>> --
>> 2.32.0


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 15:11       ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 15:11 UTC (permalink / raw)
  To: sam, tzimmermann, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> I hope you can fine to test this patch from Thomas.
> If this works then we can forget about my attempt to do the same.

I'll test this as soon as I can and let you know.

Thanks,
Dan
> 
> Hi Thomas,
> 
> IRQ_NOTCONNECTED check seems redundant, as mentioned in another patch
> already.
> 
> With that considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> We shall wait for testing from Dan before you apply it as I had made a
> similar patch that failed to work. I assume my patch was buggy but I
> prefer to be sure.
> 
>          Sam
> 
> On Tue, Jul 27, 2021 at 08:27:10PM +0200, 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>
>> ---
>>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 85 ++++++++++++--------
>>   1 file changed, 52 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> index f09b6dd8754c..cfa8c2c9c8aa 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
>> @@ -22,7 +22,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_probe_helper.h>
>>   #include <drm/drm_vblank.h>
>>
>> @@ -557,6 +556,56 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data)
>>        return IRQ_HANDLED;
>>   }
>>
>> +static void atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int cfg = 0;
>> +     int i;
>> +
>> +     /* Enable interrupts on activated layers */
>> +     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> +             if (dc->layers[i])
>> +                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> +     }
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_disable(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +     unsigned int isr;
>> +
>> +     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> +     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> +}
>> +
>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>> +{
>> +     int ret;
>> +
>> +     if (irq == IRQ_NOTCONNECTED)
>> +             return -ENOTCONN;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +
>> +     ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     atmel_hlcdc_dc_irq_postinstall(dev);
>> +
>> +     return 0;
>> +}
>> +
>> +static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> +{
>> +     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> +
>> +     atmel_hlcdc_dc_irq_disable(dev);
>> +     free_irq(dc->hlcdc->irq, dev);
>> +}
>> +
>>   static const struct drm_mode_config_funcs mode_config_funcs = {
>>        .fb_create = drm_gem_fb_create,
>>        .atomic_check = drm_atomic_helper_check,
>> @@ -647,7 +696,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
>>        drm_mode_config_reset(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     ret = drm_irq_install(dev, dc->hlcdc->irq);
>> +     ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq);
>>        pm_runtime_put_sync(dev->dev);
>>        if (ret < 0) {
>>                dev_err(dev->dev, "failed to install IRQ handler\n");
>> @@ -676,7 +725,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        drm_mode_config_cleanup(dev);
>>
>>        pm_runtime_get_sync(dev->dev);
>> -     drm_irq_uninstall(dev);
>> +     atmel_hlcdc_dc_irq_uninstall(dev);
>>        pm_runtime_put_sync(dev->dev);
>>
>>        dev->dev_private = NULL;
>> @@ -685,40 +734,10 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>>        clk_disable_unprepare(dc->hlcdc->periph_clk);
>>   }
>>
>> -static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int cfg = 0;
>> -     int i;
>> -
>> -     /* Enable interrupts on activated layers */
>> -     for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) {
>> -             if (dc->layers[i])
>> -                     cfg |= ATMEL_HLCDC_LAYER_STATUS(i);
>> -     }
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg);
>> -
>> -     return 0;
>> -}
>> -
>> -static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>> -{
>> -     struct atmel_hlcdc_dc *dc = dev->dev_private;
>> -     unsigned int isr;
>> -
>> -     regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff);
>> -     regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr);
>> -}
>> -
>>   DEFINE_DRM_GEM_CMA_FOPS(fops);
>>
>>   static const struct drm_driver atmel_hlcdc_dc_driver = {
>>        .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -     .irq_handler = atmel_hlcdc_dc_irq_handler,
>> -     .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
>> -     .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
>> -     .irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
>>        DRM_GEM_CMA_DRIVER_OPS,
>>        .fops = &fops,
>>        .name = "atmel-hlcdc",
>> --
>> 2.32.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 15:11       ` Dan.Sneddon
  (?)
@ 2021-07-28 15:44         ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 15:44 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> > [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> > 
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Dan,
> > 
> > I hope you can fine to test this patch from Thomas.
> > If this works then we can forget about my attempt to do the same.
> 
> I'll test this as soon as I can and let you know.

Thanks, crossing my fingers... (which explains the funny spelling from
time to time)

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 15:44         ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 15:44 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Dan,

On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> > [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> > 
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Dan,
> > 
> > I hope you can fine to test this patch from Thomas.
> > If this works then we can forget about my attempt to do the same.
> 
> I'll test this as soon as I can and let you know.

Thanks, crossing my fingers... (which explains the funny spelling from
time to time)

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 15:44         ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 15:44 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> > [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> > 
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Dan,
> > 
> > I hope you can fine to test this patch from Thomas.
> > If this works then we can forget about my attempt to do the same.
> 
> I'll test this as soon as I can and let you know.

Thanks, crossing my fingers... (which explains the funny spelling from
time to time)

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 15:44         ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28 17:50           ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 17:50 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: tzimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, bbrezillon,
	Nicolas.Ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> I hope you can fine to test this patch from Thomas.
>>> If this works then we can forget about my attempt to do the same.
>>
>> I'll test this as soon as I can and let you know.
> 
> Thanks, crossing my fingers... (which explains the funny spelling from
> time to time)
> 
>          Sam
> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
graphics demos that come with our linux4sam releases seem to run just 
fine.  modetest -v seems to run just fine.  However, vbltest returns 
"drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks,
Dan

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 17:50           ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 17:50 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> I hope you can fine to test this patch from Thomas.
>>> If this works then we can forget about my attempt to do the same.
>>
>> I'll test this as soon as I can and let you know.
> 
> Thanks, crossing my fingers... (which explains the funny spelling from
> time to time)
> 
>          Sam
> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
graphics demos that come with our linux4sam releases seem to run just 
fine.  modetest -v seems to run just fine.  However, vbltest returns 
"drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks,
Dan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 17:50           ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 17:50 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> I hope you can fine to test this patch from Thomas.
>>> If this works then we can forget about my attempt to do the same.
>>
>> I'll test this as soon as I can and let you know.
> 
> Thanks, crossing my fingers... (which explains the funny spelling from
> time to time)
> 
>          Sam
> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
graphics demos that come with our linux4sam releases seem to run just 
fine.  modetest -v seems to run just fine.  However, vbltest returns 
"drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks,
Dan

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 17:50           ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 17:50 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> I hope you can fine to test this patch from Thomas.
>>> If this works then we can forget about my attempt to do the same.
>>
>> I'll test this as soon as I can and let you know.
> 
> Thanks, crossing my fingers... (which explains the funny spelling from
> time to time)
> 
>          Sam
> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
graphics demos that come with our linux4sam releases seem to run just 
fine.  modetest -v seems to run just fine.  However, vbltest returns 
"drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks,
Dan
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 17:50           ` Dan.Sneddon
  (?)
@ 2021-07-28 18:11             ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 18:11 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

thanks for the quick feedback!

On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Dan,
> > 
> > On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
> >> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> >>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> >>>
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> Hi Dan,
> >>>
> >>> I hope you can fine to test this patch from Thomas.
> >>> If this works then we can forget about my attempt to do the same.
> >>
> >> I'll test this as soon as I can and let you know.
> > 
> > Thanks, crossing my fingers... (which explains the funny spelling from
> > time to time)
> > 
> >          Sam
> > So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
> graphics demos that come with our linux4sam releases seem to run just 
> fine.  modetest -v seems to run just fine.  However, vbltest returns 
> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Strange indeed.


Just to be sure...
Can you confirm that vbltest is working OK *before* this patch?

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:11             ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 18:11 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Dan,

thanks for the quick feedback!

On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Dan,
> > 
> > On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
> >> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> >>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> >>>
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> Hi Dan,
> >>>
> >>> I hope you can fine to test this patch from Thomas.
> >>> If this works then we can forget about my attempt to do the same.
> >>
> >> I'll test this as soon as I can and let you know.
> > 
> > Thanks, crossing my fingers... (which explains the funny spelling from
> > time to time)
> > 
> >          Sam
> > So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
> graphics demos that come with our linux4sam releases seem to run just 
> fine.  modetest -v seems to run just fine.  However, vbltest returns 
> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Strange indeed.


Just to be sure...
Can you confirm that vbltest is working OK *before* this patch?

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:11             ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 18:11 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

thanks for the quick feedback!

On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Dan,
> > 
> > On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
> >> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
> >>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
> >>>
> >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>>
> >>> Hi Dan,
> >>>
> >>> I hope you can fine to test this patch from Thomas.
> >>> If this works then we can forget about my attempt to do the same.
> >>
> >> I'll test this as soon as I can and let you know.
> > 
> > Thanks, crossing my fingers... (which explains the funny spelling from
> > time to time)
> > 
> >          Sam
> > So I ran the test on an A5D27 XULT board with a PDA5 display.  Our 
> graphics demos that come with our linux4sam releases seem to run just 
> fine.  modetest -v seems to run just fine.  However, vbltest returns 
> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why 
> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Strange indeed.


Just to be sure...
Can you confirm that vbltest is working OK *before* this patch?

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
  2021-07-28 13:31     ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28 18:15       ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:15 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 9792 bytes --]

Hi Sam

Am 28.07.21 um 15:31 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
>>
>> Calls to platform_get_irq() can fail with a negative errno code.
>> Abort initialization in this case. The DRM IRQ midlayer does not
>> handle this case correctly.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>>   drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>>   2 files changed, 97 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
>> index 81ae92390736..b9998fe3982f 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
>> @@ -29,7 +29,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_modeset_helper.h>
>>   #include <drm/drm_of.h>
>>   #include <drm/drm_probe_helper.h>
>> @@ -38,6 +37,94 @@
>>   #include "hdlcd_drv.h"
>>   #include "hdlcd_regs.h"
>>   
>> +static irqreturn_t hdlcd_irq(int irq, void *arg)
>> +{
>> +	struct drm_device *drm = arg;
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_status;
>> +
>> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> +		atomic_inc(&hdlcd->buffer_underrun_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> +		atomic_inc(&hdlcd->dma_end_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> +		atomic_inc(&hdlcd->bus_error_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		atomic_inc(&hdlcd->vsync_count);
>> +
>> +#endif
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		drm_crtc_handle_vblank(&hdlcd->crtc);
>> +
>> +	/* acknowledge interrupt(s) */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static void hdlcd_irq_preinstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* Ensure interrupts are disabled */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> +}
>> +
>> +static void hdlcd_irq_postinstall(struct drm_device *drm)
>> +{
>> +#ifdef CONFIG_DEBUG_FS
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +	/* enable debug interrupts */
>> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> +
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +#endif
>> +}
>> +
>> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
> It is inconsistent that the drm_device * is named "dev", as similar
> functions in this patch uses the name "drm".
> 
>> +{
>> +	int ret;
>> +
>> +	if (irq == IRQ_NOTCONNECTED)
>> +		return -ENOTCONN;
> The code above is almost redundandt as request_irq has the same check.
> The only benefit of this check is that we avoid calling
> hdlcd_irq_preinstall().

I'd expect that there's a reason that the code is in _preinstall(). So 
testing for IRQF_NOTCONNECTED in request_irq() might be too late. I'd 
really like to here from driver maintainers that this can be changed.

I agree that the logic is duplicated and the whole thing could be 
simpler. But I rather stick with the original logic as used in 
drm_irq_install(). That function get's it totally wrong BTW.

> 
> And IRQ_NOTCONNECTED is only set for PCI devices which this is not.

Is that guaranteed?

Best regards
Thomas

> So I would thing the if () should be dropped here. ??
> 
> With the inputs considered/addressed:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> 
>> +
>> +	hdlcd_irq_preinstall(dev);
>> +
>> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
>> +	if (ret)
>> +		return ret;
>> +
>> +	hdlcd_irq_postinstall(dev);
>> +
>> +	return 0;
>> +}
>> +
>> +static void hdlcd_irq_uninstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* disable all the interrupts that we might have enabled */
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	/* disable debug interrupts */
>> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> +#endif
>> +
>> +	/* disable vsync interrupts */
>> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +
>> +	free_irq(hdlcd->irq, drm);
>> +}
>> +
>>   static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   {
>>   	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   		goto setup_fail;
>>   	}
>>   
>> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
>> +	ret = platform_get_irq(pdev, 0);
>> +	if (ret < 0)
>> +		goto irq_fail;
>> +	hdlcd->irq = ret;
>> +
>> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>>   	if (ret < 0) {
>>   		DRM_ERROR("failed to install IRQ handler\n");
>>   		goto irq_fail;
>> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>>   	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>>   }
>>   
>> -static irqreturn_t hdlcd_irq(int irq, void *arg)
>> -{
>> -	struct drm_device *drm = arg;
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_status;
>> -
>> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> -		atomic_inc(&hdlcd->buffer_underrun_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> -		atomic_inc(&hdlcd->dma_end_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> -		atomic_inc(&hdlcd->bus_error_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		atomic_inc(&hdlcd->vsync_count);
>> -
>> -#endif
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		drm_crtc_handle_vblank(&hdlcd->crtc);
>> -
>> -	/* acknowledge interrupt(s) */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> -
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static void hdlcd_irq_preinstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* Ensure interrupts are disabled */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> -}
>> -
>> -static int hdlcd_irq_postinstall(struct drm_device *drm)
>> -{
>> -#ifdef CONFIG_DEBUG_FS
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -	/* enable debug interrupts */
>> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -#endif
>> -	return 0;
>> -}
>> -
>> -static void hdlcd_irq_uninstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* disable all the interrupts that we might have enabled */
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	/* disable debug interrupts */
>> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> -#endif
>> -
>> -	/* disable vsync interrupts */
>> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -}
>> -
>>   #ifdef CONFIG_DEBUG_FS
>>   static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>>   {
>> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>>   
>>   static const struct drm_driver hdlcd_driver = {
>>   	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -	.irq_handler = hdlcd_irq,
>> -	.irq_preinstall = hdlcd_irq_preinstall,
>> -	.irq_postinstall = hdlcd_irq_postinstall,
>> -	.irq_uninstall = hdlcd_irq_uninstall,
>>   	DRM_GEM_CMA_DRIVER_OPS,
>>   #ifdef CONFIG_DEBUG_FS
>>   	.debugfs_init = hdlcd_debugfs_init,
>> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>>   err_unload:
>>   	of_node_put(hdlcd->crtc.port);
>>   	hdlcd->crtc.port = NULL;
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	of_reserved_mem_device_release(drm->dev);
>>   err_free:
>>   	drm_mode_config_cleanup(drm);
>> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>>   	hdlcd->crtc.port = NULL;
>>   	pm_runtime_get_sync(dev);
>>   	drm_atomic_helper_shutdown(drm);
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	pm_runtime_put(dev);
>>   	if (pm_runtime_enabled(dev))
>>   		pm_runtime_disable(dev);
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
>> index fd438d177b64..909c39c28487 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
>> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>>   	struct clk			*clk;
>>   	struct drm_crtc			crtc;
>>   	struct drm_plane		*plane;
>> +	unsigned int			irq;
>>   #ifdef CONFIG_DEBUG_FS
>>   	atomic_t buffer_underrun_count;
>>   	atomic_t bus_error_count;
>> -- 
>> 2.32.0

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-28 18:15       ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:15 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 9792 bytes --]

Hi Sam

Am 28.07.21 um 15:31 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
>>
>> Calls to platform_get_irq() can fail with a negative errno code.
>> Abort initialization in this case. The DRM IRQ midlayer does not
>> handle this case correctly.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>>   drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>>   2 files changed, 97 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
>> index 81ae92390736..b9998fe3982f 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
>> @@ -29,7 +29,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_modeset_helper.h>
>>   #include <drm/drm_of.h>
>>   #include <drm/drm_probe_helper.h>
>> @@ -38,6 +37,94 @@
>>   #include "hdlcd_drv.h"
>>   #include "hdlcd_regs.h"
>>   
>> +static irqreturn_t hdlcd_irq(int irq, void *arg)
>> +{
>> +	struct drm_device *drm = arg;
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_status;
>> +
>> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> +		atomic_inc(&hdlcd->buffer_underrun_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> +		atomic_inc(&hdlcd->dma_end_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> +		atomic_inc(&hdlcd->bus_error_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		atomic_inc(&hdlcd->vsync_count);
>> +
>> +#endif
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		drm_crtc_handle_vblank(&hdlcd->crtc);
>> +
>> +	/* acknowledge interrupt(s) */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static void hdlcd_irq_preinstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* Ensure interrupts are disabled */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> +}
>> +
>> +static void hdlcd_irq_postinstall(struct drm_device *drm)
>> +{
>> +#ifdef CONFIG_DEBUG_FS
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +	/* enable debug interrupts */
>> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> +
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +#endif
>> +}
>> +
>> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
> It is inconsistent that the drm_device * is named "dev", as similar
> functions in this patch uses the name "drm".
> 
>> +{
>> +	int ret;
>> +
>> +	if (irq == IRQ_NOTCONNECTED)
>> +		return -ENOTCONN;
> The code above is almost redundandt as request_irq has the same check.
> The only benefit of this check is that we avoid calling
> hdlcd_irq_preinstall().

I'd expect that there's a reason that the code is in _preinstall(). So 
testing for IRQF_NOTCONNECTED in request_irq() might be too late. I'd 
really like to here from driver maintainers that this can be changed.

I agree that the logic is duplicated and the whole thing could be 
simpler. But I rather stick with the original logic as used in 
drm_irq_install(). That function get's it totally wrong BTW.

> 
> And IRQ_NOTCONNECTED is only set for PCI devices which this is not.

Is that guaranteed?

Best regards
Thomas

> So I would thing the if () should be dropped here. ??
> 
> With the inputs considered/addressed:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> 
>> +
>> +	hdlcd_irq_preinstall(dev);
>> +
>> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
>> +	if (ret)
>> +		return ret;
>> +
>> +	hdlcd_irq_postinstall(dev);
>> +
>> +	return 0;
>> +}
>> +
>> +static void hdlcd_irq_uninstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* disable all the interrupts that we might have enabled */
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	/* disable debug interrupts */
>> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> +#endif
>> +
>> +	/* disable vsync interrupts */
>> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +
>> +	free_irq(hdlcd->irq, drm);
>> +}
>> +
>>   static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   {
>>   	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   		goto setup_fail;
>>   	}
>>   
>> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
>> +	ret = platform_get_irq(pdev, 0);
>> +	if (ret < 0)
>> +		goto irq_fail;
>> +	hdlcd->irq = ret;
>> +
>> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>>   	if (ret < 0) {
>>   		DRM_ERROR("failed to install IRQ handler\n");
>>   		goto irq_fail;
>> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>>   	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>>   }
>>   
>> -static irqreturn_t hdlcd_irq(int irq, void *arg)
>> -{
>> -	struct drm_device *drm = arg;
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_status;
>> -
>> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> -		atomic_inc(&hdlcd->buffer_underrun_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> -		atomic_inc(&hdlcd->dma_end_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> -		atomic_inc(&hdlcd->bus_error_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		atomic_inc(&hdlcd->vsync_count);
>> -
>> -#endif
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		drm_crtc_handle_vblank(&hdlcd->crtc);
>> -
>> -	/* acknowledge interrupt(s) */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> -
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static void hdlcd_irq_preinstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* Ensure interrupts are disabled */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> -}
>> -
>> -static int hdlcd_irq_postinstall(struct drm_device *drm)
>> -{
>> -#ifdef CONFIG_DEBUG_FS
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -	/* enable debug interrupts */
>> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -#endif
>> -	return 0;
>> -}
>> -
>> -static void hdlcd_irq_uninstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* disable all the interrupts that we might have enabled */
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	/* disable debug interrupts */
>> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> -#endif
>> -
>> -	/* disable vsync interrupts */
>> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -}
>> -
>>   #ifdef CONFIG_DEBUG_FS
>>   static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>>   {
>> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>>   
>>   static const struct drm_driver hdlcd_driver = {
>>   	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -	.irq_handler = hdlcd_irq,
>> -	.irq_preinstall = hdlcd_irq_preinstall,
>> -	.irq_postinstall = hdlcd_irq_postinstall,
>> -	.irq_uninstall = hdlcd_irq_uninstall,
>>   	DRM_GEM_CMA_DRIVER_OPS,
>>   #ifdef CONFIG_DEBUG_FS
>>   	.debugfs_init = hdlcd_debugfs_init,
>> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>>   err_unload:
>>   	of_node_put(hdlcd->crtc.port);
>>   	hdlcd->crtc.port = NULL;
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	of_reserved_mem_device_release(drm->dev);
>>   err_free:
>>   	drm_mode_config_cleanup(drm);
>> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>>   	hdlcd->crtc.port = NULL;
>>   	pm_runtime_get_sync(dev);
>>   	drm_atomic_helper_shutdown(drm);
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	pm_runtime_put(dev);
>>   	if (pm_runtime_enabled(dev))
>>   		pm_runtime_disable(dev);
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
>> index fd438d177b64..909c39c28487 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
>> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>>   	struct clk			*clk;
>>   	struct drm_crtc			crtc;
>>   	struct drm_plane		*plane;
>> +	unsigned int			irq;
>>   #ifdef CONFIG_DEBUG_FS
>>   	atomic_t buffer_underrun_count;
>>   	atomic_t bus_error_count;
>> -- 
>> 2.32.0

-- 
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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-28 18:15       ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:15 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, nicolas.ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 9792 bytes --]

Hi Sam

Am 28.07.21 um 15:31 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
>>
>> Calls to platform_get_irq() can fail with a negative errno code.
>> Abort initialization in this case. The DRM IRQ midlayer does not
>> handle this case correctly.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>>   drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>>   2 files changed, 97 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
>> index 81ae92390736..b9998fe3982f 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
>> @@ -29,7 +29,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_modeset_helper.h>
>>   #include <drm/drm_of.h>
>>   #include <drm/drm_probe_helper.h>
>> @@ -38,6 +37,94 @@
>>   #include "hdlcd_drv.h"
>>   #include "hdlcd_regs.h"
>>   
>> +static irqreturn_t hdlcd_irq(int irq, void *arg)
>> +{
>> +	struct drm_device *drm = arg;
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_status;
>> +
>> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> +		atomic_inc(&hdlcd->buffer_underrun_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> +		atomic_inc(&hdlcd->dma_end_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> +		atomic_inc(&hdlcd->bus_error_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		atomic_inc(&hdlcd->vsync_count);
>> +
>> +#endif
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		drm_crtc_handle_vblank(&hdlcd->crtc);
>> +
>> +	/* acknowledge interrupt(s) */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static void hdlcd_irq_preinstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* Ensure interrupts are disabled */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> +}
>> +
>> +static void hdlcd_irq_postinstall(struct drm_device *drm)
>> +{
>> +#ifdef CONFIG_DEBUG_FS
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +	/* enable debug interrupts */
>> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> +
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +#endif
>> +}
>> +
>> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
> It is inconsistent that the drm_device * is named "dev", as similar
> functions in this patch uses the name "drm".
> 
>> +{
>> +	int ret;
>> +
>> +	if (irq == IRQ_NOTCONNECTED)
>> +		return -ENOTCONN;
> The code above is almost redundandt as request_irq has the same check.
> The only benefit of this check is that we avoid calling
> hdlcd_irq_preinstall().

I'd expect that there's a reason that the code is in _preinstall(). So 
testing for IRQF_NOTCONNECTED in request_irq() might be too late. I'd 
really like to here from driver maintainers that this can be changed.

I agree that the logic is duplicated and the whole thing could be 
simpler. But I rather stick with the original logic as used in 
drm_irq_install(). That function get's it totally wrong BTW.

> 
> And IRQ_NOTCONNECTED is only set for PCI devices which this is not.

Is that guaranteed?

Best regards
Thomas

> So I would thing the if () should be dropped here. ??
> 
> With the inputs considered/addressed:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> 
>> +
>> +	hdlcd_irq_preinstall(dev);
>> +
>> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
>> +	if (ret)
>> +		return ret;
>> +
>> +	hdlcd_irq_postinstall(dev);
>> +
>> +	return 0;
>> +}
>> +
>> +static void hdlcd_irq_uninstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* disable all the interrupts that we might have enabled */
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	/* disable debug interrupts */
>> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> +#endif
>> +
>> +	/* disable vsync interrupts */
>> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +
>> +	free_irq(hdlcd->irq, drm);
>> +}
>> +
>>   static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   {
>>   	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   		goto setup_fail;
>>   	}
>>   
>> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
>> +	ret = platform_get_irq(pdev, 0);
>> +	if (ret < 0)
>> +		goto irq_fail;
>> +	hdlcd->irq = ret;
>> +
>> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>>   	if (ret < 0) {
>>   		DRM_ERROR("failed to install IRQ handler\n");
>>   		goto irq_fail;
>> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>>   	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>>   }
>>   
>> -static irqreturn_t hdlcd_irq(int irq, void *arg)
>> -{
>> -	struct drm_device *drm = arg;
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_status;
>> -
>> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> -		atomic_inc(&hdlcd->buffer_underrun_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> -		atomic_inc(&hdlcd->dma_end_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> -		atomic_inc(&hdlcd->bus_error_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		atomic_inc(&hdlcd->vsync_count);
>> -
>> -#endif
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		drm_crtc_handle_vblank(&hdlcd->crtc);
>> -
>> -	/* acknowledge interrupt(s) */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> -
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static void hdlcd_irq_preinstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* Ensure interrupts are disabled */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> -}
>> -
>> -static int hdlcd_irq_postinstall(struct drm_device *drm)
>> -{
>> -#ifdef CONFIG_DEBUG_FS
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -	/* enable debug interrupts */
>> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -#endif
>> -	return 0;
>> -}
>> -
>> -static void hdlcd_irq_uninstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* disable all the interrupts that we might have enabled */
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	/* disable debug interrupts */
>> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> -#endif
>> -
>> -	/* disable vsync interrupts */
>> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -}
>> -
>>   #ifdef CONFIG_DEBUG_FS
>>   static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>>   {
>> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>>   
>>   static const struct drm_driver hdlcd_driver = {
>>   	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -	.irq_handler = hdlcd_irq,
>> -	.irq_preinstall = hdlcd_irq_preinstall,
>> -	.irq_postinstall = hdlcd_irq_postinstall,
>> -	.irq_uninstall = hdlcd_irq_uninstall,
>>   	DRM_GEM_CMA_DRIVER_OPS,
>>   #ifdef CONFIG_DEBUG_FS
>>   	.debugfs_init = hdlcd_debugfs_init,
>> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>>   err_unload:
>>   	of_node_put(hdlcd->crtc.port);
>>   	hdlcd->crtc.port = NULL;
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	of_reserved_mem_device_release(drm->dev);
>>   err_free:
>>   	drm_mode_config_cleanup(drm);
>> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>>   	hdlcd->crtc.port = NULL;
>>   	pm_runtime_get_sync(dev);
>>   	drm_atomic_helper_shutdown(drm);
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	pm_runtime_put(dev);
>>   	if (pm_runtime_enabled(dev))
>>   		pm_runtime_disable(dev);
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
>> index fd438d177b64..909c39c28487 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
>> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>>   	struct clk			*clk;
>>   	struct drm_crtc			crtc;
>>   	struct drm_plane		*plane;
>> +	unsigned int			irq;
>>   #ifdef CONFIG_DEBUG_FS
>>   	atomic_t buffer_underrun_count;
>>   	atomic_t bus_error_count;
>> -- 
>> 2.32.0

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 02/14] drm/arm/hdlcd: Convert to Linux IRQ interfaces
@ 2021-07-28 18:15       ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:15 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	nicolas.ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 9792 bytes --]

Hi Sam

Am 28.07.21 um 15:31 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:09PM +0200, 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.
>>
>> Calls to platform_get_irq() can fail with a negative errno code.
>> Abort initialization in this case. The DRM IRQ midlayer does not
>> handle this case correctly.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/arm/hdlcd_drv.c | 174 ++++++++++++++++++--------------
>>   drivers/gpu/drm/arm/hdlcd_drv.h |   1 +
>>   2 files changed, 97 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
>> index 81ae92390736..b9998fe3982f 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
>> @@ -29,7 +29,6 @@
>>   #include <drm/drm_fb_helper.h>
>>   #include <drm/drm_gem_cma_helper.h>
>>   #include <drm/drm_gem_framebuffer_helper.h>
>> -#include <drm/drm_irq.h>
>>   #include <drm/drm_modeset_helper.h>
>>   #include <drm/drm_of.h>
>>   #include <drm/drm_probe_helper.h>
>> @@ -38,6 +37,94 @@
>>   #include "hdlcd_drv.h"
>>   #include "hdlcd_regs.h"
>>   
>> +static irqreturn_t hdlcd_irq(int irq, void *arg)
>> +{
>> +	struct drm_device *drm = arg;
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_status;
>> +
>> +	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> +		atomic_inc(&hdlcd->buffer_underrun_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> +		atomic_inc(&hdlcd->dma_end_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> +		atomic_inc(&hdlcd->bus_error_count);
>> +
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		atomic_inc(&hdlcd->vsync_count);
>> +
>> +#endif
>> +	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> +		drm_crtc_handle_vblank(&hdlcd->crtc);
>> +
>> +	/* acknowledge interrupt(s) */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static void hdlcd_irq_preinstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* Ensure interrupts are disabled */
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> +}
>> +
>> +static void hdlcd_irq_postinstall(struct drm_device *drm)
>> +{
>> +#ifdef CONFIG_DEBUG_FS
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +	/* enable debug interrupts */
>> +	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> +
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +#endif
>> +}
>> +
>> +static int hdlcd_irq_install(struct drm_device *dev, int irq)
> It is inconsistent that the drm_device * is named "dev", as similar
> functions in this patch uses the name "drm".
> 
>> +{
>> +	int ret;
>> +
>> +	if (irq == IRQ_NOTCONNECTED)
>> +		return -ENOTCONN;
> The code above is almost redundandt as request_irq has the same check.
> The only benefit of this check is that we avoid calling
> hdlcd_irq_preinstall().

I'd expect that there's a reason that the code is in _preinstall(). So 
testing for IRQF_NOTCONNECTED in request_irq() might be too late. I'd 
really like to here from driver maintainers that this can be changed.

I agree that the logic is duplicated and the whole thing could be 
simpler. But I rather stick with the original logic as used in 
drm_irq_install(). That function get's it totally wrong BTW.

> 
> And IRQ_NOTCONNECTED is only set for PCI devices which this is not.

Is that guaranteed?

Best regards
Thomas

> So I would thing the if () should be dropped here. ??
> 
> With the inputs considered/addressed:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> 
> 
>> +
>> +	hdlcd_irq_preinstall(dev);
>> +
>> +	ret = request_irq(irq, hdlcd_irq, 0, dev->driver->name, dev);
>> +	if (ret)
>> +		return ret;
>> +
>> +	hdlcd_irq_postinstall(dev);
>> +
>> +	return 0;
>> +}
>> +
>> +static void hdlcd_irq_uninstall(struct drm_device *drm)
>> +{
>> +	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> +	/* disable all the interrupts that we might have enabled */
>> +	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> +
>> +#ifdef CONFIG_DEBUG_FS
>> +	/* disable debug interrupts */
>> +	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> +#endif
>> +
>> +	/* disable vsync interrupts */
>> +	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> +	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> +
>> +	free_irq(hdlcd->irq, drm);
>> +}
>> +
>>   static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   {
>>   	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> @@ -90,7 +177,12 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
>>   		goto setup_fail;
>>   	}
>>   
>> -	ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
>> +	ret = platform_get_irq(pdev, 0);
>> +	if (ret < 0)
>> +		goto irq_fail;
>> +	hdlcd->irq = ret;
>> +
>> +	ret = hdlcd_irq_install(drm, hdlcd->irq);
>>   	if (ret < 0) {
>>   		DRM_ERROR("failed to install IRQ handler\n");
>>   		goto irq_fail;
>> @@ -122,76 +214,6 @@ static void hdlcd_setup_mode_config(struct drm_device *drm)
>>   	drm->mode_config.funcs = &hdlcd_mode_config_funcs;
>>   }
>>   
>> -static irqreturn_t hdlcd_irq(int irq, void *arg)
>> -{
>> -	struct drm_device *drm = arg;
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_status;
>> -
>> -	irq_status = hdlcd_read(hdlcd, HDLCD_REG_INT_STATUS);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	if (irq_status & HDLCD_INTERRUPT_UNDERRUN)
>> -		atomic_inc(&hdlcd->buffer_underrun_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_DMA_END)
>> -		atomic_inc(&hdlcd->dma_end_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_BUS_ERROR)
>> -		atomic_inc(&hdlcd->bus_error_count);
>> -
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		atomic_inc(&hdlcd->vsync_count);
>> -
>> -#endif
>> -	if (irq_status & HDLCD_INTERRUPT_VSYNC)
>> -		drm_crtc_handle_vblank(&hdlcd->crtc);
>> -
>> -	/* acknowledge interrupt(s) */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
>> -
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static void hdlcd_irq_preinstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* Ensure interrupts are disabled */
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, 0);
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, ~0);
>> -}
>> -
>> -static int hdlcd_irq_postinstall(struct drm_device *drm)
>> -{
>> -#ifdef CONFIG_DEBUG_FS
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -	/* enable debug interrupts */
>> -	irq_mask |= HDLCD_DEBUG_INT_MASK;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -#endif
>> -	return 0;
>> -}
>> -
>> -static void hdlcd_irq_uninstall(struct drm_device *drm)
>> -{
>> -	struct hdlcd_drm_private *hdlcd = drm->dev_private;
>> -	/* disable all the interrupts that we might have enabled */
>> -	unsigned long irq_mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
>> -
>> -#ifdef CONFIG_DEBUG_FS
>> -	/* disable debug interrupts */
>> -	irq_mask &= ~HDLCD_DEBUG_INT_MASK;
>> -#endif
>> -
>> -	/* disable vsync interrupts */
>> -	irq_mask &= ~HDLCD_INTERRUPT_VSYNC;
>> -
>> -	hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, irq_mask);
>> -}
>> -
>>   #ifdef CONFIG_DEBUG_FS
>>   static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
>>   {
>> @@ -236,10 +258,6 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
>>   
>>   static const struct drm_driver hdlcd_driver = {
>>   	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>> -	.irq_handler = hdlcd_irq,
>> -	.irq_preinstall = hdlcd_irq_preinstall,
>> -	.irq_postinstall = hdlcd_irq_postinstall,
>> -	.irq_uninstall = hdlcd_irq_uninstall,
>>   	DRM_GEM_CMA_DRIVER_OPS,
>>   #ifdef CONFIG_DEBUG_FS
>>   	.debugfs_init = hdlcd_debugfs_init,
>> @@ -316,7 +334,7 @@ static int hdlcd_drm_bind(struct device *dev)
>>   err_unload:
>>   	of_node_put(hdlcd->crtc.port);
>>   	hdlcd->crtc.port = NULL;
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	of_reserved_mem_device_release(drm->dev);
>>   err_free:
>>   	drm_mode_config_cleanup(drm);
>> @@ -338,7 +356,7 @@ static void hdlcd_drm_unbind(struct device *dev)
>>   	hdlcd->crtc.port = NULL;
>>   	pm_runtime_get_sync(dev);
>>   	drm_atomic_helper_shutdown(drm);
>> -	drm_irq_uninstall(drm);
>> +	hdlcd_irq_uninstall(drm);
>>   	pm_runtime_put(dev);
>>   	if (pm_runtime_enabled(dev))
>>   		pm_runtime_disable(dev);
>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
>> index fd438d177b64..909c39c28487 100644
>> --- a/drivers/gpu/drm/arm/hdlcd_drv.h
>> +++ b/drivers/gpu/drm/arm/hdlcd_drv.h
>> @@ -11,6 +11,7 @@ struct hdlcd_drm_private {
>>   	struct clk			*clk;
>>   	struct drm_crtc			crtc;
>>   	struct drm_plane		*plane;
>> +	unsigned int			irq;
>>   #ifdef CONFIG_DEBUG_FS
>>   	atomic_t buffer_underrun_count;
>>   	atomic_t bus_error_count;
>> -- 
>> 2.32.0

-- 
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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 18:11             ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28 18:17               ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:17 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1947 bytes --]

Hi

Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks for testing.

> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?

Yes, can you please verify that it regressed. If so, this would mean 
that the driver misses vblank interrupts with the patch applied.

Best regards
Thomas

> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:17               ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:17 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1947 bytes --]

Hi

Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks for testing.

> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?

Yes, can you please verify that it regressed. If so, this would mean 
that the driver misses vblank interrupts with the patch applied.

Best regards
Thomas

> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:17               ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:17 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 1947 bytes --]

Hi

Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks for testing.

> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?

Yes, can you please verify that it regressed. If so, this would mean 
that the driver misses vblank interrupts with the patch applied.

Best regards
Thomas

> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:17               ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-28 18:17 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1947 bytes --]

Hi

Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.

Thanks for testing.

> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?

Yes, can you please verify that it regressed. If so, this would mean 
that the driver misses vblank interrupts with the patch applied.

Best regards
Thomas

> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 18:11             ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28 18:19               ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: tzimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, bbrezillon,
	Nicolas.Ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 7/28/21 11:11 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?
> 
>          Sam
> 
I'm afraid vbltest works without the patch, but not with it.

Dan

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:19               ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

On 7/28/21 11:11 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?
> 
>          Sam
> 
I'm afraid vbltest works without the patch, but not with it.

Dan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:19               ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

On 7/28/21 11:11 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?
> 
>          Sam
> 
I'm afraid vbltest works without the patch, but not with it.

Dan

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:19               ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

On 7/28/21 11:11 AM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
> thanks for the quick feedback!
> 
> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> Hi Dan,
>>>
>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com wrote:
>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>> [You don't often get email from sam@ravnborg.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Hi Dan,
>>>>>
>>>>> I hope you can fine to test this patch from Thomas.
>>>>> If this works then we can forget about my attempt to do the same.
>>>>
>>>> I'll test this as soon as I can and let you know.
>>>
>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>> time to time)
>>>
>>>           Sam
>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>> graphics demos that come with our linux4sam releases seem to run just
>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Strange indeed.
> 
> 
> Just to be sure...
> Can you confirm that vbltest is working OK *before* this patch?
> 
>          Sam
> 
I'm afraid vbltest works without the patch, but not with it.

Dan
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 18:17               ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-28 18:46                 ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:46 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

Hi Thomas,

On 7/28/21 11:17 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>> thanks for the quick feedback!
>>
>> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com 
>> wrote:
>>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>> know the content is safe
>>>>
>>>> Hi Dan,
>>>>
>>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com 
>>>> wrote:
>>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>>> [You don't often get email from sam@ravnborg.org. Learn why this 
>>>>>> is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>>
>>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>>>> know the content is safe
>>>>>>
>>>>>> Hi Dan,
>>>>>>
>>>>>> I hope you can fine to test this patch from Thomas.
>>>>>> If this works then we can forget about my attempt to do the same.
>>>>>
>>>>> I'll test this as soon as I can and let you know.
>>>>
>>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>>> time to time)
>>>>
>>>>           Sam
>>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>>> graphics demos that come with our linux4sam releases seem to run just
>>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Thanks for testing.
> 
>>
>> Strange indeed.
>>
>>
>> Just to be sure...
>> Can you confirm that vbltest is working OK *before* this patch?
> 
> Yes, can you please verify that it regressed. If so, this would mean 
> that the driver misses vblank interrupts with the patch applied.

Yes, unfortunately the vbltest works before this patch, but fails after 
this patch is applied.

Best Regards,
Dan

> 
> Best regards
> Thomas
> 
>>
>>     Sam
>>
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:46                 ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:46 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

On 7/28/21 11:17 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>> thanks for the quick feedback!
>>
>> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com 
>> wrote:
>>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>> know the content is safe
>>>>
>>>> Hi Dan,
>>>>
>>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com 
>>>> wrote:
>>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>>> [You don't often get email from sam@ravnborg.org. Learn why this 
>>>>>> is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>>
>>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>>>> know the content is safe
>>>>>>
>>>>>> Hi Dan,
>>>>>>
>>>>>> I hope you can fine to test this patch from Thomas.
>>>>>> If this works then we can forget about my attempt to do the same.
>>>>>
>>>>> I'll test this as soon as I can and let you know.
>>>>
>>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>>> time to time)
>>>>
>>>>           Sam
>>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>>> graphics demos that come with our linux4sam releases seem to run just
>>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Thanks for testing.
> 
>>
>> Strange indeed.
>>
>>
>> Just to be sure...
>> Can you confirm that vbltest is working OK *before* this patch?
> 
> Yes, can you please verify that it regressed. If so, this would mean 
> that the driver misses vblank interrupts with the patch applied.

Yes, unfortunately the vbltest works before this patch, but fails after 
this patch is applied.

Best Regards,
Dan

> 
> Best regards
> Thomas
> 
>>
>>     Sam
>>
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:46                 ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:46 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

Hi Thomas,

On 7/28/21 11:17 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>> thanks for the quick feedback!
>>
>> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com 
>> wrote:
>>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>> know the content is safe
>>>>
>>>> Hi Dan,
>>>>
>>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com 
>>>> wrote:
>>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>>> [You don't often get email from sam@ravnborg.org. Learn why this 
>>>>>> is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>>
>>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>>>> know the content is safe
>>>>>>
>>>>>> Hi Dan,
>>>>>>
>>>>>> I hope you can fine to test this patch from Thomas.
>>>>>> If this works then we can forget about my attempt to do the same.
>>>>>
>>>>> I'll test this as soon as I can and let you know.
>>>>
>>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>>> time to time)
>>>>
>>>>           Sam
>>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>>> graphics demos that come with our linux4sam releases seem to run just
>>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Thanks for testing.
> 
>>
>> Strange indeed.
>>
>>
>> Just to be sure...
>> Can you confirm that vbltest is working OK *before* this patch?
> 
> Yes, can you please verify that it regressed. If so, this would mean 
> that the driver misses vblank interrupts with the patch applied.

Yes, unfortunately the vbltest works before this patch, but fails after 
this patch is applied.

Best Regards,
Dan

> 
> Best regards
> Thomas
> 
>>
>>     Sam
>>
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 18:46                 ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 18:46 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

On 7/28/21 11:17 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 20:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>> thanks for the quick feedback!
>>
>> On Wed, Jul 28, 2021 at 05:50:34PM +0000, Dan.Sneddon@microchip.com 
>> wrote:
>>> On 7/28/21 8:44 AM, Sam Ravnborg wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>> know the content is safe
>>>>
>>>> Hi Dan,
>>>>
>>>> On Wed, Jul 28, 2021 at 03:11:08PM +0000, Dan.Sneddon@microchip.com 
>>>> wrote:
>>>>> On 7/28/21 7:00 AM, Sam Ravnborg wrote:
>>>>>> [You don't often get email from sam@ravnborg.org. Learn why this 
>>>>>> is important at http://aka.ms/LearnAboutSenderIdentification.]
>>>>>>
>>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>>>>> know the content is safe
>>>>>>
>>>>>> Hi Dan,
>>>>>>
>>>>>> I hope you can fine to test this patch from Thomas.
>>>>>> If this works then we can forget about my attempt to do the same.
>>>>>
>>>>> I'll test this as soon as I can and let you know.
>>>>
>>>> Thanks, crossing my fingers... (which explains the funny spelling from
>>>> time to time)
>>>>
>>>>           Sam
>>>> So I ran the test on an A5D27 XULT board with a PDA5 display.  Our
>>> graphics demos that come with our linux4sam releases seem to run just
>>> fine.  modetest -v seems to run just fine.  However, vbltest returns
>>> "drmWaitVBlank (relative) failed ret: -1".  I don't understand why
>>> modetest -v is working and vbltest isn't, but that's what I'm seeing.
> 
> Thanks for testing.
> 
>>
>> Strange indeed.
>>
>>
>> Just to be sure...
>> Can you confirm that vbltest is working OK *before* this patch?
> 
> Yes, can you please verify that it regressed. If so, this would mean 
> that the driver misses vblank interrupts with the patch applied.

Yes, unfortunately the vbltest works before this patch, but fails after 
this patch is applied.

Best Regards,
Dan

> 
> Best regards
> Thomas
> 
>>
>>     Sam
>>
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 18:46                 ` Dan.Sneddon
  (?)
@ 2021-07-28 19:08                   ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 19:08 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

> >>
> >> Just to be sure...
> >> Can you confirm that vbltest is working OK *before* this patch?
> > 
> > Yes, can you please verify that it regressed. If so, this would mean 
> > that the driver misses vblank interrupts with the patch applied.
> 
> Yes, unfortunately the vbltest works before this patch, but fails after 
> this patch is applied.

I think I got it - we need to set irq_enabled to true.
The documentation says so:
"
	 * @irq_enabled:
	 *
	 * Indicates that interrupt handling is enabled, specifically vblank
	 * handling. Drivers which don't use drm_irq_install() need to set this
	 * to true manually.
"

Can you try to add the following line:


+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+       int ret;
+
+       if (irq == IRQ_NOTCONNECTED)
+               return -ENOTCONN;
+

	dev->irq_enabled = true;		<= THIS LINE


+       atmel_hlcdc_dc_irq_disable(dev);
+
+       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+       if (ret)
+               return ret;

I hope this fixes it.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 19:08                   ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 19:08 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Dan,

> >>
> >> Just to be sure...
> >> Can you confirm that vbltest is working OK *before* this patch?
> > 
> > Yes, can you please verify that it regressed. If so, this would mean 
> > that the driver misses vblank interrupts with the patch applied.
> 
> Yes, unfortunately the vbltest works before this patch, but fails after 
> this patch is applied.

I think I got it - we need to set irq_enabled to true.
The documentation says so:
"
	 * @irq_enabled:
	 *
	 * Indicates that interrupt handling is enabled, specifically vblank
	 * handling. Drivers which don't use drm_irq_install() need to set this
	 * to true manually.
"

Can you try to add the following line:


+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+       int ret;
+
+       if (irq == IRQ_NOTCONNECTED)
+               return -ENOTCONN;
+

	dev->irq_enabled = true;		<= THIS LINE


+       atmel_hlcdc_dc_irq_disable(dev);
+
+       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+       if (ret)
+               return ret;

I hope this fixes it.

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 19:08                   ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 19:08 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

> >>
> >> Just to be sure...
> >> Can you confirm that vbltest is working OK *before* this patch?
> > 
> > Yes, can you please verify that it regressed. If so, this would mean 
> > that the driver misses vblank interrupts with the patch applied.
> 
> Yes, unfortunately the vbltest works before this patch, but fails after 
> this patch is applied.

I think I got it - we need to set irq_enabled to true.
The documentation says so:
"
	 * @irq_enabled:
	 *
	 * Indicates that interrupt handling is enabled, specifically vblank
	 * handling. Drivers which don't use drm_irq_install() need to set this
	 * to true manually.
"

Can you try to add the following line:


+static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
+{
+       int ret;
+
+       if (irq == IRQ_NOTCONNECTED)
+               return -ENOTCONN;
+

	dev->irq_enabled = true;		<= THIS LINE


+       atmel_hlcdc_dc_irq_disable(dev);
+
+       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
+       if (ret)
+               return ret;

I hope this fixes it.

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 19:08                   ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-28 19:19                     ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 19:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: tzimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, bbrezillon,
	Nicolas.Ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

Hi Sam,
On 7/28/21 12:08 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
>>>>
>>>> Just to be sure...
>>>> Can you confirm that vbltest is working OK *before* this patch?
>>>
>>> Yes, can you please verify that it regressed. If so, this would mean
>>> that the driver misses vblank interrupts with the patch applied.
>>
>> Yes, unfortunately the vbltest works before this patch, but fails after
>> this patch is applied.
> 
> I think I got it - we need to set irq_enabled to true.
> The documentation says so:
> "
>           * @irq_enabled:
>           *
>           * Indicates that interrupt handling is enabled, specifically vblank
>           * handling. Drivers which don't use drm_irq_install() need to set this
>           * to true manually.
> "
> 
> Can you try to add the following line:
> 
> 
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> 
>          dev->irq_enabled = true;                <= THIS LINE
> 
> 
> +       atmel_hlcdc_dc_irq_disable(dev);
> +
> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> 
> I hope this fixes it.

It does!  With the irq_enabled line added everything is looking good.

Best Regards,
Dan

> 
>          Sam
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 19:19                     ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 19:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

Hi Sam,
On 7/28/21 12:08 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
>>>>
>>>> Just to be sure...
>>>> Can you confirm that vbltest is working OK *before* this patch?
>>>
>>> Yes, can you please verify that it regressed. If so, this would mean
>>> that the driver misses vblank interrupts with the patch applied.
>>
>> Yes, unfortunately the vbltest works before this patch, but fails after
>> this patch is applied.
> 
> I think I got it - we need to set irq_enabled to true.
> The documentation says so:
> "
>           * @irq_enabled:
>           *
>           * Indicates that interrupt handling is enabled, specifically vblank
>           * handling. Drivers which don't use drm_irq_install() need to set this
>           * to true manually.
> "
> 
> Can you try to add the following line:
> 
> 
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> 
>          dev->irq_enabled = true;                <= THIS LINE
> 
> 
> +       atmel_hlcdc_dc_irq_disable(dev);
> +
> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> 
> I hope this fixes it.

It does!  With the irq_enabled line added everything is looking good.

Best Regards,
Dan

> 
>          Sam
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 19:19                     ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 19:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Sam,
On 7/28/21 12:08 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
>>>>
>>>> Just to be sure...
>>>> Can you confirm that vbltest is working OK *before* this patch?
>>>
>>> Yes, can you please verify that it regressed. If so, this would mean
>>> that the driver misses vblank interrupts with the patch applied.
>>
>> Yes, unfortunately the vbltest works before this patch, but fails after
>> this patch is applied.
> 
> I think I got it - we need to set irq_enabled to true.
> The documentation says so:
> "
>           * @irq_enabled:
>           *
>           * Indicates that interrupt handling is enabled, specifically vblank
>           * handling. Drivers which don't use drm_irq_install() need to set this
>           * to true manually.
> "
> 
> Can you try to add the following line:
> 
> 
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> 
>          dev->irq_enabled = true;                <= THIS LINE
> 
> 
> +       atmel_hlcdc_dc_irq_disable(dev);
> +
> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> 
> I hope this fixes it.

It does!  With the irq_enabled line added everything is looking good.

Best Regards,
Dan

> 
>          Sam
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 19:19                     ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-28 19:19 UTC (permalink / raw)
  To: sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Sam,
On 7/28/21 12:08 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Dan,
> 
>>>>
>>>> Just to be sure...
>>>> Can you confirm that vbltest is working OK *before* this patch?
>>>
>>> Yes, can you please verify that it regressed. If so, this would mean
>>> that the driver misses vblank interrupts with the patch applied.
>>
>> Yes, unfortunately the vbltest works before this patch, but fails after
>> this patch is applied.
> 
> I think I got it - we need to set irq_enabled to true.
> The documentation says so:
> "
>           * @irq_enabled:
>           *
>           * Indicates that interrupt handling is enabled, specifically vblank
>           * handling. Drivers which don't use drm_irq_install() need to set this
>           * to true manually.
> "
> 
> Can you try to add the following line:
> 
> 
> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> +{
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> 
>          dev->irq_enabled = true;                <= THIS LINE
> 
> 
> +       atmel_hlcdc_dc_irq_disable(dev);
> +
> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> 
> I hope this fixes it.

It does!  With the irq_enabled line added everything is looking good.

Best Regards,
Dan

> 
>          Sam
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 19:19                     ` Dan.Sneddon
  (?)
@ 2021-07-28 20:11                       ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 20:11 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, kernel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, tzimmermann,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

> > 
> > I think I got it - we need to set irq_enabled to true.
> > The documentation says so:
> > "
> >           * @irq_enabled:
> >           *
> >           * Indicates that interrupt handling is enabled, specifically vblank
> >           * handling. Drivers which don't use drm_irq_install() need to set this
> >           * to true manually.
> > "
> > 
> > Can you try to add the following line:
> > 
> > 
> > +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> > +{
> > +       int ret;
> > +
> > +       if (irq == IRQ_NOTCONNECTED)
> > +               return -ENOTCONN;
> > +
> > 
> >          dev->irq_enabled = true;                <= THIS LINE
> > 
> > 
> > +       atmel_hlcdc_dc_irq_disable(dev);
> > +
> > +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> > +       if (ret)
> > +               return ret;
> > 
> > I hope this fixes it.
> 
> It does!  With the irq_enabled line added everything is looking good.

Great, thanks for testing.

Thomas - I assume you will do a re-spin and there is likely some fixes
for the applied IRQ conversions too.

Note - irq_enabled must be cleared if request_irq fails. I did not
include this in the testing here.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 20:11                       ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 20:11 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, tzimmermann, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Dan,

> > 
> > I think I got it - we need to set irq_enabled to true.
> > The documentation says so:
> > "
> >           * @irq_enabled:
> >           *
> >           * Indicates that interrupt handling is enabled, specifically vblank
> >           * handling. Drivers which don't use drm_irq_install() need to set this
> >           * to true manually.
> > "
> > 
> > Can you try to add the following line:
> > 
> > 
> > +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> > +{
> > +       int ret;
> > +
> > +       if (irq == IRQ_NOTCONNECTED)
> > +               return -ENOTCONN;
> > +
> > 
> >          dev->irq_enabled = true;                <= THIS LINE
> > 
> > 
> > +       atmel_hlcdc_dc_irq_disable(dev);
> > +
> > +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> > +       if (ret)
> > +               return ret;
> > 
> > I hope this fixes it.
> 
> It does!  With the irq_enabled line added everything is looking good.

Great, thanks for testing.

Thomas - I assume you will do a re-spin and there is likely some fixes
for the applied IRQ conversions too.

Note - irq_enabled must be cleared if request_irq fails. I did not
include this in the testing here.

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-28 20:11                       ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-28 20:11 UTC (permalink / raw)
  To: Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, tzimmermann,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, daniel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Dan,

> > 
> > I think I got it - we need to set irq_enabled to true.
> > The documentation says so:
> > "
> >           * @irq_enabled:
> >           *
> >           * Indicates that interrupt handling is enabled, specifically vblank
> >           * handling. Drivers which don't use drm_irq_install() need to set this
> >           * to true manually.
> > "
> > 
> > Can you try to add the following line:
> > 
> > 
> > +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
> > +{
> > +       int ret;
> > +
> > +       if (irq == IRQ_NOTCONNECTED)
> > +               return -ENOTCONN;
> > +
> > 
> >          dev->irq_enabled = true;                <= THIS LINE
> > 
> > 
> > +       atmel_hlcdc_dc_irq_disable(dev);
> > +
> > +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
> > +       if (ret)
> > +               return ret;
> > 
> > I hope this fixes it.
> 
> It does!  With the irq_enabled line added everything is looking good.

Great, thanks for testing.

Thomas - I assume you will do a re-spin and there is likely some fixes
for the applied IRQ conversions too.

Note - irq_enabled must be cleared if request_irq fails. I did not
include this in the testing here.

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
  2021-07-27 18:27   ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-29  7:02     ` Tomi Valkeinen
  -1 siblings, 0 replies; 172+ messages in thread
From: Tomi Valkeinen @ 2021-07-29  7:02 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, sam, bbrezillon,
	nicolas.ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 27/07/2021 21:27, 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>
> ---
>   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 +---
>   4 files changed, 32 insertions(+), 16 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Works fine on AM6 EVM. Some cleanups can be done in tidss_irq_install(), 
but those can be done later.

  Tomi

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
@ 2021-07-29  7:02     ` Tomi Valkeinen
  0 siblings, 0 replies; 172+ messages in thread
From: Tomi Valkeinen @ 2021-07-29  7:02 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, sam, bbrezillon,
	nicolas.ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha
  Cc: amd-gfx, dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 27/07/2021 21:27, 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>
> ---
>   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 +---
>   4 files changed, 32 insertions(+), 16 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Works fine on AM6 EVM. Some cleanups can be done in tidss_irq_install(), 
but those can be done later.

  Tomi

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
@ 2021-07-29  7:02     ` Tomi Valkeinen
  0 siblings, 0 replies; 172+ messages in thread
From: Tomi Valkeinen @ 2021-07-29  7:02 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, sam, bbrezillon,
	nicolas.ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha
  Cc: linux-arm-kernel, linux-arm-msm, freedreno, dri-devel, amd-gfx

On 27/07/2021 21:27, 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>
> ---
>   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 +---
>   4 files changed, 32 insertions(+), 16 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Works fine on AM6 EVM. Some cleanups can be done in tidss_irq_install(), 
but those can be done later.

  Tomi

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 10/14] drm/tidss: Convert to Linux IRQ interfaces
@ 2021-07-29  7:02     ` Tomi Valkeinen
  0 siblings, 0 replies; 172+ messages in thread
From: Tomi Valkeinen @ 2021-07-29  7:02 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, sam, bbrezillon,
	nicolas.ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha
  Cc: linux-arm-kernel, linux-arm-msm, freedreno, dri-devel, amd-gfx

On 27/07/2021 21:27, 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>
> ---
>   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 +---
>   4 files changed, 32 insertions(+), 16 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Works fine on AM6 EVM. Some cleanups can be done in tidss_irq_install(), 
but those can be done later.

  Tomi
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-28 20:11                       ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-29 19:18                         ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:18 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1833 bytes --]

Hi

Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
>>>
>>> I think I got it - we need to set irq_enabled to true.
>>> The documentation says so:
>>> "
>>>            * @irq_enabled:
>>>            *
>>>            * Indicates that interrupt handling is enabled, specifically vblank
>>>            * handling. Drivers which don't use drm_irq_install() need to set this
>>>            * to true manually.
>>> "
>>>
>>> Can you try to add the following line:
>>>
>>>
>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>>> +{
>>> +       int ret;
>>> +
>>> +       if (irq == IRQ_NOTCONNECTED)
>>> +               return -ENOTCONN;
>>> +
>>>
>>>           dev->irq_enabled = true;                <= THIS LINE
>>>
>>>
>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>> +
>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>>> +       if (ret)
>>> +               return ret;
>>>
>>> I hope this fixes it.
>>
>> It does!  With the irq_enabled line added everything is looking good.

Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
Because using irq_enabled is deprecated and the flag was recently 
replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
VBLANK ioctls").

Best regards
Thomas

> 
> Great, thanks for testing.
> 
> Thomas - I assume you will do a re-spin and there is likely some fixes
> for the applied IRQ conversions too.
> 
> Note - irq_enabled must be cleared if request_irq fails. I did not
> include this in the testing here.
> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:18                         ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:18 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1833 bytes --]

Hi

Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
>>>
>>> I think I got it - we need to set irq_enabled to true.
>>> The documentation says so:
>>> "
>>>            * @irq_enabled:
>>>            *
>>>            * Indicates that interrupt handling is enabled, specifically vblank
>>>            * handling. Drivers which don't use drm_irq_install() need to set this
>>>            * to true manually.
>>> "
>>>
>>> Can you try to add the following line:
>>>
>>>
>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>>> +{
>>> +       int ret;
>>> +
>>> +       if (irq == IRQ_NOTCONNECTED)
>>> +               return -ENOTCONN;
>>> +
>>>
>>>           dev->irq_enabled = true;                <= THIS LINE
>>>
>>>
>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>> +
>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>>> +       if (ret)
>>> +               return ret;
>>>
>>> I hope this fixes it.
>>
>> It does!  With the irq_enabled line added everything is looking good.

Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
Because using irq_enabled is deprecated and the flag was recently 
replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
VBLANK ioctls").

Best regards
Thomas

> 
> Great, thanks for testing.
> 
> Thomas - I assume you will do a re-spin and there is likely some fixes
> for the applied IRQ conversions too.
> 
> Note - irq_enabled must be cleared if request_irq fails. I did not
> include this in the testing here.
> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:18                         ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:18 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 1833 bytes --]

Hi

Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
>>>
>>> I think I got it - we need to set irq_enabled to true.
>>> The documentation says so:
>>> "
>>>            * @irq_enabled:
>>>            *
>>>            * Indicates that interrupt handling is enabled, specifically vblank
>>>            * handling. Drivers which don't use drm_irq_install() need to set this
>>>            * to true manually.
>>> "
>>>
>>> Can you try to add the following line:
>>>
>>>
>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>>> +{
>>> +       int ret;
>>> +
>>> +       if (irq == IRQ_NOTCONNECTED)
>>> +               return -ENOTCONN;
>>> +
>>>
>>>           dev->irq_enabled = true;                <= THIS LINE
>>>
>>>
>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>> +
>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>>> +       if (ret)
>>> +               return ret;
>>>
>>> I hope this fixes it.
>>
>> It does!  With the irq_enabled line added everything is looking good.

Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
Because using irq_enabled is deprecated and the flag was recently 
replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
VBLANK ioctls").

Best regards
Thomas

> 
> Great, thanks for testing.
> 
> Thomas - I assume you will do a re-spin and there is likely some fixes
> for the applied IRQ conversions too.
> 
> Note - irq_enabled must be cleared if request_irq fails. I did not
> include this in the testing here.
> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:18                         ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:18 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1833 bytes --]

Hi

Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
> Hi Dan,
> 
>>>
>>> I think I got it - we need to set irq_enabled to true.
>>> The documentation says so:
>>> "
>>>            * @irq_enabled:
>>>            *
>>>            * Indicates that interrupt handling is enabled, specifically vblank
>>>            * handling. Drivers which don't use drm_irq_install() need to set this
>>>            * to true manually.
>>> "
>>>
>>> Can you try to add the following line:
>>>
>>>
>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, unsigned int irq)
>>> +{
>>> +       int ret;
>>> +
>>> +       if (irq == IRQ_NOTCONNECTED)
>>> +               return -ENOTCONN;
>>> +
>>>
>>>           dev->irq_enabled = true;                <= THIS LINE
>>>
>>>
>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>> +
>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, dev->driver->name, dev);
>>> +       if (ret)
>>> +               return ret;
>>>
>>> I hope this fixes it.
>>
>> It does!  With the irq_enabled line added everything is looking good.

Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
Because using irq_enabled is deprecated and the flag was recently 
replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
VBLANK ioctls").

Best regards
Thomas

> 
> Great, thanks for testing.
> 
> Thomas - I assume you will do a re-spin and there is likely some fixes
> for the applied IRQ conversions too.
> 
> Note - irq_enabled must be cleared if request_irq fails. I did not
> include this in the testing here.
> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-29 19:18                         ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-29 19:21                           ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:21 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 2298 bytes --]

Hi

Am 29.07.21 um 21:18 schrieb Thomas Zimmermann:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").

For reference, the cover letter lists

base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb

which is a recent drm-tip created on July 25.

Best regards
Thomas

> 
> Best regards
> Thomas
> 
>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:21                           ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:21 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 2298 bytes --]

Hi

Am 29.07.21 um 21:18 schrieb Thomas Zimmermann:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").

For reference, the cover letter lists

base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb

which is a recent drm-tip created on July 25.

Best regards
Thomas

> 
> Best regards
> Thomas
> 
>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:21                           ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:21 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 2298 bytes --]

Hi

Am 29.07.21 um 21:18 schrieb Thomas Zimmermann:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").

For reference, the cover letter lists

base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb

which is a recent drm-tip created on July 25.

Best regards
Thomas

> 
> Best regards
> Thomas
> 
>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:21                           ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:21 UTC (permalink / raw)
  To: Sam Ravnborg, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 2298 bytes --]

Hi

Am 29.07.21 um 21:18 schrieb Thomas Zimmermann:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").

For reference, the cover letter lists

base-commit: 2bda1ca4d4acb4892556fec3a7ea1f02afcd40bb

which is a recent drm-tip created on July 25.

Best regards
Thomas

> 
> Best regards
> Thomas
> 
>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-29 19:18                         ` Thomas Zimmermann
  (?)
  (?)
@ 2021-07-29 19:24                           ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:24 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

Hi Thomas,

On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").
> 
> Best regards
> Thomas
> 

I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next. 
There a preferred branch to test from?

Thanks and regards,
Dan

>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     Sam
>>
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:24                           ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:24 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").
> 
> Best regards
> Thomas
> 

I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next. 
There a preferred branch to test from?

Thanks and regards,
Dan

>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     Sam
>>
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:24                           ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:24 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo

Hi Thomas,

On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").
> 
> Best regards
> Thomas
> 

I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next. 
There a preferred branch to test from?

Thanks and regards,
Dan

>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     Sam
>>
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:24                           ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:24 UTC (permalink / raw)
  To: tzimmermann, sam, Dan.Sneddon
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>> Hi Dan,
>>
>>>>
>>>> I think I got it - we need to set irq_enabled to true.
>>>> The documentation says so:
>>>> "
>>>>            * @irq_enabled:
>>>>            *
>>>>            * Indicates that interrupt handling is enabled, 
>>>> specifically vblank
>>>>            * handling. Drivers which don't use drm_irq_install() 
>>>> need to set this
>>>>            * to true manually.
>>>> "
>>>>
>>>> Can you try to add the following line:
>>>>
>>>>
>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev, 
>>>> unsigned int irq)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>> +               return -ENOTCONN;
>>>> +
>>>>
>>>>           dev->irq_enabled = true;                <= THIS LINE
>>>>
>>>>
>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>> +
>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0, 
>>>> dev->driver->name, dev);
>>>> +       if (ret)
>>>> +               return ret;
>>>>
>>>> I hope this fixes it.
>>>
>>> It does!  With the irq_enabled line added everything is looking good.
> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip? 
> Because using irq_enabled is deprecated and the flag was recently 
> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in 
> VBLANK ioctls").
> 
> Best regards
> Thomas
> 

I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next. 
There a preferred branch to test from?

Thanks and regards,
Dan

>>
>> Great, thanks for testing.
>>
>> Thomas - I assume you will do a re-spin and there is likely some fixes
>> for the applied IRQ conversions too.
>>
>> Note - irq_enabled must be cleared if request_irq fails. I did not
>> include this in the testing here.
>>
>>     Sam
>>
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-29 19:24                           ` Dan.Sneddon
  (?)
  (?)
@ 2021-07-29 19:32                             ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:32 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 2558 bytes --]

Hi

Am 29.07.21 um 21:24 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas,
> 
> On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>>> Hi Dan,
>>>
>>>>>
>>>>> I think I got it - we need to set irq_enabled to true.
>>>>> The documentation says so:
>>>>> "
>>>>>             * @irq_enabled:
>>>>>             *
>>>>>             * Indicates that interrupt handling is enabled,
>>>>> specifically vblank
>>>>>             * handling. Drivers which don't use drm_irq_install()
>>>>> need to set this
>>>>>             * to true manually.
>>>>> "
>>>>>
>>>>> Can you try to add the following line:
>>>>>
>>>>>
>>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev,
>>>>> unsigned int irq)
>>>>> +{
>>>>> +       int ret;
>>>>> +
>>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>>> +               return -ENOTCONN;
>>>>> +
>>>>>
>>>>>            dev->irq_enabled = true;                <= THIS LINE
>>>>>
>>>>>
>>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>>> +
>>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0,
>>>>> dev->driver->name, dev);
>>>>> +       if (ret)
>>>>> +               return ret;
>>>>>
>>>>> I hope this fixes it.
>>>>
>>>> It does!  With the irq_enabled line added everything is looking good.
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently
>> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in
>> VBLANK ioctls").
>>
>> Best regards
>> Thomas
>>
> 
> I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next.
> There a preferred branch to test from?

I use drm-tip for development, but all the relevant patches go through 
drm-misc-next. So either is fine.

Best regards
Thomas

> 
> Thanks and regards,
> Dan
> 
>>>
>>> Great, thanks for testing.
>>>
>>> Thomas - I assume you will do a re-spin and there is likely some fixes
>>> for the applied IRQ conversions too.
>>>
>>> Note - irq_enabled must be cleared if request_irq fails. I did not
>>> include this in the testing here.
>>>
>>>      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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:32                             ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:32 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 2558 bytes --]

Hi

Am 29.07.21 um 21:24 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas,
> 
> On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>>> Hi Dan,
>>>
>>>>>
>>>>> I think I got it - we need to set irq_enabled to true.
>>>>> The documentation says so:
>>>>> "
>>>>>             * @irq_enabled:
>>>>>             *
>>>>>             * Indicates that interrupt handling is enabled,
>>>>> specifically vblank
>>>>>             * handling. Drivers which don't use drm_irq_install()
>>>>> need to set this
>>>>>             * to true manually.
>>>>> "
>>>>>
>>>>> Can you try to add the following line:
>>>>>
>>>>>
>>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev,
>>>>> unsigned int irq)
>>>>> +{
>>>>> +       int ret;
>>>>> +
>>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>>> +               return -ENOTCONN;
>>>>> +
>>>>>
>>>>>            dev->irq_enabled = true;                <= THIS LINE
>>>>>
>>>>>
>>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>>> +
>>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0,
>>>>> dev->driver->name, dev);
>>>>> +       if (ret)
>>>>> +               return ret;
>>>>>
>>>>> I hope this fixes it.
>>>>
>>>> It does!  With the irq_enabled line added everything is looking good.
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently
>> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in
>> VBLANK ioctls").
>>
>> Best regards
>> Thomas
>>
> 
> I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next.
> There a preferred branch to test from?

I use drm-tip for development, but all the relevant patches go through 
drm-misc-next. So either is fine.

Best regards
Thomas

> 
> Thanks and regards,
> Dan
> 
>>>
>>> Great, thanks for testing.
>>>
>>> Thomas - I assume you will do a re-spin and there is likely some fixes
>>> for the applied IRQ conversions too.
>>>
>>> Note - irq_enabled must be cleared if request_irq fails. I did not
>>> include this in the testing here.
>>>
>>>      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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:32                             ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:32 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 2558 bytes --]

Hi

Am 29.07.21 um 21:24 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas,
> 
> On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>>> Hi Dan,
>>>
>>>>>
>>>>> I think I got it - we need to set irq_enabled to true.
>>>>> The documentation says so:
>>>>> "
>>>>>             * @irq_enabled:
>>>>>             *
>>>>>             * Indicates that interrupt handling is enabled,
>>>>> specifically vblank
>>>>>             * handling. Drivers which don't use drm_irq_install()
>>>>> need to set this
>>>>>             * to true manually.
>>>>> "
>>>>>
>>>>> Can you try to add the following line:
>>>>>
>>>>>
>>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev,
>>>>> unsigned int irq)
>>>>> +{
>>>>> +       int ret;
>>>>> +
>>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>>> +               return -ENOTCONN;
>>>>> +
>>>>>
>>>>>            dev->irq_enabled = true;                <= THIS LINE
>>>>>
>>>>>
>>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>>> +
>>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0,
>>>>> dev->driver->name, dev);
>>>>> +       if (ret)
>>>>> +               return ret;
>>>>>
>>>>> I hope this fixes it.
>>>>
>>>> It does!  With the irq_enabled line added everything is looking good.
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently
>> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in
>> VBLANK ioctls").
>>
>> Best regards
>> Thomas
>>
> 
> I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next.
> There a preferred branch to test from?

I use drm-tip for development, but all the relevant patches go through 
drm-misc-next. So either is fine.

Best regards
Thomas

> 
> Thanks and regards,
> Dan
> 
>>>
>>> Great, thanks for testing.
>>>
>>> Thomas - I assume you will do a re-spin and there is likely some fixes
>>> for the applied IRQ conversions too.
>>>
>>> Note - irq_enabled must be cleared if request_irq fails. I did not
>>> include this in the testing here.
>>>
>>>      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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:32                             ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-29 19:32 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 2558 bytes --]

Hi

Am 29.07.21 um 21:24 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas,
> 
> On 7/29/21 12:18 PM, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 28.07.21 um 22:11 schrieb Sam Ravnborg:
>>> Hi Dan,
>>>
>>>>>
>>>>> I think I got it - we need to set irq_enabled to true.
>>>>> The documentation says so:
>>>>> "
>>>>>             * @irq_enabled:
>>>>>             *
>>>>>             * Indicates that interrupt handling is enabled,
>>>>> specifically vblank
>>>>>             * handling. Drivers which don't use drm_irq_install()
>>>>> need to set this
>>>>>             * to true manually.
>>>>> "
>>>>>
>>>>> Can you try to add the following line:
>>>>>
>>>>>
>>>>> +static int atmel_hlcdc_dc_irq_install(struct drm_device *dev,
>>>>> unsigned int irq)
>>>>> +{
>>>>> +       int ret;
>>>>> +
>>>>> +       if (irq == IRQ_NOTCONNECTED)
>>>>> +               return -ENOTCONN;
>>>>> +
>>>>>
>>>>>            dev->irq_enabled = true;                <= THIS LINE
>>>>>
>>>>>
>>>>> +       atmel_hlcdc_dc_irq_disable(dev);
>>>>> +
>>>>> +       ret = request_irq(irq, atmel_hlcdc_dc_irq_handler, 0,
>>>>> dev->driver->name, dev);
>>>>> +       if (ret)
>>>>> +               return ret;
>>>>>
>>>>> I hope this fixes it.
>>>>
>>>> It does!  With the irq_enabled line added everything is looking good.
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently
>> replaced by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in
>> VBLANK ioctls").
>>
>> Best regards
>> Thomas
>>
> 
> I was testing with 5.14-rc3.  I can test with drm-tip or drm-misc-next.
> There a preferred branch to test from?

I use drm-tip for development, but all the relevant patches go through 
drm-misc-next. So either is fine.

Best regards
Thomas

> 
> Thanks and regards,
> Dan
> 
>>>
>>> Great, thanks for testing.
>>>
>>> Thomas - I assume you will do a re-spin and there is likely some fixes
>>> for the applied IRQ conversions too.
>>>
>>> Note - irq_enabled must be cleared if request_irq fails. I did not
>>> include this in the testing here.
>>>
>>>      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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-29 19:18                         ` Thomas Zimmermann
  (?)
@ 2021-07-29 19:48                           ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-29 19:48 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	Dan.Sneddon, patrik.r.jakobsson, linux-arm-msm, freedreno,
	daniel, edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst,
	mripard, dri-devel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
> Because using irq_enabled is deprecated and the flag was recently replaced
> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

I was looking at drm-misc-fixes which did not have this commit :-(
Just my silly excuse why I was convinced this was the issue.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:48                           ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-29 19:48 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, Dan.Sneddon,
	linux-arm-msm, freedreno, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Thomas,

> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
> Because using irq_enabled is deprecated and the flag was recently replaced
> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

I was looking at drm-misc-fixes which did not have this commit :-(
Just my silly excuse why I was convinced this was the issue.

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:48                           ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-29 19:48 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	Dan.Sneddon, patrik.r.jakobsson, linux-arm-msm, freedreno,
	daniel, edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst,
	mripard, dri-devel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas,

> 
> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
> Because using irq_enabled is deprecated and the flag was recently replaced
> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

I was looking at drm-misc-fixes which did not have this commit :-(
Just my silly excuse why I was convinced this was the issue.

	Sam
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-29 19:48                           ` Sam Ravnborg
  (?)
  (?)
@ 2021-07-29 19:55                             ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:55 UTC (permalink / raw)
  To: sam, tzimmermann
  Cc: Dan.Sneddon, daniel, airlied, alexander.deucher,
	christian.koenig, liviu.dudau, brian.starkey, bbrezillon,
	Nicolas.Ferre, maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

Hi Thomas and Sam,
On 7/29/21 12:48 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Thomas,
> 
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently replaced
>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

Ok, My fault for testing on the wrong branch.  When I test this patch on 
drm-misc-next it works great.  Sorry for the confusion!

> 
> I was looking at drm-misc-fixes which did not have this commit :-(
> Just my silly excuse why I was convinced this was the issue.
> 
>          Sam
> 

Best regards,
Dan

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:55                             ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:55 UTC (permalink / raw)
  To: sam, tzimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	Dan.Sneddon, patrik.r.jakobsson, linux-arm-msm, freedreno,
	daniel, edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst,
	mripard, dri-devel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas and Sam,
On 7/29/21 12:48 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Thomas,
> 
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently replaced
>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

Ok, My fault for testing on the wrong branch.  When I test this patch on 
drm-misc-next it works great.  Sorry for the confusion!

> 
> I was looking at drm-misc-fixes which did not have this commit :-(
> Just my silly excuse why I was convinced this was the issue.
> 
>          Sam
> 

Best regards,
Dan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:55                             ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:55 UTC (permalink / raw)
  To: sam, tzimmermann
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, Dan.Sneddon,
	linux-arm-msm, freedreno, edmund.j.dea, s.hauer, alison.wang,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, kernel, alexander.deucher,
	shawnguo

Hi Thomas and Sam,
On 7/29/21 12:48 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Thomas,
> 
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently replaced
>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

Ok, My fault for testing on the wrong branch.  When I test this patch on 
drm-misc-next it works great.  Sorry for the confusion!

> 
> I was looking at drm-misc-fixes which did not have this commit :-(
> Just my silly excuse why I was convinced this was the issue.
> 
>          Sam
> 

Best regards,
Dan

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-29 19:55                             ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-29 19:55 UTC (permalink / raw)
  To: sam, tzimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	Dan.Sneddon, patrik.r.jakobsson, linux-arm-msm, freedreno,
	daniel, edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst,
	mripard, dri-devel, sean, linux-arm-kernel, tomba, bbrezillon,
	jyri.sarha, Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey

Hi Thomas and Sam,
On 7/29/21 12:48 PM, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Thomas,
> 
>>
>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>> Because using irq_enabled is deprecated and the flag was recently replaced
>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").

Ok, My fault for testing on the wrong branch.  When I test this patch on 
drm-misc-next it works great.  Sorry for the confusion!

> 
> I was looking at drm-misc-fixes which did not have this commit :-(
> Just my silly excuse why I was convinced this was the issue.
> 
>          Sam
> 

Best regards,
Dan
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-29 19:55                             ` Dan.Sneddon
  (?)
  (?)
@ 2021-07-30  8:31                               ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-30  8:31 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno


[-- Attachment #1.1: Type: text/plain, Size: 1160 bytes --]

Hi Dan and Sam

Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas and Sam,
> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> Hi Thomas,
>>
>>>
>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>> Because using irq_enabled is deprecated and the flag was recently replaced
>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").
> 
> Ok, My fault for testing on the wrong branch.  When I test this patch on
> drm-misc-next it works great.  Sorry for the confusion!
> 
>>
>> I was looking at drm-misc-fixes which did not have this commit :-(
>> Just my silly excuse why I was convinced this was the issue.

Don't worry.

I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

Best regards
Thomas


>>
>>           Sam
>>
> 
> Best regards,
> Dan
> 

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-30  8:31                               ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-30  8:31 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1160 bytes --]

Hi Dan and Sam

Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas and Sam,
> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> Hi Thomas,
>>
>>>
>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>> Because using irq_enabled is deprecated and the flag was recently replaced
>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").
> 
> Ok, My fault for testing on the wrong branch.  When I test this patch on
> drm-misc-next it works great.  Sorry for the confusion!
> 
>>
>> I was looking at drm-misc-fixes which did not have this commit :-(
>> Just my silly excuse why I was convinced this was the issue.

Don't worry.

I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

Best regards
Thomas


>>
>>           Sam
>>
> 
> Best regards,
> Dan
> 

-- 
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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-30  8:31                               ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-30  8:31 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, amd-gfx, anitha.chrisanthus, linux-arm-msm,
	freedreno, edmund.j.dea, s.hauer, alison.wang, dri-devel, sean,
	linux-arm-kernel, tomba, bbrezillon, jyri.sarha, Nicolas.Ferre,
	christian.koenig, kernel, alexander.deucher, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 1160 bytes --]

Hi Dan and Sam

Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas and Sam,
> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> Hi Thomas,
>>
>>>
>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>> Because using irq_enabled is deprecated and the flag was recently replaced
>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").
> 
> Ok, My fault for testing on the wrong branch.  When I test this patch on
> drm-misc-next it works great.  Sorry for the confusion!
> 
>>
>> I was looking at drm-misc-fixes which did not have this commit :-(
>> Just my silly excuse why I was convinced this was the issue.

Don't worry.

I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

Best regards
Thomas


>>
>>           Sam
>>
> 
> Best regards,
> Dan
> 

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-30  8:31                               ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-07-30  8:31 UTC (permalink / raw)
  To: Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	Nicolas.Ferre, christian.koenig, robdclark, kernel,
	alexander.deucher, shawnguo, brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 1160 bytes --]

Hi Dan and Sam

Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
> Hi Thomas and Sam,
> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> Hi Thomas,
>>
>>>
>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>> Because using irq_enabled is deprecated and the flag was recently replaced
>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK ioctls").
> 
> Ok, My fault for testing on the wrong branch.  When I test this patch on
> drm-misc-next it works great.  Sorry for the confusion!
> 
>>
>> I was looking at drm-misc-fixes which did not have this commit :-(
>> Just my silly excuse why I was convinced this was the issue.

Don't worry.

I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

Best regards
Thomas


>>
>>           Sam
>>
> 
> Best regards,
> Dan
> 

-- 
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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
  2021-07-30  8:31                               ` Thomas Zimmermann
  (?)
@ 2021-07-30 18:10                                 ` Dan.Sneddon
  -1 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-30 18:10 UTC (permalink / raw)
  To: tzimmermann, Dan.Sneddon, sam
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 7/30/21 1:31 AM, Thomas Zimmermann wrote:
> Hi Dan and Sam
> 
> Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
>> Hi Thomas and Sam,
>> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>> know the content is safe
>>>
>>> Hi Thomas,
>>>
>>>>
>>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>>> Because using irq_enabled is deprecated and the flag was recently 
>>>> replaced
>>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK 
>>>> ioctls").
>>
>> Ok, My fault for testing on the wrong branch.  When I test this patch on
>> drm-misc-next it works great.  Sorry for the confusion!
>>
>>>
>>> I was looking at drm-misc-fixes which did not have this commit :-(
>>> Just my silly excuse why I was convinced this was the issue.
> 
> Don't worry.
> 
> I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

The tested-by works for me!  Thanks!
> 
> Best regards
> Thomas
> 
> 
>>>
>>>           Sam
>>>
>>
>> Best regards,
>> Dan
>>
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-30 18:10                                 ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-30 18:10 UTC (permalink / raw)
  To: tzimmermann, Dan.Sneddon, sam
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

On 7/30/21 1:31 AM, Thomas Zimmermann wrote:
> Hi Dan and Sam
> 
> Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
>> Hi Thomas and Sam,
>> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>> know the content is safe
>>>
>>> Hi Thomas,
>>>
>>>>
>>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>>> Because using irq_enabled is deprecated and the flag was recently 
>>>> replaced
>>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK 
>>>> ioctls").
>>
>> Ok, My fault for testing on the wrong branch.  When I test this patch on
>> drm-misc-next it works great.  Sorry for the confusion!
>>
>>>
>>> I was looking at drm-misc-fixes which did not have this commit :-(
>>> Just my silly excuse why I was convinced this was the issue.
> 
> Don't worry.
> 
> I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

The tested-by works for me!  Thanks!
> 
> Best regards
> Thomas
> 
> 
>>>
>>>           Sam
>>>
>>
>> Best regards,
>> Dan
>>
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: Re: [PATCH 03/14] drm/atmel-hlcdc: Convert to Linux IRQ interfaces
@ 2021-07-30 18:10                                 ` Dan.Sneddon
  0 siblings, 0 replies; 172+ messages in thread
From: Dan.Sneddon @ 2021-07-30 18:10 UTC (permalink / raw)
  To: tzimmermann, Dan.Sneddon, sam
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, Nicolas.Ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba, amd-gfx,
	dri-devel, linux-arm-kernel, linux-arm-msm, freedreno

On 7/30/21 1:31 AM, Thomas Zimmermann wrote:
> Hi Dan and Sam
> 
> Am 29.07.21 um 21:55 schrieb Dan.Sneddon@microchip.com:
>> Hi Thomas and Sam,
>> On 7/29/21 12:48 PM, Sam Ravnborg wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you 
>>> know the content is safe
>>>
>>> Hi Thomas,
>>>
>>>>
>>>> Are you sure, you're testing with the latest drm-misc-next or drm-tip?
>>>> Because using irq_enabled is deprecated and the flag was recently 
>>>> replaced
>>>> by commit 1e4cd78ed493 ("drm: Don't test for IRQ support in VBLANK 
>>>> ioctls").
>>
>> Ok, My fault for testing on the wrong branch.  When I test this patch on
>> drm-misc-next it works great.  Sorry for the confusion!
>>
>>>
>>> I was looking at drm-misc-fixes which did not have this commit :-(
>>> Just my silly excuse why I was convinced this was the issue.
> 
> Don't worry.
> 
> I'll add Sam's R-b and a Tested-by from Dan to the patch. Is that ok?

The tested-by works for me!  Thanks!
> 
> Best regards
> Thomas
> 
> 
>>>
>>>           Sam
>>>
>>
>> Best regards,
>> Dan
>>
> 


^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
  2021-07-27 18:27 ` Thomas Zimmermann
@ 2021-07-31 18:50   ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-31 18:50 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:07PM +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.
> 
> 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

With the irq_enabled confusion out of the way I want to re-address two
issues here that I know you have answered but I am just not convinced.

1) IRQ_NOTCONNECTED

We do not have this check in drm_irq today and we should avoid spreading
it all over. We are either carrying it forever or we wil lsee patches
floating in to drop the check again.
The current use in the kernel is minimal:
https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED

So as a minimum drop it from atmel_hlcdc and preferably from the rest as
it is really not used. (Speaking as atmel_hlcdc maintainer)


2) devm_request_irq()

We are moving towards managed allocation so we do not fail to free
resources. And an irq has a lifetime equal the device itself - so an
obvious cnadidate for devm_request_irq.
If we do not introduce it now we will see a revisit of this later.
I can be convinced to wait with this as we will have to do much more in
each driver, but I cannot see any good arguments to avoid the more
modern way to use devm_request_irq.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-07-31 18:50   ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-07-31 18:50 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba,
	linux-arm-msm, dri-devel, amd-gfx, freedreno, linux-arm-kernel

Hi Thomas,

On Tue, Jul 27, 2021 at 08:27:07PM +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.
> 
> 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

With the irq_enabled confusion out of the way I want to re-address two
issues here that I know you have answered but I am just not convinced.

1) IRQ_NOTCONNECTED

We do not have this check in drm_irq today and we should avoid spreading
it all over. We are either carrying it forever or we wil lsee patches
floating in to drop the check again.
The current use in the kernel is minimal:
https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED

So as a minimum drop it from atmel_hlcdc and preferably from the rest as
it is really not used. (Speaking as atmel_hlcdc maintainer)


2) devm_request_irq()

We are moving towards managed allocation so we do not fail to free
resources. And an irq has a lifetime equal the device itself - so an
obvious cnadidate for devm_request_irq.
If we do not introduce it now we will see a revisit of this later.
I can be convinced to wait with this as we will have to do much more in
each driver, but I cannot see any good arguments to avoid the more
modern way to use devm_request_irq.

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
  2021-07-31 18:50   ` Sam Ravnborg
@ 2021-08-01 19:56     ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-01 19:56 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba,
	linux-arm-msm, dri-devel, amd-gfx, freedreno, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 4188 bytes --]

Hi Sam

Am 31.07.21 um 20:50 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:07PM +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.
>>
>> 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
> 
> With the irq_enabled confusion out of the way I want to re-address two
> issues here that I know you have answered but I am just not convinced.
> 
> 1) IRQ_NOTCONNECTED
> 
> We do not have this check in drm_irq today and we should avoid spreading
> it all over. We are either carrying it forever or we wil lsee patches
> floating in to drop the check again.
> The current use in the kernel is minimal:
> https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED
> 
> So as a minimum drop it from atmel_hlcdc and preferably from the rest as
> it is really not used. (Speaking as atmel_hlcdc maintainer)

I'll drop it from atmel_hlcdc then.

But saying that it's not used is not correct. At least radeon an gma500 
handle PCI-based devices and BIOSes often had the option of disabling 
the rsp graphics interrupts.

> 
> 
> 2) devm_request_irq()
> 
> We are moving towards managed allocation so we do not fail to free
> resources. And an irq has a lifetime equal the device itself - so an
> obvious cnadidate for devm_request_irq.
> If we do not introduce it now we will see a revisit of this later.
> I can be convinced to wait with this as we will have to do much more in
> each driver, but I cannot see any good arguments to avoid the more
> modern way to use devm_request_irq.

I'll change this in atmel_hdlcd and maybe I can find trivial cases where 
devm_request_irq() can be used. But drivers that had an uninstall 
callback before should not have the cleanup logic altered by a patch as 
this one. I suspect that most of the IRQ cleanup
is actually a vblank cleanup and should be done in response to 
drm_vblank_init(). But that's again not something for this patchset 
here. We cannot change multiple things at once and still expect any of 
it to work.

I welcome the use of devm_ et al. But these changes are better done in a 
per-driver patchset that changes all of the driver to managed release.

Best regards
Thomas

> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-08-01 19:56     ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-01 19:56 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 4188 bytes --]

Hi Sam

Am 31.07.21 um 20:50 schrieb Sam Ravnborg:
> Hi Thomas,
> 
> On Tue, Jul 27, 2021 at 08:27:07PM +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.
>>
>> 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
> 
> With the irq_enabled confusion out of the way I want to re-address two
> issues here that I know you have answered but I am just not convinced.
> 
> 1) IRQ_NOTCONNECTED
> 
> We do not have this check in drm_irq today and we should avoid spreading
> it all over. We are either carrying it forever or we wil lsee patches
> floating in to drop the check again.
> The current use in the kernel is minimal:
> https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED
> 
> So as a minimum drop it from atmel_hlcdc and preferably from the rest as
> it is really not used. (Speaking as atmel_hlcdc maintainer)

I'll drop it from atmel_hlcdc then.

But saying that it's not used is not correct. At least radeon an gma500 
handle PCI-based devices and BIOSes often had the option of disabling 
the rsp graphics interrupts.

> 
> 
> 2) devm_request_irq()
> 
> We are moving towards managed allocation so we do not fail to free
> resources. And an irq has a lifetime equal the device itself - so an
> obvious cnadidate for devm_request_irq.
> If we do not introduce it now we will see a revisit of this later.
> I can be convinced to wait with this as we will have to do much more in
> each driver, but I cannot see any good arguments to avoid the more
> modern way to use devm_request_irq.

I'll change this in atmel_hdlcd and maybe I can find trivial cases where 
devm_request_irq() can be used. But drivers that had an uninstall 
callback before should not have the cleanup logic altered by a patch as 
this one. I suspect that most of the IRQ cleanup
is actually a vblank cleanup and should be done in response to 
drm_vblank_init(). But that's again not something for this patchset 
here. We cannot change multiple things at once and still expect any of 
it to work.

I welcome the use of devm_ et al. But these changes are better done in a 
per-driver patchset that changes all of the driver to managed release.

Best regards
Thomas

> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
  2021-08-01 19:56     ` Thomas Zimmermann
@ 2021-08-01 20:24       ` Sam Ravnborg
  -1 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-08-01 20:24 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey

Hi Thomas,

> > 
> > 1) IRQ_NOTCONNECTED
> > 
> > We do not have this check in drm_irq today and we should avoid spreading
> > it all over. We are either carrying it forever or we wil lsee patches
> > floating in to drop the check again.
> > The current use in the kernel is minimal:
> > https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED
> > 
> > So as a minimum drop it from atmel_hlcdc and preferably from the rest as
> > it is really not used. (Speaking as atmel_hlcdc maintainer)
> 
> I'll drop it from atmel_hlcdc then.
> 
> But saying that it's not used is not correct.
My point is the drm_irq do not check this - so adding this check add
something there was not needed/done before.

> > 2) devm_request_irq()
> > 
> > We are moving towards managed allocation so we do not fail to free
> > resources. And an irq has a lifetime equal the device itself - so an
> > obvious cnadidate for devm_request_irq.
> > If we do not introduce it now we will see a revisit of this later.
> > I can be convinced to wait with this as we will have to do much more in
> > each driver, but I cannot see any good arguments to avoid the more
> > modern way to use devm_request_irq.
> 
> I'll change this in atmel_hdlcd and maybe I can find trivial cases where
> devm_request_irq() can be used. But drivers that had an uninstall callback
> before should not have the cleanup logic altered by a patch as this one. I
> suspect that most of the IRQ cleanup
> is actually a vblank cleanup and should be done in response to
> drm_vblank_init(). But that's again not something for this patchset here. We
> cannot change multiple things at once and still expect any of it to work.
> 
> I welcome the use of devm_ et al. But these changes are better done in a
> per-driver patchset that changes all of the driver to managed release.
Fair enough, and fine with me.
I have yet to read through all patches - will do so in the coming week.

	Sam

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-08-01 20:24       ` Sam Ravnborg
  0 siblings, 0 replies; 172+ messages in thread
From: Sam Ravnborg @ 2021-08-01 20:24 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba,
	linux-arm-msm, dri-devel, amd-gfx, freedreno, linux-arm-kernel

Hi Thomas,

> > 
> > 1) IRQ_NOTCONNECTED
> > 
> > We do not have this check in drm_irq today and we should avoid spreading
> > it all over. We are either carrying it forever or we wil lsee patches
> > floating in to drop the check again.
> > The current use in the kernel is minimal:
> > https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED
> > 
> > So as a minimum drop it from atmel_hlcdc and preferably from the rest as
> > it is really not used. (Speaking as atmel_hlcdc maintainer)
> 
> I'll drop it from atmel_hlcdc then.
> 
> But saying that it's not used is not correct.
My point is the drm_irq do not check this - so adding this check add
something there was not needed/done before.

> > 2) devm_request_irq()
> > 
> > We are moving towards managed allocation so we do not fail to free
> > resources. And an irq has a lifetime equal the device itself - so an
> > obvious cnadidate for devm_request_irq.
> > If we do not introduce it now we will see a revisit of this later.
> > I can be convinced to wait with this as we will have to do much more in
> > each driver, but I cannot see any good arguments to avoid the more
> > modern way to use devm_request_irq.
> 
> I'll change this in atmel_hdlcd and maybe I can find trivial cases where
> devm_request_irq() can be used. But drivers that had an uninstall callback
> before should not have the cleanup logic altered by a patch as this one. I
> suspect that most of the IRQ cleanup
> is actually a vblank cleanup and should be done in response to
> drm_vblank_init(). But that's again not something for this patchset here. We
> cannot change multiple things at once and still expect any of it to work.
> 
> I welcome the use of devm_ et al. But these changes are better done in a
> per-driver patchset that changes all of the driver to managed release.
Fair enough, and fine with me.
I have yet to read through all patches - will do so in the coming week.

	Sam

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
  2021-08-01 20:24       ` Sam Ravnborg
@ 2021-08-02  8:42         ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-02  8:42 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: daniel, airlied, alexander.deucher, christian.koenig,
	liviu.dudau, brian.starkey, bbrezillon, nicolas.ferre,
	maarten.lankhorst, mripard, stefan, alison.wang,
	patrik.r.jakobsson, anitha.chrisanthus, robdclark, edmund.j.dea,
	sean, shawnguo, s.hauer, kernel, jyri.sarha, tomba,
	linux-arm-msm, dri-devel, amd-gfx, freedreno, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2644 bytes --]

Hi Sam

Am 01.08.21 um 22:24 schrieb Sam Ravnborg:
> Hi Thomas,
> 
>>>
>>> 1) IRQ_NOTCONNECTED
>>>
>>> We do not have this check in drm_irq today and we should avoid spreading
>>> it all over. We are either carrying it forever or we wil lsee patches
>>> floating in to drop the check again.
>>> The current use in the kernel is minimal:
>>> https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED
>>>
>>> So as a minimum drop it from atmel_hlcdc and preferably from the rest as
>>> it is really not used. (Speaking as atmel_hlcdc maintainer)
>>
>> I'll drop it from atmel_hlcdc then.
>>
>> But saying that it's not used is not correct.
> My point is the drm_irq do not check this - so adding this check add
> something there was not needed/done before.

What is being done at [1] is actually a check for unassigned interrupts. 
It's just that both, test and errno code, are plain wrong. The patchset 
fixes this.

> 
>>> 2) devm_request_irq()
>>>
>>> We are moving towards managed allocation so we do not fail to free
>>> resources. And an irq has a lifetime equal the device itself - so an
>>> obvious cnadidate for devm_request_irq.
>>> If we do not introduce it now we will see a revisit of this later.
>>> I can be convinced to wait with this as we will have to do much more in
>>> each driver, but I cannot see any good arguments to avoid the more
>>> modern way to use devm_request_irq.
>>
>> I'll change this in atmel_hdlcd and maybe I can find trivial cases where
>> devm_request_irq() can be used. But drivers that had an uninstall callback
>> before should not have the cleanup logic altered by a patch as this one. I
>> suspect that most of the IRQ cleanup
>> is actually a vblank cleanup and should be done in response to
>> drm_vblank_init(). But that's again not something for this patchset here. We
>> cannot change multiple things at once and still expect any of it to work.
>>
>> I welcome the use of devm_ et al. But these changes are better done in a
>> per-driver patchset that changes all of the driver to managed release.
> Fair enough, and fine with me.
> I have yet to read through all patches - will do so in the coming week.

OK, thanks a lot. I'll send out a new revision soon, so maybe don't 
waste time with this one.

Best regards
Thomas


[1] 
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L111



> 
> 	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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 00/14] drm: Make DRM's IRQ helpers legacy
@ 2021-08-02  8:42         ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-02  8:42 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: airlied, liviu.dudau, stefan, amd-gfx, anitha.chrisanthus,
	patrik.r.jakobsson, linux-arm-msm, freedreno, daniel,
	edmund.j.dea, s.hauer, alison.wang, maarten.lankhorst, mripard,
	dri-devel, sean, linux-arm-kernel, tomba, bbrezillon, jyri.sarha,
	christian.koenig, robdclark, kernel, alexander.deucher, shawnguo,
	brian.starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 2644 bytes --]

Hi Sam

Am 01.08.21 um 22:24 schrieb Sam Ravnborg:
> Hi Thomas,
> 
>>>
>>> 1) IRQ_NOTCONNECTED
>>>
>>> We do not have this check in drm_irq today and we should avoid spreading
>>> it all over. We are either carrying it forever or we wil lsee patches
>>> floating in to drop the check again.
>>> The current use in the kernel is minimal:
>>> https://elixir.bootlin.com/linux/latest/A/ident/IRQ_NOTCONNECTED
>>>
>>> So as a minimum drop it from atmel_hlcdc and preferably from the rest as
>>> it is really not used. (Speaking as atmel_hlcdc maintainer)
>>
>> I'll drop it from atmel_hlcdc then.
>>
>> But saying that it's not used is not correct.
> My point is the drm_irq do not check this - so adding this check add
> something there was not needed/done before.

What is being done at [1] is actually a check for unassigned interrupts. 
It's just that both, test and errno code, are plain wrong. The patchset 
fixes this.

> 
>>> 2) devm_request_irq()
>>>
>>> We are moving towards managed allocation so we do not fail to free
>>> resources. And an irq has a lifetime equal the device itself - so an
>>> obvious cnadidate for devm_request_irq.
>>> If we do not introduce it now we will see a revisit of this later.
>>> I can be convinced to wait with this as we will have to do much more in
>>> each driver, but I cannot see any good arguments to avoid the more
>>> modern way to use devm_request_irq.
>>
>> I'll change this in atmel_hdlcd and maybe I can find trivial cases where
>> devm_request_irq() can be used. But drivers that had an uninstall callback
>> before should not have the cleanup logic altered by a patch as this one. I
>> suspect that most of the IRQ cleanup
>> is actually a vblank cleanup and should be done in response to
>> drm_vblank_init(). But that's again not something for this patchset here. We
>> cannot change multiple things at once and still expect any of it to work.
>>
>> I welcome the use of devm_ et al. But these changes are better done in a
>> per-driver patchset that changes all of the driver to managed release.
> Fair enough, and fine with me.
> I have yet to read through all patches - will do so in the coming week.

OK, thanks a lot. I'll send out a new revision soon, so maybe don't 
waste time with this one.

Best regards
Thomas


[1] 
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L111



> 
> 	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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
  2021-07-28 14:03       ` Alex Deucher
  (?)
@ 2021-08-02  8:43         ` Thomas Zimmermann
  -1 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-02  8:43 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: Daniel Vetter, Dave Airlie, Deucher, Alexander, Liviu Dudau,
	Brian Starkey, Sam Ravnborg, bbrezillon, nicolas.ferre,
	Maarten Lankhorst, Maxime Ripard, Stefan Agner, alison.wang,
	Patrik Jakobsson, anitha.chrisanthus, Rob Clark, edmund.j.dea,
	Sean Paul, Shawn Guo, Sascha Hauer, Sascha Hauer, jyri.sarha,
	tomba, linux-arm-kernel, linux-arm-msm, freedreno,
	Maling list - DRI developers, amd-gfx list


[-- Attachment #1.1: Type: text/plain, Size: 5971 bytes --]

Hi

Am 28.07.21 um 16:03 schrieb Alex Deucher:
> On Wed, Jul 28, 2021 at 6:27 AM Christian König
> <christian.koenig@amd.com> wrote:
>>
>> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
>>> 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.
>>>
>>> The interrupt number returned by pci_msi_vector() is now stored
>>> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
>>> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
>>> midlayer does not handle this correctly.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>
>> Alex needs to take a look at this as well, but of hand the patch is
>> Acked-by: Christian König <christian.koenig@amd.com>.
> 
> Looks good to me as well:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Thanks a lot. Do you have comments on the changes to radeon?

Best regards
Thomas

> 
>>
>> Thanks,
>> Christian.
>>
>>> ---
>>>    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 +-
>>>    3 files changed, 15 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> index 2bd13fc2541a..1e05b5aa94e7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>>>        .open = amdgpu_driver_open_kms,
>>>        .postclose = amdgpu_driver_postclose_kms,
>>>        .lastclose = amdgpu_driver_lastclose_kms,
>>> -     .irq_handler = amdgpu_irq_handler,
>>>        .ioctls = amdgpu_ioctls_kms,
>>>        .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>>>        .dumb_create = amdgpu_mode_dumb_create,
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> index 0d01cfaca77e..a36cdc7323f4 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> @@ -46,7 +46,6 @@
>>>    #include <linux/pci.h>
>>>
>>>    #include <drm/drm_crtc_helper.h>
>>> -#include <drm/drm_irq.h>
>>>    #include <drm/drm_vblank.h>
>>>    #include <drm/amdgpu_drm.h>
>>>    #include <drm/drm_drv.h>
>>> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>>>     * Returns:
>>>     * result of handling the IRQ, as defined by &irqreturn_t
>>>     */
>>> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>>> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>>>    {
>>>        struct drm_device *dev = (struct drm_device *) arg;
>>>        struct amdgpu_device *adev = drm_to_adev(dev);
>>> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>>>    int amdgpu_irq_init(struct amdgpu_device *adev)
>>>    {
>>>        int r = 0;
>>> +     unsigned int irq;
>>>
>>>        spin_lock_init(&adev->irq.lock);
>>>
>>> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>>        INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>>>        INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>>>
>>> -     adev->irq.installed = true;
>>> -     /* Use vector 0 for MSI-X */
>>> -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
>>> +     /* Use vector 0 for MSI-X. */
>>> +     r = pci_irq_vector(adev->pdev, 0);
>>> +     if (r < 0)
>>> +             return r;
>>> +     irq = r;
>>> +
>>> +     /* PCI devices require shared interrupts. */
>>> +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
>>> +                     adev_to_drm(adev));
>>>        if (r) {
>>> -             adev->irq.installed = false;
>>>                if (!amdgpu_device_has_dc_support(adev))
>>>                        flush_work(&adev->hotplug_work);
>>>                return r;
>>>        }
>>> +     adev->irq.installed = true;
>>> +     adev->irq.irq = irq;
>>>        adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>>>
>>>        DRM_DEBUG("amdgpu: irq initialized.\n");
>>> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>>    void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>>>    {
>>>        if (adev->irq.installed) {
>>> -             drm_irq_uninstall(&adev->ddev);
>>> +             free_irq(adev->irq.irq, adev_to_drm(adev));
>>>                adev->irq.installed = false;
>>>                if (adev->irq.msi_enabled)
>>>                        pci_free_irq_vectors(adev->pdev);
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> index 78ad4784cc74..e9f2c11ea416 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>>>
>>>    struct amdgpu_irq {
>>>        bool                            installed;
>>> +     unsigned int                    irq;
>>>        spinlock_t                      lock;
>>>        /* interrupt sources */
>>>        struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
>>> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>>>    };
>>>
>>>    void amdgpu_irq_disable_all(struct amdgpu_device *adev);
>>> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>>>
>>>    int amdgpu_irq_init(struct amdgpu_device *adev);
>>>    void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>>

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-08-02  8:43         ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-02  8:43 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: Dave Airlie, Liviu Dudau, Stefan Agner, amd-gfx list,
	anitha.chrisanthus, Sam Ravnborg, Patrik Jakobsson,
	linux-arm-msm, freedreno, Daniel Vetter, edmund.j.dea,
	Sascha Hauer, alison.wang, Maarten Lankhorst, Maxime Ripard,
	Maling list - DRI developers, Sean Paul, linux-arm-kernel, tomba,
	bbrezillon, jyri.sarha, Rob Clark, Sascha Hauer, Deucher,
	Alexander, Shawn Guo, Brian Starkey


[-- Attachment #1.1.1: Type: text/plain, Size: 5971 bytes --]

Hi

Am 28.07.21 um 16:03 schrieb Alex Deucher:
> On Wed, Jul 28, 2021 at 6:27 AM Christian König
> <christian.koenig@amd.com> wrote:
>>
>> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
>>> 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.
>>>
>>> The interrupt number returned by pci_msi_vector() is now stored
>>> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
>>> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
>>> midlayer does not handle this correctly.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>
>> Alex needs to take a look at this as well, but of hand the patch is
>> Acked-by: Christian König <christian.koenig@amd.com>.
> 
> Looks good to me as well:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Thanks a lot. Do you have comments on the changes to radeon?

Best regards
Thomas

> 
>>
>> Thanks,
>> Christian.
>>
>>> ---
>>>    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 +-
>>>    3 files changed, 15 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> index 2bd13fc2541a..1e05b5aa94e7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>>>        .open = amdgpu_driver_open_kms,
>>>        .postclose = amdgpu_driver_postclose_kms,
>>>        .lastclose = amdgpu_driver_lastclose_kms,
>>> -     .irq_handler = amdgpu_irq_handler,
>>>        .ioctls = amdgpu_ioctls_kms,
>>>        .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>>>        .dumb_create = amdgpu_mode_dumb_create,
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> index 0d01cfaca77e..a36cdc7323f4 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> @@ -46,7 +46,6 @@
>>>    #include <linux/pci.h>
>>>
>>>    #include <drm/drm_crtc_helper.h>
>>> -#include <drm/drm_irq.h>
>>>    #include <drm/drm_vblank.h>
>>>    #include <drm/amdgpu_drm.h>
>>>    #include <drm/drm_drv.h>
>>> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>>>     * Returns:
>>>     * result of handling the IRQ, as defined by &irqreturn_t
>>>     */
>>> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>>> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>>>    {
>>>        struct drm_device *dev = (struct drm_device *) arg;
>>>        struct amdgpu_device *adev = drm_to_adev(dev);
>>> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>>>    int amdgpu_irq_init(struct amdgpu_device *adev)
>>>    {
>>>        int r = 0;
>>> +     unsigned int irq;
>>>
>>>        spin_lock_init(&adev->irq.lock);
>>>
>>> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>>        INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>>>        INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>>>
>>> -     adev->irq.installed = true;
>>> -     /* Use vector 0 for MSI-X */
>>> -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
>>> +     /* Use vector 0 for MSI-X. */
>>> +     r = pci_irq_vector(adev->pdev, 0);
>>> +     if (r < 0)
>>> +             return r;
>>> +     irq = r;
>>> +
>>> +     /* PCI devices require shared interrupts. */
>>> +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
>>> +                     adev_to_drm(adev));
>>>        if (r) {
>>> -             adev->irq.installed = false;
>>>                if (!amdgpu_device_has_dc_support(adev))
>>>                        flush_work(&adev->hotplug_work);
>>>                return r;
>>>        }
>>> +     adev->irq.installed = true;
>>> +     adev->irq.irq = irq;
>>>        adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>>>
>>>        DRM_DEBUG("amdgpu: irq initialized.\n");
>>> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>>    void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>>>    {
>>>        if (adev->irq.installed) {
>>> -             drm_irq_uninstall(&adev->ddev);
>>> +             free_irq(adev->irq.irq, adev_to_drm(adev));
>>>                adev->irq.installed = false;
>>>                if (adev->irq.msi_enabled)
>>>                        pci_free_irq_vectors(adev->pdev);
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> index 78ad4784cc74..e9f2c11ea416 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>>>
>>>    struct amdgpu_irq {
>>>        bool                            installed;
>>> +     unsigned int                    irq;
>>>        spinlock_t                      lock;
>>>        /* interrupt sources */
>>>        struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
>>> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>>>    };
>>>
>>>    void amdgpu_irq_disable_all(struct amdgpu_device *adev);
>>> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>>>
>>>    int amdgpu_irq_init(struct amdgpu_device *adev);
>>>    void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>>

-- 
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


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
@ 2021-08-02  8:43         ` Thomas Zimmermann
  0 siblings, 0 replies; 172+ messages in thread
From: Thomas Zimmermann @ 2021-08-02  8:43 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: Daniel Vetter, Dave Airlie, Deucher, Alexander, Liviu Dudau,
	Brian Starkey, Sam Ravnborg, bbrezillon, nicolas.ferre,
	Maarten Lankhorst, Maxime Ripard, Stefan Agner, alison.wang,
	Patrik Jakobsson, anitha.chrisanthus, Rob Clark, edmund.j.dea,
	Sean Paul, Shawn Guo, Sascha Hauer, Sascha Hauer, jyri.sarha,
	tomba, linux-arm-kernel, linux-arm-msm, freedreno,
	Maling list - DRI developers, amd-gfx list


[-- Attachment #1.1: Type: text/plain, Size: 5971 bytes --]

Hi

Am 28.07.21 um 16:03 schrieb Alex Deucher:
> On Wed, Jul 28, 2021 at 6:27 AM Christian König
> <christian.koenig@amd.com> wrote:
>>
>> Am 27.07.21 um 20:27 schrieb Thomas Zimmermann:
>>> 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.
>>>
>>> The interrupt number returned by pci_msi_vector() is now stored
>>> in struct amdgpu_irq. Calls to pci_msi_vector() can fail and return
>>> a negative errno code. Abort initlaizaton in thi case. The DRM IRQ
>>> midlayer does not handle this correctly.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>
>> Alex needs to take a look at this as well, but of hand the patch is
>> Acked-by: Christian König <christian.koenig@amd.com>.
> 
> Looks good to me as well:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Thanks a lot. Do you have comments on the changes to radeon?

Best regards
Thomas

> 
>>
>> Thanks,
>> Christian.
>>
>>> ---
>>>    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 +-
>>>    3 files changed, 15 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> index 2bd13fc2541a..1e05b5aa94e7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> @@ -1775,7 +1775,6 @@ static const struct drm_driver amdgpu_kms_driver = {
>>>        .open = amdgpu_driver_open_kms,
>>>        .postclose = amdgpu_driver_postclose_kms,
>>>        .lastclose = amdgpu_driver_lastclose_kms,
>>> -     .irq_handler = amdgpu_irq_handler,
>>>        .ioctls = amdgpu_ioctls_kms,
>>>        .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>>>        .dumb_create = amdgpu_mode_dumb_create,
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> index 0d01cfaca77e..a36cdc7323f4 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>>> @@ -46,7 +46,6 @@
>>>    #include <linux/pci.h>
>>>
>>>    #include <drm/drm_crtc_helper.h>
>>> -#include <drm/drm_irq.h>
>>>    #include <drm/drm_vblank.h>
>>>    #include <drm/amdgpu_drm.h>
>>>    #include <drm/drm_drv.h>
>>> @@ -184,7 +183,7 @@ void amdgpu_irq_disable_all(struct amdgpu_device *adev)
>>>     * Returns:
>>>     * result of handling the IRQ, as defined by &irqreturn_t
>>>     */
>>> -irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>>> +static irqreturn_t amdgpu_irq_handler(int irq, void *arg)
>>>    {
>>>        struct drm_device *dev = (struct drm_device *) arg;
>>>        struct amdgpu_device *adev = drm_to_adev(dev);
>>> @@ -307,6 +306,7 @@ static void amdgpu_restore_msix(struct amdgpu_device *adev)
>>>    int amdgpu_irq_init(struct amdgpu_device *adev)
>>>    {
>>>        int r = 0;
>>> +     unsigned int irq;
>>>
>>>        spin_lock_init(&adev->irq.lock);
>>>
>>> @@ -349,15 +349,22 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>>        INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2);
>>>        INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft);
>>>
>>> -     adev->irq.installed = true;
>>> -     /* Use vector 0 for MSI-X */
>>> -     r = drm_irq_install(adev_to_drm(adev), pci_irq_vector(adev->pdev, 0));
>>> +     /* Use vector 0 for MSI-X. */
>>> +     r = pci_irq_vector(adev->pdev, 0);
>>> +     if (r < 0)
>>> +             return r;
>>> +     irq = r;
>>> +
>>> +     /* PCI devices require shared interrupts. */
>>> +     r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name,
>>> +                     adev_to_drm(adev));
>>>        if (r) {
>>> -             adev->irq.installed = false;
>>>                if (!amdgpu_device_has_dc_support(adev))
>>>                        flush_work(&adev->hotplug_work);
>>>                return r;
>>>        }
>>> +     adev->irq.installed = true;
>>> +     adev->irq.irq = irq;
>>>        adev_to_drm(adev)->max_vblank_count = 0x00ffffff;
>>>
>>>        DRM_DEBUG("amdgpu: irq initialized.\n");
>>> @@ -368,7 +375,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>>    void amdgpu_irq_fini_hw(struct amdgpu_device *adev)
>>>    {
>>>        if (adev->irq.installed) {
>>> -             drm_irq_uninstall(&adev->ddev);
>>> +             free_irq(adev->irq.irq, adev_to_drm(adev));
>>>                adev->irq.installed = false;
>>>                if (adev->irq.msi_enabled)
>>>                        pci_free_irq_vectors(adev->pdev);
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> index 78ad4784cc74..e9f2c11ea416 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h
>>> @@ -80,6 +80,7 @@ struct amdgpu_irq_src_funcs {
>>>
>>>    struct amdgpu_irq {
>>>        bool                            installed;
>>> +     unsigned int                    irq;
>>>        spinlock_t                      lock;
>>>        /* interrupt sources */
>>>        struct amdgpu_irq_client        client[AMDGPU_IRQ_CLIENTID_MAX];
>>> @@ -100,7 +101,6 @@ struct amdgpu_irq {
>>>    };
>>>
>>>    void amdgpu_irq_disable_all(struct amdgpu_device *adev);
>>> -irqreturn_t amdgpu_irq_handler(int irq, void *arg);
>>>
>>>    int amdgpu_irq_init(struct amdgpu_device *adev);
>>>    void amdgpu_irq_fini_sw(struct amdgpu_device *adev);
>>

-- 
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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
  2021-07-27 18:27   ` Thomas Zimmermann
  (?)
@ 2021-08-02 15:27     ` Alex Deucher
  -1 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-08-02 15:27 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Daniel Vetter, Dave Airlie, Deucher, Alexander, Christian Koenig,
	Liviu Dudau, Brian Starkey, Sam Ravnborg, bbrezillon,
	nicolas.ferre, Maarten Lankhorst, Maxime Ripard, Stefan Agner,
	alison.wang, Patrik Jakobsson, anitha.chrisanthus, Rob Clark,
	edmund.j.dea, Sean Paul, Shawn Guo, Sascha Hauer, Sascha Hauer,
	jyri.sarha, tomba, linux-arm-msm, Maling list - DRI developers,
	amd-gfx list, freedreno, linux-arm-kernel

On Tue, Jul 27, 2021 at 2:27 PM Thomas Zimmermann <tzimmermann@suse.de> 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: Alex Deucher <alexander.deucher@amd.com>

> ---
>  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 ---
>  3 files changed, 37 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index c8dd68152d65..b74cebca1f89 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .irq_preinstall = radeon_driver_irq_preinstall_kms,
> -       .irq_postinstall = radeon_driver_irq_postinstall_kms,
> -       .irq_uninstall = radeon_driver_irq_uninstall_kms,
> -       .irq_handler = radeon_driver_irq_handler_kms,
>         .ioctls = radeon_ioctls_kms,
>         .num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
>         .dumb_create = radeon_mode_dumb_create,
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index a36ce826d0c0..3907785d0798 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -31,7 +31,7 @@
>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_device.h>
> -#include <drm/drm_irq.h>
> +#include <drm/drm_drv.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  #include <drm/radeon_drm.h>
> @@ -51,7 +51,7 @@
>   * radeon_irq_process is a macro that points to the per-asic
>   * irq handler callback.
>   */
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
> +static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
>  {
>         struct drm_device *dev = (struct drm_device *) arg;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
>   * Gets the hw ready to enable irqs (all asics).
>   * This function disables all interrupt sources on the GPU.
>   */
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
> +static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
> @@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>   * Handles stuff to be done after enabling irqs (all asics).
>   * Returns 0 on success.
>   */
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
> +static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>
> @@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>   *
>   * This function disables all interrupt sources on the GPU (all asics).
>   */
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
> +static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
> @@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
>
> +static int radeon_irq_install(struct radeon_device *rdev, int irq)
> +{
> +       struct drm_device *dev = rdev->ddev;
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> +       radeon_driver_irq_preinstall_kms(dev);
> +
> +       /* PCI devices require shared interrupts. */
> +       ret = request_irq(irq, radeon_driver_irq_handler_kms,
> +                         IRQF_SHARED, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> +
> +       radeon_driver_irq_postinstall_kms(dev);
> +
> +       return 0;
> +}
> +
> +static void radeon_irq_uninstall(struct radeon_device *rdev)
> +{
> +       struct drm_device *dev = rdev->ddev;
> +       struct pci_dev *pdev = to_pci_dev(dev->dev);
> +
> +       radeon_driver_irq_uninstall_kms(dev);
> +       free_irq(pdev->irq, dev);
> +}
> +
>  /**
>   * radeon_msi_ok - asic specific msi checks
>   *
> @@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>         INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
>
>         rdev->irq.installed = true;
> -       r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
> +       r = radeon_irq_install(rdev, rdev->pdev->irq);
>         if (r) {
>                 rdev->irq.installed = false;
>                 flush_delayed_work(&rdev->hotplug_work);
> @@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>  void radeon_irq_kms_fini(struct radeon_device *rdev)
>  {
>         if (rdev->irq.installed) {
> -               drm_irq_uninstall(rdev->ddev);
> +               radeon_irq_uninstall(rdev);
>                 rdev->irq.installed = false;
>                 if (rdev->msi_enabled)
>                         pci_disable_msi(rdev->pdev);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
> index 9b97bf38acd4..36e73cea9215 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.h
> +++ b/drivers/gpu/drm/radeon/radeon_kms.h
> @@ -31,9 +31,5 @@
>  u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
>  int radeon_enable_vblank_kms(struct drm_crtc *crtc);
>  void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
>
>  #endif                         /* __RADEON_KMS_H__ */
> --
> 2.32.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
@ 2021-08-02 15:27     ` Alex Deucher
  0 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-08-02 15:27 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Dave Airlie, Liviu Dudau, Stefan Agner, amd-gfx list,
	anitha.chrisanthus, Sam Ravnborg, Patrik Jakobsson,
	linux-arm-msm, freedreno, Daniel Vetter, edmund.j.dea,
	Sascha Hauer, alison.wang, Maarten Lankhorst, Maxime Ripard,
	Maling list - DRI developers, Sean Paul, linux-arm-kernel, tomba,
	bbrezillon, jyri.sarha, Christian Koenig, Rob Clark,
	Sascha Hauer, Deucher, Alexander, Shawn Guo, Brian Starkey

On Tue, Jul 27, 2021 at 2:27 PM Thomas Zimmermann <tzimmermann@suse.de> 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: Alex Deucher <alexander.deucher@amd.com>

> ---
>  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 ---
>  3 files changed, 37 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index c8dd68152d65..b74cebca1f89 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .irq_preinstall = radeon_driver_irq_preinstall_kms,
> -       .irq_postinstall = radeon_driver_irq_postinstall_kms,
> -       .irq_uninstall = radeon_driver_irq_uninstall_kms,
> -       .irq_handler = radeon_driver_irq_handler_kms,
>         .ioctls = radeon_ioctls_kms,
>         .num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
>         .dumb_create = radeon_mode_dumb_create,
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index a36ce826d0c0..3907785d0798 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -31,7 +31,7 @@
>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_device.h>
> -#include <drm/drm_irq.h>
> +#include <drm/drm_drv.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  #include <drm/radeon_drm.h>
> @@ -51,7 +51,7 @@
>   * radeon_irq_process is a macro that points to the per-asic
>   * irq handler callback.
>   */
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
> +static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
>  {
>         struct drm_device *dev = (struct drm_device *) arg;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
>   * Gets the hw ready to enable irqs (all asics).
>   * This function disables all interrupt sources on the GPU.
>   */
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
> +static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
> @@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>   * Handles stuff to be done after enabling irqs (all asics).
>   * Returns 0 on success.
>   */
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
> +static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>
> @@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>   *
>   * This function disables all interrupt sources on the GPU (all asics).
>   */
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
> +static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
> @@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
>
> +static int radeon_irq_install(struct radeon_device *rdev, int irq)
> +{
> +       struct drm_device *dev = rdev->ddev;
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> +       radeon_driver_irq_preinstall_kms(dev);
> +
> +       /* PCI devices require shared interrupts. */
> +       ret = request_irq(irq, radeon_driver_irq_handler_kms,
> +                         IRQF_SHARED, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> +
> +       radeon_driver_irq_postinstall_kms(dev);
> +
> +       return 0;
> +}
> +
> +static void radeon_irq_uninstall(struct radeon_device *rdev)
> +{
> +       struct drm_device *dev = rdev->ddev;
> +       struct pci_dev *pdev = to_pci_dev(dev->dev);
> +
> +       radeon_driver_irq_uninstall_kms(dev);
> +       free_irq(pdev->irq, dev);
> +}
> +
>  /**
>   * radeon_msi_ok - asic specific msi checks
>   *
> @@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>         INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
>
>         rdev->irq.installed = true;
> -       r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
> +       r = radeon_irq_install(rdev, rdev->pdev->irq);
>         if (r) {
>                 rdev->irq.installed = false;
>                 flush_delayed_work(&rdev->hotplug_work);
> @@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>  void radeon_irq_kms_fini(struct radeon_device *rdev)
>  {
>         if (rdev->irq.installed) {
> -               drm_irq_uninstall(rdev->ddev);
> +               radeon_irq_uninstall(rdev);
>                 rdev->irq.installed = false;
>                 if (rdev->msi_enabled)
>                         pci_disable_msi(rdev->pdev);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
> index 9b97bf38acd4..36e73cea9215 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.h
> +++ b/drivers/gpu/drm/radeon/radeon_kms.h
> @@ -31,9 +31,5 @@
>  u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
>  int radeon_enable_vblank_kms(struct drm_crtc *crtc);
>  void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
>
>  #endif                         /* __RADEON_KMS_H__ */
> --
> 2.32.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 172+ messages in thread

* Re: [PATCH 09/14] drm/radeon: Convert to Linux IRQ interfaces
@ 2021-08-02 15:27     ` Alex Deucher
  0 siblings, 0 replies; 172+ messages in thread
From: Alex Deucher @ 2021-08-02 15:27 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Daniel Vetter, Dave Airlie, Deucher, Alexander, Christian Koenig,
	Liviu Dudau, Brian Starkey, Sam Ravnborg, bbrezillon,
	nicolas.ferre, Maarten Lankhorst, Maxime Ripard, Stefan Agner,
	alison.wang, Patrik Jakobsson, anitha.chrisanthus, Rob Clark,
	edmund.j.dea, Sean Paul, Shawn Guo, Sascha Hauer, Sascha Hauer,
	jyri.sarha, tomba, linux-arm-msm, Maling list - DRI developers,
	amd-gfx list, freedreno, linux-arm-kernel

On Tue, Jul 27, 2021 at 2:27 PM Thomas Zimmermann <tzimmermann@suse.de> 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: Alex Deucher <alexander.deucher@amd.com>

> ---
>  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 ---
>  3 files changed, 37 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index c8dd68152d65..b74cebca1f89 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
>         .postclose = radeon_driver_postclose_kms,
>         .lastclose = radeon_driver_lastclose_kms,
>         .unload = radeon_driver_unload_kms,
> -       .irq_preinstall = radeon_driver_irq_preinstall_kms,
> -       .irq_postinstall = radeon_driver_irq_postinstall_kms,
> -       .irq_uninstall = radeon_driver_irq_uninstall_kms,
> -       .irq_handler = radeon_driver_irq_handler_kms,
>         .ioctls = radeon_ioctls_kms,
>         .num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
>         .dumb_create = radeon_mode_dumb_create,
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index a36ce826d0c0..3907785d0798 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -31,7 +31,7 @@
>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_device.h>
> -#include <drm/drm_irq.h>
> +#include <drm/drm_drv.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  #include <drm/radeon_drm.h>
> @@ -51,7 +51,7 @@
>   * radeon_irq_process is a macro that points to the per-asic
>   * irq handler callback.
>   */
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
> +static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
>  {
>         struct drm_device *dev = (struct drm_device *) arg;
>         struct radeon_device *rdev = dev->dev_private;
> @@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
>   * Gets the hw ready to enable irqs (all asics).
>   * This function disables all interrupt sources on the GPU.
>   */
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
> +static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
> @@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>   * Handles stuff to be done after enabling irqs (all asics).
>   * Returns 0 on success.
>   */
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
> +static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>
> @@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
>   *
>   * This function disables all interrupt sources on the GPU (all asics).
>   */
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
> +static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>  {
>         struct radeon_device *rdev = dev->dev_private;
>         unsigned long irqflags;
> @@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
>         spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
>  }
>
> +static int radeon_irq_install(struct radeon_device *rdev, int irq)
> +{
> +       struct drm_device *dev = rdev->ddev;
> +       int ret;
> +
> +       if (irq == IRQ_NOTCONNECTED)
> +               return -ENOTCONN;
> +
> +       radeon_driver_irq_preinstall_kms(dev);
> +
> +       /* PCI devices require shared interrupts. */
> +       ret = request_irq(irq, radeon_driver_irq_handler_kms,
> +                         IRQF_SHARED, dev->driver->name, dev);
> +       if (ret)
> +               return ret;
> +
> +       radeon_driver_irq_postinstall_kms(dev);
> +
> +       return 0;
> +}
> +
> +static void radeon_irq_uninstall(struct radeon_device *rdev)
> +{
> +       struct drm_device *dev = rdev->ddev;
> +       struct pci_dev *pdev = to_pci_dev(dev->dev);
> +
> +       radeon_driver_irq_uninstall_kms(dev);
> +       free_irq(pdev->irq, dev);
> +}
> +
>  /**
>   * radeon_msi_ok - asic specific msi checks
>   *
> @@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>         INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
>
>         rdev->irq.installed = true;
> -       r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
> +       r = radeon_irq_install(rdev, rdev->pdev->irq);
>         if (r) {
>                 rdev->irq.installed = false;
>                 flush_delayed_work(&rdev->hotplug_work);
> @@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>  void radeon_irq_kms_fini(struct radeon_device *rdev)
>  {
>         if (rdev->irq.installed) {
> -               drm_irq_uninstall(rdev->ddev);
> +               radeon_irq_uninstall(rdev);
>                 rdev->irq.installed = false;
>                 if (rdev->msi_enabled)
>                         pci_disable_msi(rdev->pdev);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h
> index 9b97bf38acd4..36e73cea9215 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.h
> +++ b/drivers/gpu/drm/radeon/radeon_kms.h
> @@ -31,9 +31,5 @@
>  u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
>  int radeon_enable_vblank_kms(struct drm_crtc *crtc);
>  void radeon_disable_vblank_kms(struct drm_crtc *crtc);
> -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
> -void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
> -int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
> -void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
>
>  #endif                         /* __RADEON_KMS_H__ */
> --
> 2.32.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 172+ messages in thread

end of thread, other threads:[~2021-08-02 15:29 UTC | newest]

Thread overview: 172+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 18:27 [PATCH 00/14] drm: Make DRM's IRQ helpers legacy Thomas Zimmermann
2021-07-27 18:27 ` Thomas Zimmermann
2021-07-27 18:27 ` Thomas Zimmermann
2021-07-27 18:27 ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-28 10:27   ` Christian König
2021-07-28 10:27     ` Christian König
2021-07-28 10:27     ` Christian König
2021-07-28 10:27     ` Christian König
2021-07-28 14:03     ` Alex Deucher
2021-07-28 14:03       ` Alex Deucher
2021-07-28 14:03       ` Alex Deucher
2021-07-28 14:03       ` Alex Deucher
2021-08-02  8:43       ` Thomas Zimmermann
2021-08-02  8:43         ` Thomas Zimmermann
2021-08-02  8:43         ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 02/14] drm/arm/hdlcd: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-28 13:31   ` Sam Ravnborg
2021-07-28 13:31     ` Sam Ravnborg
2021-07-28 13:31     ` Sam Ravnborg
2021-07-28 18:15     ` Thomas Zimmermann
2021-07-28 18:15       ` Thomas Zimmermann
2021-07-28 18:15       ` Thomas Zimmermann
2021-07-28 18:15       ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 03/14] drm/atmel-hlcdc: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-28 14:00   ` Sam Ravnborg
2021-07-28 14:00     ` Sam Ravnborg
2021-07-28 14:00     ` Sam Ravnborg
2021-07-28 15:11     ` Dan.Sneddon
2021-07-28 15:11       ` Dan.Sneddon
2021-07-28 15:11       ` Dan.Sneddon
2021-07-28 15:11       ` Dan.Sneddon
2021-07-28 15:44       ` Sam Ravnborg
2021-07-28 15:44         ` Sam Ravnborg
2021-07-28 15:44         ` Sam Ravnborg
2021-07-28 17:50         ` Dan.Sneddon
2021-07-28 17:50           ` Dan.Sneddon
2021-07-28 17:50           ` Dan.Sneddon
2021-07-28 17:50           ` Dan.Sneddon
2021-07-28 18:11           ` Sam Ravnborg
2021-07-28 18:11             ` Sam Ravnborg
2021-07-28 18:11             ` Sam Ravnborg
2021-07-28 18:17             ` Thomas Zimmermann
2021-07-28 18:17               ` Thomas Zimmermann
2021-07-28 18:17               ` Thomas Zimmermann
2021-07-28 18:17               ` Thomas Zimmermann
2021-07-28 18:46               ` Dan.Sneddon
2021-07-28 18:46                 ` Dan.Sneddon
2021-07-28 18:46                 ` Dan.Sneddon
2021-07-28 18:46                 ` Dan.Sneddon
2021-07-28 19:08                 ` Sam Ravnborg
2021-07-28 19:08                   ` Sam Ravnborg
2021-07-28 19:08                   ` Sam Ravnborg
2021-07-28 19:19                   ` Dan.Sneddon
2021-07-28 19:19                     ` Dan.Sneddon
2021-07-28 19:19                     ` Dan.Sneddon
2021-07-28 19:19                     ` Dan.Sneddon
2021-07-28 20:11                     ` Sam Ravnborg
2021-07-28 20:11                       ` Sam Ravnborg
2021-07-28 20:11                       ` Sam Ravnborg
2021-07-29 19:18                       ` Thomas Zimmermann
2021-07-29 19:18                         ` Thomas Zimmermann
2021-07-29 19:18                         ` Thomas Zimmermann
2021-07-29 19:18                         ` Thomas Zimmermann
2021-07-29 19:21                         ` Thomas Zimmermann
2021-07-29 19:21                           ` Thomas Zimmermann
2021-07-29 19:21                           ` Thomas Zimmermann
2021-07-29 19:21                           ` Thomas Zimmermann
2021-07-29 19:24                         ` Dan.Sneddon
2021-07-29 19:24                           ` Dan.Sneddon
2021-07-29 19:24                           ` Dan.Sneddon
2021-07-29 19:24                           ` Dan.Sneddon
2021-07-29 19:32                           ` Thomas Zimmermann
2021-07-29 19:32                             ` Thomas Zimmermann
2021-07-29 19:32                             ` Thomas Zimmermann
2021-07-29 19:32                             ` Thomas Zimmermann
2021-07-29 19:48                         ` Sam Ravnborg
2021-07-29 19:48                           ` Sam Ravnborg
2021-07-29 19:48                           ` Sam Ravnborg
2021-07-29 19:55                           ` Dan.Sneddon
2021-07-29 19:55                             ` Dan.Sneddon
2021-07-29 19:55                             ` Dan.Sneddon
2021-07-29 19:55                             ` Dan.Sneddon
2021-07-30  8:31                             ` Thomas Zimmermann
2021-07-30  8:31                               ` Thomas Zimmermann
2021-07-30  8:31                               ` Thomas Zimmermann
2021-07-30  8:31                               ` Thomas Zimmermann
2021-07-30 18:10                               ` Dan.Sneddon
2021-07-30 18:10                                 ` Dan.Sneddon
2021-07-30 18:10                                 ` Dan.Sneddon
2021-07-28 18:19             ` Dan.Sneddon
2021-07-28 18:19               ` Dan.Sneddon
2021-07-28 18:19               ` Dan.Sneddon
2021-07-28 18:19               ` Dan.Sneddon
2021-07-27 18:27 ` [PATCH 04/14] drm/fsl-dcu: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 05/14] drm/gma500: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 06/14] drm/kmb: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 07/14] drm/msm: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 08/14] drm/mxsfb: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 09/14] drm/radeon: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-08-02 15:27   ` Alex Deucher
2021-08-02 15:27     ` Alex Deucher
2021-08-02 15:27     ` Alex Deucher
2021-07-27 18:27 ` [PATCH 10/14] drm/tidss: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-29  7:02   ` Tomi Valkeinen
2021-07-29  7:02     ` Tomi Valkeinen
2021-07-29  7:02     ` Tomi Valkeinen
2021-07-29  7:02     ` Tomi Valkeinen
2021-07-27 18:27 ` [PATCH 11/14] drm/tilcdc: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 12/14] drm/vc4: " Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 13/14] drm: Remove unused devm_drm_irq_install() Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 14/14] drm: IRQ midlayer is now legacy Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-27 18:27   ` Thomas Zimmermann
2021-07-28 14:10   ` Sam Ravnborg
2021-07-28 14:10     ` Sam Ravnborg
2021-07-28 14:10     ` Sam Ravnborg
2021-07-27 18:51 ` [PATCH 00/14] drm: Make DRM's IRQ helpers legacy Sam Ravnborg
2021-07-27 18:51   ` Sam Ravnborg
2021-07-27 18:51   ` Sam Ravnborg
2021-07-28  5:19   ` Thomas Zimmermann
2021-07-28  5:19     ` Thomas Zimmermann
2021-07-28  5:19     ` Thomas Zimmermann
2021-07-28  5:19     ` Thomas Zimmermann
2021-07-31 18:50 ` Sam Ravnborg
2021-07-31 18:50   ` Sam Ravnborg
2021-08-01 19:56   ` Thomas Zimmermann
2021-08-01 19:56     ` Thomas Zimmermann
2021-08-01 20:24     ` Sam Ravnborg
2021-08-01 20:24       ` Sam Ravnborg
2021-08-02  8:42       ` Thomas Zimmermann
2021-08-02  8:42         ` Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.