Skip to content

Harden HDM decoder enumeration

Alison Schofield linux-cxl sashiko-reviews 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 7 repliesIn review
  2. v44 patches 17 repliesSuperseded
  3. v33 patches 7 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches5 repliesSuperseded
v13 patches2 repliesSuperseded

Changes in v5 from the cover letter

Drop P2 of v4 as it changed what user sees in iw and ig attributes (Davidlohr)
Renumbering: v4 P3 and P4 are now P2 and P3
P1: Validate the target count once per port, not per decoder (Jonathan)
P1: Move the zero-target reject back to cxl_switch_decoder_init() (Ming)
P1: Drop the ways reset for uncommitted decoders (Jonathan, Davidlohr)
P1: Declare cxlsd on one line (Jonathan)
P1: Reword the CXL_HDM_DECODER0_TL_TARGETS comment (Jonathan)
P2: Build the target IDs with put_unaligned_le32() (Jonathan)
P2: Dropped all the tags on endian-ness patch
P3: Commit log s/none committed/uncommitted/ (DaveJ)
P4: New - bound switch decoder target array walks by nr_targets

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4cxl/hdm: Reject switch decoder interleave ways that overflow targetsdrivers/cxl/core/hdm.c drivers/cxl/core/port.c drivers/cxl/cxl.h+27 -13 replies
2/4cxl/hdm: Make switch decoder target parsing endian-safedrivers/cxl/core/hdm.c+7 -81 reply
3/4cxl/hdm: Restore commit_end when decoder enumeration failsdrivers/cxl/core/hdm.c+20 -30 replies
4/4cxl/port: Bound switch decoder target array access by nr_targetsdrivers/cxl/core/port.c+18 -71 reply

Reviews trailers per patch

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

PatchDavidlohr BuesoRichard ChengJonathan CameronDave JiangLi Ming
1/4T-b R-b R-b R-b R-b
2/4R-b
3/4R-b R-b R-b R-b
4/4R-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 5 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/4] Harden HDM decoder enumeration

Changes in v5:
Drop P2 of v4 as it changed what user sees in iw and ig attributes (Davidlohr)
Renumbering: v4 P3 and P4 are now P2 and P3
P1: Validate the target count once per port, not per decoder (Jonathan)
P1: Move the zero-target reject back to cxl_switch_decoder_init() (Ming)
P1: Drop the ways reset for uncommitted decoders (Jonathan, Davidlohr)
P1: Declare cxlsd on one line (Jonathan)
P1: Reword the CXL_HDM_DECODER0_TL_TARGETS comment (Jonathan)
P2: Build the target IDs with put_unaligned_le32() (Jonathan)
P2: Dropped all the tags on endian-ness patch
P3: Commit log s/none committed/uncommitted/ (DaveJ)
P4: New - bound switch decoder target array walks by nr_targets

Changes in v4:
A new patch was inserted as Patch2, so now set is 4 patches.
Sashiko is likely to complain in Patch 1 for something fixed in Patches 2 and 3, but reordering does not makes sense.
P2: Only interpret interleave settings on committed decoders (Ming)
This is the newly inserted patch
P4: Register reset w devm_add_action (Ming)
P4: Fix up a kernel-doc comment issue (lkp)

Changes in v3:
P1: Move zero-target reject to init_hdm_decoder() (RichardC)
P3: Reset commit_end via a devres action after decoder teardown (RichardC)

Changes in v2:
P1: Handle uncommitted decoders (Sashiko)
P1: Reject switch decoders with zero targets (Sashiko)
P1: Add in code comment clarifying target_count (Sashiko)
P1: Update commit log
P3: Reset commit_end on the failure path only (Sashiko)
P3: Update commit log
P2: No

This set started as Sashiko reported cleanups. The patch added at v4 on Li Ming's review is dropped in v5. Davidlohr pointed out that it changes what interleave_ways and interleave_granularity report for an uncommitted decoder, and those are documented ABI. That is also the answer to Ming's v3 question that prompted the patch - enumeration decodes those fields because userspace reads them, not because the driver needs them.

Only the first patch includes a link to the original Sashiko complaint, since the others did not originally appear on Lore for me to add public links.

Srirangan: I believe some of these patches address pre-existing issues Sashiko posted in reply to your reset series, but frankly, with the renumbering here, and the respin of your series, I no longer have the exact patch to patch correlation.
Alison Schofield (4):
cxl/hdm: Reject switch decoder interleave ways that overflow targets cxl/hdm: Make switch decoder target parsing endian-safe cxl/hdm: Restore commit_end when decoder enumeration fails cxl/port: Bound switch decoder target array access by nr_targets

 drivers/cxl/core/hdm.c  | 62 +++++++++++++++++++++++++++++++++--------
 drivers/cxl/core/port.c | 27 ++++++++++++------
 drivers/cxl/cxl.h       |  2 ++
 3 files changed, 72 insertions(+), 19 deletions(-)

base-commit: 075b74841bd0065a3bda3440873c747938e69b68

Signature · 1 line
2.37.3