From 73243017514ac509c3a91224286f2bcf9f5a95bd Mon Sep 17 00:00:00 2001 From: David Nieto Date: Thu, 19 Jan 2017 16:04:50 -0800 Subject: 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 Reviewed-on: http://git-master/r/1291758 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/pci.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'drivers/gpu/nvgpu/pci.c') 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) ret_stall = g->ops.mc.isr_stall(g); ret_nonstall = g->ops.mc.isr_nonstall(g); +#if defined(CONFIG_PCI_MSI) + /* Send MSI EOI */ + if (g->ops.xve.rearm_msi && g->msi_enabled) + g->ops.xve.rearm_msi(g); +#endif + return (ret_stall == IRQ_NONE && ret_nonstall == IRQ_NONE) ? IRQ_NONE : IRQ_WAKE_THREAD; } @@ -361,6 +367,16 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, g->pci_class = (pdev->class >> 8) & 0xFFFFU; // we only want base/sub g->pci_revision = pdev->revision; +#if defined(CONFIG_PCI_MSI) + err = pci_enable_msi(pdev); + if (err) { + gk20a_err(&pdev->dev, + "MSI could not be enabled, falling back to legacy"); + g->msi_enabled = false; + } else + g->msi_enabled = true; +#endif + g->irq_stall = pdev->irq; g->irq_nonstall = pdev->irq; if (g->irq_stall < 0) @@ -370,6 +386,9 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, g->irq_stall, nvgpu_pci_isr, nvgpu_pci_intr_thread, +#if defined(CONFIG_PCI_MSI) + g->msi_enabled ? 0 : +#endif IRQF_SHARED, "nvgpu", g); if (err) { gk20a_err(&pdev->dev, @@ -419,6 +438,13 @@ static void nvgpu_pci_remove(struct pci_dev *pdev) disable_irq(g->irq_stall); devm_free_irq(&pdev->dev, g->irq_stall, g); + +#if defined(CONFIG_PCI_MSI) + if (g->msi_enabled) { + pci_disable_msi(pdev); + g->msi_enabled = false; + } +#endif gk20a_dbg(gpu_dbg_shutdown, "IRQs disabled.\n"); /* -- cgit v1.2.2