<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 21-01-2024 14:32, Dani Liberman
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20240121090214.2072923-1-dliberman@habana.ai">
<pre class="moz-quote-pre" wrap="">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 <a class="moz-txt-link-rfc2396E" href="mailto:osharabi@habana.ai"><osharabi@habana.ai></a>
Cc: Lucas De Marchi <a class="moz-txt-link-rfc2396E" href="mailto:lucas.demarchi@intel.com"><lucas.demarchi@intel.com></a>
Signed-off-by: Dani Liberman <a class="moz-txt-link-rfc2396E" href="mailto:dliberman@habana.ai"><dliberman@habana.ai></a>
---
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);</pre>
</blockquote>
<br>
Shouldn't the parameter be only <span style="white-space: pre-wrap">PCI_IRQ_MSI </span>
in case nvec == <span style="white-space: pre-wrap">EINVAL</span>
? <br>
<blockquote type="cite" cite="mid:20240121090214.2072923-1-dliberman@habana.ai">
<pre class="moz-quote-pre" wrap="">
if (err < 0) {
drm_err(&xe->drm, "MSI/MSIX: Failed to enable support %d\n", err);
return err;
</pre>
</blockquote>
</body>
</html>