Message ID | 20210727182721.17981-1-tzimmermann@suse.de |
---|---|
Headers | show |
Series | drm: Make DRM's IRQ helpers legacy | expand |
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 >
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);
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); >
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
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
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