summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_irq.c
diff options
context:
space:
mode:
authorDani Liberman <dliberman@habana.ai>2023-09-18 14:48:47 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:41:16 +0300
commit14d25d8d684d0196d160653659c5afbf5af777f0 (patch)
tree394ceff2e5e66d7797de95a8b5ce333f8043fac1 /drivers/gpu/drm/xe/xe_irq.c
parentdbac286d8529d6debc0f56fa9a3ea26f78826997 (diff)
downloadlinux-14d25d8d684d0196d160653659c5afbf5af777f0.tar.xz
drm/xe: change old msi irq api to a new one
As a preparation for msix support, changing for new msi irq api which supports both msi and msix. Reviewed-by: Ohad Sharabi <osharabi@habana.ai> Signed-off-by: Dani Liberman <dliberman@habana.ai> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> [Rebase fixes by Rodrigo]
Diffstat (limited to 'drivers/gpu/drm/xe/xe_irq.c')
-rw-r--r--drivers/gpu/drm/xe/xe_irq.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index e1126eccb50e..82ddf9d84a56 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -555,23 +555,24 @@ static void irq_uninstall(struct drm_device *drm, void *arg)
{
struct xe_device *xe = arg;
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
- int irq = pdev->irq;
+ int irq;
if (!xe->irq.enabled)
return;
xe->irq.enabled = false;
xe_irq_reset(xe);
+
+ irq = pci_irq_vector(pdev, 0);
free_irq(irq, xe);
- if (pdev->msi_enabled)
- pci_disable_msi(pdev);
+ pci_free_irq_vectors(pdev);
}
int xe_irq_install(struct xe_device *xe)
{
- int irq = to_pci_dev(xe->drm.dev)->irq;
+ struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
irq_handler_t irq_handler;
- int err;
+ int err, irq;
irq_handler = xe_irq_handler(xe);
if (!irq_handler) {
@@ -581,16 +582,35 @@ int xe_irq_install(struct xe_device *xe)
xe_irq_reset(xe);
- err = request_irq(irq, irq_handler,
- IRQF_SHARED, DRIVER_NAME, xe);
- if (err < 0)
+ err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
+ if (err < 0) {
+ drm_err(&xe->drm, "MSI: Failed to enable support %d\n", err);
return err;
+ }
+
+ irq = pci_irq_vector(pdev, 0);
+ err = request_irq(irq, irq_handler, IRQF_SHARED, DRIVER_NAME, xe);
+ if (err < 0) {
+ drm_err(&xe->drm, "Failed to request MSI IRQ %d\n", err);
+ goto free_pci_irq_vectors;
+ }
xe->irq.enabled = true;
xe_irq_postinstall(xe);
- return drmm_add_action_or_reset(&xe->drm, irq_uninstall, xe);
+ err = drmm_add_action_or_reset(&xe->drm, irq_uninstall, xe);
+ if (err)
+ goto free_irq_handler;
+
+ return 0;
+
+free_irq_handler:
+ free_irq(irq, xe);
+free_pci_irq_vectors:
+ pci_free_irq_vectors(pdev);
+
+ return err;
}
void xe_irq_shutdown(struct xe_device *xe)