public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v1 0/2] cxl/cli: HPA-ordered destroy-region teardown
@ 2025-11-25 14:38 Pawel Mielimonka
  2025-11-25 14:38 ` [RFC PATCH v1 1/2] cxl/cli: add helpers to collect and sort regions by HPA Pawel Mielimonka
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Pawel Mielimonka @ 2025-11-25 14:38 UTC (permalink / raw)
  To: dan.j.williams, alison.schofield
  Cc: Smita.KoralahalliChannabasappa, linux-cxl, linux-kernel, dave,
	jonathan.cameron, dave.jiang, vishal.l.verma, ira.weiny,
	Pawel Mielimonka

This series addresses an issue in destroy-region, where
region teardown relied on libcxl enumeration order, which is not
guaranteed to match the increasing HPA order exposed by the kernel. 
When a decoder window is fully populated, attempting to destroy a
non-last region causes kernel-side validation to fail (e.g.
set_dpa_size(..., 0) returns an error), and subsequent destroy/create
sequences may become impossible.

The CXL specification requires that decoder programming (and the
implicit teardown path) must preserve continuous HPA coverage and
proceed strictly in order: decoder m before decoder m+1, with each
covering an HPA range below the next one. Practically, this means that
region teardown must follow HPA-descending order and must stop as soon
as a gap in the requested suffix is encountered.

The patch introduces destroy_multiple_regions(), which collects all
regions under a given root decoder, sorts them by HPA, and destroys
only the suffix requested by the user (or all regions in the case of
“all”). The implementation guarantees that only valid teardown
sequences are attempted and prevents decoder state inconsistencies
observed during repeated destroy/create cycles.

Enable/disable paths and all existing bus/port/decoder filtering
remain unchanged.

Pawel Mielimonka (2):
  cxl/cli: add helpers to collect and sort regions by HPA
  cxl/cli: enforce HPA-descending teardown order for destroy-region

 cxl/region.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 111 insertions(+), 3 deletions(-)

-- 
2.45.1.windows.1


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

end of thread, other threads:[~2026-01-21 18:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 14:38 [RFC PATCH v1 0/2] cxl/cli: HPA-ordered destroy-region teardown Pawel Mielimonka
2025-11-25 14:38 ` [RFC PATCH v1 1/2] cxl/cli: add helpers to collect and sort regions by HPA Pawel Mielimonka
2025-12-03  3:52   ` Alison Schofield
2025-12-03  9:09     ` Paweł Mielimonka
2025-11-25 14:38 ` [RFC PATCH v1 2/2] cxl/cli: enforce HPA-descending teardown order for destroy-region Pawel Mielimonka
2025-12-03  4:15   ` Alison Schofield
2025-12-03 10:13     ` Paweł Mielimonka
2025-12-03 23:46       ` Alison Schofield
2025-12-07  0:28   ` Alison Schofield
2025-12-03  3:38 ` [RFC PATCH v1 0/2] cxl/cli: HPA-ordered destroy-region teardown Alison Schofield
2026-01-20 14:32 ` [PATCH v2 0/1] " Pawel Mielimonka
2026-01-20 14:32   ` [PATCH v2 1/1] cxl/cli: enforce HPA-descening teardown order for destroy-region Pawel Mielimonka
2026-01-21 18:45   ` [PATCH v2 0/1] cxl/cli: HPA-ordered destroy-region teardown Alison Schofield

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