[PATCH V2 2/2] nvme-multipath: enable PCI P2PDMA for multipath devices

Chaitanya Kulkarni kch at nvidia.com
Wed Apr 8 00:25:37 PDT 2026


From: Kiran Kumar Modukuri <kmodukuri at nvidia.com>

NVMe multipath does not expose BLK_FEAT_PCI_P2PDMA on the head disk
even when the underlying controller supports it.

Set BLK_FEAT_PCI_P2PDMA in nvme_mpath_alloc_disk() when the controller
advertises P2PDMA support via ctrl->ops->supports_pci_p2pdma.

Since multipath can match paths across different transports (e.g. PCIe
and FC), not all paths are guaranteed to support P2PDMA. Clear
BLK_FEAT_PCI_P2PDMA from the head disk in nvme_mpath_add_disk() if the
newly added path does not support it, ensuring the feature is only
advertised when every member supports it.

Signed-off-by: Kiran Kumar Modukuri <kmodukuri at nvidia.com>
Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
---
 drivers/nvme/host/multipath.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index ba00f0b72b85..48d920ce803f 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -737,6 +737,9 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
 		BLK_FEAT_POLL | BLK_FEAT_ATOMIC_WRITES;
 	if (head->ids.csi == NVME_CSI_ZNS)
 		lim.features |= BLK_FEAT_ZONED;
+	if (ctrl->ops && ctrl->ops->supports_pci_p2pdma &&
+	    ctrl->ops->supports_pci_p2pdma(ctrl))
+		lim.features |= BLK_FEAT_PCI_P2PDMA;
 
 	head->disk = blk_alloc_disk(&lim, ctrl->numa_node);
 	if (IS_ERR(head->disk))
@@ -1248,6 +1251,21 @@ void nvme_mpath_remove_sysfs_link(struct nvme_ns *ns)
 
 void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid)
 {
+	struct nvme_ns_head *head = ns->head;
+
+	/*
+	 * Clear BLK_FEAT_PCI_P2PDMA on the head disk if this path does not
+	 * support it. Multipath may span different transports (e.g. PCIe and
+	 * FC), so every member must support P2PDMA for it to be safe on the
+	 * head disk.
+	 */
+	if (head->disk && !blk_queue_pci_p2pdma(ns->queue)) {
+		struct queue_limits lim =
+			queue_limits_start_update(head->disk->queue);
+		lim.features &= ~BLK_FEAT_PCI_P2PDMA;
+		queue_limits_commit_update(head->disk->queue, &lim);
+	}
+
 	if (nvme_ctrl_use_ana(ns->ctrl)) {
 		struct nvme_ana_group_desc desc = {
 			.grpid = anagrpid,
-- 
2.39.5




More information about the Linux-nvme mailing list