Skip to content

Commit f6bb525

Browse files
committed
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
2 parents 55fbb9a + c31fad1 commit f6bb525

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

drivers/nvme/host/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,12 +1876,18 @@ static void nvme_configure_pi_elbas(struct nvme_ns_head *head,
18761876
struct nvme_id_ns *id, struct nvme_id_ns_nvm *nvm)
18771877
{
18781878
u32 elbaf = le32_to_cpu(nvm->elbaf[nvme_lbaf_index(id->flbas)]);
1879+
u8 guard_type;
18791880

18801881
/* no support for storage tag formats right now */
18811882
if (nvme_elbaf_sts(elbaf))
18821883
return;
18831884

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;
18851891
switch (head->guard_type) {
18861892
case NVME_NVM_NS_64B_GUARD:
18871893
head->pi_size = sizeof(struct crc64_pi_tuple);

drivers/nvme/host/fabrics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,10 +1403,10 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file)
14031403
tok = &opt_tokens[idx];
14041404
if (tok->token == NVMF_OPT_ERR)
14051405
continue;
1406-
seq_puts(seq_file, ",");
1406+
seq_putc(seq_file, ',');
14071407
seq_puts(seq_file, tok->pattern);
14081408
}
1409-
seq_puts(seq_file, "\n");
1409+
seq_putc(seq_file, '\n');
14101410
}
14111411

14121412
static int nvmf_dev_show(struct seq_file *seq_file, void *private)

drivers/nvme/host/pci.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ static blk_status_t nvme_prep_rq(struct nvme_dev *dev, struct request *req)
863863
nvme_start_request(req);
864864
return BLK_STS_OK;
865865
out_unmap_data:
866-
nvme_unmap_data(dev, req);
866+
if (blk_rq_nr_phys_segments(req))
867+
nvme_unmap_data(dev, req);
867868
out_free_cmd:
868869
nvme_cleanup_cmd(req);
869870
return ret;
@@ -1309,7 +1310,7 @@ static void nvme_warn_reset(struct nvme_dev *dev, u32 csts)
13091310
dev_warn(dev->ctrl.device,
13101311
"Does your device have a faulty power saving mode enabled?\n");
13111312
dev_warn(dev->ctrl.device,
1312-
"Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off\" and report a bug\n");
1313+
"Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off pcie_port_pm=off\" and report a bug\n");
13131314
}
13141315

13151316
static enum blk_eh_timer_return nvme_timeout(struct request *req)
@@ -2968,6 +2969,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
29682969
return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND;
29692970
}
29702971

2972+
/*
2973+
* NVMe SSD drops off the PCIe bus after system idle
2974+
* for 10 hours on a Lenovo N60z board.
2975+
*/
2976+
if (dmi_match(DMI_BOARD_NAME, "LXKT-ZXEG-N6"))
2977+
return NVME_QUIRK_NO_APST;
2978+
29712979
return 0;
29722980
}
29732981

drivers/nvme/host/sysfs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,12 @@ static ssize_t nuse_show(struct device *dev, struct device_attribute *attr,
233233
{
234234
struct nvme_ns_head *head = dev_to_ns_head(dev);
235235
struct gendisk *disk = dev_to_disk(dev);
236-
struct block_device *bdev = disk->part0;
237236
int ret;
238237

239-
if (nvme_disk_is_ns_head(bdev->bd_disk))
238+
if (nvme_disk_is_ns_head(disk))
240239
ret = ns_head_update_nuse(head);
241240
else
242-
ret = ns_update_nuse(bdev->bd_disk->private_data);
241+
ret = ns_update_nuse(disk->private_data);
243242
if (ret)
244243
return ret;
245244

include/linux/nvme.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ enum {
485485
NVME_ID_NS_NVM_STS_MASK = 0x7f,
486486
NVME_ID_NS_NVM_GUARD_SHIFT = 7,
487487
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,
488491
};
489492

490493
static inline __u8 nvme_elbaf_sts(__u32 elbaf)
@@ -497,6 +500,11 @@ static inline __u8 nvme_elbaf_guard_type(__u32 elbaf)
497500
return (elbaf >> NVME_ID_NS_NVM_GUARD_SHIFT) & NVME_ID_NS_NVM_GUARD_MASK;
498501
}
499502

503+
static inline __u8 nvme_elbaf_qualified_guard_type(__u32 elbaf)
504+
{
505+
return (elbaf >> NVME_ID_NS_NVM_QPIF_SHIFT) & NVME_ID_NS_NVM_QPIF_MASK;
506+
}
507+
500508
struct nvme_id_ctrl_nvm {
501509
__u8 vsl;
502510
__u8 wzsl;
@@ -576,6 +584,7 @@ enum {
576584
NVME_NVM_NS_16B_GUARD = 0,
577585
NVME_NVM_NS_32B_GUARD = 1,
578586
NVME_NVM_NS_64B_GUARD = 2,
587+
NVME_NVM_NS_QTYPE_GUARD = 3,
579588
};
580589

581590
static inline __u8 nvme_lbaf_index(__u8 flbas)

0 commit comments

Comments
 (0)