Skip to content

Commit 6af941d

Browse files
MingLi-4davejiang
authored andcommitted
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>
1 parent 87d2de0 commit 6af941d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/cxl/core/pci.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,24 +1130,22 @@ static int update_gpf_port_dvsec(struct pci_dev *pdev, int dvsec, int phase)
11301130

11311131
int cxl_gpf_port_setup(struct cxl_dport *dport)
11321132
{
1133-
struct pci_dev *pdev;
1134-
11351133
if (!dport)
11361134
return -EINVAL;
11371135

11381136
if (!dport->gpf_dvsec) {
1137+
struct pci_dev *pdev;
11391138
int dvsec;
11401139

11411140
dvsec = cxl_gpf_get_dvsec(dport->dport_dev, true);
11421141
if (!dvsec)
11431142
return -EINVAL;
11441143

11451144
dport->gpf_dvsec = dvsec;
1145+
pdev = to_pci_dev(dport->dport_dev);
1146+
update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 1);
1147+
update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 2);
11461148
}
11471149

1148-
pdev = to_pci_dev(dport->dport_dev);
1149-
update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 1);
1150-
update_gpf_port_dvsec(pdev, dport->gpf_dvsec, 2);
1151-
11521150
return 0;
11531151
}

0 commit comments

Comments
 (0)