mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 15:45:45 +00:00
ioat: fix ioat3_irq_reinit
The implementation of ioat3_irq_reinit has two bugs: 1/ The mode is incorrectly set to MSIX for the MSI case 2/ The 'dev_id' parameter to free_irq is the ioatdma_device not the channel in the msi and intx case Include a small cleanup to clarify that ioat3_irq_reinit is only for bwd hardware Cc: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
4c5d9619e0
commit
779e561ae2
2 changed files with 15 additions and 26 deletions
|
@ -934,7 +934,7 @@ int ioat_dma_setup_interrupts(struct ioatdma_device *device)
|
||||||
pci_disable_msi(pdev);
|
pci_disable_msi(pdev);
|
||||||
goto intx;
|
goto intx;
|
||||||
}
|
}
|
||||||
device->irq_mode = IOAT_MSIX;
|
device->irq_mode = IOAT_MSI;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
intx:
|
intx:
|
||||||
|
|
|
@ -1449,45 +1449,36 @@ static int ioat3_dma_self_test(struct ioatdma_device *device)
|
||||||
|
|
||||||
static int ioat3_irq_reinit(struct ioatdma_device *device)
|
static int ioat3_irq_reinit(struct ioatdma_device *device)
|
||||||
{
|
{
|
||||||
int msixcnt = device->common.chancnt;
|
|
||||||
struct pci_dev *pdev = device->pdev;
|
struct pci_dev *pdev = device->pdev;
|
||||||
int i;
|
int irq = pdev->irq, i;
|
||||||
struct msix_entry *msix;
|
|
||||||
struct ioat_chan_common *chan;
|
if (!is_bwd_ioat(pdev))
|
||||||
int err = 0;
|
return 0;
|
||||||
|
|
||||||
switch (device->irq_mode) {
|
switch (device->irq_mode) {
|
||||||
case IOAT_MSIX:
|
case IOAT_MSIX:
|
||||||
|
for (i = 0; i < device->common.chancnt; i++) {
|
||||||
|
struct msix_entry *msix = &device->msix_entries[i];
|
||||||
|
struct ioat_chan_common *chan;
|
||||||
|
|
||||||
for (i = 0; i < msixcnt; i++) {
|
|
||||||
msix = &device->msix_entries[i];
|
|
||||||
chan = ioat_chan_by_index(device, i);
|
chan = ioat_chan_by_index(device, i);
|
||||||
devm_free_irq(&pdev->dev, msix->vector, chan);
|
devm_free_irq(&pdev->dev, msix->vector, chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_disable_msix(pdev);
|
pci_disable_msix(pdev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOAT_MSI:
|
case IOAT_MSI:
|
||||||
chan = ioat_chan_by_index(device, 0);
|
|
||||||
devm_free_irq(&pdev->dev, pdev->irq, chan);
|
|
||||||
pci_disable_msi(pdev);
|
pci_disable_msi(pdev);
|
||||||
break;
|
/* fall through */
|
||||||
|
|
||||||
case IOAT_INTX:
|
case IOAT_INTX:
|
||||||
chan = ioat_chan_by_index(device, 0);
|
devm_free_irq(&pdev->dev, irq, device);
|
||||||
devm_free_irq(&pdev->dev, pdev->irq, chan);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->irq_mode = IOAT_NOIRQ;
|
device->irq_mode = IOAT_NOIRQ;
|
||||||
|
|
||||||
err = ioat_dma_setup_interrupts(device);
|
return ioat_dma_setup_interrupts(device);
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ioat3_reset_hw(struct ioat_chan_common *chan)
|
static int ioat3_reset_hw(struct ioat_chan_common *chan)
|
||||||
|
@ -1530,14 +1521,12 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioat2_reset_sync(chan, msecs_to_jiffies(200));
|
err = ioat2_reset_sync(chan, msecs_to_jiffies(200));
|
||||||
if (err) {
|
if (!err)
|
||||||
dev_err(&pdev->dev, "Failed to reset!\n");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device->irq_mode != IOAT_NOIRQ && is_bwd_ioat(pdev))
|
|
||||||
err = ioat3_irq_reinit(device);
|
err = ioat3_irq_reinit(device);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
dev_err(&pdev->dev, "Failed to reset: %d\n", err);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue