Skip to content

Commit 83bdfcb

Browse files
committed
nvme-pci: qdepth 1 quirk
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/[email protected]/ Reported-by: Robert Beckett <[email protected]> Reviewed-by: Christoph Hellwig [email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 2d5a333 commit 83bdfcb

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

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
@@ -2557,15 +2557,8 @@ static int nvme_pci_enable(struct nvme_dev *dev)
25572557
else
25582558
dev->io_sqes = NVME_NVM_IOSQES;
25592559

2560-
/*
2561-
* Temporary fix for the Apple controller found in the MacBook8,1 and
2562-
* some MacBook7,1 to avoid controller resets and data loss.
2563-
*/
2564-
if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001) {
2560+
if (dev->ctrl.quirks & NVME_QUIRK_QDEPTH_ONE) {
25652561
dev->q_depth = 2;
2566-
dev_warn(dev->ctrl.device, "detected Apple NVMe controller, "
2567-
"set queue depth=%u to work around controller resets\n",
2568-
dev->q_depth);
25692562
} else if (pdev->vendor == PCI_VENDOR_ID_SAMSUNG &&
25702563
(pdev->device == 0xa821 || pdev->device == 0xa822) &&
25712564
NVME_CAP_MQES(dev->ctrl.cap) == 0) {
@@ -3425,6 +3418,8 @@ static const struct pci_device_id nvme_id_table[] = {
34253418
NVME_QUIRK_BOGUS_NID, },
34263419
{ PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */
34273420
.driver_data = NVME_QUIRK_BOGUS_NID, },
3421+
{ PCI_DEVICE(0x1217, 0x8760), /* O2 Micro 64GB Steam Deck */
3422+
.driver_data = NVME_QUIRK_QDEPTH_ONE },
34283423
{ PCI_DEVICE(0x126f, 0x2262), /* Silicon Motion generic */
34293424
.driver_data = NVME_QUIRK_NO_DEEPEST_PS |
34303425
NVME_QUIRK_BOGUS_NID, },
@@ -3559,7 +3554,12 @@ static const struct pci_device_id nvme_id_table[] = {
35593554
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0xcd02),
35603555
.driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
35613556
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001),
3562-
.driver_data = NVME_QUIRK_SINGLE_VECTOR },
3557+
/*
3558+
* Fix for the Apple controller found in the MacBook8,1 and
3559+
* some MacBook7,1 to avoid controller resets and data loss.
3560+
*/
3561+
.driver_data = NVME_QUIRK_SINGLE_VECTOR |
3562+
NVME_QUIRK_QDEPTH_ONE },
35633563
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
35643564
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005),
35653565
.driver_data = NVME_QUIRK_SINGLE_VECTOR |

0 commit comments

Comments
 (0)