ACK: [PATCH] UBUNTU: (fix) NVMe: restore code to always use MSI/MSI-x interrupts

Luis Henriques luis.henriques at canonical.com
Thu Dec 8 09:44:36 UTC 2016


On Wed, Dec 07, 2016 at 06:34:12PM -0500, Dan Streetman wrote:
> BugLink: http://bugs.launchpad.net/bugs/1647887
> 
> Commit 90c9712fbb388077b5e53069cae43f1acbb0102a ("NVMe: Always use MSI/MSI-x
> interrupts") changed the NVMe driver to always use MSI/MSI-x interrupts.
> However, later commit 30d6592fce71beabe18460252c3823747c4742f6 ("NVMe: Don't
> unmap controller registers on reset") as well as commit
> e9820e415895bdd9cfd21f87e80e3e0a10f131f0 ("UBUNTU: (fix) NVMe: Don't unmap
> controller registers on reset") accidentally reverted part of the original
> commit, which reverted the NVMe driver to using GSI interrupts instead of
> always using MSI/MSI-x interrupts.
> 
> This un-reverts the accidental reversion, to restore the NVMe driver to
> always use MSI/MSI-x interrupts.
> 
> Signed-off-by: Dan Streetman <dan.streetman at canonical.com>
> ---
>  drivers/nvme/host/pci.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index aef8652..7b91d57 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1726,7 +1726,6 @@ static int nvme_pci_enable(struct nvme_dev *dev)
>  	if (pci_enable_device_mem(pdev))
>  		return result;
>  
> -	dev->entry[0].vector = pdev->irq;
>  	pci_set_master(pdev);
>  
>  	if (dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)) &&
> @@ -1739,16 +1738,22 @@ static int nvme_pci_enable(struct nvme_dev *dev)
>  	}
>  
>  	/*
> -	 * Some devices don't advertse INTx interrupts, pre-enable a single
> -	 * MSIX vec for setup. We'll adjust this later.
> +	 * Some devices and/or platforms don't advertise or work with INTx
> +	 * interrupts. Pre-enable a single MSIX or MSI vec for setup. We'll
> +	 * adjust this later.
>  	 */
> -	if (!pdev->irq) {
> -		result = pci_enable_msix(pdev, dev->entry, 1);
> -		if (result < 0)
> -			goto disable;
> +	if (pci_enable_msix(pdev, dev->entry, 1)) {
> +		pci_enable_msi(pdev);
> +		dev->entry[0].vector = pdev->irq;
> +	}
> +
> +	if (!dev->entry[0].vector) {
> +		result = -ENODEV;
> +		goto disable;
>  	}
>  
>  	cap = lo_hi_readq(dev->bar + NVME_REG_CAP);
> +
>  	dev->q_depth = min_t(int, NVME_CAP_MQES(cap) + 1, NVME_Q_DEPTH);
>  	dev->db_stride = 1 << NVME_CAP_STRIDE(cap);
>  	dev->dbs = dev->bar + 4096;
> -- 
> 2.9.3
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Cheers,
--
Luís
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20161208/21e93ce8/attachment.sig>


More information about the kernel-team mailing list