]> git.ipfire.org Git - thirdparty/linux.git/commit
cxl/region: Refactor address translation funcs for testing
authorAlison Schofield <alison.schofield@intel.com>
Tue, 14 Oct 2025 08:24:30 +0000 (01:24 -0700)
committerDave Jiang <dave.jiang@intel.com>
Mon, 3 Nov 2025 16:27:32 +0000 (09:27 -0700)
commitb78b9e7b7979f86c7838f1ab7d084ca35a17702d
treef41ba989397b3d7dad9fedbcea4d9f09a5fa81fa
parent6146a0f1dfae5d37442a9ddcba012add260bceb0
cxl/region: Refactor address translation funcs for testing

In preparation for adding a test module that exercises the address
translation calculations, extract the core calculations into stand-
alone functions that operate on base parameters without dependencies
on struct cxl_region.

Perform additional parameter validation to protect against a test
module sending bad parameters. Export the validation function, as
well as the three core translation functions for use by test module
cxl_translate only.

This refactoring enables unit testing of the address translation logic
with controlled inputs, while preserving identical functionality in
the existing code paths.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/region.c
drivers/cxl/cxl.h