From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Ohad Sharabi <osharabi@habana.ai>, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [Intel-xe] [CI 2/3] drm/xe: change old msi irq api to a new one
Date: Thu, 21 Sep 2023 17:07:59 -0400 [thread overview]
Message-ID: <20230921210800.170275-2-rodrigo.vivi@intel.com> (raw)
In-Reply-To: <20230921210800.170275-1-rodrigo.vivi@intel.com>
From: Dani Liberman <dliberman@habana.ai>
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]
---
drivers/gpu/drm/xe/xe_irq.c | 38 ++++++++++++++++++++++++++++---------
drivers/gpu/drm/xe/xe_pci.c | 3 ---
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index f98aa1f06c8f..6052c944acda 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -566,23 +566,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) {
@@ -592,16 +593,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)
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index dc233a1226bd..a11163b89a3f 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -694,9 +694,6 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_master(pdev);
- if (pci_enable_msi(pdev) < 0)
- drm_dbg(&xe->drm, "can't enable MSI");
-
err = xe_info_init(xe, desc, subplatform_desc);
if (err)
goto err_pci_disable;
--
2.41.0
next prev parent reply other threads:[~2023-09-21 21:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 21:07 [Intel-xe] [CI 1/3] drm/xe: proper setting of irq enabled flag Rodrigo Vivi
2023-09-21 21:07 ` Rodrigo Vivi [this message]
2023-09-21 21:08 ` [Intel-xe] [CI 3/3] drm/xe: add msix support Rodrigo Vivi
2023-09-21 21:54 ` [Intel-xe] ✓ CI.Patch_applied: success for series starting with [CI,1/3] drm/xe: proper setting of irq enabled flag Patchwork
2023-09-21 21:54 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-09-21 21:56 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-09-21 22:03 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-21 22:03 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-21 22:04 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-09-21 22:39 ` [Intel-xe] ✓ CI.BAT: " Patchwork
2023-09-22 8:18 ` [Intel-xe] [CI 1/3] " Ville Syrjälä
2023-09-22 12:11 ` Rodrigo Vivi
2023-09-22 12:54 ` Ville Syrjälä
2023-09-22 21:05 ` Rodrigo Vivi
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=20230921210800.170275-2-rodrigo.vivi@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=osharabi@habana.ai \
/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