Skip to content

CXL Address Translation

[email protected] linux-cxl 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4cxl/region: Add a DPA to HPA translation helperdrivers/cxl/core/core.h drivers/cxl/core/region.c+83 -04 replies
2/4cxl/region: Check addr trans at pmem region create (debug only)drivers/cxl/core/region.c+33 -12 replies
3/4cxl/acpi: Move the target entry(n) calc to its own functiondrivers/cxl/acpi.c+23 -180 replies
4/4cxl/acpi: Add a match on dport check for XOR addr translationdrivers/cxl/acpi.c drivers/cxl/core/core.h drivers/cxl/core/port.c +2 more+66 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] CXL Address Translation

From: Alison Schofield <[email protected]>

Introducing CXL DPA->HPA address translations. User space requires HPA addresses when CXL devices, participating in a region, report errors. For example, a patchset[1] adding trace events for media errors is in review on this list, yet it only provides userspace with the DPA. By adding this translation, HPA’s can be added to those media error trace events.

Patch 1 performs the translation and Patch 2 gives it exercise by translating a small sample of addresses at every pmem region creation, in a debug kernel.

Patches 1 & 2 deliver what is required for address translation, and do not depend on Patches 3 & 4.

Patches 3 & 4 seem like a good idea, however, the value of that idea is not clear. The idea is to add another level of validation to address translations for regions using XOR arithmetic (as opposed to modulo).

Patch 4 runs the newly constructed HPA through the existing XORMAP filter to see if it maps to the expected dport. While a valid check, it's not clear that it offers anything more than the range checking already done in the generic translation. That is, if an HPA translation passes the range check, how can a match on dport test ever fail? I don't know. I’m looking for help in proving or disproving the usefulness of 3 & 4.

Using cxl_test, existing unit tests that create regions exercise the address translation and the results can be viewed like this:

# meson test -C build --suite=cxl
ninja: Entering directory `/root/ndctl/build'
[109/109] Linking target ndctl/ndctl
1/5 ndctl:cxl / cxl-topology.sh             OK               4.19s
2/5 ndctl:cxl / cxl-region-sysfs.sh         OK               2.69s
3/5 ndctl:cxl / cxl-labels.sh               OK               5.85s
4/5 ndctl:cxl / cxl-create-region.sh        OK               5.35s
5/5 ndctl:cxl / cxl-xor-region.sh           OK               1.62s
# dmesg | grep -m1 "Address translation"
cxl_core:devm_cxl_add_pmem_region:2006: cxl_region region6: Address translation check: Pass
# dmesg | grep Addr | grep Pass | wc -l
46
That '46', is how many regions are created and their addresses successfully
translated in the existing cxl unit tests.  (No Fails today ;))

TODO in ndctl: If the check on region creation gets merged, add watchers for it to cxl unit tests that create regions.

Alison Schofield (4):
cxl/region: Add a DPA to HPA translation helper cxl/region: Check addr trans at pmem region create (debug only) cxl/acpi: Move the target entry(n) calc to its own function cxl/acpi: Add a match on dport check for XOR addr translation

 drivers/cxl/acpi.c        |  91 +++++++++++++++++++++++-------
 drivers/cxl/core/port.c   |   5 +-
 drivers/cxl/core/region.c | 116 +++++++++++++++++++++++++++++++++++++-
 drivers/cxl/cxl.h         |  11 +++-
 4 files changed, 199 insertions(+), 24 deletions(-)

base-commit: f0c4d9fc9cc9462659728d168387191387e903cc

This is built upon 6.1-rc4 plus CXL XOR Interleave Arithmetic [2] If Patches 3 & 4 are discarded, then there is no dependency on [2]

[1] https://lore.kernel.org/linux-cxl/[email protected]/
[2] https://lore.kernel.org/linux-cxl/[email protected]/

Gobble Gobble

Signature · 1 line
2.37.3