Skip to content

Add initial CXL.cache support

Ben Cheatham linux-cxl 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest15 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15cxl/core: Add CXL.cache device structdrivers/cxl/core/Makefile drivers/cxl/core/cachedev.c drivers/cxl/core/port.c +3 more+163 -00 replies
2/15cxl/cache: Add cxl_cache driverdrivers/cxl/Kconfig drivers/cxl/Makefile drivers/cxl/cache.c +5 more+186 -90 replies
3/15cxl/core: Change cxl_ep_load() to use device pointer parameterdrivers/cxl/core/port.c drivers/cxl/core/region.c drivers/cxl/cxlmem.h +1 more+17 -170 replies
4/15cxl/core: Update devm_cxl_enumerate_ports() for cxl_cachedevsdrivers/cxl/core/port.c drivers/cxl/cxl.h drivers/cxl/mem.c+67 -320 replies
5/15cxl/port: Split endpoint port probe on device typedrivers/cxl/cache.c drivers/cxl/core/cachedev.c drivers/cxl/core/port.c +3 more+73 -200 replies
6/15cxl/core: Update devm_cxl_add_endpoint() for cxl_cachedevsdrivers/cxl/cache.c drivers/cxl/core/port.c drivers/cxl/cxl.h +2 more+69 -170 replies
7/15cxl/cache: Verify port hierarchy has CXL.cache enableddrivers/cxl/cache.c include/uapi/linux/pci_regs.h+79 -10 replies
8/15cxl/core, cache: Add Cache ID register probing and initdrivers/cxl/core/Makefile drivers/cxl/core/cache.c drivers/cxl/core/port.c +4 more+103 -00 replies
9/15cxl/core: Add Cache ID verificationdrivers/cxl/cache.c drivers/cxl/core/cache.c drivers/cxl/core/cachedev.c +4 more+278 -20 replies
10/15cxl/core: Add Cache ID allocationdrivers/cxl/cache.c drivers/cxl/core/cache.c drivers/cxl/cxl.h +1 more+359 -110 replies
11/15cxl/core: Add support for HDM-D cache id programmingdrivers/cxl/cache.c drivers/cxl/core/cache.c drivers/cxl/cxl.h+49 -120 replies
12/15cxl/cache: Add snoop filter creation and set updrivers/cxl/core/cache.c drivers/cxl/core/core.h drivers/cxl/core/port.c +4 more+166 -20 replies
13/15cxl/cache: Add snoop filter allocationdrivers/cxl/cache.c drivers/cxl/core/cache.c drivers/cxl/core/memdev.c +1 more+162 -30 replies
14/15iommu, cxl: Configure IOMMU for CXL.cachedrivers/cxl/cache.c drivers/cxl/core/cache.c drivers/iommu/amd/amd_iommu_types.h +5 more+175 -10 replies
15/15cxl/cache: Enable CXL.cache on successful probedrivers/cxl/cache.c+1 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/15] Add initial CXL.cache support

This series adds support for CXL.cache devices to the CXL subsystem. The set includes the following:
- Updates to the existing CXL infrastructure to enable adding CXL.cache devices (struct cxl_cachedev) to the driver
- Support for cache id and snoop filter capabilities
- IOMMU updates to allow CXL.cache ATS requests
- Driver for struct cxl_cachedev devices that calls all of the above

The vast majority of the support is gated behind CONFIG_CXL_CACHE since CXL.cache devices aren't commonplace. This set is untested since I don't (currently) have access to a CXL.cache-capable device. Using multiple devices requires cache id capabilties, which may not be available depending on the platform (for AMD it's Venice or later).

There is a major missing piece in this set: There's no endpoint driver that adds a cxl_cachedev device, so this code is currently unused. I was planning on only sending this out once I had a device, but the plans for the device I was planning to support fell through and I didn't want to just sit on this.

Another thing that's missing is mapping host memory for CXL.cache use. I think the DMA API *should* just work after these changes, but it's not tested. I originally had the CXL core driver set up the DMA range for the endpoint driver, but it didn't end up making much sense. So, I've left the implementation for the (eventual) endpoint driver.

Thanks,
Ben

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935 (v7.3-rc1)

Ben Cheatham (15):
cxl/core: Add CXL.cache device struct
cxl/cache: Add cxl_cache driver
cxl/core: Change cxl_ep_load() to use device pointer parameter cxl/core: Update devm_cxl_enumerate_ports() for cxl_cachedevs cxl/port: Split endpoint port probe on device type cxl/core: Update devm_cxl_add_endpoint() for cxl_cachedevs cxl/cache: Verify port hierarchy has CXL.cache enabled cxl/core, cache: Add Cache ID register probing and init cxl/core: Add Cache ID verification
cxl/core: Add Cache ID allocation
cxl/core: Add support for HDM-D cache id programming cxl/cache: Add snoop filter creation and set up cxl/cache: Add snoop filter allocation
iommu, cxl: Configure IOMMU for CXL.cache
cxl/cache: Enable CXL.cache on successful probe

 drivers/cxl/Kconfig                 |  14 +
 drivers/cxl/Makefile                |   6 +-
 drivers/cxl/cache.c                 | 285 ++++++++++
 drivers/cxl/core/Makefile           |   2 +
 drivers/cxl/core/cache.c            | 851 ++++++++++++++++++++++++++++
 drivers/cxl/core/cachedev.c         | 131 +++++
 drivers/cxl/core/core.h             |   7 +
 drivers/cxl/core/memdev.c           |   1 +
 drivers/cxl/core/pci.c              |  78 ++-
 drivers/cxl/core/port.c             | 149 +++--
 drivers/cxl/core/region.c           |  24 +-
 drivers/cxl/core/regs.c             |  30 +
 drivers/cxl/cxl.h                   |  74 ++-
 drivers/cxl/cxlcache.h              |  50 ++
 drivers/cxl/cxlmem.h                |   4 +-
 drivers/cxl/mem.c                   |   4 +-
 drivers/cxl/port.c                  |  97 +++-
 drivers/iommu/amd/amd_iommu_types.h |   4 +
 drivers/iommu/amd/init.c            |  14 +
 drivers/iommu/amd/iommu.c           |  56 +-
 drivers/iommu/iommu.c               |  28 +
 include/cxl/cxl.h                   |  78 ++-
 include/linux/iommu.h               |   8 +
 include/uapi/linux/pci_regs.h       |   8 +
 24 files changed, 1911 insertions(+), 92 deletions(-)
 create mode 100644 drivers/cxl/cache.c
 create mode 100644 drivers/cxl/core/cache.c
 create mode 100644 drivers/cxl/core/cachedev.c
 create mode 100644 drivers/cxl/cxlcache.h
Signature · 1 line
2.53.0