Skip to content

cxl/pci: Fix the GPF DVSEC setup path

Guixin Liu linux-cxl 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 5 repliesIn review
  2. v13 patches 6 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3cxl/pci: Use the Device GPF DVSEC for restricted endpointsdrivers/cxl/core/pci.c+2 -11 reply
2/3cxl/pci: Program the Port GPF timeouts before caching the DVSECdrivers/cxl/core/pci.c+21 -91 reply
3/3cxl/pci: Update only the Port GPF timeout fieldsdrivers/cxl/core/pci.c+2 -22 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchJonathan CameronDave JiangAlison Schofield
1/3R-b R-b R-b
2/3R-b R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/3] cxl/pci: Fix the GPF DVSEC setup path

Three small fixes for the GPF setup path in cxl/core/pci.c, found while reworking the same area for a downstream backport.

Patch 1 is the one with user-visible impact: on an RCD the GPF DVSEC lookup takes the port path, so dirty shutdown tracking never arms and the count stays invalid. The other two deal with error handling and a full-register rewrite of the phase control register.

Testing on a QEMU CXL topology, with the patched cxl_core hot-swapped in and the topology re-enumerated. With the phase 1/2 timeout registers of all four dports (two root ports, two switch downstream ports) zeroed beforehand, every dport came back at 0x0702 — base 2, scale 7, the same value the unpatched code writes. So the timeout write ran on each of them: the read-modify-write of patch 3, through the error-checked setup of patch 2. With the registers left at their programmed value instead, the setup takes the "already at max" early return and writes nothing. Re-enumeration comes up clean, all three memdevs back.

What QEMU cannot exercise: the topology has no RCD, so the RC_END branch of patch 1 never ran — though the emulated type-3 devices do expose the Device GPF DVSEC that the fix selects for a restricted endpoint. A config write to a live DVSEC does not fail, so the error paths of patch 2 stayed cold. And the phase control register defines no non-timeout bits today, so patch 3 lands on the same value the old full rewrite did.

Changes since v1 [1]:

- Collect the Reviewed-by tags from Jonathan Cameron and Dave Jiang for patches 1 and 2 (code unchanged).

- Rework patch 3 to use a pair of FIELD_MODIFY() calls instead of clearing and setting the timeout masks by hand, as suggested by Jonathan Cameron. The generated code for update_gpf_port_dvsec() is identical to the manual version.

[1] https://lore.kernel.org/all/[email protected]/

Guixin Liu (3):
cxl/pci: Use the Device GPF DVSEC for restricted endpoints cxl/pci: Program the Port GPF timeouts before caching the DVSEC cxl/pci: Update only the Port GPF timeout fields

 drivers/cxl/core/pci.c | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)
Signature · 1 line
2.43.7