All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org>
Cc: geert+renesas@glider.be, nouveau@lists.freedesktop.org,
	Victor.Zhao@amd.com, edmund.j.dea@intel.com,
	linux-kernel@vger.kernel.org, paul@crapouillou.net,
	linux-tegra@vger.kernel.org, mdaenzer@redhat.com,
	thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com,
	alim.akhtar@samsung.com, anitha.chrisanthus@intel.com,
	srinivasan.shanmugam@amd.com, steven.price@arm.com,
	mario.limonciello@amd.com, robh@kernel.org,
	linux-samsung-soc@vger.kernel.org, festevam@gmail.com,
	abrodkin@synopsys.com, kyungmin.park@samsung.com,
	amd-gfx@lists.freedesktop.org, matthias.bgg@gmail.com,
	bskeggs@redhat.com, sam@ravnborg.org, orsonzhai@gmail.com,
	linux-imx@nxp.com, p.zabel@pengutronix.de,
	chunkuang.hu@kernel.org, lijo.lazar@amd.com,
	kernel@pengutronix.de, mperttunen@nvidia.com,
	Bokun.Zhang@amd.com, Sascha Hauer <s.hauer@pengutronix.de>,
	maarten.lankhorst@linux.intel.com, shiwu.zhang@amd.com,
	inki.dae@samsung.com, le.ma@amd.com,
	linux-mediatek@lists.infradead.org,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	laurentiu.palcu@oss.nxp.com, biju.das.jz@bp.renesas.com,
	James.Zhu@amd.com, linux-arm-kernel@lists.infradead.org,
	angelogioacchino.delregno@collabora.com, jim.cromie@gmail.com,
	felix.kuehling@amd.com, Xinhui.Pan@amd.com,
	sw0312.kim@samsung.com, Douglas Anderson <dianders@chromium.org>,
	patrik.r.jakobsson@gmail.com, linux-renesas-soc@vger.kernel.org,
	krzysztof.kozlowski@linaro.org,
	kieran.bingham+renesas@ideasonboard.com, daniel@ffwll.ch,
	zhang.lyra@gmail.com, alexander.deucher@amd.com,
	l.stach@pengutronix.de, shawnguo@kernel.org,
	christian.koenig@amd.com, Hawking.Zhang@amd.com
Subject: [Nouveau] [RFT PATCH v2 00/12] drm: call drm_atomic_helper_shutdown() at the right times
Date: Thu, 21 Sep 2023 12:26:43 -0700	[thread overview]
Message-ID: <20230921192749.1542462-1-dianders@chromium.org> (raw)


This patch series came about after a _long_ discussion between me and
Maxime Ripard in response to a different patch I sent out [1]. As part
of that discussion, we realized that it would be good if DRM drivers
consistently called drm_atomic_helper_shutdown() properly at shutdown
and driver remove time as it's documented that they should do. The
eventual goal of this would be to enable removing some hacky code from
panel drivers where they had to hook into shutdown themselves because
the DRM driver wasn't calling them.

It turns out that quite a lot of drivers seemed to be missing
drm_atomic_helper_shutdown() in one or both places that it was
supposed to be. This patch series attempts to fix all the drivers that
I was able to identify.

NOTE: fixing this wasn't exactly cookie cutter. Each driver has its
own unique way of setting itself up and tearing itself down. Some
drivers also use the component model, which adds extra fun. I've made
my best guess at solving this and I've run a bunch of compile tests
(specifically, allmodconfig for amd64, arm64, and powerpc). That being
said, these code changes are not totally trivial and I've done zero
real testing on them. Making these patches was also a little mind
numbing and I'm certain my eyes glazed over at several points when
writing them. What I'm trying to say is to please double-check that I
didn't do anything too silly, like cast your driver's drvdata to the
wrong type. Even better, test these patches!

I've labeled this patch series as RFT (request for testing) to help
call attention to the fact that I didn't personally test any of these
patches.

I'd like to call out a few drivers that I _didn't_ fix in this series
and why. If any of these drivers should be fixed then please yell.
- DRM drivers backed by usb_driver (like gud, gm12u320, udl): I didn't
  add the call to drm_atomic_helper_shutdown() at shutdown time
  because there's no ".shutdown" callback for them USB drivers. Given
  that USB is hotpluggable, I'm assuming that they are robust against
  this and the special shutdown callback isn't needed.
- ofdrm and simpledrm: These didn't have drm_atomic_helper_shutdown()
  in either shutdown or remove, but I didn't add it. I think that's OK
  since they're sorta special and not really directly controlling
  hardware power sequencing.
- virtio, vkms, vmwgfx, xen: I believe these are all virtual (thus
  they wouldn't directly drive a panel) and adding the shutdown
  didn't look straightforward, so I skipped them.

I've let each patch in the series get CCed straight from
get_maintainer. That means not everyone will have received every patch
but everyone should be on the cover letter. I know some people dislike
this but when touching this many drivers there's not much
choice. dri-devel and lkml have been CCed and lore/lei exist, so
hopefully that's enough for folks. I'm happy to add people to the
whole series for future posts.

NOTE: I landed everything I could from v1 of the patch series [2] [3]
to drm-misc. This v2 is everyone that is still left. If you'd like me
to land one of the patches here to drm-misc for you, please say
so. Otherwise I will assume maintainers will pick patches for their
particular driver and land them. There are no dependencies.

[1] https://lore.kernel.org/lkml/20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid
[2] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org
[3] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org

Changes in v2:
- Rebased and resolved conflicts.

Douglas Anderson (12):
  drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time
  drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time
  drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time
  drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown
    time
  drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time
  drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/sprd: Call drm_atomic_helper_shutdown() at remove time
  drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
  drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/renesas/shmobile: Call drm_helper_force_disable_all() at
    shutdown/remove time

 drivers/gpu/drm/amd/amdgpu/amdgpu.h              |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c       | 10 ++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c          |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.c          | 11 +++++++++++
 drivers/gpu/drm/gma500/psb_drv.c                 |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-drv.c              |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.c              |  7 +++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.h              |  1 +
 drivers/gpu/drm/kmb/kmb_drv.c                    |  6 ++++++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c           |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.c        |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.h        |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c            | 13 +++++++++++++
 drivers/gpu/drm/nouveau/nouveau_drv.h            |  1 +
 drivers/gpu/drm/nouveau/nouveau_platform.c       |  6 ++++++
 drivers/gpu/drm/radeon/radeon_drv.c              |  7 ++++++-
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 10 ++++++++++
 drivers/gpu/drm/sprd/sprd_drm.c                  |  4 +++-
 drivers/gpu/drm/tegra/drm.c                      |  6 ++++++
 drivers/gpu/drm/tiny/arcpgu.c                    |  6 ++++++
 20 files changed, 124 insertions(+), 2 deletions(-)

-- 
2.42.0.515.g380fc7ccd1-goog


WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org>
To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org>
Cc: Douglas Anderson <dianders@chromium.org>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Bokun.Zhang@amd.com, Hawking.Zhang@amd.com, James.Zhu@amd.com,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Victor.Zhao@amd.com, Xinhui.Pan@amd.com, abrodkin@synopsys.com,
	airlied@gmail.com, alexander.deucher@amd.com,
	alim.akhtar@samsung.com, amd-gfx@lists.freedesktop.org,
	angelogioacchino.delregno@collabora.com,
	anitha.chrisanthus@intel.com, biju.das.jz@bp.renesas.com,
	bskeggs@redhat.com, christian.koenig@amd.com,
	chunkuang.hu@kernel.org, daniel@ffwll.ch, edmund.j.dea@intel.com,
	felix.kuehling@amd.com, festevam@gmail.com,
	geert+renesas@glider.be, inki.dae@samsung.com,
	jim.cromie@gmail.com, jonathanh@nvidia.com,
	kernel@pengutronix.de, kherbst@redhat.com,
	kieran.bingham+renesas@ideasonboard.com,
	krzysztof.kozlowski@linaro.org, kyungmin.park@samsung.com,
	l.stach@pengutronix.de, laurent.pinchart@ideasonboard.com,
	laurentiu.palcu@oss.nxp.com, le.ma@amd.com, lijo.lazar@amd.com,
	linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-renesas-soc@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org,
	lyude@redhat.com, maarten.lankhorst@linux.intel.com,
	mario.limonciello@amd.com, matthias.bgg@gmail.com,
	mdaenzer@redhat.com, mperttunen@nvidia.com,
	nouveau@lists.freedesktop.org, orsonzhai@gmail.com,
	p.zabel@pengutronix.de, patrik.r.jakobsson@gmail.com,
	paul@crapouillou.net, robh@kernel.org, sam@ravnborg.org,
	shawnguo@kernel.org, shiwu.zhang@amd.com,
	srinivasan.shanmugam@amd.com, steven.price@arm.com,
	sw0312.kim@samsung.com, thierry.reding@gmail.com,
	tzimmermann@suse.de, zhang.lyra@gmail.com
Subject: [RFT PATCH v2 00/12] drm: call drm_atomic_helper_shutdown() at the right times
Date: Thu, 21 Sep 2023 12:26:43 -0700	[thread overview]
Message-ID: <20230921192749.1542462-1-dianders@chromium.org> (raw)


This patch series came about after a _long_ discussion between me and
Maxime Ripard in response to a different patch I sent out [1]. As part
of that discussion, we realized that it would be good if DRM drivers
consistently called drm_atomic_helper_shutdown() properly at shutdown
and driver remove time as it's documented that they should do. The
eventual goal of this would be to enable removing some hacky code from
panel drivers where they had to hook into shutdown themselves because
the DRM driver wasn't calling them.

It turns out that quite a lot of drivers seemed to be missing
drm_atomic_helper_shutdown() in one or both places that it was
supposed to be. This patch series attempts to fix all the drivers that
I was able to identify.

NOTE: fixing this wasn't exactly cookie cutter. Each driver has its
own unique way of setting itself up and tearing itself down. Some
drivers also use the component model, which adds extra fun. I've made
my best guess at solving this and I've run a bunch of compile tests
(specifically, allmodconfig for amd64, arm64, and powerpc). That being
said, these code changes are not totally trivial and I've done zero
real testing on them. Making these patches was also a little mind
numbing and I'm certain my eyes glazed over at several points when
writing them. What I'm trying to say is to please double-check that I
didn't do anything too silly, like cast your driver's drvdata to the
wrong type. Even better, test these patches!

I've labeled this patch series as RFT (request for testing) to help
call attention to the fact that I didn't personally test any of these
patches.

I'd like to call out a few drivers that I _didn't_ fix in this series
and why. If any of these drivers should be fixed then please yell.
- DRM drivers backed by usb_driver (like gud, gm12u320, udl): I didn't
  add the call to drm_atomic_helper_shutdown() at shutdown time
  because there's no ".shutdown" callback for them USB drivers. Given
  that USB is hotpluggable, I'm assuming that they are robust against
  this and the special shutdown callback isn't needed.
- ofdrm and simpledrm: These didn't have drm_atomic_helper_shutdown()
  in either shutdown or remove, but I didn't add it. I think that's OK
  since they're sorta special and not really directly controlling
  hardware power sequencing.
- virtio, vkms, vmwgfx, xen: I believe these are all virtual (thus
  they wouldn't directly drive a panel) and adding the shutdown
  didn't look straightforward, so I skipped them.

I've let each patch in the series get CCed straight from
get_maintainer. That means not everyone will have received every patch
but everyone should be on the cover letter. I know some people dislike
this but when touching this many drivers there's not much
choice. dri-devel and lkml have been CCed and lore/lei exist, so
hopefully that's enough for folks. I'm happy to add people to the
whole series for future posts.

NOTE: I landed everything I could from v1 of the patch series [2] [3]
to drm-misc. This v2 is everyone that is still left. If you'd like me
to land one of the patches here to drm-misc for you, please say
so. Otherwise I will assume maintainers will pick patches for their
particular driver and land them. There are no dependencies.

[1] https://lore.kernel.org/lkml/20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid
[2] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org
[3] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org

Changes in v2:
- Rebased and resolved conflicts.

Douglas Anderson (12):
  drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time
  drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time
  drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time
  drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown
    time
  drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time
  drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/sprd: Call drm_atomic_helper_shutdown() at remove time
  drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
  drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/renesas/shmobile: Call drm_helper_force_disable_all() at
    shutdown/remove time

 drivers/gpu/drm/amd/amdgpu/amdgpu.h              |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c       | 10 ++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c          |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.c          | 11 +++++++++++
 drivers/gpu/drm/gma500/psb_drv.c                 |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-drv.c              |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.c              |  7 +++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.h              |  1 +
 drivers/gpu/drm/kmb/kmb_drv.c                    |  6 ++++++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c           |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.c        |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.h        |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c            | 13 +++++++++++++
 drivers/gpu/drm/nouveau/nouveau_drv.h            |  1 +
 drivers/gpu/drm/nouveau/nouveau_platform.c       |  6 ++++++
 drivers/gpu/drm/radeon/radeon_drv.c              |  7 ++++++-
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 10 ++++++++++
 drivers/gpu/drm/sprd/sprd_drm.c                  |  4 +++-
 drivers/gpu/drm/tegra/drm.c                      |  6 ++++++
 drivers/gpu/drm/tiny/arcpgu.c                    |  6 ++++++
 20 files changed, 124 insertions(+), 2 deletions(-)

-- 
2.42.0.515.g380fc7ccd1-goog


WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org>
To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org>
Cc: geert+renesas@glider.be, nouveau@lists.freedesktop.org,
	Victor.Zhao@amd.com, edmund.j.dea@intel.com,
	linux-kernel@vger.kernel.org, paul@crapouillou.net,
	linux-tegra@vger.kernel.org, mdaenzer@redhat.com,
	thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com,
	alim.akhtar@samsung.com, anitha.chrisanthus@intel.com,
	srinivasan.shanmugam@amd.com, steven.price@arm.com,
	mario.limonciello@amd.com, linux-samsung-soc@vger.kernel.org,
	kherbst@redhat.com, abrodkin@synopsys.com,
	kyungmin.park@samsung.com, amd-gfx@lists.freedesktop.org,
	jonathanh@nvidia.com, matthias.bgg@gmail.com, bskeggs@redhat.com,
	sam@ravnborg.org, orsonzhai@gmail.com, linux-imx@nxp.com,
	chunkuang.hu@kernel.org, lijo.lazar@amd.com,
	kernel@pengutronix.de, mperttunen@nvidia.com,
	Bokun.Zhang@amd.com, Sascha Hauer <s.hauer@pengutronix.de>,
	shiwu.zhang@amd.com, le.ma@amd.com,
	linux-mediatek@lists.infradead.org,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	laurentiu.palcu@oss.nxp.com, biju.das.jz@bp.renesas.com,
	James.Zhu@amd.com, linux-arm-kernel@lists.infradead.org,
	angelogioacchino.delregno@collabora.com, tzimmermann@suse.de,
	felix.kuehling@amd.com, Xinhui.Pan@amd.com,
	sw0312.kim@samsung.com, Douglas Anderson <dianders@chromium.org>,
	linux-renesas-soc@vger.kernel.org,
	krzysztof.kozlowski@linaro.org,
	kieran.bingham+renesas@ideasonboard.com, zhang.lyra@gmail.com,
	alexander.deucher@amd.com, shawnguo@kernel.org,
	christian.koenig@amd.com, Hawking.Zhang@amd.com
Subject: [RFT PATCH v2 00/12] drm: call drm_atomic_helper_shutdown() at the right times
Date: Thu, 21 Sep 2023 12:26:43 -0700	[thread overview]
Message-ID: <20230921192749.1542462-1-dianders@chromium.org> (raw)


This patch series came about after a _long_ discussion between me and
Maxime Ripard in response to a different patch I sent out [1]. As part
of that discussion, we realized that it would be good if DRM drivers
consistently called drm_atomic_helper_shutdown() properly at shutdown
and driver remove time as it's documented that they should do. The
eventual goal of this would be to enable removing some hacky code from
panel drivers where they had to hook into shutdown themselves because
the DRM driver wasn't calling them.

It turns out that quite a lot of drivers seemed to be missing
drm_atomic_helper_shutdown() in one or both places that it was
supposed to be. This patch series attempts to fix all the drivers that
I was able to identify.

NOTE: fixing this wasn't exactly cookie cutter. Each driver has its
own unique way of setting itself up and tearing itself down. Some
drivers also use the component model, which adds extra fun. I've made
my best guess at solving this and I've run a bunch of compile tests
(specifically, allmodconfig for amd64, arm64, and powerpc). That being
said, these code changes are not totally trivial and I've done zero
real testing on them. Making these patches was also a little mind
numbing and I'm certain my eyes glazed over at several points when
writing them. What I'm trying to say is to please double-check that I
didn't do anything too silly, like cast your driver's drvdata to the
wrong type. Even better, test these patches!

I've labeled this patch series as RFT (request for testing) to help
call attention to the fact that I didn't personally test any of these
patches.

I'd like to call out a few drivers that I _didn't_ fix in this series
and why. If any of these drivers should be fixed then please yell.
- DRM drivers backed by usb_driver (like gud, gm12u320, udl): I didn't
  add the call to drm_atomic_helper_shutdown() at shutdown time
  because there's no ".shutdown" callback for them USB drivers. Given
  that USB is hotpluggable, I'm assuming that they are robust against
  this and the special shutdown callback isn't needed.
- ofdrm and simpledrm: These didn't have drm_atomic_helper_shutdown()
  in either shutdown or remove, but I didn't add it. I think that's OK
  since they're sorta special and not really directly controlling
  hardware power sequencing.
- virtio, vkms, vmwgfx, xen: I believe these are all virtual (thus
  they wouldn't directly drive a panel) and adding the shutdown
  didn't look straightforward, so I skipped them.

I've let each patch in the series get CCed straight from
get_maintainer. That means not everyone will have received every patch
but everyone should be on the cover letter. I know some people dislike
this but when touching this many drivers there's not much
choice. dri-devel and lkml have been CCed and lore/lei exist, so
hopefully that's enough for folks. I'm happy to add people to the
whole series for future posts.

NOTE: I landed everything I could from v1 of the patch series [2] [3]
to drm-misc. This v2 is everyone that is still left. If you'd like me
to land one of the patches here to drm-misc for you, please say
so. Otherwise I will assume maintainers will pick patches for their
particular driver and land them. There are no dependencies.

[1] https://lore.kernel.org/lkml/20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid
[2] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org
[3] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org

Changes in v2:
- Rebased and resolved conflicts.

Douglas Anderson (12):
  drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time
  drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time
  drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time
  drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown
    time
  drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time
  drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/sprd: Call drm_atomic_helper_shutdown() at remove time
  drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
  drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/renesas/shmobile: Call drm_helper_force_disable_all() at
    shutdown/remove time

 drivers/gpu/drm/amd/amdgpu/amdgpu.h              |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c       | 10 ++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c          |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.c          | 11 +++++++++++
 drivers/gpu/drm/gma500/psb_drv.c                 |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-drv.c              |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.c              |  7 +++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.h              |  1 +
 drivers/gpu/drm/kmb/kmb_drv.c                    |  6 ++++++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c           |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.c        |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.h        |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c            | 13 +++++++++++++
 drivers/gpu/drm/nouveau/nouveau_drv.h            |  1 +
 drivers/gpu/drm/nouveau/nouveau_platform.c       |  6 ++++++
 drivers/gpu/drm/radeon/radeon_drv.c              |  7 ++++++-
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 10 ++++++++++
 drivers/gpu/drm/sprd/sprd_drm.c                  |  4 +++-
 drivers/gpu/drm/tegra/drm.c                      |  6 ++++++
 drivers/gpu/drm/tiny/arcpgu.c                    |  6 ++++++
 20 files changed, 124 insertions(+), 2 deletions(-)

-- 
2.42.0.515.g380fc7ccd1-goog


WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org>
To: dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org>
Cc: geert+renesas@glider.be, nouveau@lists.freedesktop.org,
	Victor.Zhao@amd.com, edmund.j.dea@intel.com,
	linux-kernel@vger.kernel.org, paul@crapouillou.net,
	linux-tegra@vger.kernel.org, mdaenzer@redhat.com,
	thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com,
	alim.akhtar@samsung.com, anitha.chrisanthus@intel.com,
	srinivasan.shanmugam@amd.com, steven.price@arm.com,
	airlied@gmail.com, mario.limonciello@amd.com, robh@kernel.org,
	linux-samsung-soc@vger.kernel.org, kherbst@redhat.com,
	festevam@gmail.com, abrodkin@synopsys.com,
	kyungmin.park@samsung.com, amd-gfx@lists.freedesktop.org,
	jonathanh@nvidia.com, matthias.bgg@gmail.com, bskeggs@redhat.com,
	sam@ravnborg.org, orsonzhai@gmail.com, linux-imx@nxp.com,
	p.zabel@pengutronix.de, chunkuang.hu@kernel.org,
	lijo.lazar@amd.com, kernel@pengutronix.de, mperttunen@nvidia.com,
	Bokun.Zhang@amd.com, Sascha Hauer <s.hauer@pengutronix.de>,
	maarten.lankhorst@linux.intel.com, shiwu.zhang@amd.com,
	inki.dae@samsung.com, le.ma@amd.com,
	linux-mediatek@lists.infradead.org,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	laurentiu.palcu@oss.nxp.com, biju.das.jz@bp.renesas.com,
	James.Zhu@amd.com, linux-arm-kernel@lists.infradead.org,
	angelogioacchino.delregno@collabora.com, jim.cromie@gmail.com,
	tzimmermann@suse.de, felix.kuehling@amd.com, Xinhui.Pan@amd.com,
	sw0312.kim@samsung.com, Douglas Anderson <dianders@chromium.org>,
	patrik.r.jakobsson@gmail.com, linux-renesas-soc@vger.kernel.org,
	krzysztof.kozlowski@linaro.org,
	kieran.bingham+renesas@ideasonboard.com, daniel@ffwll.ch,
	zhang.lyra@gmail.com, alexander.deucher@amd.com,
	l.stach@pengutronix.de, shawnguo@kernel.org,
	christian.koenig@amd.com, Hawking.Zhang@amd.com
Subject: [RFT PATCH v2 00/12] drm: call drm_atomic_helper_shutdown() at the right times
Date: Thu, 21 Sep 2023 12:26:43 -0700	[thread overview]
Message-ID: <20230921192749.1542462-1-dianders@chromium.org> (raw)


This patch series came about after a _long_ discussion between me and
Maxime Ripard in response to a different patch I sent out [1]. As part
of that discussion, we realized that it would be good if DRM drivers
consistently called drm_atomic_helper_shutdown() properly at shutdown
and driver remove time as it's documented that they should do. The
eventual goal of this would be to enable removing some hacky code from
panel drivers where they had to hook into shutdown themselves because
the DRM driver wasn't calling them.

It turns out that quite a lot of drivers seemed to be missing
drm_atomic_helper_shutdown() in one or both places that it was
supposed to be. This patch series attempts to fix all the drivers that
I was able to identify.

NOTE: fixing this wasn't exactly cookie cutter. Each driver has its
own unique way of setting itself up and tearing itself down. Some
drivers also use the component model, which adds extra fun. I've made
my best guess at solving this and I've run a bunch of compile tests
(specifically, allmodconfig for amd64, arm64, and powerpc). That being
said, these code changes are not totally trivial and I've done zero
real testing on them. Making these patches was also a little mind
numbing and I'm certain my eyes glazed over at several points when
writing them. What I'm trying to say is to please double-check that I
didn't do anything too silly, like cast your driver's drvdata to the
wrong type. Even better, test these patches!

I've labeled this patch series as RFT (request for testing) to help
call attention to the fact that I didn't personally test any of these
patches.

I'd like to call out a few drivers that I _didn't_ fix in this series
and why. If any of these drivers should be fixed then please yell.
- DRM drivers backed by usb_driver (like gud, gm12u320, udl): I didn't
  add the call to drm_atomic_helper_shutdown() at shutdown time
  because there's no ".shutdown" callback for them USB drivers. Given
  that USB is hotpluggable, I'm assuming that they are robust against
  this and the special shutdown callback isn't needed.
- ofdrm and simpledrm: These didn't have drm_atomic_helper_shutdown()
  in either shutdown or remove, but I didn't add it. I think that's OK
  since they're sorta special and not really directly controlling
  hardware power sequencing.
- virtio, vkms, vmwgfx, xen: I believe these are all virtual (thus
  they wouldn't directly drive a panel) and adding the shutdown
  didn't look straightforward, so I skipped them.

I've let each patch in the series get CCed straight from
get_maintainer. That means not everyone will have received every patch
but everyone should be on the cover letter. I know some people dislike
this but when touching this many drivers there's not much
choice. dri-devel and lkml have been CCed and lore/lei exist, so
hopefully that's enough for folks. I'm happy to add people to the
whole series for future posts.

NOTE: I landed everything I could from v1 of the patch series [2] [3]
to drm-misc. This v2 is everyone that is still left. If you'd like me
to land one of the patches here to drm-misc for you, please say
so. Otherwise I will assume maintainers will pick patches for their
particular driver and land them. There are no dependencies.

[1] https://lore.kernel.org/lkml/20230804140605.RFC.4.I930069a32baab6faf46d6b234f89613b5cec0f14@changeid
[2] https://lore.kernel.org/r/20230901234015.566018-1-dianders@chromium.org
[3] https://lore.kernel.org/r/20230901234202.566951-1-dianders@chromium.org

Changes in v2:
- Rebased and resolved conflicts.

Douglas Anderson (12):
  drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time
  drm/kmb: Call drm_atomic_helper_shutdown() at shutdown time
  drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time
  drm/nouveau: Call drm_atomic_helper_shutdown() or equiv at shutdown
    time
  drm/tegra: Call drm_atomic_helper_shutdown() at shutdown time
  drm/arcpgu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/amdgpu: Call drm_atomic_helper_shutdown() at shutdown time
  drm/sprd: Call drm_atomic_helper_shutdown() at remove time
  drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time
  drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/radeon: Call drm_helper_force_disable_all() at shutdown/remove
    time
  drm/renesas/shmobile: Call drm_helper_force_disable_all() at
    shutdown/remove time

 drivers/gpu/drm/amd/amdgpu/amdgpu.h              |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c       | 10 ++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c          |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_drv.c          | 11 +++++++++++
 drivers/gpu/drm/gma500/psb_drv.c                 |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-drv.c              |  8 ++++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.c              |  7 +++++++
 drivers/gpu/drm/imx/dcss/dcss-kms.h              |  1 +
 drivers/gpu/drm/kmb/kmb_drv.c                    |  6 ++++++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c           |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.c        |  9 +++++++++
 drivers/gpu/drm/nouveau/nouveau_display.h        |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c            | 13 +++++++++++++
 drivers/gpu/drm/nouveau/nouveau_drv.h            |  1 +
 drivers/gpu/drm/nouveau/nouveau_platform.c       |  6 ++++++
 drivers/gpu/drm/radeon/radeon_drv.c              |  7 ++++++-
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 10 ++++++++++
 drivers/gpu/drm/sprd/sprd_drm.c                  |  4 +++-
 drivers/gpu/drm/tegra/drm.c                      |  6 ++++++
 drivers/gpu/drm/tiny/arcpgu.c                    |  6 ++++++
 20 files changed, 124 insertions(+), 2 deletions(-)

-- 
2.42.0.515.g380fc7ccd1-goog


             reply	other threads:[~2023-09-21 19:28 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 19:26 Douglas Anderson [this message]
2023-09-21 19:26 ` [RFT PATCH v2 00/12] drm: call drm_atomic_helper_shutdown() at the right times Douglas Anderson
2023-09-21 19:26 ` Douglas Anderson
2023-09-21 19:26 ` Douglas Anderson
2023-09-21 19:26 ` [RFT PATCH v2 01/12] drm/imx/dcss: Call drm_atomic_helper_shutdown() at shutdown time Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-22  7:56   ` Laurentiu Palcu
2023-09-22  7:56     ` Laurentiu Palcu
2023-09-22  7:56     ` Laurentiu Palcu
2023-09-22 15:44     ` Doug Anderson
2023-09-22 15:44       ` Doug Anderson
2023-09-22 15:44       ` Doug Anderson
2023-09-25  5:47       ` Laurentiu Palcu
2023-09-25  5:47         ` Laurentiu Palcu
2023-09-25  5:47         ` Laurentiu Palcu
2023-09-25 22:53         ` Doug Anderson
2023-09-25 22:53           ` Doug Anderson
2023-09-25 22:53           ` Doug Anderson
2023-09-21 19:26 ` [RFT PATCH v2 02/12] drm/kmb: " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26 ` [RFT PATCH v2 03/12] drm/mediatek: " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26 ` [Nouveau] [RFT PATCH v2 04/12] drm/nouveau: Call drm_atomic_helper_shutdown() or equiv " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-22 21:06   ` Lyude Paul
2023-09-22 21:06     ` Lyude Paul
2023-09-22 21:06     ` [Nouveau] " Lyude Paul
2023-11-17 23:00     ` Doug Anderson
2023-11-17 23:00       ` Doug Anderson
2023-11-17 23:00       ` [Nouveau] " Doug Anderson
2023-12-05 20:45       ` Doug Anderson
2023-12-05 20:45         ` Doug Anderson
2023-12-05 20:45         ` [Nouveau] " Doug Anderson
2023-12-06  8:14         ` Maxime Ripard
2023-12-06  8:14           ` Maxime Ripard
2023-12-06  8:14           ` [Nouveau] " Maxime Ripard
2023-09-21 19:26 ` [RFT PATCH v2 05/12] drm/tegra: Call drm_atomic_helper_shutdown() " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26 ` [RFT PATCH v2 06/12] drm/arcpgu: " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26 ` [RFT PATCH v2 07/12] drm/amdgpu: " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-25 15:56   ` Deucher, Alexander
2023-09-25 15:56     ` Deucher, Alexander
2023-09-25 15:56     ` Deucher, Alexander
2023-09-25 17:04     ` Doug Anderson
2023-09-25 17:04       ` Doug Anderson
2023-09-25 17:04       ` Doug Anderson
2023-09-21 19:26 ` [RFT PATCH v2 08/12] drm/sprd: Call drm_atomic_helper_shutdown() at remove time Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26 ` [RFT PATCH v2 09/12] drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-22  5:55   ` Marek Szyprowski
2023-09-22  5:55     ` Marek Szyprowski
2023-09-22  5:55     ` Marek Szyprowski
2023-10-06  2:19     ` Inki Dae
2023-10-06  2:19       ` Inki Dae
2023-10-06  2:19       ` Inki Dae
2023-10-06 13:50       ` Doug Anderson
2023-10-06 13:50         ` Doug Anderson
2023-10-06 13:50         ` Doug Anderson
2023-10-10 15:46         ` Inki Dae
2023-10-10 15:46           ` Inki Dae
2023-10-10 15:46           ` Inki Dae
2023-09-21 19:26 ` [RFT PATCH v2 10/12] drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove time Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26 ` [RFT PATCH v2 11/12] drm/radeon: " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson
2023-09-25 15:49   ` Deucher, Alexander
2023-09-25 15:49     ` Deucher, Alexander
2023-09-25 15:49     ` Deucher, Alexander
2023-09-25 16:09     ` Doug Anderson
2023-09-25 16:09       ` Doug Anderson
2023-09-25 16:09       ` Doug Anderson
2023-09-21 19:26 ` [RFT PATCH v2 12/12] drm/renesas/shmobile: " Douglas Anderson
2023-09-21 19:26   ` Douglas Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230921192749.1542462-1-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=Bokun.Zhang@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=James.Zhu@amd.com \
    --cc=Victor.Zhao@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=abrodkin@synopsys.com \
    --cc=alexander.deucher@amd.com \
    --cc=alim.akhtar@samsung.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=anitha.chrisanthus@intel.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edmund.j.dea@intel.com \
    --cc=felix.kuehling@amd.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=inki.dae@samsung.com \
    --cc=jim.cromie@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kyungmin.park@samsung.com \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=laurentiu.palcu@oss.nxp.com \
    --cc=le.ma@amd.com \
    --cc=lijo.lazar@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mdaenzer@redhat.com \
    --cc=mperttunen@nvidia.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=orsonzhai@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=patrik.r.jakobsson@gmail.com \
    --cc=paul@crapouillou.net \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sam@ravnborg.org \
    --cc=shawnguo@kernel.org \
    --cc=shiwu.zhang@amd.com \
    --cc=srinivasan.shanmugam@amd.com \
    --cc=steven.price@arm.com \
    --cc=sw0312.kim@samsung.com \
    --cc=thierry.reding@gmail.com \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.