Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nvme-6.8-2023-02-08' of git://git.infradead.org/nvme into block-6.8

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.8

- Update a potentially stale firmware attribute (Maurizio)
- Fixes for the recent verbose error logging (Keith, Chaitanya)
- Protection information payload size fix for passthrough (Francis)"

* tag 'nvme-6.8-2023-02-08' of git://git.infradead.org/nvme:
nvme: use ns->head->pi_size instead of t10_pi_tuple structure size
nvme-core: fix comment to reflect right functions
nvme: move passthrough logging attribute to head
nvme-host: fix the updating of the firmware version

+25 -23
+8 -6
drivers/nvme/host/core.c
··· 713 713 if (req->q->queuedata) { 714 714 struct nvme_ns *ns = req->q->disk->private_data; 715 715 716 - logging_enabled = ns->passthru_err_log_enabled; 716 + logging_enabled = ns->head->passthru_err_log_enabled; 717 717 req->timeout = NVME_IO_TIMEOUT; 718 718 } else { /* no queuedata implies admin queue */ 719 719 logging_enabled = nr->ctrl->passthru_err_log_enabled; ··· 3696 3696 3697 3697 ns->disk = disk; 3698 3698 ns->queue = disk->queue; 3699 - ns->passthru_err_log_enabled = false; 3700 3699 3701 3700 if (ctrl->opts && ctrl->opts->data_digest) 3702 3701 blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue); ··· 3761 3762 3762 3763 /* 3763 3764 * Set ns->disk->device->driver_data to ns so we can access 3764 - * ns->logging_enabled in nvme_passthru_err_log_enabled_store() and 3765 - * nvme_passthru_err_log_enabled_show(). 3765 + * ns->head->passthru_err_log_enabled in 3766 + * nvme_io_passthru_err_log_enabled_[store | show](). 3766 3767 */ 3767 3768 dev_set_drvdata(disk_to_dev(ns->disk), ns); 3768 3769 ··· 4190 4191 static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl) 4191 4192 { 4192 4193 struct nvme_fw_slot_info_log *log; 4194 + u8 next_fw_slot, cur_fw_slot; 4193 4195 4194 4196 log = kmalloc(sizeof(*log), GFP_KERNEL); 4195 4197 if (!log) ··· 4202 4202 goto out_free_log; 4203 4203 } 4204 4204 4205 - if (log->afi & 0x70 || !(log->afi & 0x7)) { 4205 + cur_fw_slot = log->afi & 0x7; 4206 + next_fw_slot = (log->afi & 0x70) >> 4; 4207 + if (!cur_fw_slot || (next_fw_slot && (cur_fw_slot != next_fw_slot))) { 4206 4208 dev_info(ctrl->device, 4207 4209 "Firmware is activated after next Controller Level Reset\n"); 4208 4210 goto out_free_log; 4209 4211 } 4210 4212 4211 - memcpy(ctrl->subsys->firmware_rev, &log->frs[(log->afi & 0x7) - 1], 4213 + memcpy(ctrl->subsys->firmware_rev, &log->frs[cur_fw_slot - 1], 4212 4214 sizeof(ctrl->subsys->firmware_rev)); 4213 4215 4214 4216 out_free_log:
+1 -1
drivers/nvme/host/ioctl.c
··· 228 228 length = (io.nblocks + 1) << ns->head->lba_shift; 229 229 230 230 if ((io.control & NVME_RW_PRINFO_PRACT) && 231 - ns->head->ms == sizeof(struct t10_pi_tuple)) { 231 + (ns->head->ms == ns->head->pi_size)) { 232 232 /* 233 233 * Protection information is stripped/inserted by the 234 234 * controller.
+1 -1
drivers/nvme/host/nvme.h
··· 455 455 struct list_head entry; 456 456 struct kref ref; 457 457 bool shared; 458 + bool passthru_err_log_enabled; 458 459 int instance; 459 460 struct nvme_effects_log *effects; 460 461 u64 nuse; ··· 524 523 struct device cdev_device; 525 524 526 525 struct nvme_fault_inject fault_inject; 527 - bool passthru_err_log_enabled; 528 526 }; 529 527 530 528 /* NVMe ns supports metadata actions by the controller (generate/strip) */
+15 -15
drivers/nvme/host/sysfs.c
··· 48 48 struct device_attribute *attr, const char *buf, size_t count) 49 49 { 50 50 struct nvme_ctrl *ctrl = dev_get_drvdata(dev); 51 - int err; 52 51 bool passthru_err_log_enabled; 52 + int err; 53 53 54 54 err = kstrtobool(buf, &passthru_err_log_enabled); 55 55 if (err) ··· 60 60 return count; 61 61 } 62 62 63 + static inline struct nvme_ns_head *dev_to_ns_head(struct device *dev) 64 + { 65 + struct gendisk *disk = dev_to_disk(dev); 66 + 67 + if (nvme_disk_is_ns_head(disk)) 68 + return disk->private_data; 69 + return nvme_get_ns_from_dev(dev)->head; 70 + } 71 + 63 72 static ssize_t nvme_io_passthru_err_log_enabled_show(struct device *dev, 64 73 struct device_attribute *attr, char *buf) 65 74 { 66 - struct nvme_ns *n = dev_get_drvdata(dev); 75 + struct nvme_ns_head *head = dev_to_ns_head(dev); 67 76 68 - return sysfs_emit(buf, n->passthru_err_log_enabled ? "on\n" : "off\n"); 77 + return sysfs_emit(buf, head->passthru_err_log_enabled ? "on\n" : "off\n"); 69 78 } 70 79 71 80 static ssize_t nvme_io_passthru_err_log_enabled_store(struct device *dev, 72 81 struct device_attribute *attr, const char *buf, size_t count) 73 82 { 74 - struct nvme_ns *ns = dev_get_drvdata(dev); 75 - int err; 83 + struct nvme_ns_head *head = dev_to_ns_head(dev); 76 84 bool passthru_err_log_enabled; 85 + int err; 77 86 78 87 err = kstrtobool(buf, &passthru_err_log_enabled); 79 88 if (err) 80 89 return -EINVAL; 81 - ns->passthru_err_log_enabled = passthru_err_log_enabled; 90 + head->passthru_err_log_enabled = passthru_err_log_enabled; 82 91 83 92 return count; 84 93 } ··· 99 90 static struct device_attribute dev_attr_io_passthru_err_log_enabled = \ 100 91 __ATTR(passthru_err_log_enabled, S_IRUGO | S_IWUSR, \ 101 92 nvme_io_passthru_err_log_enabled_show, nvme_io_passthru_err_log_enabled_store); 102 - 103 - static inline struct nvme_ns_head *dev_to_ns_head(struct device *dev) 104 - { 105 - struct gendisk *disk = dev_to_disk(dev); 106 - 107 - if (nvme_disk_is_ns_head(disk)) 108 - return disk->private_data; 109 - return nvme_get_ns_from_dev(dev)->head; 110 - } 111 93 112 94 static ssize_t wwid_show(struct device *dev, struct device_attribute *attr, 113 95 char *buf)