|
| 1 | +Link: https://bugzilla.kernel.org/show_bug.cgi?id=214509 |
| 2 | +Cc: Sven Peter <sven at svenpeter.dev> |
| 3 | +Reported-by: Orlando Chamberlain <redecorating at protonmail.com> |
| 4 | +Reported-by: Aditya Garg <gargaditya08 at live.com> |
| 5 | +Signed-off-by: Keith Busch <kbusch at kernel.org> |
| 6 | +--- |
| 7 | +v1->v2: fixed logical bug checking the quirk setting |
| 8 | + |
| 9 | + drivers/nvme/host/core.c | 4 +++- |
| 10 | + drivers/nvme/host/nvme.h | 6 ++++++ |
| 11 | + drivers/nvme/host/pci.c | 3 ++- |
| 12 | + 3 files changed, 11 insertions(+), 2 deletions(-) |
| 13 | + |
| 14 | +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
| 15 | +index e486845d2c7e..7712a8f78337 100644 |
| 16 | +--- a/drivers/nvme/host/core.c |
| 17 | ++++ b/drivers/nvme/host/core.c |
| 18 | +@@ -978,6 +978,7 @@ EXPORT_SYMBOL_GPL(nvme_cleanup_cmd); |
| 19 | + blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req) |
| 20 | + { |
| 21 | + struct nvme_command *cmd = nvme_req(req)->cmd; |
| 22 | ++ struct nvme_ctrl *ctrl = nvme_req(req)->ctrl; |
| 23 | + blk_status_t ret = BLK_STS_OK; |
| 24 | + |
| 25 | + if (!(req->rq_flags & RQF_DONTPREP)) { |
| 26 | +@@ -1026,7 +1027,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req) |
| 27 | + return BLK_STS_IOERR; |
| 28 | + } |
| 29 | + |
| 30 | +- nvme_req(req)->genctr++; |
| 31 | ++ if (!(ctrl->quirks & NVME_QUIRK_SKIP_CID_GEN)) |
| 32 | ++ nvme_req(req)->genctr++; |
| 33 | + cmd->common.command_id = nvme_cid(req); |
| 34 | + trace_nvme_setup_cmd(req, cmd); |
| 35 | + return ret; |
| 36 | +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h |
| 37 | +index 9871c0c9374c..ed79a6c7e804 100644 |
| 38 | +--- a/drivers/nvme/host/nvme.h |
| 39 | ++++ b/drivers/nvme/host/nvme.h |
| 40 | +@@ -138,6 +138,12 @@ enum nvme_quirks { |
| 41 | + * 48 bits. |
| 42 | + */ |
| 43 | + NVME_QUIRK_DMA_ADDRESS_BITS_48 = (1 << 16), |
| 44 | ++ |
| 45 | ++ /* |
| 46 | ++ * The controller requires the command_id value be be limited, so skip |
| 47 | ++ * encoding the generation sequence number. |
| 48 | ++ */ |
| 49 | ++ NVME_QUIRK_SKIP_CID_GEN = (1 << 17), |
| 50 | + }; |
| 51 | + |
| 52 | + /* |
| 53 | +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
| 54 | +index b82492cd7503..456a0e8a5718 100644 |
| 55 | +--- a/drivers/nvme/host/pci.c |
| 56 | ++++ b/drivers/nvme/host/pci.c |
| 57 | +@@ -3369,7 +3369,8 @@ static const struct pci_device_id nvme_id_table[] = { |
| 58 | + { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005), |
| 59 | + .driver_data = NVME_QUIRK_SINGLE_VECTOR | |
| 60 | + NVME_QUIRK_128_BYTES_SQES | |
| 61 | +- NVME_QUIRK_SHARED_TAGS }, |
| 62 | ++ NVME_QUIRK_SHARED_TAGS | |
| 63 | ++ NVME_QUIRK_SKIP_CID_GEN }, |
| 64 | + |
| 65 | + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
| 66 | + { 0, } |
| 67 | +-- |
| 68 | +2.25.4 |
| 69 | + |
0 commit comments