mbox series

[v2,0/4] Add managed SOFT RESERVE resource handling

Message ID cover.1737046620.git.nathan.fontenot@amd.com (mailing list archive)
Headers show
Series Add managed SOFT RESERVE resource handling | expand

Message

Nathan Fontenot Jan. 16, 2025, 5:42 p.m. UTC
Add the ability to manage SOFT RESERVE iomem resources prior to them
being added to the iomem resource tree. This allows drivers, such as
CXL, to remove any pieces of the SOFT RESERVE resource that intersect
with created CXL regions.

The current approac of leaving the SOFT RESERVE resources as is can
cause failures during hotplug of devices, such as CXL, because the
resource is not available for reuse after teardown of the device.

The approach is to add SOFT RESERVE resources to a separate tree
during boot. This allows any drivers to update the SOFT RESERVE
resources before they are merged into the iomem resource tree. In
addition a notifier chain is added so that drivers can be notified
when these SOFT RESERVE resources are added to the ioeme resource
tree.

The CXL driver is modified to use a worker thread that waits for
the CXL PCI and CXL mem drivers to be loaded and for their probe
routine to complete. Then walks through any created CXL regions to
remove pieces that intersect with SOFT RESERVE resources from the
SOFT RESERVES before adding the SOFT RESERVES to the iomem tree.

The dax driver uses the new soft reserve notifier chain so it can
consume any remaining SOFT RESERVES once they're added to the
iomem tree.

v2 updates:
- Add config option SOFT_RESERVE_MANAGED to control use of the
separate srmem resource tree at boot.
- Only add SOFT RESERVE resources to the soft reserve tree during
boot, they go to the iomem resource tree after boot.
- Remove the resource trimming code in the previous patch to re-use
the existing code in kernel/resource.c
-Add functionality for the cxl acpi driver to wait for the cxl PCI
and me drivers to load.

Nathan Fontenot (4):
  kernel/resource: Introduce managed SOFT RESERVED resources
  cxl: Update Soft Reserve resources upon region creation
  dax: Update hmem resource/device registration
  Add SOFT RESERVE resource notification chain

 drivers/acpi/numa/hmat.c   |   7 +--
 drivers/cxl/Kconfig        |   1 +
 drivers/cxl/acpi.c         |  26 ++++++++++
 drivers/cxl/core/Makefile  |   2 +-
 drivers/cxl/core/region.c  |  25 +++++++++-
 drivers/cxl/core/suspend.c |  41 +++++++++++++++
 drivers/cxl/cxl.h          |   3 ++
 drivers/cxl/cxlmem.h       |   9 ----
 drivers/cxl/cxlpci.h       |   2 +
 drivers/cxl/pci.c          |   1 +
 drivers/dax/hmem/device.c  |  14 +++---
 drivers/dax/hmem/hmem.c    |  34 +++++++++++--
 include/linux/dax.h        |   9 ++--
 include/linux/ioport.h     |  20 ++++++++
 kernel/resource.c          | 100 +++++++++++++++++++++++++++++++++++--
 lib/Kconfig                |   4 ++
 16 files changed, 260 insertions(+), 38 deletions(-)