summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Cheng <icheng@nvidia.com>2026-05-27 17:03:32 +0800
committerDave Jiang <dave.jiang@intel.com>2026-06-04 08:44:00 -0700
commitd40745cd06f35095a7b2925ea3217bf7ef764832 (patch)
tree4ad363c79215cce7c01068a739dc0468ee3b4302
parent16329b510f76e5b824e05bf8add8b29850f1f16f (diff)
downloadlinux-d40745cd06f35095a7b2925ea3217bf7ef764832.tar.gz
linux-d40745cd06f35095a7b2925ea3217bf7ef764832.zip
cxl/test: Enforce PMD alignment for volatile mock regions
cxl_test allocates synthetic CFMWS HPA windows from a gen_pool with SZ_256M alignment. On arm64 with CONFIG_ARM64_64K_PAGES=y and CONFIG_PGTABLE_LEVELS=3, PMD_SIZE is 512M, so every CXL region carved from a volatile window inherits a non-PMD-aligned start, and cxl_dax_region_probe() -> alloc_dax_region() fails: """ cxl_dax_region dax_region1: probe with driver cxl_dax_region failed with error -12 """ Enforce that every volatile mock CFMWS is PMD-aligned in both start and size Reviewed-by: Dave Jiang <dave.jiang@intel.com> Acked-by: Kai-Heng Feng <kaihengf@nvidia.com> Signed-off-by: Richard Cheng <icheng@nvidia.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Link: https://patch.msgid.link/20260527090332.30002-1-icheng@nvidia.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
-rw-r--r--tools/testing/cxl/test/cxl.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index 296516eecfd6..4281d34cd0e7 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -318,7 +318,7 @@ static struct {
.restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
ACPI_CEDT_CFMWS_RESTRICT_VOLATILE,
.qtg_id = FAKE_QTG_ID,
- .window_size = SZ_256M,
+ .window_size = SZ_256M > PMD_SIZE ? SZ_256M : PMD_SIZE,
},
.target = { 3 },
},
@@ -495,9 +495,12 @@ static int populate_cedt(void)
for (i = cfmws_start; i <= cfmws_end; i++) {
struct acpi_cedt_cfmws *window = mock_cfmws[i];
+ int align = SZ_256M;
cfmws_elc_update(window, i);
- res = alloc_mock_res(window->window_size, SZ_256M);
+ if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
+ align = max_t(int, SZ_256M, PMD_SIZE);
+ res = alloc_mock_res(window->window_size, align);
if (!res)
return -ENOMEM;
window->base_hpa = res->range.start;
@@ -1819,6 +1822,12 @@ static __init int cxl_test_init(void)
int rc, i;
struct range mappable;
+ if (!IS_ALIGNED(mock_auto_region_size, PMD_SIZE)) {
+ pr_err_once("mock_auto_region_size %d must be PMD-aligned\n",
+ mock_auto_region_size);
+ return -EINVAL;
+ }
+
cxl_acpi_test();
cxl_core_test();
cxl_mem_test();