linux-stable/tools
Ben Widawsky 779dd20cfb cxl/region: Add region creation support
CXL 2.0 allows for dynamic provisioning of new memory regions (system
physical address resources like "System RAM" and "Persistent Memory").
Whereas DDR and PMEM resources are conveyed statically at boot, CXL
allows for assembling and instantiating new regions from the available
capacity of CXL memory expanders in the system.

Sysfs with an "echo $region_name > $create_region_attribute" interface
is chosen as the mechanism to initiate the provisioning process. This
was chosen over ioctl() and netlink() to keep the configuration
interface entirely in a pseudo-fs interface, and it was chosen over
configfs since, aside from this one creation event, the interface is
read-mostly. I.e. configfs supports cases where an object is designed to
be provisioned each boot, like an iSCSI storage target, and CXL region
creation is mostly for PMEM regions which are created usually once
per-lifetime of a server instance. This is an improvement over nvdimm
that pre-created "seed" devices that tended to confuse users looking to
determine which devices are active and which are idle.

Recall that the major change that CXL brings over previous persistent
memory architectures is the ability to dynamically define new regions.
Compare that to drivers like 'nfit' where the region configuration is
statically defined by platform firmware.

Regions are created as a child of a root decoder that encompasses an
address space with constraints. When created through sysfs, the root
decoder is explicit. When created from an LSA's region structure a root
decoder will possibly need to be inferred by the driver.

Upon region creation through sysfs, a vacant region is created with a
unique name. Regions have a number of attributes that must be configured
before the region can be bound to the driver where HDM decoder program
is completed.

An example of creating a new region:

- Allocate a new region name:
region=$(cat /sys/bus/cxl/devices/decoder0.0/create_pmem_region)

- Create a new region by name:
while
region=$(cat /sys/bus/cxl/devices/decoder0.0/create_pmem_region)
! echo $region > /sys/bus/cxl/devices/decoder0.0/create_pmem_region
do true; done

- Region now exists in sysfs:
stat -t /sys/bus/cxl/devices/decoder0.0/$region

- Delete the region, and name:
echo $region > /sys/bus/cxl/devices/decoder0.0/delete_region

Signed-off-by: Ben Widawsky <bwidawsk@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/165784333909.1758207.794374602146306032.stgit@dwillia2-xfh.jf.intel.com
[djbw: simplify locking, reword changelog]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2022-07-21 17:19:25 -07:00
..
accounting delayacct: track delays from write-protect copy 2022-06-01 15:55:25 -07:00
arch Yet another hw vulnerability with a software mitigation: Processor MMIO 2022-06-14 07:43:15 -07:00
bootconfig
bpf bpftool: Use sysfs vmlinux when dumping BTF by ID 2022-05-13 16:07:53 -07:00
build perf build: Stop using __weak bpf_map_create() to handle older libbpf versions 2022-05-26 12:36:56 -03:00
certs tools/certs: Add print-cert-tbs-hash.sh 2022-05-23 18:47:49 +03:00
cgroup
counter
debugging
edid
firewire
firmware
gpio tools: gpio: Add new hardware clock type 2022-05-04 11:06:14 +02:00
hv
iio Kbuild updates for v5.18 2022-03-31 11:59:03 -07:00
include x86/ftrace: Remove OBJECT_FILES_NON_STANDARD usage 2022-06-06 11:50:22 -07:00
io_uring
kvm/kvm_stat
laptop
leds
lib Bitmap patches for 5.19-rc1 2022-06-04 14:04:27 -07:00
memory-model tools/memory-model/README: Update klitmus7 compat table 2022-05-03 10:12:48 -07:00
objtool x86/extable: Annotate ex_handler_msr_mce() as a dead end 2022-05-27 12:34:45 +02:00
pci
pcmcia
perf perf vendor events intel: Update metrics for Alderlake 2022-06-03 21:45:32 +02:00
power Power management updates for 5.19-rc1 2022-05-24 16:04:25 -07:00
rcu
scripts Kbuild updates for v5.18 2022-03-31 11:59:03 -07:00
spi
testing cxl/region: Add region creation support 2022-07-21 17:19:25 -07:00
thermal tools/thermal: remove unneeded semicolon 2022-05-19 12:11:52 +02:00
time
tracing rtla: Remove procps-ng dependency 2022-05-26 15:20:46 -04:00
usb testusb: Fix warning comparing pointer to 0 2022-04-26 13:32:49 +02:00
virtio tools/virtio: compile with -pthread 2022-03-28 16:52:59 -04:00
vm mm/page-flags: reuse PG_mappedtodisk as PG_anon_exclusive for PageAnon() pages 2022-05-09 18:20:44 -07:00
wmi
Makefile Thermal control updates for 5.19-rc1 2022-05-24 16:19:30 -07:00