diff options
| -rw-r--r-- | drivers/nvme/host/pci.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 660ec84bc40f..4fd733ff72b1 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
| @@ -1478,8 +1478,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) | |||
| 1478 | if (result > 0) { | 1478 | if (result > 0) { |
| 1479 | dev_err(dev->ctrl.device, | 1479 | dev_err(dev->ctrl.device, |
| 1480 | "Could not set queue count (%d)\n", result); | 1480 | "Could not set queue count (%d)\n", result); |
| 1481 | nr_io_queues = 0; | 1481 | return 0; |
| 1482 | result = 0; | ||
| 1483 | } | 1482 | } |
| 1484 | 1483 | ||
| 1485 | if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) { | 1484 | if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) { |
| @@ -1513,7 +1512,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) | |||
| 1513 | * If we enable msix early due to not intx, disable it again before | 1512 | * If we enable msix early due to not intx, disable it again before |
| 1514 | * setting up the full range we need. | 1513 | * setting up the full range we need. |
| 1515 | */ | 1514 | */ |
| 1516 | if (!pdev->irq) | 1515 | if (pdev->msi_enabled) |
| 1516 | pci_disable_msi(pdev); | ||
| 1517 | else if (pdev->msix_enabled) | ||
| 1517 | pci_disable_msix(pdev); | 1518 | pci_disable_msix(pdev); |
| 1518 | 1519 | ||
| 1519 | for (i = 0; i < nr_io_queues; i++) | 1520 | for (i = 0; i < nr_io_queues; i++) |
| @@ -1696,7 +1697,6 @@ static int nvme_pci_enable(struct nvme_dev *dev) | |||
| 1696 | if (pci_enable_device_mem(pdev)) | 1697 | if (pci_enable_device_mem(pdev)) |
| 1697 | return result; | 1698 | return result; |
| 1698 | 1699 | ||
| 1699 | dev->entry[0].vector = pdev->irq; | ||
| 1700 | pci_set_master(pdev); | 1700 | pci_set_master(pdev); |
| 1701 | 1701 | ||
| 1702 | if (dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)) && | 1702 | if (dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)) && |
| @@ -1709,13 +1709,18 @@ static int nvme_pci_enable(struct nvme_dev *dev) | |||
| 1709 | } | 1709 | } |
| 1710 | 1710 | ||
| 1711 | /* | 1711 | /* |
| 1712 | * Some devices don't advertse INTx interrupts, pre-enable a single | 1712 | * Some devices and/or platforms don't advertise or work with INTx |
| 1713 | * MSIX vec for setup. We'll adjust this later. | 1713 | * interrupts. Pre-enable a single MSIX or MSI vec for setup. We'll |
| 1714 | * adjust this later. | ||
| 1714 | */ | 1715 | */ |
| 1715 | if (!pdev->irq) { | 1716 | if (pci_enable_msix(pdev, dev->entry, 1)) { |
| 1716 | result = pci_enable_msix(pdev, dev->entry, 1); | 1717 | pci_enable_msi(pdev); |
| 1717 | if (result < 0) | 1718 | dev->entry[0].vector = pdev->irq; |
| 1718 | goto disable; | 1719 | } |
| 1720 | |||
| 1721 | if (!dev->entry[0].vector) { | ||
| 1722 | result = -ENODEV; | ||
| 1723 | goto disable; | ||
| 1719 | } | 1724 | } |
| 1720 | 1725 | ||
| 1721 | cap = lo_hi_readq(dev->bar + NVME_REG_CAP); | 1726 | cap = lo_hi_readq(dev->bar + NVME_REG_CAP); |
