Linux CXL
 help / color / mirror / Atom feed
* [PATCH v4 0/4] XOR Math Fixups: translation & position
@ 2024-07-03  5:29 alison.schofield
  2024-07-03  5:29 ` [PATCH v4 1/4] cxl/core: Fold cxl_trace_hpa() into cxl_dpa_to_hpa() alison.schofield
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: alison.schofield @ 2024-07-03  5:29 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl

From: Alison Schofield <alison.schofield@intel.com>


Dropped tags on Patch 2 due to changes. Please Tag again.

Changes in v4:
- Patch 1: Updated commit msg/log 
  The name tidy-ups eventually led to a 'fold' not a 'rename'
- Patch 2: Rename the root decoder callback hpa_to_spa (Dan)
- Patch 2: Remove hpa_to_spa as a param to cxl_root_decoder_alloc()
- Patch 2: Add code comment that chunk check is modulo only (Fabio)
- Patch 2: Add lore link to unit test in commit log (Fabio)
- Cover Letter: Add an introduction (Dan)

Link to v3:
https://lore.kernel.org/cover.1719275633.git.alison.schofield@intel.com/


Begin cover letter:

XOR Math Fixups are presented for both translation and position.

Translation:
The CXL driver intends to report DPAs and their SPA translation in
the TRACE logs for CXL poison, general_media, and dram events. It
is actually only logging the HPA, not the SPA. That works for CXL
decodes using typical MODULO arithmetic where HPA==SPA, but not for
XOR decodes. The driver needs to restore the XOR'd bits in order to
get to the SPA and it doesn't. This means that address translations
for root decoders using XOR maps are wrong.

Specifically regions that interleave across 2,4,6,8,12, or 16 host
bridges are affected. Interleaves using 1 or 3 host bridges, even if
configured with XOR Arithmetic, do not use xormaps, and are safe.

Aside from knowing that any address translation of a 1 or 3 way host
bridge interleave is correct no matter the decode (XOR or MODULO),
all others are suspect because the decode is actually transparent to
users.

Position:
The position part of this patchset came from the discovery that
the driver doesn't need to calculate a targets position in a region
interleave set. The BIOS sets the target list and the driver can
simply use that order.


Presentation is as follows:

Patch 1: Clean up - cxl_trace_hpa()-> cxl_dpa_to_hpa()

Patch 2: cxl: Restore XOR'd position bits during address translation
This completes the DPA->HPA->SPA translation, correcting the XOR
address translation problem described above.

Patch 3 & Patch 4 are paired. Patch 3 presents the new method for
verifying a target position in the list and Patch 4 removes the
old method.

FYI - the reason I don't present the code removal first is because
I think it is easier to read the diff if I leave in the old root
decoder call back setup for calc_hb, insert the new call back along
the same path, and then rip out the defunct calc_hb. That's the
way I created the patchset and it may be an easier way for reviewers
to follow along with the root decoder callback setup.


Alison Schofield (4):
  cxl/core: Fold cxl_trace_hpa() into cxl_dpa_to_hpa()
  cxl: Restore XOR'd position bits during address translation
  cxl/region: Verify target positions using the ordered target list
  cxl: Remove defunct code calculating host bridge target positions

 drivers/cxl/acpi.c        | 84 ++++++++++++++++-----------------------
 drivers/cxl/core/core.h   |  8 ++--
 drivers/cxl/core/mbox.c   |  2 +-
 drivers/cxl/core/port.c   | 20 +---------
 drivers/cxl/core/region.c | 61 ++++++++++++++--------------
 drivers/cxl/core/trace.h  |  4 +-
 drivers/cxl/cxl.h         | 11 ++---
 7 files changed, 77 insertions(+), 113 deletions(-)


base-commit: 22a40d14b572deb80c0648557f4bd502d7e83826
-- 
2.37.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-07-11 22:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03  5:29 [PATCH v4 0/4] XOR Math Fixups: translation & position alison.schofield
2024-07-03  5:29 ` [PATCH v4 1/4] cxl/core: Fold cxl_trace_hpa() into cxl_dpa_to_hpa() alison.schofield
2024-07-11 20:52   ` Robert Richter
2024-07-03  5:29 ` [PATCH v4 2/4] cxl: Restore XOR'd position bits during address translation alison.schofield
2024-07-11 22:35   ` Dan Williams
2024-07-03  5:29 ` [PATCH v4 3/4] cxl/region: Verify target positions using the ordered target list alison.schofield
2024-07-03  5:29 ` [PATCH v4 4/4] cxl: Remove defunct code calculating host bridge target positions alison.schofield
2024-07-11 19:59 ` [PATCH v4 0/4] XOR Math Fixups: translation & position Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox