summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/pci.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-01-19 19:04:50 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-08 14:32:24 -0500
commit73243017514ac509c3a91224286f2bcf9f5a95bd (patch)
tree637443ce8387c18d1c9c27d09e1c7f7b982f79fb /drivers/gpu/nvgpu/pci.c
parent27dd1ce475183d00686ffa62d4cffee4786ab66d (diff)
gpu: nvgpu: enable PCI MSI interrupts
Use MSI interrupts instead of legacy on PCIe dGPUs to reduce latency and contention with other PCIe devices JIRA EVLR-986 Change-Id: I6cecc7e62e5797860d42a5bee21e8f4f664e1b18 Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1291758 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/pci.c')
-rw-r--r--drivers/gpu/nvgpu/pci.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c
index feb253b6..648fc60e 100644
--- a/drivers/gpu/nvgpu/pci.c
+++ b/drivers/gpu/nvgpu/pci.c
@@ -226,6 +226,12 @@ static irqreturn_t nvgpu_pci_isr(int irq, void *dev_id)
226 ret_stall = g->ops.mc.isr_stall(g); 226 ret_stall = g->ops.mc.isr_stall(g);
227 ret_nonstall = g->ops.mc.isr_nonstall(g); 227 ret_nonstall = g->ops.mc.isr_nonstall(g);
228 228
229#if defined(CONFIG_PCI_MSI)
230 /* Send MSI EOI */
231 if (g->ops.xve.rearm_msi && g->msi_enabled)
232 g->ops.xve.rearm_msi(g);
233#endif
234
229 return (ret_stall == IRQ_NONE && ret_nonstall == IRQ_NONE) ? 235 return (ret_stall == IRQ_NONE && ret_nonstall == IRQ_NONE) ?
230 IRQ_NONE : IRQ_WAKE_THREAD; 236 IRQ_NONE : IRQ_WAKE_THREAD;
231} 237}
@@ -361,6 +367,16 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
361 g->pci_class = (pdev->class >> 8) & 0xFFFFU; // we only want base/sub 367 g->pci_class = (pdev->class >> 8) & 0xFFFFU; // we only want base/sub
362 g->pci_revision = pdev->revision; 368 g->pci_revision = pdev->revision;
363 369
370#if defined(CONFIG_PCI_MSI)
371 err = pci_enable_msi(pdev);
372 if (err) {
373 gk20a_err(&pdev->dev,
374 "MSI could not be enabled, falling back to legacy");
375 g->msi_enabled = false;
376 } else
377 g->msi_enabled = true;
378#endif
379
364 g->irq_stall = pdev->irq; 380 g->irq_stall = pdev->irq;
365 g->irq_nonstall = pdev->irq; 381 g->irq_nonstall = pdev->irq;
366 if (g->irq_stall < 0) 382 if (g->irq_stall < 0)
@@ -370,6 +386,9 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
370 g->irq_stall, 386 g->irq_stall,
371 nvgpu_pci_isr, 387 nvgpu_pci_isr,
372 nvgpu_pci_intr_thread, 388 nvgpu_pci_intr_thread,
389#if defined(CONFIG_PCI_MSI)
390 g->msi_enabled ? 0 :
391#endif
373 IRQF_SHARED, "nvgpu", g); 392 IRQF_SHARED, "nvgpu", g);
374 if (err) { 393 if (err) {
375 gk20a_err(&pdev->dev, 394 gk20a_err(&pdev->dev,
@@ -419,6 +438,13 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
419 438
420 disable_irq(g->irq_stall); 439 disable_irq(g->irq_stall);
421 devm_free_irq(&pdev->dev, g->irq_stall, g); 440 devm_free_irq(&pdev->dev, g->irq_stall, g);
441
442#if defined(CONFIG_PCI_MSI)
443 if (g->msi_enabled) {
444 pci_disable_msi(pdev);
445 g->msi_enabled = false;
446 }
447#endif
422 gk20a_dbg(gpu_dbg_shutdown, "IRQs disabled.\n"); 448 gk20a_dbg(gpu_dbg_shutdown, "IRQs disabled.\n");
423 449
424 /* 450 /*