Skip to content

Address translation for HDM decoding

Robert Richter linux-cxl lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 11 repliesIn review
  2. v15 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* Fixed build error for other archs [kbot]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5cxl/hdm: Moving HDM specific code to core/hdm.c.drivers/cxl/core/core.h drivers/cxl/core/hdm.c drivers/cxl/core/pci.c +2 more+123 -1211 reply
2/5cxl/hdm: Implement address translation for HDM decodingdrivers/cxl/core/hdm.c drivers/cxl/cxlmem.h+57 -132 replies
3/5cxl/acpi: Add platform flag for HPA address translationdrivers/cxl/acpi.c drivers/cxl/cxl.h+9 -02 replies
4/5cxl/hdm: Setup HPA base for address translation using the HPA window in CFMWSdrivers/cxl/core/hdm.c+69 -00 replies
5/5cxl/acpi: Enable address translation for Zen4 platformsdrivers/cxl/acpi.c+10 -10 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchDan Williams
1/5R-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] Address translation for HDM decoding

Default expectation of Linux is that HPA == SPA, which means that hardware addresses in the decoders are the same as the kernel sees them. However, there are platforms where this is not the case and an address translation between decoder's (HPA) and the system's physical addresses (SPA) is needed.

This series implements address translation for HDM decoding. The implementation follows the rule that the representation of hardware address ranges in the kernel are all SPA. If decoder registers (HDM decoder cap or register range) are not SPA, a base offset must be applied. Translation happens when accessing the registers back and forth. After a read access an address will be converted to SPA and before a write access the programmed address is translated from an SPA. The decoder register access can be easily encapsulated by address translation and thus there are only a few places where translation is needed and the code must be changed. This is implemented in patch #2, patch #1 is a prerequisite.

Address translation is restricted to platforms that need it. As such a platform check is needed and a flag is introduced for this (patch #3).

For address translation the base offset must be determined for the memory domain. Depending on the platform there are various options for this. The address range in the CEDT's CFWMS entry of the CXL host bridge can be used to determine the decoder's base address (patch #4). This is enabled for AMD Zen4 platforms (patch #5).

Changelog:

v2:
* Fixed build error for other archs [kbot]

Robert Richter (5):
cxl/hdm: Moving HDM specific code to core/hdm.c.
cxl/hdm: Implement address translation for HDM decoding cxl/acpi: Add platform flag for HPA address translation cxl/hdm: Setup HPA base for address translation using the HPA window
in CFMWS
cxl/acpi: Enable address translation for Zen4 platforms

 drivers/cxl/acpi.c      |  16 +++
 drivers/cxl/core/core.h |   2 +
 drivers/cxl/core/hdm.c  | 245 ++++++++++++++++++++++++++++++++++++++--
 drivers/cxl/core/pci.c  | 119 +------------------
 drivers/cxl/cxl.h       |   2 +
 drivers/cxl/cxlmem.h    |   4 +
 drivers/cxl/cxlpci.h    |   3 -
 7 files changed, 262 insertions(+), 129 deletions(-)

base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0

Signature · 1 line
2.39.2