Skip to content

Commit 89a2ee9

Browse files
committed
Merge tag 'nvme-5.18-2022-04-15' of git://git.infradead.org/nvme into block-5.18
Pull NVMe fixes from Christoph: "nvme fixes for Linux 5.18 - tone down the error logging added this merge window a bit (Chaitanya Kulkarni) - quirk devices with non-unique unique identifiers (me)" * tag 'nvme-5.18-2022-04-15' of git://git.infradead.org/nvme: nvme-pci: disable namespace identifiers for Qemu controllers nvme-pci: disable namespace identifiers for the MAXIO MAP1002/1202 nvme: add a quirk to disable namespace identifiers nvme: don't print verbose errors for internal passthrough requests
2 parents 3d973a7 + 66dd346 commit 89a2ee9

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

drivers/nvme/host/core.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static inline void nvme_end_req(struct request *req)
366366
{
367367
blk_status_t status = nvme_error_status(nvme_req(req)->status);
368368

369-
if (unlikely(nvme_req(req)->status != NVME_SC_SUCCESS))
369+
if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET)))
370370
nvme_log_error(req);
371371
nvme_end_req_zoned(req);
372372
nvme_trace_bio_complete(req);
@@ -1015,6 +1015,7 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
10151015
goto out;
10161016
}
10171017

1018+
req->rq_flags |= RQF_QUIET;
10181019
ret = nvme_execute_rq(req, at_head);
10191020
if (result && ret >= 0)
10201021
*result = nvme_req(req)->result;
@@ -1287,6 +1288,8 @@ static int nvme_process_ns_desc(struct nvme_ctrl *ctrl, struct nvme_ns_ids *ids,
12871288
warn_str, cur->nidl);
12881289
return -1;
12891290
}
1291+
if (ctrl->quirks & NVME_QUIRK_BOGUS_NID)
1292+
return NVME_NIDT_EUI64_LEN;
12901293
memcpy(ids->eui64, data + sizeof(*cur), NVME_NIDT_EUI64_LEN);
12911294
return NVME_NIDT_EUI64_LEN;
12921295
case NVME_NIDT_NGUID:
@@ -1295,6 +1298,8 @@ static int nvme_process_ns_desc(struct nvme_ctrl *ctrl, struct nvme_ns_ids *ids,
12951298
warn_str, cur->nidl);
12961299
return -1;
12971300
}
1301+
if (ctrl->quirks & NVME_QUIRK_BOGUS_NID)
1302+
return NVME_NIDT_NGUID_LEN;
12981303
memcpy(ids->nguid, data + sizeof(*cur), NVME_NIDT_NGUID_LEN);
12991304
return NVME_NIDT_NGUID_LEN;
13001305
case NVME_NIDT_UUID:
@@ -1303,6 +1308,8 @@ static int nvme_process_ns_desc(struct nvme_ctrl *ctrl, struct nvme_ns_ids *ids,
13031308
warn_str, cur->nidl);
13041309
return -1;
13051310
}
1311+
if (ctrl->quirks & NVME_QUIRK_BOGUS_NID)
1312+
return NVME_NIDT_UUID_LEN;
13061313
uuid_copy(&ids->uuid, data + sizeof(*cur));
13071314
return NVME_NIDT_UUID_LEN;
13081315
case NVME_NIDT_CSI:
@@ -1399,12 +1406,18 @@ static int nvme_identify_ns(struct nvme_ctrl *ctrl, unsigned nsid,
13991406
if ((*id)->ncap == 0) /* namespace not allocated or attached */
14001407
goto out_free_id;
14011408

1402-
if (ctrl->vs >= NVME_VS(1, 1, 0) &&
1403-
!memchr_inv(ids->eui64, 0, sizeof(ids->eui64)))
1404-
memcpy(ids->eui64, (*id)->eui64, sizeof(ids->eui64));
1405-
if (ctrl->vs >= NVME_VS(1, 2, 0) &&
1406-
!memchr_inv(ids->nguid, 0, sizeof(ids->nguid)))
1407-
memcpy(ids->nguid, (*id)->nguid, sizeof(ids->nguid));
1409+
1410+
if (ctrl->quirks & NVME_QUIRK_BOGUS_NID) {
1411+
dev_info(ctrl->device,
1412+
"Ignoring bogus Namespace Identifiers\n");
1413+
} else {
1414+
if (ctrl->vs >= NVME_VS(1, 1, 0) &&
1415+
!memchr_inv(ids->eui64, 0, sizeof(ids->eui64)))
1416+
memcpy(ids->eui64, (*id)->eui64, sizeof(ids->eui64));
1417+
if (ctrl->vs >= NVME_VS(1, 2, 0) &&
1418+
!memchr_inv(ids->nguid, 0, sizeof(ids->nguid)))
1419+
memcpy(ids->nguid, (*id)->nguid, sizeof(ids->nguid));
1420+
}
14081421

14091422
return 0;
14101423

drivers/nvme/host/nvme.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ enum nvme_quirks {
144144
* encoding the generation sequence number.
145145
*/
146146
NVME_QUIRK_SKIP_CID_GEN = (1 << 17),
147+
148+
/*
149+
* Reports garbage in the namespace identifiers (eui64, nguid, uuid).
150+
*/
151+
NVME_QUIRK_BOGUS_NID = (1 << 18),
147152
};
148153

149154
/*

drivers/nvme/host/pci.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3409,7 +3409,10 @@ static const struct pci_device_id nvme_id_table[] = {
34093409
.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
34103410
{ PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
34113411
.driver_data = NVME_QUIRK_IDENTIFY_CNS |
3412-
NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3412+
NVME_QUIRK_DISABLE_WRITE_ZEROES |
3413+
NVME_QUIRK_BOGUS_NID, },
3414+
{ PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */
3415+
.driver_data = NVME_QUIRK_BOGUS_NID, },
34133416
{ PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */
34143417
.driver_data = NVME_QUIRK_NO_NS_DESC_LIST, },
34153418
{ PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
@@ -3447,6 +3450,10 @@ static const struct pci_device_id nvme_id_table[] = {
34473450
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
34483451
{ PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */
34493452
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
3453+
{ PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */
3454+
.driver_data = NVME_QUIRK_BOGUS_NID, },
3455+
{ PCI_DEVICE(0x1e4B, 0x1202), /* MAXIO MAP1202 */
3456+
.driver_data = NVME_QUIRK_BOGUS_NID, },
34503457
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061),
34513458
.driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
34523459
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),

0 commit comments

Comments
 (0)