Merge tag 'nvme-6.11-2024-07-26' of git://git.infradead.org/nvme into block-6.11

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.11

- Fix request without payloads cleanup (Leon)
- Use new protection information format (Francis)
- Improved debug message for lost pci link (Bart)
- Another apst quirk (Wang)
- Use appropriate sysfs api for printing chars (Markus)"

* tag 'nvme-6.11-2024-07-26' of git://git.infradead.org/nvme:
nvme-pci: add missing condition check for existence of mapped data
nvme-core: choose PIF from QPIF if QPIFS supports and PIF is QTYPE
nvme-pci: Fix the instructions for disabling power management
nvme: remove redundant bdev local variable
nvme-fabrics: Use seq_putc() in __nvmf_concat_opt_tokens()
nvme/pci: Add APST quirk for Lenovo N60z laptop

+30 -8
+7 -1
drivers/nvme/host/core.c
··· 1876 1876 struct nvme_id_ns *id, struct nvme_id_ns_nvm *nvm) 1877 1877 { 1878 1878 u32 elbaf = le32_to_cpu(nvm->elbaf[nvme_lbaf_index(id->flbas)]); 1879 + u8 guard_type; 1879 1880 1880 1881 /* no support for storage tag formats right now */ 1881 1882 if (nvme_elbaf_sts(elbaf)) 1882 1883 return; 1883 1884 1884 - head->guard_type = nvme_elbaf_guard_type(elbaf); 1885 + guard_type = nvme_elbaf_guard_type(elbaf); 1886 + if ((nvm->pic & NVME_ID_NS_NVM_QPIFS) && 1887 + guard_type == NVME_NVM_NS_QTYPE_GUARD) 1888 + guard_type = nvme_elbaf_qualified_guard_type(elbaf); 1889 + 1890 + head->guard_type = guard_type; 1885 1891 switch (head->guard_type) { 1886 1892 case NVME_NVM_NS_64B_GUARD: 1887 1893 head->pi_size = sizeof(struct crc64_pi_tuple);
+2 -2
drivers/nvme/host/fabrics.c
··· 1403 1403 tok = &opt_tokens[idx]; 1404 1404 if (tok->token == NVMF_OPT_ERR) 1405 1405 continue; 1406 - seq_puts(seq_file, ","); 1406 + seq_putc(seq_file, ','); 1407 1407 seq_puts(seq_file, tok->pattern); 1408 1408 } 1409 - seq_puts(seq_file, "\n"); 1409 + seq_putc(seq_file, '\n'); 1410 1410 } 1411 1411 1412 1412 static int nvmf_dev_show(struct seq_file *seq_file, void *private)
+10 -2
drivers/nvme/host/pci.c
··· 863 863 nvme_start_request(req); 864 864 return BLK_STS_OK; 865 865 out_unmap_data: 866 - nvme_unmap_data(dev, req); 866 + if (blk_rq_nr_phys_segments(req)) 867 + nvme_unmap_data(dev, req); 867 868 out_free_cmd: 868 869 nvme_cleanup_cmd(req); 869 870 return ret; ··· 1310 1309 dev_warn(dev->ctrl.device, 1311 1310 "Does your device have a faulty power saving mode enabled?\n"); 1312 1311 dev_warn(dev->ctrl.device, 1313 - "Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off\" and report a bug\n"); 1312 + "Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off pcie_port_pm=off\" and report a bug\n"); 1314 1313 } 1315 1314 1316 1315 static enum blk_eh_timer_return nvme_timeout(struct request *req) ··· 2968 2967 dmi_match(DMI_BOARD_NAME, "PH4PRX1_PH6PRX1")) 2969 2968 return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND; 2970 2969 } 2970 + 2971 + /* 2972 + * NVMe SSD drops off the PCIe bus after system idle 2973 + * for 10 hours on a Lenovo N60z board. 2974 + */ 2975 + if (dmi_match(DMI_BOARD_NAME, "LXKT-ZXEG-N6")) 2976 + return NVME_QUIRK_NO_APST; 2971 2977 2972 2978 return 0; 2973 2979 }
+2 -3
drivers/nvme/host/sysfs.c
··· 233 233 { 234 234 struct nvme_ns_head *head = dev_to_ns_head(dev); 235 235 struct gendisk *disk = dev_to_disk(dev); 236 - struct block_device *bdev = disk->part0; 237 236 int ret; 238 237 239 - if (nvme_disk_is_ns_head(bdev->bd_disk)) 238 + if (nvme_disk_is_ns_head(disk)) 240 239 ret = ns_head_update_nuse(head); 241 240 else 242 - ret = ns_update_nuse(bdev->bd_disk->private_data); 241 + ret = ns_update_nuse(disk->private_data); 243 242 if (ret) 244 243 return ret; 245 244
+9
include/linux/nvme.h
··· 485 485 NVME_ID_NS_NVM_STS_MASK = 0x7f, 486 486 NVME_ID_NS_NVM_GUARD_SHIFT = 7, 487 487 NVME_ID_NS_NVM_GUARD_MASK = 0x3, 488 + NVME_ID_NS_NVM_QPIF_SHIFT = 9, 489 + NVME_ID_NS_NVM_QPIF_MASK = 0xf, 490 + NVME_ID_NS_NVM_QPIFS = 1 << 3, 488 491 }; 489 492 490 493 static inline __u8 nvme_elbaf_sts(__u32 elbaf) ··· 498 495 static inline __u8 nvme_elbaf_guard_type(__u32 elbaf) 499 496 { 500 497 return (elbaf >> NVME_ID_NS_NVM_GUARD_SHIFT) & NVME_ID_NS_NVM_GUARD_MASK; 498 + } 499 + 500 + static inline __u8 nvme_elbaf_qualified_guard_type(__u32 elbaf) 501 + { 502 + return (elbaf >> NVME_ID_NS_NVM_QPIF_SHIFT) & NVME_ID_NS_NVM_QPIF_MASK; 501 503 } 502 504 503 505 struct nvme_id_ctrl_nvm { ··· 584 576 NVME_NVM_NS_16B_GUARD = 0, 585 577 NVME_NVM_NS_32B_GUARD = 1, 586 578 NVME_NVM_NS_64B_GUARD = 2, 579 + NVME_NVM_NS_QTYPE_GUARD = 3, 587 580 }; 588 581 589 582 static inline __u8 nvme_lbaf_index(__u8 flbas)