diff options
author | Dani Liberman <[email protected]> | 2024-01-24 09:50:58 +0200 |
---|---|---|
committer | Lucas De Marchi <[email protected]> | 2024-02-08 13:26:44 -0800 |
commit | 82bd83a0cf7ab1e92bd100fb91081a6855bd3545 (patch) | |
tree | 9ca2d9b47c8d5843c8ef636d73c2616b1e40768a | |
parent | eb538b5574251a449f40b1ee35efc631228c8992 (diff) |
drm/xe/irq: allocate all possible msix interrupts
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.
v3:
- pass specific type in irq flags.
Cc: Ohad Sharabi <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Signed-off-by: Dani Liberman <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Signed-off-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r-- | drivers/gpu/drm/xe/xe_irq.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c index d31e87de5a1c..17b3affdb6a0 100644 --- a/drivers/gpu/drm/xe/xe_irq.c +++ b/drivers/gpu/drm/xe/xe_irq.c @@ -683,8 +683,9 @@ static void irq_uninstall(struct drm_device *drm, void *arg) int xe_irq_install(struct xe_device *xe) { struct pci_dev *pdev = to_pci_dev(xe->drm.dev); + unsigned int irq_flags = PCI_IRQ_MSIX; irq_handler_t irq_handler; - int err, irq; + int err, irq, nvec; irq_handler = xe_irq_handler(xe); if (!irq_handler) { @@ -694,7 +695,19 @@ 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 */ + irq_flags = PCI_IRQ_MSI; + nvec = 1; + } else { + drm_err(&xe->drm, "MSIX: Failed getting count\n"); + return nvec; + } + } + + err = pci_alloc_irq_vectors(pdev, nvec, nvec, irq_flags); if (err < 0) { drm_err(&xe->drm, "MSI/MSIX: Failed to enable support %d\n", err); return err; |