Skip to content

Support zero-sized HDM decoders

Richard Cheng linux-cxl lkml 10 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest3 patches 3 repliesIn review
  2. v93 patches 4 repliesSuperseded
  3. v83 patches 4 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v7 posting 2/22 patches10 repliesSuperseded
v7 posting 1/22 patches2 repliesSuperseded
v62 patches5 repliesSuperseded
v52 patches4 repliesSuperseded
v42 patches9 repliesSuperseded
v32 patches1 replySuperseded
v22 patches2 repliesSuperseded

Changes in v10 from the cover letter

- Patch 2: propagate -ENOMEM when allocation of the standalone zero-sized resource fails.
- Patch 2: retain the original !cxled->dpa_res guard in cxl_dpa_free(). An existing zero-sized reservation must reach the region, enabled-state, and release-order checks.
- Patch 2: update the commit message.
- Patches 1 and 3 are unchanged.

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3cxl/region: Simplify poison_by_decoder() error handlingdrivers/cxl/core/region.c+16 -101 reply
2/3cxl/hdm: Allow zero sized HDM decodersdrivers/cxl/core/hdm.c drivers/cxl/core/mbox.c drivers/cxl/core/region.c +2 more+86 -331 reply
3/3tools/testing/cxl: Enable zero sized decoders under hb0tools/testing/cxl/test/cxl.c+94 -150 replies

Reviews trailers per patch

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

PatchAlison SchofieldDan WilliamsDave JiangJonathan Cameron
1/3R-b R-b
2/3R-b R-b R-b R-b
3/3R-b R-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 4 reviewers.

Read the v10 thread

Cover letter [PATCH v10 0/3] Support zero-sized HDM decoders

CXL r4.0 §8.2.4.20.12 ("Committing Decoder Programming") and §14.13.10 ("CXL HDM Decoder Zero Size Commit") permit committing an HDM decoder with size 0. Firmware may commit and lock such decoders so the OS cannot program regions through them; this is a platform design choice rather than a specification requirement.

The kernel currently rejects these decoders with -ENXIO during port enumeration and aborts enumeration of the entire port. On affected systems, this prevents the CXL topology from appearing in userspace.

This series enumerates empty committed decoders into the topology while keeping them out of region assembly.

Patch 1 is a preparatory cleanup with no functional change. It clarifies the error handling and iteration control in poison_by_decoder(), and shares the check for a forgiven -EFAULT on a RAM partition with cxl_get_poison_unmapped().

Patch 2 makes zero-size DPA reservations first-class. Since the resource tree cannot represent an empty range, an empty decoder is backed by a separately allocated resource. This keeps port->hdm_end, skip handling, and in-order DPA accounting consistent. Operations requiring non-empty capacity, including region attachment and poison queries, are guarded appropriately.

Patch 3 adds the mock_zero_size_decoders cxl_test module parameter, disabled by default. When enabled, it installs committed, locked, zero-sized endpoint, switch, and host-bridge decoders under host-bridge0.

Testing:

As reported in v9, the series was tested on arm64 with cxl_test and the ndctl v85 unit suite, with KASAN and lockdep enabled. With mock_zero_size_decoders disabled, the full CXL suite reported 15 tests passed and 1 skipped.

cxl-poison.sh was skipped because its unaligned translation section was unreachable; both run_poison_test() rounds passed. Details:
https://lore.kernel.org/linux-cxl/anKpY6Y1Sqne1f7Y@MWDK4CY14F/

The core patch was also previously validated on a Montage CXL Type 3 device.

The corresponding ndctl test:
https://lore.kernel.org/linux-cxl/[email protected]/

Runtime-tested v10 on a CXL Type 3 device and confirmed that normal device operation continues to work with the series applied.

Changelog:

v9->v10 (Alison Schofield):
- Patch 2: propagate -ENOMEM when allocation of the standalone zero-sized resource fails.
- Patch 2: retain the original !cxled->dpa_res guard in cxl_dpa_free(). An existing zero-sized reservation must reach the region, enabled-state, and release-order checks.
- Patch 2: update the commit message.
- Patches 1 and 3 are unchanged.

Previous version:
https://lore.kernel.org/linux-cxl/[email protected]/

Richard Cheng (3):
cxl/region: Simplify poison_by_decoder() error handling cxl/hdm: Allow zero sized HDM decoders tools/testing/cxl: Enable zero sized decoders under hb0

 drivers/cxl/core/hdm.c       |  58 +++++++++++++------
 drivers/cxl/core/mbox.c      |   3 +
 drivers/cxl/core/region.c    |  69 ++++++++++++++--------
 drivers/cxl/cxl.h            |  10 ++++
 drivers/cxl/port.c           |   3 +
 tools/testing/cxl/test/cxl.c | 109 ++++++++++++++++++++++++++++++-----
 6 files changed, 195 insertions(+), 57 deletions(-)

base-commit: 899648a2707d0405f573dfc7fe15385d9ba3af55

Signature · 1 line
2.43.0