Linux CXL
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Support zero-sized HDM decoders
@ 2026-06-02  5:40 Richard Cheng
  2026-06-02  5:40 ` [PATCH v2 1/2] cxl/hdm: Allow zero sized " Richard Cheng
  2026-06-02  5:40 ` [PATCH v2 2/2] tools/testing/cxl: Enable zero sized decoders under hb0 Richard Cheng
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Cheng @ 2026-06-02  5:40 UTC (permalink / raw)
  To: dave, jonathan.cameron, dave.jiang, alison.schofield,
	vishal.l.verma, ira.weiny, dan.j.williams
  Cc: linux-cxl, linux-kernel, newtonl, kristinc, kaihengf, kobak,
	vaslot, smadhavan, Richard Cheng

Hello,

This v2 picks up Vishal Aslot's "Support zero-sized decoders" series [1]
and addresses the review feedback, if any SoB or credits have mistake,
please let me know, I'll correct them.

CXL r3.2 §8.2.4.20.12 and §14.13.10 permit committing an HDM decoder
with size 0. BIOS uses this together with LOCK to burn decoder slots so
the OS cannot program new regions through them — e.g. for a Type 3
device in a Trusted Computing Base (TCB) established via the Trusted
Security Protocol (TSP).

init_hdm_decoder() today rejects committed zero-size decoders with
-ENXIO during port enumeration, which aborts the whole port — affected
systems show nothing under 'cxl list'. Patch 1 lets these decoders be
enumerated normally so they appear in topology with their HW-reported
LOCK state. Patch 2 extends cxl_test to inject zero-size + locked
decoders under host-bridge 0 so the new code path has in-tree coverage.

A note on Alison's v1 concern about autoregion teardown being blocked
by locked zero-size decoders sitting above the autoregion: this does
not actually fire with v2's "add to topology" approach. The existing
cxl_decoder_reset() already returns early on CXL_DECODER_F_LOCK and
tolerates out-of-order reset of the unlocked autoregion.
port->commit_end staying at its watermark after teardown
maps to physical reality — the slots above are permanently burned by
the locked decoders. No reset-path patch is therefore needed in v2.

Changes since v1:
    - Reorder: implementation patch first, cxl_test patch second
    - Patch 1: drop -ENOSPC sentinel and the matching "continue"
      in devm_cxl_enumerate_decoders(). The decoder is now added
      to the topology so "cxl list" shows it.
      Move port->commit_end assignment before the size check so
      later contiguous decoders pass the out-of-order check. Add
      an early return before devm_cxl_dpa_reserve().
    - Patch 2: replace second_decoder() / third_decoder() with a single
      match_decoder_by_index() helper. Use CXL_DECODER_STATE_MANUAL 
      instead of STATE_AUTO. Set CXL_DECODER_F_LOCK on the mock zero-size
      decoders to model the BIOS-burns-slots case.

[1]:
https://lore.kernel.org/all/20251015024019.1189713-1-vaslot@nvidia.com/T/#u

Richard Cheng (2):
  cxl/hdm: Allow zero sized HDM decoders
  tools/testing/cxl: Enable zero sized decoders under hb0

 drivers/cxl/core/hdm.c       | 15 ++++---
 tools/testing/cxl/test/cxl.c | 79 +++++++++++++++++++++++++++++++-----
 2 files changed, 78 insertions(+), 16 deletions(-)


base-commit: eb3f4b7426cfd2b79d65b7d37155480b32259a11
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-04  2:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02  5:40 [PATCH v2 0/2] Support zero-sized HDM decoders Richard Cheng
2026-06-02  5:40 ` [PATCH v2 1/2] cxl/hdm: Allow zero sized " Richard Cheng
2026-06-02  5:57   ` sashiko-bot
2026-06-04  2:56   ` Alison Schofield
2026-06-02  5:40 ` [PATCH v2 2/2] tools/testing/cxl: Enable zero sized decoders under hb0 Richard Cheng
2026-06-04  2:44   ` Alison Schofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox