Commit d90c470b authored by Jens Axboe's avatar Jens Axboe
Browse files

Merge tag 'nvme-7.0-2026-03-04' of git://git.infradead.org/nvme into block-7.0

Pull NVMe fixes from Keith:

"- Improve quirk visibility and configurability (Maurizio)
 - Fix runtime user modification to queue setup (Keith)
 - Fix multipath leak on try_module_get failure (Keith)
 - Ignore ambiguous spec definitions for better atomics support (John)
 - Fix admin queue leak on controller reset (Ming)
 - Fix large allocation in persistent reservation read keys (Sungwoo Kim)
 - Fix fcloop callback handling (Justin)
 - Securely free DHCHAP secrets (Daniel)
 - Various cleanups and typo fixes (John, Wilfred)"

* tag 'nvme-7.0-2026-03-04' of git://git.infradead.org/nvme:
  nvme: fix memory allocation in nvme_pr_read_keys()
  nvme-multipath: fix leak on try_module_get failure
  nvmet-fcloop: Check remoteport port_state before calling done callback
  nvme-pci: do not try to add queue maps at runtime
  nvme-pci: cap queue creation to used queues
  nvme-pci: ensure we're polling a polled queue
  nvme: fix memory leak in quirks_param_set()
  nvme: correct comment about nvme_ns_remove()
  nvme: stop setting namespace gendisk device driver data
  nvme: add support for dynamic quirk configuration via module parameter
  nvme: fix admin queue leak on controller reset
  nvme-fabrics: use kfree_sensitive() for DHCHAP secrets
  nvme: stop using AWUPF
  nvme: expose active quirks in sysfs
  nvme/host: fixup some typos
parents 8da8df43 c3320153
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@
	TPM	TPM drivers are enabled.
	UMS	USB Mass Storage support is enabled.
	USB	USB support is enabled.
	NVME	NVMe support is enabled
	USBHID	USB Human Interface Device support is enabled.
	V4L	Video For Linux support is enabled.
	VGA	The VGA console has been enabled.
@@ -4787,6 +4788,18 @@ Kernel parameters
			This can be set from sysctl after boot.
			See Documentation/admin-guide/sysctl/vm.rst for details.

	nvme.quirks=    [NVME] A list of quirk entries to augment the built-in
			nvme quirk list. List entries are separated by a
			'-' character.
			Each entry has the form VendorID:ProductID:quirk_names.
			The IDs are 4-digits hex numbers and quirk_names is a
			list of quirk names separated by commas. A quirk name
			can be prefixed by '^', meaning that the specified
			quirk must be disabled.

			Example:
			nvme.quirks=7710:2267:bogus_nid,^identify_cns-9900:7711:broken_msi

	ohci1394_dma=early	[HW,EARLY] enable debugging via the ohci1394 driver.
			See Documentation/core-api/debugging-via-ohci1394.rst for more
			info.
+12 −16
Original line number Diff line number Diff line
@@ -2046,14 +2046,10 @@ static u32 nvme_configure_atomic_write(struct nvme_ns *ns,
		if (id->nabspf)
			boundary = (le16_to_cpu(id->nabspf) + 1) * bs;
	} else {
		/*
		 * Use the controller wide atomic write unit.  This sucks
		 * because the limit is defined in terms of logical blocks while
		 * namespaces can have different formats, and because there is
		 * no clear language in the specification prohibiting different
		 * values for different controllers in the subsystem.
		 */
		atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs;
		if (ns->ctrl->awupf)
			dev_info_once(ns->ctrl->device,
				"AWUPF ignored, only NAWUPF accepted\n");
		atomic_bs = bs;
	}

	lim->atomic_write_hw_max = atomic_bs;
@@ -3222,7 +3218,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
	memcpy(subsys->model, id->mn, sizeof(subsys->model));
	subsys->vendor_id = le16_to_cpu(id->vid);
	subsys->cmic = id->cmic;
	subsys->awupf = le16_to_cpu(id->awupf);

	/* Versions prior to 1.4 don't necessarily report a valid type */
	if (id->cntrltype == NVME_CTRL_DISC ||
@@ -3655,6 +3650,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
		dev_pm_qos_expose_latency_tolerance(ctrl->device);
	else if (!ctrl->apst_enabled && prev_apst_enabled)
		dev_pm_qos_hide_latency_tolerance(ctrl->device);
	ctrl->awupf = le16_to_cpu(id->awupf);
out_free:
	kfree(id);
	return ret;
@@ -4186,13 +4182,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
	nvme_mpath_add_disk(ns, info->anagrpid);
	nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name);

	/*
	 * Set ns->disk->device->driver_data to ns so we can access
	 * ns->head->passthru_err_log_enabled in
	 * nvme_io_passthru_err_log_enabled_[store | show]().
	 */
	dev_set_drvdata(disk_to_dev(ns->disk), ns);

	return;

 out_cleanup_ns_from_list:
@@ -4865,6 +4854,13 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
	if (ret)
		return ret;

	/*
	 * If a previous admin queue exists (e.g., from before a reset),
	 * put it now before allocating a new one to avoid orphaning it.
	 */
	if (ctrl->admin_q)
		blk_put_queue(ctrl->admin_q);

	ctrl->admin_q = blk_mq_alloc_queue(set, &lim, NULL);
	if (IS_ERR(ctrl->admin_q)) {
		ret = PTR_ERR(ctrl->admin_q);
+2 −2
Original line number Diff line number Diff line
@@ -1290,8 +1290,8 @@ void nvmf_free_options(struct nvmf_ctrl_options *opts)
	kfree(opts->subsysnqn);
	kfree(opts->host_traddr);
	kfree(opts->host_iface);
	kfree(opts->dhchap_secret);
	kfree(opts->dhchap_ctrl_secret);
	kfree_sensitive(opts->dhchap_secret);
	kfree_sensitive(opts->dhchap_ctrl_secret);
	kfree(opts);
}
EXPORT_SYMBOL_GPL(nvmf_free_options);
+6 −8
Original line number Diff line number Diff line
@@ -1300,7 +1300,7 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
	mutex_lock(&head->subsys->lock);
	/*
	 * We are called when all paths have been removed, and at that point
	 * head->list is expected to be empty. However, nvme_remove_ns() and
	 * head->list is expected to be empty. However, nvme_ns_remove() and
	 * nvme_init_ns_head() can run concurrently and so if head->delayed_
	 * removal_secs is configured, it is possible that by the time we reach
	 * this point, head->list may no longer be empty. Therefore, we recheck
@@ -1310,13 +1310,11 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
	if (!list_empty(&head->list))
		goto out;

	if (head->delayed_removal_secs) {
	/*
	 * Ensure that no one could remove this module while the head
	 * remove work is pending.
	 */
		if (!try_module_get(THIS_MODULE))
			goto out;
	if (head->delayed_removal_secs && try_module_get(THIS_MODULE)) {
		mod_delayed_work(nvme_wq, &head->remove_work,
				head->delayed_removal_secs * HZ);
	} else {
+56 −1
Original line number Diff line number Diff line
@@ -180,6 +180,60 @@ enum nvme_quirks {
	NVME_QUIRK_DMAPOOL_ALIGN_512		= (1 << 22),
};

static inline char *nvme_quirk_name(enum nvme_quirks q)
{
	switch (q) {
	case NVME_QUIRK_STRIPE_SIZE:
		return "stripe_size";
	case NVME_QUIRK_IDENTIFY_CNS:
		return "identify_cns";
	case NVME_QUIRK_DEALLOCATE_ZEROES:
		return "deallocate_zeroes";
	case NVME_QUIRK_DELAY_BEFORE_CHK_RDY:
		return "delay_before_chk_rdy";
	case NVME_QUIRK_NO_APST:
		return "no_apst";
	case NVME_QUIRK_NO_DEEPEST_PS:
		return "no_deepest_ps";
	case NVME_QUIRK_QDEPTH_ONE:
		return "qdepth_one";
	case NVME_QUIRK_MEDIUM_PRIO_SQ:
		return "medium_prio_sq";
	case NVME_QUIRK_IGNORE_DEV_SUBNQN:
		return "ignore_dev_subnqn";
	case NVME_QUIRK_DISABLE_WRITE_ZEROES:
		return "disable_write_zeroes";
	case NVME_QUIRK_SIMPLE_SUSPEND:
		return "simple_suspend";
	case NVME_QUIRK_SINGLE_VECTOR:
		return "single_vector";
	case NVME_QUIRK_128_BYTES_SQES:
		return "128_bytes_sqes";
	case NVME_QUIRK_SHARED_TAGS:
		return "shared_tags";
	case NVME_QUIRK_NO_TEMP_THRESH_CHANGE:
		return "no_temp_thresh_change";
	case NVME_QUIRK_NO_NS_DESC_LIST:
		return "no_ns_desc_list";
	case NVME_QUIRK_DMA_ADDRESS_BITS_48:
		return "dma_address_bits_48";
	case NVME_QUIRK_SKIP_CID_GEN:
		return "skip_cid_gen";
	case NVME_QUIRK_BOGUS_NID:
		return "bogus_nid";
	case NVME_QUIRK_NO_SECONDARY_TEMP_THRESH:
		return "no_secondary_temp_thresh";
	case NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND:
		return "force_no_simple_suspend";
	case NVME_QUIRK_BROKEN_MSI:
		return "broken_msi";
	case NVME_QUIRK_DMAPOOL_ALIGN_512:
		return "dmapool_align_512";
	}

	return "unknown";
}

/*
 * Common request structure for NVMe passthrough.  All drivers must have
 * this structure as the first member of their request-private data.
@@ -410,6 +464,8 @@ struct nvme_ctrl {

	enum nvme_ctrl_type cntrltype;
	enum nvme_dctype dctype;

	u16			awupf; /* 0's based value. */
};

static inline enum nvme_ctrl_state nvme_ctrl_state(struct nvme_ctrl *ctrl)
@@ -442,7 +498,6 @@ struct nvme_subsystem {
	u8			cmic;
	enum nvme_subsys_type	subtype;
	u16			vendor_id;
	u16			awupf; /* 0's based value. */
	struct ida		ns_ida;
#ifdef CONFIG_NVME_MULTIPATH
	enum nvme_iopolicy	iopolicy;
Loading