[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251125143826.282312-1-pawel.mielimonka@fujitsu.com>
Date: Tue, 25 Nov 2025 23:38:22 +0900
From: Pawel Mielimonka <pawel.mielimonka@...itsu.com>
To: dan.j.williams@...el.com,
alison.schofield@...el.com
Cc: Smita.KoralahalliChannabasappa@....com,
linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org,
dave@...olabs.net,
jonathan.cameron@...wei.com,
dave.jiang@...el.com,
vishal.l.verma@...el.com,
ira.weiny@...el.com,
Pawel Mielimonka <pawel.mielimonka@...itsu.com>
Subject: [RFC PATCH v1 0/2] cxl/cli: HPA-ordered destroy-region teardown
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
Powered by blists - more mailing lists