Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 749941f2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

nvme: only ignore hardware errors in nvme_create_io_queues



Half initialized queues due to kernel error returns or timeout are still a
good reason to give up on initializing a controller.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 287922eb
Loading
Loading
Loading
Loading
+20 −15
Original line number Original line Diff line number Diff line
@@ -1537,28 +1537,35 @@ static int nvme_kthread(void *data)
	return 0;
	return 0;
}
}


/*
static int nvme_create_io_queues(struct nvme_dev *dev)
 * Create I/O queues.  Failing to create an I/O queue is not an issue,
 * we can continue with less than the desired amount of queues, and
 * even a controller without I/O queues an still be used to issue
 * admin commands.  This might be useful to upgrade a buggy firmware
 * for example.
 */
static void nvme_create_io_queues(struct nvme_dev *dev)
{
{
	unsigned i;
	unsigned i;
	int ret = 0;


	for (i = dev->queue_count; i <= dev->max_qid; i++)
	for (i = dev->queue_count; i <= dev->max_qid; i++) {
		if (!nvme_alloc_queue(dev, i, dev->q_depth))
		if (!nvme_alloc_queue(dev, i, dev->q_depth)) {
			ret = -ENOMEM;
			break;
			break;
		}
	}


	for (i = dev->online_queues; i <= dev->queue_count - 1; i++)
	for (i = dev->online_queues; i <= dev->queue_count - 1; i++) {
		if (nvme_create_queue(dev->queues[i], i)) {
		ret = nvme_create_queue(dev->queues[i], i);
		if (ret) {
			nvme_free_queues(dev, i);
			nvme_free_queues(dev, i);
			break;
			break;
		}
		}
	}
	}


	/*
	 * Ignore failing Create SQ/CQ commands, we can continue with less
	 * than the desired aount of queues, and even a controller without
	 * I/O queues an still be used to issue admin commands.  This might
	 * be useful to upgrade a buggy firmware for example.
	 */
	return ret >= 0 ? 0 : ret;
}

static void __iomem *nvme_map_cmb(struct nvme_dev *dev)
static void __iomem *nvme_map_cmb(struct nvme_dev *dev)
{
{
	u64 szu, size, offset;
	u64 szu, size, offset;
@@ -1702,9 +1709,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)


	/* Free previously allocated queues that are no longer usable */
	/* Free previously allocated queues that are no longer usable */
	nvme_free_queues(dev, nr_io_queues + 1);
	nvme_free_queues(dev, nr_io_queues + 1);
	nvme_create_io_queues(dev);
	return nvme_create_io_queues(dev);

	return 0;


 free_queues:
 free_queues:
	nvme_free_queues(dev, 1);
	nvme_free_queues(dev, 1);