* [PATCH v3 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active
2026-11-05 3:57 [PATCH v3 0/3] cxl/test: mock fixups and new topology support Alison Schofield
2026-11-05 3:57 ` [PATCH v3 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
@ 2026-11-05 3:57 ` Alison Schofield
2026-11-05 3:57 ` [PATCH v3 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests Alison Schofield
2026-11-06 16:34 ` [PATCH v3 0/3] cxl/test: mock fixups and new topology support Dave Jiang
3 siblings, 0 replies; 5+ messages in thread
From: Alison Schofield @ 2026-11-05 3:57 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.
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
tools/testing/cxl/test/cxl.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 6819143640a9..d0793961b0ee 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -424,6 +424,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;
@@ -1124,7 +1136,8 @@ enum cxld_init_type {
static enum cxld_init_type get_decoder_init_type(struct cxl_decoder *cxld,
struct platform_device *pdev,
bool hb0,
- struct cxl_test_decoder **td)
+ struct cxl_test_decoder **td,
+ struct acpi_cedt_cfmws **window)
{
struct cxl_test_decoder *found_td = cxld_registry_find(cxld);
@@ -1134,6 +1147,7 @@ static enum cxld_init_type get_decoder_init_type(struct cxl_decoder *cxld,
}
*td = NULL;
+ *window = NULL;
/*
* The first decoder on the first 2 devices on the first switch
@@ -1147,6 +1161,11 @@ static enum cxld_init_type get_decoder_init_type(struct cxl_decoder *cxld,
pdev->id > 4 || cxld->id > (mock_zero_size_decoders ? 2 : 0))
return MOCK_DECODER_INIT_DEFAULT;
+ /* XOR windows are all pmem, no window to host the RAM region */
+ *window = mock_auto_region_cfmws();
+ if (!*window)
+ return MOCK_DECODER_INIT_DEFAULT;
+
return type2_test ? MOCK_DECODER_INIT_TYPE2_AUTO :
MOCK_DECODER_INIT_TYPE3_AUTO;
}
@@ -1168,9 +1187,9 @@ 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 cxl_port *port,
+ struct acpi_cedt_cfmws *window)
{
- struct acpi_cedt_cfmws *window = mock_cfmws[0];
struct cxl_decoder *cxld = &cxled->cxld;
struct cxl_switch_decoder *cxlsd;
struct cxl_dport *dport;
@@ -1243,9 +1262,9 @@ static void mock_init_hdm_type2_cxled(struct cxl_endpoint_decoder *cxled,
static void mock_init_hdm_type3_cxled(struct cxl_endpoint_decoder *cxled,
struct cxl_port *port,
struct platform_device *pdev,
- bool hb0)
+ bool hb0,
+ struct acpi_cedt_cfmws *window)
{
- struct acpi_cedt_cfmws *window = mock_cfmws[0];
struct cxl_decoder *cxld = &cxled->cxld;
struct cxl_switch_decoder *cxlsd;
struct cxl_dport *dport;
@@ -1396,6 +1415,7 @@ static bool mock_init_hdm_decoder(struct cxl_decoder *cxld)
{
struct cxl_endpoint_decoder *cxled = NULL;
struct platform_device *pdev = NULL;
+ struct acpi_cedt_cfmws *window;
struct cxl_test_decoder *td;
struct cxl_memdev *cxlmd;
struct cxl_port *port;
@@ -1424,7 +1444,7 @@ static bool mock_init_hdm_decoder(struct cxl_decoder *cxld)
port = to_cxl_port(cxld->dev.parent);
}
- switch (get_decoder_init_type(cxld, pdev, hb0, &td)) {
+ switch (get_decoder_init_type(cxld, pdev, hb0, &td, &window)) {
case MOCK_DECODER_INIT_SAVED:
if (WARN_ON(!td))
return false;
@@ -1437,10 +1457,10 @@ static bool mock_init_hdm_decoder(struct cxl_decoder *cxld)
default_mock_decoder(cxld);
return false;
case MOCK_DECODER_INIT_TYPE3_AUTO:
- mock_init_hdm_type3_cxled(cxled, port, pdev, hb0);
+ mock_init_hdm_type3_cxled(cxled, port, pdev, hb0, window);
return false;
case MOCK_DECODER_INIT_TYPE2_AUTO:
- mock_init_hdm_type2_cxled(cxled, port);
+ mock_init_hdm_type2_cxled(cxled, port, window);
return false;
default:
return false;
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests
2026-11-05 3:57 [PATCH v3 0/3] cxl/test: mock fixups and new topology support Alison Schofield
2026-11-05 3:57 ` [PATCH v3 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
2026-11-05 3:57 ` [PATCH v3 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
@ 2026-11-05 3:57 ` Alison Schofield
2026-11-06 16:34 ` [PATCH v3 0/3] cxl/test: mock fixups and new topology support Dave Jiang
3 siblings, 0 replies; 5+ messages in thread
From: Alison Schofield @ 2026-11-05 3:57 UTC (permalink / raw)
To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Li Ming, Richard Cheng
Cc: linux-cxl, Jonathan Cameron
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.
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
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 d0793961b0ee..7fae489d00e9 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -185,12 +185,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];
@@ -325,22 +333,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 = {
@@ -348,16 +354,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 = {
@@ -365,6 +372,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 |
@@ -407,18 +446,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] 5+ messages in thread