All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NVMe: make setup work for devices that don't do INTx
@ 2014-11-14 16:49 Jens Axboe
  2014-11-19 17:54 ` Keith Busch
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2014-11-14 16:49 UTC (permalink / raw)


The setup/probe part currently relies on INTx being there and
working, that's not always the case. For devices that don't
advertise INTx, enable a single MSIx vector early on and disable
it again before we ask for our full range of queue vecs.

Signed-off-by: Jens Axboe <axboe at fb.com>
---
 drivers/block/nvme-core.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index fc2fc53992cb..ee533aabf479 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2009,6 +2009,13 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
 	/* Deregister the admin queue's interrupt */
 	free_irq(dev->entry[0].vector, adminq);
 
+	/*
+	 * If we enable msix early due to not intx, disable it again before
+	 * setting up the full range we need.
+	 */
+	if (!pdev->irq)
+		pci_disable_msix(pdev);
+
 	for (i = 0; i < nr_io_queues; i++)
 		dev->entry[i].entry = i;
 	vecs = pci_enable_msix_range(pdev, dev->entry, 1, nr_io_queues);
@@ -2161,10 +2168,22 @@ static int nvme_dev_map(struct nvme_dev *dev)
 	dev->bar = ioremap(pci_resource_start(pdev, 0), 8192);
 	if (!dev->bar)
 		goto disable;
+
 	if (readl(&dev->bar->csts) == -1) {
 		result = -ENODEV;
 		goto unmap;
 	}
+
+	/*
+	 * Some devices don't advertse INTx interrupts, pre-enable a single
+	 * MSIX vec for setup. We'll adjust this later.
+	 */
+	if (!pdev->irq) {
+		result = pci_enable_msix(pdev, dev->entry, 1);
+		if (result < 0)
+			goto unmap;
+	}
+
 	cap = readq(&dev->bar->cap);
 	dev->q_depth = min_t(int, NVME_CAP_MQES(cap) + 1, NVME_Q_DEPTH);
 	dev->db_stride = 1 << NVME_CAP_STRIDE(cap);
-- 
1.9.1

-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] NVMe: make setup work for devices that don't do INTx
  2014-11-14 16:49 [PATCH] NVMe: make setup work for devices that don't do INTx Jens Axboe
@ 2014-11-19 17:54 ` Keith Busch
  2014-11-20  3:36   ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2014-11-19 17:54 UTC (permalink / raw)


On Fri, 14 Nov 2014, Jens Axboe wrote:
> The setup/probe part currently relies on INTx being there and
> working, that's not always the case. For devices that don't
> advertise INTx, enable a single MSIx vector early on and disable
> it again before we ask for our full range of queue vecs.

Acked-by: Keith Busch <keith.busch at intel.com>

I have an early sample platform that has the same behavior. I thought
it was just a buggy prototype, but the h/w makers tell me it's designed
that way.

> Signed-off-by: Jens Axboe <axboe at fb.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] NVMe: make setup work for devices that don't do INTx
  2014-11-19 17:54 ` Keith Busch
@ 2014-11-20  3:36   ` Jens Axboe
  2014-11-20 16:55     ` Keith Busch
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2014-11-20  3:36 UTC (permalink / raw)


On 11/19/2014 10:54 AM, Keith Busch wrote:
> On Fri, 14 Nov 2014, Jens Axboe wrote:
>> The setup/probe part currently relies on INTx being there and
>> working, that's not always the case. For devices that don't
>> advertise INTx, enable a single MSIx vector early on and disable
>> it again before we ask for our full range of queue vecs.
>
> Acked-by: Keith Busch <keith.busch at intel.com>
>
> I have an early sample platform that has the same behavior. I thought
> it was just a buggy prototype, but the h/w makers tell me it's designed
> that way.

I believe they are correct :-)

Thanks for the ack, I'll add this to the 3.19 mix. Did you take a look 
at the other two trivial patches?

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] NVMe: make setup work for devices that don't do INTx
  2014-11-20  3:36   ` Jens Axboe
@ 2014-11-20 16:55     ` Keith Busch
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2014-11-20 16:55 UTC (permalink / raw)


On Wed, 19 Nov 2014, Jens Axboe wrote:
> Thanks for the ack, I'll add this to the 3.19 mix. Did you take a look at the 
> other two trivial patches?

Yep, the others look pretty obvious, so no objections to either.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-20 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14 16:49 [PATCH] NVMe: make setup work for devices that don't do INTx Jens Axboe
2014-11-19 17:54 ` Keith Busch
2014-11-20  3:36   ` Jens Axboe
2014-11-20 16:55     ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.