aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-05-08 12:25:15 -0400
committerKeith Busch <keith.busch@intel.com>2018-05-11 15:37:14 -0400
commit9abd68ef454c824bfd18629033367b4382b5f390 (patch)
treee16412fb89c2eec7e9f430f72a4aaa9fb5fdac02
parent4e50d9ebaeaa3c6761d2b513ef7039510c8cf213 (diff)
nvme: add quirk to force medium priority for SQ creation
Some P3100 drives have a bug where they think WRRU (weighted round robin) is always enabled, even though the host doesn't set it. Since they think it's enabled, they also look at the submission queue creation priority. We used to set that to MEDIUM by default, but that was removed in commit 81c1cd98351b. This causes various issues on that drive. Add a quirk to still set MEDIUM priority for that controller. Fixes: 81c1cd98351b ("nvme/pci: Don't set reserved SQ create flags") Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Keith Busch <keith.busch@intel.com>
-rw-r--r--drivers/nvme/host/nvme.h5
-rw-r--r--drivers/nvme/host/pci.c12
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 7ded7a51c430..17d2f7cf3fed 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -84,6 +84,11 @@ enum nvme_quirks {
84 * Supports the LighNVM command set if indicated in vs[1]. 84 * Supports the LighNVM command set if indicated in vs[1].
85 */ 85 */
86 NVME_QUIRK_LIGHTNVM = (1 << 6), 86 NVME_QUIRK_LIGHTNVM = (1 << 6),
87
88 /*
89 * Set MEDIUM priority on SQ creation
90 */
91 NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7),
87}; 92};
88 93
89/* 94/*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fbc71fac6f1e..17a0190bd88f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1093,10 +1093,19 @@ static int adapter_alloc_cq(struct nvme_dev *dev, u16 qid,
1093static int adapter_alloc_sq(struct nvme_dev *dev, u16 qid, 1093static int adapter_alloc_sq(struct nvme_dev *dev, u16 qid,
1094 struct nvme_queue *nvmeq) 1094 struct nvme_queue *nvmeq)
1095{ 1095{
1096 struct nvme_ctrl *ctrl = &dev->ctrl;
1096 struct nvme_command c; 1097 struct nvme_command c;
1097 int flags = NVME_QUEUE_PHYS_CONTIG; 1098 int flags = NVME_QUEUE_PHYS_CONTIG;
1098 1099
1099 /* 1100 /*
1101 * Some drives have a bug that auto-enables WRRU if MEDIUM isn't
1102 * set. Since URGENT priority is zeroes, it makes all queues
1103 * URGENT.
1104 */
1105 if (ctrl->quirks & NVME_QUIRK_MEDIUM_PRIO_SQ)
1106 flags |= NVME_SQ_PRIO_MEDIUM;
1107
1108 /*
1100 * Note: we (ab)use the fact that the prp fields survive if no data 1109 * Note: we (ab)use the fact that the prp fields survive if no data
1101 * is attached to the request. 1110 * is attached to the request.
1102 */ 1111 */
@@ -2701,7 +2710,8 @@ static const struct pci_device_id nvme_id_table[] = {
2701 .driver_data = NVME_QUIRK_STRIPE_SIZE | 2710 .driver_data = NVME_QUIRK_STRIPE_SIZE |
2702 NVME_QUIRK_DEALLOCATE_ZEROES, }, 2711 NVME_QUIRK_DEALLOCATE_ZEROES, },
2703 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ 2712 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
2704 .driver_data = NVME_QUIRK_NO_DEEPEST_PS }, 2713 .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
2714 NVME_QUIRK_MEDIUM_PRIO_SQ },
2705 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ 2715 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
2706 .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, 2716 .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
2707 { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ 2717 { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */