mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Cheng <icheng@nvidia.com>
To: dave@stgolabs.net
Cc: jonathan.cameron@huawei.com, dave.jiang@intel.com,
	alison.schofield@intel.com, vishal.l.verma@intel.com,
	ira.weiny@intel.com, dan.j.williams@intel.com,
	fabio.m.de.francesco@linux.intel.com, ming.li@zohomail.com,
	linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
	newtonl@nvidia.com, kristinc@nvidia.com, kaihengf@nvidia.com,
	kobak@nvidia.com, Richard Cheng <icheng@nvidia.com>
Subject: [PATCH] tools/testing/cxl: Align mock CFMWS to PMD_SIZE for ARM64 64K pages
Date: Wed, 20 May 2026 07:35:22 +0800	[thread overview]
Message-ID: <20260519233523.5991-1-icheng@nvidia.com> (raw)

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@nvidia.com>
Acked-by: Kai-Heng Feng <kaihengf@nvidia.com>
---
 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


             reply	other threads:[~2026-05-19 23:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 23:35 Richard Cheng [this message]
2026-05-20 14:56 ` Dave Jiang
2026-05-20 18:18 ` Dave Jiang
2026-05-21  3:09   ` Richard Cheng
2026-05-21  5:26     ` Alison Schofield
2026-05-21  7:20       ` Richard Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260519233523.5991-1-icheng@nvidia.com \
    --to=icheng@nvidia.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fabio.m.de.francesco@linux.intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kaihengf@nvidia.com \
    --cc=kobak@nvidia.com \
    --cc=kristinc@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=newtonl@nvidia.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®