* [PATCH 0/3] cxl/test: mock fixups and new topology support
@ 2026-09-29 0:56 Alison Schofield
2026-09-29 0:56 ` [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Alison Schofield @ 2026-09-29 0:56 UTC (permalink / raw)
To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Li Ming, Richard Cheng
Cc: linux-cxl
While working to enhance the cxl-cli cxl-create-region command to handle
out-of-order target lists or no user-supplied target list, I ran into some
basic issues in the existing command that need to be addressed first.
Developing tests for those fixes exposed two bugs and a topology gap in
the cxl_test mock module.
This cxl_test series addresses those issues:
1/3 fixes a DPA skip leak across mock decoder reset.
2/3 skips auto-region setup when no volatile window is active.
3/3 adds two x1 CFMWS windows needed to exercise root decoder selection.
A companion ndctl series will fix the existing cxl-create-region issues
in cxl-cli, clearing the way for out-of-order or automatically generated
target lists.
These changes preserve the existing cxl_test unit test behavior while
enabling new create-region test cases.
Alison Schofield (3):
tools/testing/cxl: Preserve DPA skip across mock decoder reset
tools/testing/cxl: Skip the auto region when no volatile window is active
tools/testing/cxl: Add CFMWS windows for region selection tests
tools/testing/cxl/test/cxl.c | 100 +++++++++++++++++++++++++++--------
1 file changed, 77 insertions(+), 23 deletions(-)
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
--
2.37.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset
2026-09-29 0:56 [PATCH 0/3] cxl/test: mock fixups and new topology support Alison Schofield
@ 2026-09-29 0:56 ` Alison Schofield
2026-09-29 10:11 ` Richard Cheng
2026-09-29 0:56 ` [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
2026-09-29 0:56 ` [PATCH 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests Alison Schofield
2 siblings, 1 reply; 6+ messages in thread
From: Alison Schofield @ 2026-09-29 0:56 UTC (permalink / raw)
To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Li Ming, Richard Cheng
Cc: linux-cxl
Mock decoder reset clears the DPA skip before releasing the decoder's
resources. This leaks skipped capacity and can cause a later DPA
allocation to fail with ENOSPC.
Preserve the skip until the DPA resource is released.
Assisted-by: LLM
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
tools/testing/cxl/test/cxl.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 62bd92b3be45..aa140307e0c3 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -913,15 +913,13 @@ static void __cxld_registry_save(struct cxl_test_decoder *td,
cxld_copy(&td->cxled.cxld, cxld);
td->cxled.state = cxled->state;
- td->cxled.skip = cxled->skip;
- if (!(cxld->flags & CXL_DECODER_F_ENABLE)) {
- td->dpa_range.start = 0;
- td->dpa_range.end = -1;
- } else if (cxled->dpa_res) {
+ if ((cxld->flags & CXL_DECODER_F_ENABLE) && cxled->dpa_res) {
+ td->cxled.skip = cxled->skip;
td->dpa_range.start = cxled->dpa_res->start;
td->dpa_range.end = cxled->dpa_res->end;
} else {
+ td->cxled.skip = 0;
td->dpa_range.start = 0;
td->dpa_range.end = -1;
}
@@ -1001,7 +999,6 @@ static void mock_decoder_reset(struct cxl_decoder *cxld)
to_cxl_endpoint_decoder(&cxld->dev);
cxled->state = CXL_DECODER_STATE_MANUAL;
- cxled->skip = 0;
}
if (decoder_reset_preserve_registry)
dev_dbg(port->uport_dev, "decoder%d: skip registry update\n",
--
2.37.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active
2026-09-29 0:56 [PATCH 0/3] cxl/test: mock fixups and new topology support Alison Schofield
2026-09-29 0:56 ` [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
@ 2026-09-29 0:56 ` Alison Schofield
2026-09-30 7:33 ` Richard Cheng
2026-09-29 0:56 ` [PATCH 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests Alison Schofield
2 siblings, 1 reply; 6+ messages in thread
From: Alison Schofield @ 2026-09-29 0:56 UTC (permalink / raw)
To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Li Ming, Richard Cheng
Cc: linux-cxl
The mock auto region always uses CFMWS0. With XOR interleave arithmetic
that window is inactive, so its HPA base is never assigned and the
endpoint decoders are programmed at HPA 0.
No root decoder matches that range, leaving DPA allocated to endpoint
decoders that are not part of a region.
Set up the auto region only when a volatile window is active.
Assisted-by: LLM
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
tools/testing/cxl/test/cxl.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index aa140307e0c3..9d844932f0c6 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -423,6 +423,18 @@ struct acpi_cedt_cxims *mock_cxims[1] = {
[0] = &mock_cedt.cxims0.cxims,
};
+static struct acpi_cedt_cfmws *mock_auto_region_cfmws(void)
+{
+ for (int i = cfmws_start; i <= cfmws_end; i++) {
+ struct acpi_cedt_cfmws *window = mock_cfmws[i];
+
+ if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
+ return window;
+ }
+
+ return NULL;
+}
+
struct cxl_mock_res {
struct list_head list;
struct range range;
@@ -1114,6 +1126,10 @@ static enum cxld_init_type get_decoder_init_type(struct cxl_decoder *cxld,
pdev->id > 4 || cxld->id > 0)
return MOCK_DECODER_INIT_DEFAULT;
+ /* XOR windows are all pmem, no window to host the RAM region */
+ if (!mock_auto_region_cfmws())
+ return MOCK_DECODER_INIT_DEFAULT;
+
return type2_test ? MOCK_DECODER_INIT_TYPE2_AUTO :
MOCK_DECODER_INIT_TYPE3_AUTO;
}
@@ -1137,7 +1153,7 @@ static bool mock_decoder_handle_saved(struct cxl_decoder *cxld, struct cxl_test_
static void mock_init_hdm_type2_cxled(struct cxl_endpoint_decoder *cxled,
struct cxl_port *port)
{
- struct acpi_cedt_cfmws *window = mock_cfmws[0];
+ struct acpi_cedt_cfmws *window = mock_auto_region_cfmws();
struct cxl_decoder *cxld = &cxled->cxld;
struct cxl_switch_decoder *cxlsd;
struct cxl_dport *dport;
@@ -1211,7 +1227,7 @@ static void mock_init_hdm_type3_cxled(struct cxl_endpoint_decoder *cxled,
struct platform_device *pdev,
bool hb0)
{
- struct acpi_cedt_cfmws *window = mock_cfmws[0];
+ struct acpi_cedt_cfmws *window = mock_auto_region_cfmws();
struct cxl_decoder *cxld = &cxled->cxld;
struct cxl_switch_decoder *cxlsd;
struct cxl_dport *dport;
--
2.37.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests
2026-09-29 0:56 [PATCH 0/3] cxl/test: mock fixups and new topology support Alison Schofield
2026-09-29 0:56 ` [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
2026-09-29 0:56 ` [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
@ 2026-09-29 0:56 ` Alison Schofield
2 siblings, 0 replies; 6+ messages in thread
From: Alison Schofield @ 2026-09-29 0:56 UTC (permalink / raw)
To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Li Ming, Richard Cheng
Cc: linux-cxl
Region selection needs topologies where multiple root decoders can
satisfy a request and where a decoder supports both RAM and PMEM. The
mock topology provides neither.
Add two x1 windows, one PMEM only and one supporting both RAM and PMEM,
while preserving the existing modulo decoder identities.
Assisted-by: LLM
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
tools/testing/cxl/test/cxl.c | 71 ++++++++++++++++++++++++++++--------
1 file changed, 56 insertions(+), 15 deletions(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 9d844932f0c6..3e76d9bb2d5f 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -184,12 +184,20 @@ static struct {
} cfmws6;
struct {
struct acpi_cedt_cfmws cfmws;
- u32 target[2];
+ u32 target[1];
} cfmws7;
struct {
struct acpi_cedt_cfmws cfmws;
- u32 target[3];
+ u32 target[1];
} cfmws8;
+ struct {
+ struct acpi_cedt_cfmws cfmws;
+ u32 target[2];
+ } cfmws9;
+ struct {
+ struct acpi_cedt_cfmws cfmws;
+ u32 target[3];
+ } cfmws10;
struct {
struct acpi_cedt_cxims cxims;
u64 xormap_list[2];
@@ -324,22 +332,20 @@ static struct {
},
.target = { 3 },
},
- /* .cfmws6,7,8 use ACPI_CEDT_CFMWS_ARITHMETIC_XOR */
.cfmws6 = {
.cfmws = {
.header = {
.type = ACPI_CEDT_TYPE_CFMWS,
.length = sizeof(mock_cedt.cfmws6),
},
- .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR,
.interleave_ways = 0,
.granularity = 4,
.restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
ACPI_CEDT_CFMWS_RESTRICT_PMEM,
.qtg_id = FAKE_QTG_ID,
- .window_size = SZ_256M * 8UL,
+ .window_size = SZ_256M * 4UL,
},
- .target = { 0, },
+ .target = { 2 },
},
.cfmws7 = {
.cfmws = {
@@ -347,16 +353,17 @@ static struct {
.type = ACPI_CEDT_TYPE_CFMWS,
.length = sizeof(mock_cedt.cfmws7),
},
- .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR,
- .interleave_ways = 1,
- .granularity = 0,
+ .interleave_ways = 0,
+ .granularity = 4,
.restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
+ ACPI_CEDT_CFMWS_RESTRICT_VOLATILE |
ACPI_CEDT_CFMWS_RESTRICT_PMEM,
.qtg_id = FAKE_QTG_ID,
- .window_size = SZ_256M * 8UL,
+ .window_size = SZ_256M * 4UL,
},
- .target = { 0, 1, },
+ .target = { 1 },
},
+ /* .cfmws8,9,10 use ACPI_CEDT_CFMWS_ARITHMETIC_XOR */
.cfmws8 = {
.cfmws = {
.header = {
@@ -364,6 +371,38 @@ static struct {
.length = sizeof(mock_cedt.cfmws8),
},
.interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR,
+ .interleave_ways = 0,
+ .granularity = 4,
+ .restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
+ ACPI_CEDT_CFMWS_RESTRICT_PMEM,
+ .qtg_id = FAKE_QTG_ID,
+ .window_size = SZ_256M * 8UL,
+ },
+ .target = { 0, },
+ },
+ .cfmws9 = {
+ .cfmws = {
+ .header = {
+ .type = ACPI_CEDT_TYPE_CFMWS,
+ .length = sizeof(mock_cedt.cfmws9),
+ },
+ .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR,
+ .interleave_ways = 1,
+ .granularity = 0,
+ .restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
+ ACPI_CEDT_CFMWS_RESTRICT_PMEM,
+ .qtg_id = FAKE_QTG_ID,
+ .window_size = SZ_256M * 8UL,
+ },
+ .target = { 0, 1, },
+ },
+ .cfmws10 = {
+ .cfmws = {
+ .header = {
+ .type = ACPI_CEDT_TYPE_CFMWS,
+ .length = sizeof(mock_cedt.cfmws10),
+ },
+ .interleave_arithmetic = ACPI_CEDT_CFMWS_ARITHMETIC_XOR,
.interleave_ways = 8,
.granularity = 1,
.restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
@@ -406,18 +445,20 @@ struct acpi_cedt_cfmws *mock_cfmws[] = {
[3] = &mock_cedt.cfmws3.cfmws,
[4] = &mock_cedt.cfmws4.cfmws,
[5] = &mock_cedt.cfmws5.cfmws,
- /* Modulo Math above, XOR Math below */
[6] = &mock_cedt.cfmws6.cfmws,
[7] = &mock_cedt.cfmws7.cfmws,
+ /* Modulo Math above, XOR Math below */
[8] = &mock_cedt.cfmws8.cfmws,
+ [9] = &mock_cedt.cfmws9.cfmws,
+ [10] = &mock_cedt.cfmws10.cfmws,
};
static int cfmws_start;
static int cfmws_end;
#define CFMWS_MOD_ARRAY_START 0
-#define CFMWS_MOD_ARRAY_END 5
-#define CFMWS_XOR_ARRAY_START 6
-#define CFMWS_XOR_ARRAY_END 8
+#define CFMWS_MOD_ARRAY_END 7
+#define CFMWS_XOR_ARRAY_START 8
+#define CFMWS_XOR_ARRAY_END 10
struct acpi_cedt_cxims *mock_cxims[1] = {
[0] = &mock_cedt.cxims0.cxims,
--
2.37.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset
2026-09-29 0:56 ` [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
@ 2026-09-29 10:11 ` Richard Cheng
0 siblings, 0 replies; 6+ messages in thread
From: Richard Cheng @ 2026-09-29 10:11 UTC (permalink / raw)
To: Alison Schofield
Cc: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Vishal Verma,
Ira Weiny, Li Ming, linux-cxl
On Mon, Sep 28, 2026 at 05:56:16PM +0800, Alison Schofield wrote:
> Mock decoder reset clears the DPA skip before releasing the decoder's
> resources. This leaks skipped capacity and can cause a later DPA
> allocation to fail with ENOSPC.
>
> Preserve the skip until the DPA resource is released.
>
> Assisted-by: LLM
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> tools/testing/cxl/test/cxl.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index 62bd92b3be45..aa140307e0c3 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -913,15 +913,13 @@ static void __cxld_registry_save(struct cxl_test_decoder *td,
>
> cxld_copy(&td->cxled.cxld, cxld);
> td->cxled.state = cxled->state;
> - td->cxled.skip = cxled->skip;
>
> - if (!(cxld->flags & CXL_DECODER_F_ENABLE)) {
> - td->dpa_range.start = 0;
> - td->dpa_range.end = -1;
> - } else if (cxled->dpa_res) {
> + if ((cxld->flags & CXL_DECODER_F_ENABLE) && cxled->dpa_res) {
> + td->cxled.skip = cxled->skip;
> td->dpa_range.start = cxled->dpa_res->start;
> td->dpa_range.end = cxled->dpa_res->end;
> } else {
> + td->cxled.skip = 0;
> td->dpa_range.start = 0;
> td->dpa_range.end = -1;
> }
> @@ -1001,7 +999,6 @@ static void mock_decoder_reset(struct cxl_decoder *cxld)
> to_cxl_endpoint_decoder(&cxld->dev);
>
> cxled->state = CXL_DECODER_STATE_MANUAL;
> - cxled->skip = 0;
> }
> if (decoder_reset_preserve_registry)
> dev_dbg(port->uport_dev, "decoder%d: skip registry update\n",
> --
> 2.37.3
>
LGTM.
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Best regards,
Richard Cheng.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active
2026-09-29 0:56 ` [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
@ 2026-09-30 7:33 ` Richard Cheng
0 siblings, 0 replies; 6+ messages in thread
From: Richard Cheng @ 2026-09-30 7:33 UTC (permalink / raw)
To: Alison Schofield
Cc: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Vishal Verma,
Ira Weiny, Li Ming, linux-cxl
On Mon, Sep 28, 2026 at 05:56:17PM +0800, Alison Schofield wrote:
> The mock auto region always uses CFMWS0. With XOR interleave arithmetic
> that window is inactive, so its HPA base is never assigned and the
> endpoint decoders are programmed at HPA 0.
>
> No root decoder matches that range, leaving DPA allocated to endpoint
> decoders that are not part of a region.
>
> Set up the auto region only when a volatile window is active.
>
> Assisted-by: LLM
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> tools/testing/cxl/test/cxl.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index aa140307e0c3..9d844932f0c6 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -423,6 +423,18 @@ struct acpi_cedt_cxims *mock_cxims[1] = {
> [0] = &mock_cedt.cxims0.cxims,
> };
>
> +static struct acpi_cedt_cfmws *mock_auto_region_cfmws(void)
> +{
> + for (int i = cfmws_start; i <= cfmws_end; i++) {
> + struct acpi_cedt_cfmws *window = mock_cfmws[i];
> +
> + if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
> + return window;
> + }
> +
> + return NULL;
> +}
> +
> struct cxl_mock_res {
> struct list_head list;
> struct range range;
> @@ -1114,6 +1126,10 @@ static enum cxld_init_type get_decoder_init_type(struct cxl_decoder *cxld,
> pdev->id > 4 || cxld->id > 0)
> return MOCK_DECODER_INIT_DEFAULT;
>
> + /* XOR windows are all pmem, no window to host the RAM region */
> + if (!mock_auto_region_cfmws())
> + return MOCK_DECODER_INIT_DEFAULT;
> +
> return type2_test ? MOCK_DECODER_INIT_TYPE2_AUTO :
> MOCK_DECODER_INIT_TYPE3_AUTO;
> }
> @@ -1137,7 +1153,7 @@ static bool mock_decoder_handle_saved(struct cxl_decoder *cxld, struct cxl_test_
> static void mock_init_hdm_type2_cxled(struct cxl_endpoint_decoder *cxled,
> struct cxl_port *port)
> {
> - struct acpi_cedt_cfmws *window = mock_cfmws[0];
> + struct acpi_cedt_cfmws *window = mock_auto_region_cfmws();
> struct cxl_decoder *cxld = &cxled->cxld;
> struct cxl_switch_decoder *cxlsd;
> struct cxl_dport *dport;
> @@ -1211,7 +1227,7 @@ static void mock_init_hdm_type3_cxled(struct cxl_endpoint_decoder *cxled,
> struct platform_device *pdev,
> bool hb0)
> {
> - struct acpi_cedt_cfmws *window = mock_cfmws[0];
> + struct acpi_cedt_cfmws *window = mock_auto_region_cfmws();
> struct cxl_decoder *cxld = &cxled->cxld;
> struct cxl_switch_decoder *cxlsd;
> struct cxl_dport *dport;
> --
> 2.37.3
>
Hi Alison,
The caller of get_decoder_init_type() and mock_init_hdm_type2/3_cxled()
is mock_init_hdm_decoder(), would it be possible to just call
mock_auto_region_cfmws() once and pass the window into each function ?
That way we can save some redundant traversal of entries.
Do you think this idea makes sense ?
Best regards,
Richard Cheng.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-30 7:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 0:56 [PATCH 0/3] cxl/test: mock fixups and new topology support Alison Schofield
2026-09-29 0:56 ` [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
2026-09-29 10:11 ` Richard Cheng
2026-09-29 0:56 ` [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
2026-09-30 7:33 ` Richard Cheng
2026-09-29 0:56 ` [PATCH 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests Alison Schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox