Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/xe/irq: allocate all possible msix interrupts
@ 2024-01-21  9:02 Dani Liberman
  2024-01-21  9:06 ` ✓ CI.Patch_applied: success for drm/xe/irq: allocate all possible msix interrupts (rev2) Patchwork
                   ` (16 more replies)
  0 siblings, 17 replies; 21+ messages in thread
From: Dani Liberman @ 2024-01-21  9:02 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi

If platform supports MSIX, driver needs to allocate all possible
interrupts.

v2:
  - drop msix_cap and use the api return code instead.
  - fix commit message.

Cc: Ohad Sharabi <osharabi@habana.ai>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Dani Liberman <dliberman@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..7a23d25c1062 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);
+	nvec = pci_msix_vec_count(pdev);
+	if (nvec <= 0) {
+		if (nvec == -EINVAL) {
+			/* MSIX capability is not supported in the device, using MSI */
+			nvec = 1;
+		} else {
+			drm_err(&xe->drm, "MSIX: Failed getting count\n");
+			return nvec;
+		}
+	}
+
+	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] 21+ messages in thread

end of thread, other threads:[~2024-01-24 20:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-21  9:02 [PATCH v2] drm/xe/irq: allocate all possible msix interrupts Dani Liberman
2024-01-21  9:06 ` ✓ CI.Patch_applied: success for drm/xe/irq: allocate all possible msix interrupts (rev2) Patchwork
2024-01-21  9:06 ` ✓ CI.checkpatch: " Patchwork
2024-01-21  9:07 ` ✓ CI.KUnit: " Patchwork
2024-01-21  9:14 ` ✓ CI.Build: " Patchwork
2024-01-21  9:14 ` ✓ CI.Hooks: " Patchwork
2024-01-21  9:16 ` ✓ CI.checksparse: " Patchwork
2024-01-21  9:42 ` ✗ CI.BAT: failure " Patchwork
2024-01-22  9:00 ` ✓ CI.Patch_applied: success for drm/xe/irq: allocate all possible msix interrupts (rev3) Patchwork
2024-01-22  9:00 ` ✓ CI.checkpatch: " Patchwork
2024-01-22  9:01 ` ✓ CI.KUnit: " Patchwork
2024-01-22  9:08 ` ✓ CI.Build: " Patchwork
2024-01-22  9:08 ` ✗ CI.Hooks: failure " Patchwork
2024-01-22  9:10 ` ✓ CI.checksparse: success " Patchwork
2024-01-22  9:33 ` ✓ CI.BAT: " Patchwork
2024-01-22 11:05 ` [PATCH v2] drm/xe/irq: allocate all possible msix interrupts Ghimiray, Himal Prasad
2024-01-23  7:00   ` Dani Liberman
2024-01-23  7:06 ` ✗ CI.Patch_applied: failure for drm/xe/irq: allocate all possible msix interrupts (rev4) Patchwork
2024-01-23 16:37 ` [PATCH v2] drm/xe/irq: allocate all possible msix interrupts Lucas De Marchi
2024-01-23 17:34   ` Dani Liberman
2024-01-24 20:34     ` Lucas De Marchi

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