Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/irq: allocate all possible msix interrupts
@ 2024-01-16 13:07 Dani Liberman
  2024-01-16 13:27 ` Ohad Sharabi
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Dani Liberman @ 2024-01-16 13:07 UTC (permalink / raw)
  To: intel-xe

For future platforms which will support msix, need to allocate all
possible interrupts.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Cc: Ohad Sharabi <osharabi@habana.ai>
---
 drivers/gpu/drm/xe/xe_irq.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index 907c8ff0fa21..62722809a01d 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -662,7 +662,7 @@ int xe_irq_install(struct xe_device *xe)
 {
 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 	irq_handler_t irq_handler;
-	int err, irq;
+	int err, irq, nvec;
 
 	irq_handler = xe_irq_handler(xe);
 	if (!irq_handler) {
@@ -672,7 +672,18 @@ int xe_irq_install(struct xe_device *xe)
 
 	xe_irq_reset(xe);
 
-	err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_MSIX);
+	if (pdev->msix_cap) {
+		nvec = pci_msix_vec_count(pdev);
+		if (nvec <= 0) {
+			drm_err(&xe->drm, "MSIX: Failed getting count\n");
+			return -EINVAL;
+		}
+	} else {
+		/* device supports only msi */
+		nvec = 1;
+	}
+
+	err = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_MSI | PCI_IRQ_MSIX);
 	if (err < 0) {
 		drm_err(&xe->drm, "MSI/MSIX: Failed to enable support %d\n", err);
 		return err;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-17 10:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16 13:07 [PATCH] drm/xe/irq: allocate all possible msix interrupts Dani Liberman
2024-01-16 13:27 ` Ohad Sharabi
2024-01-16 14:25   ` Jani Nikula
2024-01-16 14:22 ` ✓ CI.Patch_applied: success for " Patchwork
2024-01-16 14:22 ` ✓ CI.checkpatch: " Patchwork
2024-01-16 14:23 ` ✓ CI.KUnit: " Patchwork
2024-01-16 14:30 ` ✓ CI.Build: " Patchwork
2024-01-16 14:30 ` ✓ CI.Hooks: " Patchwork
2024-01-16 14:32 ` ✓ CI.checksparse: " Patchwork
2024-01-16 14:55 ` ✓ CI.BAT: " Patchwork
2024-01-16 23:13 ` [PATCH] " Lucas De Marchi
2024-01-17 10:08   ` Dani Liberman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox