Skip to content

Commit 17decf8

Browse files
keithbuschgregkh
authored andcommitted
nvme-pci: qdepth 1 quirk
commit 83bdfcb upstream. Another device has been reported to be unreliable if we have more than one outstanding command. In this new case, data corruption may occur. Since we have two devices now needing this quirky behavior, make a generic quirk flag. The same Apple quirk is clearly not "temporary", so update the comment while moving it. Link: https://lore.kernel.org/linux-nvme/191d810a4e3.fcc6066c765804.973611676137075390@collabora.com/ Reported-by: Robert Beckett <bob.beckett@collabora.com> Reviewed-by: Christoph Hellwig hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Cc: "Gagniuc, Alexandru" <alexandru.gagniuc@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1547d7b commit 17decf8

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

drivers/nvme/host/nvme.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ enum nvme_quirks {
9090
*/
9191
NVME_QUIRK_NO_DEEPEST_PS = (1 << 5),
9292

93+
/*
94+
* Problems seen with concurrent commands
95+
*/
96+
NVME_QUIRK_QDEPTH_ONE = (1 << 6),
97+
9398
/*
9499
* Set MEDIUM priority on SQ creation
95100
*/

drivers/nvme/host/pci.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,15 +2563,8 @@ static int nvme_pci_enable(struct nvme_dev *dev)
25632563
else
25642564
dev->io_sqes = NVME_NVM_IOSQES;
25652565

2566-
/*
2567-
* Temporary fix for the Apple controller found in the MacBook8,1 and
2568-
* some MacBook7,1 to avoid controller resets and data loss.
2569-
*/
2570-
if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001) {
2566+
if (dev->ctrl.quirks & NVME_QUIRK_QDEPTH_ONE) {
25712567
dev->q_depth = 2;
2572-
dev_warn(dev->ctrl.device, "detected Apple NVMe controller, "
2573-
"set queue depth=%u to work around controller resets\n",
2574-
dev->q_depth);
25752568
} else if (pdev->vendor == PCI_VENDOR_ID_SAMSUNG &&
25762569
(pdev->device == 0xa821 || pdev->device == 0xa822) &&
25772570
NVME_CAP_MQES(dev->ctrl.cap) == 0) {
@@ -3442,6 +3435,8 @@ static const struct pci_device_id nvme_id_table[] = {
34423435
NVME_QUIRK_BOGUS_NID, },
34433436
{ PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */
34443437
.driver_data = NVME_QUIRK_BOGUS_NID, },
3438+
{ PCI_DEVICE(0x1217, 0x8760), /* O2 Micro 64GB Steam Deck */
3439+
.driver_data = NVME_QUIRK_QDEPTH_ONE },
34453440
{ PCI_DEVICE(0x126f, 0x2262), /* Silicon Motion generic */
34463441
.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
34473442
NVME_QUIRK_BOGUS_NID, },
@@ -3576,7 +3571,12 @@ static const struct pci_device_id nvme_id_table[] = {
35763571
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0xcd02),
35773572
.driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
35783573
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
3579-
.driver_data = NVME_QUIRK_SINGLE_VECTOR },
3574+
/*
3575+
* Fix for the Apple controller found in the MacBook8,1 and
3576+
* some MacBook7,1 to avoid controller resets and data loss.
3577+
*/
3578+
.driver_data = NVME_QUIRK_SINGLE_VECTOR |
3579+
NVME_QUIRK_QDEPTH_ONE },
35803580
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
35813581
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005),
35823582
.driver_data = NVME_QUIRK_SINGLE_VECTOR |

0 commit comments

Comments
 (0)