[PATCH] tools/testing/cxl: Align mock CFMWS to PMD_SIZE for ARM64 64K pages
From: Richard Cheng
Date: Tue May 19 2026 - 19:37:48 EST
cxl_test allocate synthetic CFMWS HPA windows out of a gen_pool and asks
the allocator for SZ_256M alignment. It has been sufficient on x86 with
4k pages, arm64 with 4k pages since their PMD_SIZE are 2MB.
But for 64k-page arm64 kernel with CONFIG_ARM64_64K_PAGES=y and
CONFIG_PGTABLE_LEVELS=3 , the PMD_SIZE is 512 MB, which is much larger
than the alignment cxl_test guarantees. That results in every CXL region
carved from that window inherits a mis-aligned start.
The DAX driver's cxl_dax_region_probe() then calls "alloc_dax_region()
and the probe fails with -ENOMEM, with error message
"""
cxl_dax_region dax_region1: probe with driver cxl_dax_region failed
with error -12
"""
It was hit while bringing up cxl_test on an ARM64 server with
ARM64_64K_PAGES config.
Raise the alignment passed to "alloc"mock_res()" to the larger of
SZ_256M and PMD_SIZE so that the mock CFMWS window is always at least as
well-aligned as "alloc_dax_region()" require.
Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>
Acked-by: Kai-Heng Feng <kaihengf@xxxxxxxxxx>
---
tools/testing/cxl/test/cxl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 418669927fb0..b40e4bbcc958 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -497,7 +497,8 @@ static int populate_cedt(void)
struct acpi_cedt_cfmws *window = mock_cfmws[i];
cfmws_elc_update(window, i);
- res = alloc_mock_res(window->window_size, SZ_256M);
+ res = alloc_mock_res(window->window_size,
+ max_t(int, SZ_256M, PMD_SIZE));
if (!res)
return -ENOMEM;
window->base_hpa = res->range.start;
--
2.43.0