From: Alex Deucher <alexdeucher@gmail.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: Dave Airlie <airlied@linux.ie>, Liviu Dudau <liviu.dudau@arm.com>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
anitha.chrisanthus@intel.com, Sam Ravnborg <sam@ravnborg.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
freedreno <freedreno@lists.freedesktop.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
edmund.j.dea@intel.com, Sascha Hauer <s.hauer@pengutronix.de>,
alison.wang@nxp.com,
Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
Sean Paul <sean@poorly.run>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
tomba@kernel.org, bbrezillon@kernel.org, jyri.sarha@iki.fi,
nicolas.ferre@microchip.com, Sascha Hauer <kernel@pengutronix.de>,
"Deucher, Alexander" <alexander.deucher@amd.com>,
Shawn Guo <shawnguo@kernel.org>
Subject: Re: [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces
Date: Wed, 28 Jul 2021 10:03:10 -0400 [thread overview]
Message-ID: <CADnq5_MmPu=k3cc7JCg1iemkCDnoxR1T8PTD_VJn=58f5DwUNQ@mail.gmail.com> (raw)
In-Reply-To: <24a8b2ab-ef38-219b-99d4-806a44fa6aba@amd.com>
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);
>
next prev parent reply other threads:[~2021-07-28 14:03 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 18:27 [PATCH 00/14] drm: Make DRM's IRQ helpers legacy Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 01/14] drm/amdgpu: Convert to Linux IRQ interfaces Thomas Zimmermann
2021-07-28 10:27 ` Christian König
2021-07-28 14:03 ` Alex Deucher [this message]
2021-08-02 8:43 ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 02/14] drm/arm/hdlcd: " Thomas Zimmermann
2021-07-28 13:31 ` Sam Ravnborg
2021-07-28 18:15 ` Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 03/14] drm/atmel-hlcdc: " Thomas Zimmermann
2021-07-28 14:00 ` Sam Ravnborg
2021-07-28 15:11 ` Dan.Sneddon
2021-07-28 15:44 ` Sam Ravnborg
2021-07-28 17:50 ` Dan.Sneddon
2021-07-28 18:11 ` Sam Ravnborg
2021-07-28 18:17 ` Thomas Zimmermann
2021-07-28 18:46 ` Dan.Sneddon
2021-07-28 19:08 ` Sam Ravnborg
2021-07-28 19:19 ` Dan.Sneddon
2021-07-28 20:11 ` Sam Ravnborg
2021-07-29 19:18 ` Thomas Zimmermann
2021-07-29 19:21 ` Thomas Zimmermann
2021-07-29 19:24 ` Dan.Sneddon
2021-07-29 19:32 ` Thomas Zimmermann
2021-07-29 19:48 ` Sam Ravnborg
2021-07-29 19:55 ` Dan.Sneddon
2021-07-30 8:31 ` Thomas Zimmermann
2021-07-30 18:10 ` 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 ` [PATCH 05/14] drm/gma500: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 06/14] drm/kmb: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 07/14] drm/msm: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 08/14] drm/mxsfb: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 09/14] drm/radeon: " Thomas Zimmermann
2021-08-02 15:27 ` Alex Deucher
2021-07-27 18:27 ` [PATCH 10/14] drm/tidss: " Thomas Zimmermann
2021-07-29 7:02 ` Tomi Valkeinen
2021-07-27 18:27 ` [PATCH 11/14] drm/tilcdc: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 12/14] drm/vc4: " Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 13/14] drm: Remove unused devm_drm_irq_install() Thomas Zimmermann
2021-07-27 18:27 ` [PATCH 14/14] drm: IRQ midlayer is now legacy Thomas Zimmermann
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-28 5:19 ` Thomas Zimmermann
2021-07-31 18:50 ` Sam Ravnborg
2021-08-01 19:56 ` Thomas Zimmermann
2021-08-01 20:24 ` Sam Ravnborg
2021-08-02 8:42 ` Thomas Zimmermann
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='CADnq5_MmPu=k3cc7JCg1iemkCDnoxR1T8PTD_VJn=58f5DwUNQ@mail.gmail.com' \
--to=alexdeucher@gmail.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=alison.wang@nxp.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=anitha.chrisanthus@intel.com \
--cc=bbrezillon@kernel.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edmund.j.dea@intel.com \
--cc=freedreno@lists.freedesktop.org \
--cc=jyri.sarha@iki.fi \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=nicolas.ferre@microchip.com \
--cc=s.hauer@pengutronix.de \
--cc=sam@ravnborg.org \
--cc=sean@poorly.run \
--cc=shawnguo@kernel.org \
--cc=tomba@kernel.org \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).