Skip to content

Commit 2396e95

Browse files
committed
Merge tag 'nvme-5.19-2022-06-15' of git://git.infradead.org/nvme into block-5.19
Pull NVMe fixes from Christoph: "nvme fixes for Linux 5.19 - quirks, quirks, quirks to work around buggy consumer grade devices (Keith Bush, Ning Wang, Stefan Reiter, Rasheed Hsueh) - better kernel messages for devices that need quirking (Keith Bush) - make a kernel message more useful (Thomas Weißschuh)" * tag 'nvme-5.19-2022-06-15' of git://git.infradead.org/nvme: nvme-pci: disable write zeros support on UMIC and Samsung SSDs nvme-pci: avoid the deepest sleep state on ZHITAI TiPro7000 SSDs nvme-pci: sk hynix p31 has bogus namespace ids nvme-pci: smi has bogus namespace ids nvme-pci: phison e12 has bogus namespace ids nvme-pci: add NVME_QUIRK_BOGUS_NID for ADATA XPG GAMMIX S50 nvme-pci: add trouble shooting steps for timeouts nvme: add bug report info for global duplicate id nvme: add device name to warning in uuid_show()
2 parents b13bacc + 43047e0 commit 2396e95

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed

drivers/nvme/host/core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,8 +3285,8 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,
32853285
* we have no UUID set
32863286
*/
32873287
if (uuid_is_null(&ids->uuid)) {
3288-
printk_ratelimited(KERN_WARNING
3289-
"No UUID available providing old NGUID\n");
3288+
dev_warn_ratelimited(dev,
3289+
"No UUID available providing old NGUID\n");
32903290
return sysfs_emit(buf, "%pU\n", ids->nguid);
32913291
}
32923292
return sysfs_emit(buf, "%pU\n", &ids->uuid);
@@ -3863,6 +3863,7 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
38633863
if (ret) {
38643864
dev_err(ctrl->device,
38653865
"globally duplicate IDs for nsid %d\n", nsid);
3866+
nvme_print_device_info(ctrl);
38663867
return ret;
38673868
}
38683869

drivers/nvme/host/nvme.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ struct nvme_ctrl_ops {
503503
void (*submit_async_event)(struct nvme_ctrl *ctrl);
504504
void (*delete_ctrl)(struct nvme_ctrl *ctrl);
505505
int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size);
506+
void (*print_device_info)(struct nvme_ctrl *ctrl);
506507
};
507508

508509
/*
@@ -548,6 +549,33 @@ static inline struct request *nvme_cid_to_rq(struct blk_mq_tags *tags,
548549
return blk_mq_tag_to_rq(tags, nvme_tag_from_cid(command_id));
549550
}
550551

552+
/*
553+
* Return the length of the string without the space padding
554+
*/
555+
static inline int nvme_strlen(char *s, int len)
556+
{
557+
while (s[len - 1] == ' ')
558+
len--;
559+
return len;
560+
}
561+
562+
static inline void nvme_print_device_info(struct nvme_ctrl *ctrl)
563+
{
564+
struct nvme_subsystem *subsys = ctrl->subsys;
565+
566+
if (ctrl->ops->print_device_info) {
567+
ctrl->ops->print_device_info(ctrl);
568+
return;
569+
}
570+
571+
dev_err(ctrl->device,
572+
"VID:%04x model:%.*s firmware:%.*s\n", subsys->vendor_id,
573+
nvme_strlen(subsys->model, sizeof(subsys->model)),
574+
subsys->model, nvme_strlen(subsys->firmware_rev,
575+
sizeof(subsys->firmware_rev)),
576+
subsys->firmware_rev);
577+
}
578+
551579
#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
552580
void nvme_fault_inject_init(struct nvme_fault_inject *fault_inj,
553581
const char *dev_name);

drivers/nvme/host/pci.c

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,14 @@ static void nvme_warn_reset(struct nvme_dev *dev, u32 csts)
13341334
dev_warn(dev->ctrl.device,
13351335
"controller is down; will reset: CSTS=0x%x, PCI_STATUS read failed (%d)\n",
13361336
csts, result);
1337+
1338+
if (csts != ~0)
1339+
return;
1340+
1341+
dev_warn(dev->ctrl.device,
1342+
"Does your device have a faulty power saving mode enabled?\n");
1343+
dev_warn(dev->ctrl.device,
1344+
"Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off\" and report a bug\n");
13371345
}
13381346

13391347
static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
@@ -2976,6 +2984,21 @@ static int nvme_pci_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
29762984
return snprintf(buf, size, "%s\n", dev_name(&pdev->dev));
29772985
}
29782986

2987+
2988+
static void nvme_pci_print_device_info(struct nvme_ctrl *ctrl)
2989+
{
2990+
struct pci_dev *pdev = to_pci_dev(to_nvme_dev(ctrl)->dev);
2991+
struct nvme_subsystem *subsys = ctrl->subsys;
2992+
2993+
dev_err(ctrl->device,
2994+
"VID:DID %04x:%04x model:%.*s firmware:%.*s\n",
2995+
pdev->vendor, pdev->device,
2996+
nvme_strlen(subsys->model, sizeof(subsys->model)),
2997+
subsys->model, nvme_strlen(subsys->firmware_rev,
2998+
sizeof(subsys->firmware_rev)),
2999+
subsys->firmware_rev);
3000+
}
3001+
29793002
static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
29803003
.name = "pcie",
29813004
.module = THIS_MODULE,
@@ -2987,6 +3010,7 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
29873010
.free_ctrl = nvme_pci_free_ctrl,
29883011
.submit_async_event = nvme_pci_submit_async_event,
29893012
.get_address = nvme_pci_get_address,
3013+
.print_device_info = nvme_pci_print_device_info,
29903014
};
29913015

29923016
static int nvme_dev_map(struct nvme_dev *dev)
@@ -3421,7 +3445,8 @@ static const struct pci_device_id nvme_id_table[] = {
34213445
{ PCI_VDEVICE(REDHAT, 0x0010), /* Qemu emulated controller */
34223446
.driver_data = NVME_QUIRK_BOGUS_NID, },
34233447
{ PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */
3424-
.driver_data = NVME_QUIRK_NO_NS_DESC_LIST, },
3448+
.driver_data = NVME_QUIRK_NO_NS_DESC_LIST |
3449+
NVME_QUIRK_BOGUS_NID, },
34253450
{ PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */
34263451
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
34273452
NVME_QUIRK_NO_NS_DESC_LIST, },
@@ -3437,6 +3462,8 @@ static const struct pci_device_id nvme_id_table[] = {
34373462
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
34383463
NVME_QUIRK_DISABLE_WRITE_ZEROES|
34393464
NVME_QUIRK_IGNORE_DEV_SUBNQN, },
3465+
{ PCI_DEVICE(0x1987, 0x5012), /* Phison E12 */
3466+
.driver_data = NVME_QUIRK_BOGUS_NID, },
34403467
{ PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */
34413468
.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
34423469
{ PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */
@@ -3449,10 +3476,20 @@ static const struct pci_device_id nvme_id_table[] = {
34493476
NVME_QUIRK_IGNORE_DEV_SUBNQN, },
34503477
{ PCI_DEVICE(0x1c5c, 0x1504), /* SK Hynix PC400 */
34513478
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3479+
{ PCI_DEVICE(0x1c5c, 0x174a), /* SK Hynix P31 SSD */
3480+
.driver_data = NVME_QUIRK_BOGUS_NID, },
34523481
{ PCI_DEVICE(0x15b7, 0x2001), /* Sandisk Skyhawk */
34533482
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34543483
{ PCI_DEVICE(0x1d97, 0x2263), /* SPCC */
34553484
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3485+
{ PCI_DEVICE(0x144d, 0xa80b), /* Samsung PM9B1 256G and 512G */
3486+
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3487+
{ PCI_DEVICE(0x144d, 0xa809), /* Samsung MZALQ256HBJD 256G */
3488+
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3489+
{ PCI_DEVICE(0x1cc4, 0x6303), /* UMIS RPJTJ512MGE1QDY 512G */
3490+
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3491+
{ PCI_DEVICE(0x1cc4, 0x6302), /* UMIS RPJTJ256MGE1QDY 256G */
3492+
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34563493
{ PCI_DEVICE(0x2646, 0x2262), /* KINGSTON SKC2000 NVMe SSD */
34573494
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
34583495
{ PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */
@@ -3463,6 +3500,10 @@ static const struct pci_device_id nvme_id_table[] = {
34633500
.driver_data = NVME_QUIRK_BOGUS_NID, },
34643501
{ PCI_DEVICE(0x1e4B, 0x1202), /* MAXIO MAP1202 */
34653502
.driver_data = NVME_QUIRK_BOGUS_NID, },
3503+
{ PCI_DEVICE(0x1cc1, 0x5350), /* ADATA XPG GAMMIX S50 */
3504+
.driver_data = NVME_QUIRK_BOGUS_NID, },
3505+
{ PCI_DEVICE(0x1e49, 0x0041), /* ZHITAI TiPro7000 NVMe SSD */
3506+
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
34663507
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061),
34673508
.driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
34683509
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),

0 commit comments

Comments
 (0)