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

cxl/pci: Update Port GPF timeout only when the first EP attaching

update_gpf_port_dvsec() is used to update GPF Phase timeout, if a CXL
switch is under a CXL root port, update_gpf_port_dvsec() will be invoked
on the CXL root port when each cxl memory device under the CXL switch is
attaching. It is enough to be invoked once, others are redundant.

When the first EP attaching, it always triggers its ancestor dports to
locate their own Port GPF DVSEC. The change is that invoking
update_gpf_port_dvsec() on these ancestor dports after ancestor dport
locating a Port GPF DVSEC. It guarantees that update_gpf_port_dvsec() is
invoked on a dport only happens during the first EP attaching.

Signed-off-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://patch.msgid.link/20250323093110.233040-3-ming.li@zohomail.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

authored by

Li Ming and committed by
Dave Jiang
6af941db 87d2de04

+4 -6
+4 -6
drivers/cxl/core/pci.c
··· 1130 1130 1131 1131 int cxl_gpf_port_setup(struct cxl_dport *dport) 1132 1132 { 1133 - struct pci_dev *pdev; 1134 - 1135 1133 if (!dport) 1136 1134 return -EINVAL; 1137 1135 1138 1136 if (!dport->gpf_dvsec) { 1137 + struct pci_dev *pdev; 1139 1138 int dvsec; 1140 1139 1141 1140 dvsec = cxl_gpf_get_dvsec(dport->dport_dev, true); ··· 1142 1143 return -EINVAL; 1143 1144 1144 1145 dport->gpf_dvsec = dvsec; 1146 + pdev = to_pci_dev(dport->dport_dev); 1147 + update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 1); 1148 + update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 2); 1145 1149 } 1146 - 1147 - pdev = to_pci_dev(dport->dport_dev); 1148 - update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 1); 1149 - update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 2); 1150 1150 1151 1151 return 0; 1152 1152 }