--- v8
+++ v11
@@ -1,21 +1,25 @@
+The P2PDMA mapping should fail if a device with 10-Bit Tag Requester
+interact with a device that does not support 10-Bit Tag Completer.
+
Add a 10-Bit Tag check in the P2PDMA code to ensure that a device with
10-Bit Tag Requester doesn't interact with a device that does not
support 10-Bit Tag Completer. Before that happens, the kernel should
emit a warning.
-"echo 0 > /sys/bus/pci/devices/.../10bit_tag" to disable 10-Bit Tag
+"echo 0 > /sys/bus/pci/devices/.../tags" to disable 10-Bit Tag
Requester for PF device.
-"echo 0 > /sys/bus/pci/devices/.../sriov_vf_10bit_tag_ctl" to disable
+"echo 0 > /sys/bus/pci/devices/.../sriov_vf_tags_ctl" to disable
10-Bit Tag Requester for VF device.
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
+Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
---
- drivers/pci/p2pdma.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/pci/p2pdma.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
-index 50cdde3..2b9c2c9 100644
+index 50cdde3e9a8b..1565a31183af 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -19,6 +19,7 @@
@@ -37,7 +41,7 @@
+ bool req;
+ bool comp;
+ u16 ctl;
-+ const char *str = "10bit_tag";
++ const char *str = "tags";
+
+ if (a->is_virtfn) {
+#ifdef CONFIG_PCI_IOV
@@ -49,7 +53,7 @@
+ req = !!(ctl & PCI_EXP_DEVCTL2_10BIT_TAG_REQ_EN);
+ }
+
-+ comp = !!(b->pcie_devcap2 & PCI_EXP_DEVCAP2_10BIT_TAG_COMP);
++ comp = !!(b->devcap2 & PCI_EXP_DEVCAP2_10BIT_TAG_COMP);
+
+ /* 10-bit tags not enabled on requester */
+ if (!req)
@@ -66,7 +70,7 @@
+ pci_name(b));
+
+ if (a->is_virtfn)
-+ str = "sriov_vf_10bit_tag_ctl";
++ str = "sriov_vf_tags_ctl";
+
+ pci_warn(a, "to disable 10-Bit Tag Requester for this device, echo 0 > /sys/bus/pci/devices/%s/%s\n",
+ pci_name(a), str);
@@ -88,5 +92,5 @@
p2pdma = rcu_dereference(provider->p2pdma);
if (p2pdma)
--
-2.7.4
+2.22.0