]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cxl/region: Translate DPA->HPA in unaligned MOD3 regions
authorAlison Schofield <alison.schofield@intel.com>
Fri, 16 Jan 2026 04:58:36 +0000 (20:58 -0800)
committerDave Jiang <dave.jiang@intel.com>
Thu, 22 Jan 2026 23:58:14 +0000 (16:58 -0700)
commite639055f1f30311db91cafb36e408cc727c7d445
tree25aa716e86031146cfbeb681d0ffba9bf3fa6385
parent4ed7952b9e87cf731ebc8251874416e60eb15230
cxl/region: Translate DPA->HPA in unaligned MOD3 regions

The CXL driver implementation of DPA->HPA address translation depends
on a region's starting address always being aligned to Host Bridge
Interleave Ways * 256MB. The driver follows the decode methods
defined in the CXL Spec[1] and expanded upon in the CXL Driver Writers
Guide[2], which describe bit manipulations based on power-of-2
alignment to translate a DPA to an HPA.

With the introduction of MOD3 interleave way support, platforms may
create regions at starting addresses that are not power-of-2 aligned.
This allows platforms to avoid gaps in the memory map, but addresses
within those regions cannot be translated using the existing bit
manipulation method.

Introduce an unaligned translation method for DPA->HPA that
reconstructs an HPA by restoring the address first at the port level
and then at the host bridge level.

[1] CXL Spec 4.0 8.2.4.20.13 Implementation Note Device Decoder Logic
[2] CXL Type 3 Memory Software Guide 1.1 2.13.25 DPA to HPA Translation

Suggested-by: Qing Huang <qing.huang@intel.com>
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>
Link: https://patch.msgid.link/e7c53215bf69f2ff1ae7e58bcc49ca387b7b0299.1768538962.git.alison.schofield@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/region.c