Skip to content

Commit d25f002

Browse files
committed
Merge tag 'cxl-for-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull CXL updates from Dan Williams: "The highlights in terms of new functionality are support for the standard CXL Performance Monitor definition that appeared in CXL 3.0, support for device sanitization (wiping all data from a device), secure-erase (re-keying encryption of user data), and support for firmware update. The firmware update support is notable as it reuses the simple sysfs_upload interface to just cat(1) a blob to a sysfs file and pipe that to the device. Additionally there are a substantial number of cleanups and reorganizations to get ready for RCH error handling (RCH == Restricted CXL Host == current shipping hardware generation / pre CXL-2.0 topologies) and type-2 (accelerator / vendor specific) devices. For vendor specific devices they implement a subset of what the generic type-3 (generic memory expander) driver expects. As a result the rework decouples optional infrastructure from the core driver context. For RCH topologies, where the specification working group did not want to confuse pre-CXL-aware operating systems, many of the standard registers are hidden which makes support standard bus features like AER (PCIe Advanced Error Reporting) difficult. The rework arranges for the driver to help the PCI-AER core. Bjorn is on board with this direction but a late regression disocvery means the completion of this functionality needs to cook a bit longer, so it is code reorganizations only for now. Summary: - Add infrastructure for supporting background commands along with support for device sanitization and firmware update - Introduce a CXL performance monitoring unit driver based on the common definition in the specification. - Land some preparatory cleanup and refactoring for the anticipated arrival of CXL type-2 (accelerator devices) and CXL RCH (CXL-v1.1 topology) error handling. - Rework CPU cache management with respect to region configuration (device hotplug or other dynamic changes to memory interleaving) - Fix region reconfiguration vs CXL decoder ordering rules" * tag 'cxl-for-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (51 commits) cxl: Fix one kernel-doc comment cxl/pci: Use correct flag for sanitize polling docs: perf: Minimal introduction the the CXL PMU device and driver perf: CXL Performance Monitoring Unit driver tools/testing/cxl: add firmware update emulation to CXL memdevs tools/testing/cxl: Use named effects for the Command Effect Log tools/testing/cxl: Fix command effects for inject/clear poison cxl: add a firmware update mechanism using the sysfs firmware loader cxl/test: Add Secure Erase opcode support cxl/mem: Support Secure Erase cxl/test: Add Sanitize opcode support cxl/mem: Wire up Sanitization support cxl/mbox: Add sanitization handling machinery cxl/mem: Introduce security state sysfs file cxl/mbox: Allow for IRQ_NONE case in the isr Revert "cxl/port: Enable the HDM decoder capability for switch ports" cxl/memdev: Formalize endpoint port linkage cxl/pci: Unconditionally unmask 256B Flit errors cxl/region: Manage decoder target_type at decoder-attach time cxl/hdm: Default CXL_DEVTYPE_DEVMEM decoders to CXL_DECODER_DEVMEM ...
2 parents 0a1c979 + fe77cc2 commit d25f002

37 files changed

Lines changed: 3475 additions & 843 deletions

File tree

Documentation/ABI/testing/sysfs-bus-cxl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,54 @@ Description:
5858
affinity for this device.
5959

6060

61+
What: /sys/bus/cxl/devices/memX/security/state
62+
Date: June, 2023
63+
KernelVersion: v6.5
64+
Contact: linux-cxl@vger.kernel.org
65+
Description:
66+
(RO) Reading this file will display the CXL security state for
67+
that device. Such states can be: 'disabled', 'sanitize', when
68+
a sanitization is currently underway; or those available only
69+
for persistent memory: 'locked', 'unlocked' or 'frozen'. This
70+
sysfs entry is select/poll capable from userspace to notify
71+
upon completion of a sanitize operation.
72+
73+
74+
What: /sys/bus/cxl/devices/memX/security/sanitize
75+
Date: June, 2023
76+
KernelVersion: v6.5
77+
Contact: linux-cxl@vger.kernel.org
78+
Description:
79+
(WO) Write a boolean 'true' string value to this attribute to
80+
sanitize the device to securely re-purpose or decommission it.
81+
This is done by ensuring that all user data and meta-data,
82+
whether it resides in persistent capacity, volatile capacity,
83+
or the LSA, is made permanently unavailable by whatever means
84+
is appropriate for the media type. This functionality requires
85+
the device to be not be actively decoding any HPA ranges.
86+
87+
88+
What /sys/bus/cxl/devices/memX/security/erase
89+
Date: June, 2023
90+
KernelVersion: v6.5
91+
Contact: linux-cxl@vger.kernel.org
92+
Description:
93+
(WO) Write a boolean 'true' string value to this attribute to
94+
secure erase user data by changing the media encryption keys for
95+
all user data areas of the device.
96+
97+
98+
What: /sys/bus/cxl/devices/memX/firmware/
99+
Date: April, 2023
100+
KernelVersion: v6.5
101+
Contact: linux-cxl@vger.kernel.org
102+
Description:
103+
(RW) Firmware uploader mechanism. The different files under
104+
this directory can be used to upload and activate new
105+
firmware for CXL devices. The interfaces under this are
106+
documented in sysfs-class-firmware.
107+
108+
61109
What: /sys/bus/cxl/devices/*/devtype
62110
Date: June, 2021
63111
KernelVersion: v5.14
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
======================================
4+
CXL Performance Monitoring Unit (CPMU)
5+
======================================
6+
7+
The CXL rev 3.0 specification provides a definition of CXL Performance
8+
Monitoring Unit in section 13.2: Performance Monitoring.
9+
10+
CXL components (e.g. Root Port, Switch Upstream Port, End Point) may have
11+
any number of CPMU instances. CPMU capabilities are fully discoverable from
12+
the devices. The specification provides event definitions for all CXL protocol
13+
message types and a set of additional events for things commonly counted on
14+
CXL devices (e.g. DRAM events).
15+
16+
CPMU driver
17+
===========
18+
19+
The CPMU driver registers a perf PMU with the name pmu_mem<X>.<Y> on the CXL bus
20+
representing the Yth CPMU for memX.
21+
22+
/sys/bus/cxl/device/pmu_mem<X>.<Y>
23+
24+
The associated PMU is registered as
25+
26+
/sys/bus/event_sources/devices/cxl_pmu_mem<X>.<Y>
27+
28+
In common with other CXL bus devices, the id has no specific meaning and the
29+
relationship to specific CXL device should be established via the device parent
30+
of the device on the CXL bus.
31+
32+
PMU driver provides description of available events and filter options in sysfs.
33+
34+
The "format" directory describes all formats of the config (event vendor id,
35+
group id and mask) config1 (threshold, filter enables) and config2 (filter
36+
parameters) fields of the perf_event_attr structure. The "events" directory
37+
describes all documented events show in perf list.
38+
39+
The events shown in perf list are the most fine grained events with a single
40+
bit of the event mask set. More general events may be enable by setting
41+
multiple mask bits in config. For example, all Device to Host Read Requests
42+
may be captured on a single counter by setting the bits for all of
43+
44+
* d2h_req_rdcurr
45+
* d2h_req_rdown
46+
* d2h_req_rdshared
47+
* d2h_req_rdany
48+
* d2h_req_rdownnodata
49+
50+
Example of usage::
51+
52+
$#perf list
53+
cxl_pmu_mem0.0/clock_ticks/ [Kernel PMU event]
54+
cxl_pmu_mem0.0/d2h_req_rdshared/ [Kernel PMU event]
55+
cxl_pmu_mem0.0/h2d_req_snpcur/ [Kernel PMU event]
56+
cxl_pmu_mem0.0/h2d_req_snpdata/ [Kernel PMU event]
57+
cxl_pmu_mem0.0/h2d_req_snpinv/ [Kernel PMU event]
58+
-----------------------------------------------------------
59+
60+
$# perf stat -a -e cxl_pmu_mem0.0/clock_ticks/ -e cxl_pmu_mem0.0/d2h_req_rdshared/
61+
62+
Vendor specific events may also be available and if so can be used via
63+
64+
$# perf stat -a -e cxl_pmu_mem0.0/vid=VID,gid=GID,mask=MASK/
65+
66+
The driver does not support sampling so "perf record" is unsupported.
67+
It only supports system-wide counting so attaching to a task is
68+
unsupported.

Documentation/admin-guide/perf/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ Performance monitor support
2121
alibaba_pmu
2222
nvidia-pmu
2323
meson-ddr-pmu
24+
cxl

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,6 +5203,13 @@ S: Maintained
52035203
F: drivers/cxl/
52045204
F: include/uapi/linux/cxl_mem.h
52055205

5206+
COMPUTE EXPRESS LINK PMU (CPMU)
5207+
M: Jonathan Cameron <jonathan.cameron@huawei.com>
5208+
L: linux-cxl@vger.kernel.org
5209+
S: Maintained
5210+
F: Documentation/admin-guide/perf/cxl.rst
5211+
F: drivers/perf/cxl_pmu.c
5212+
52065213
CONEXANT ACCESSRUNNER USB DRIVER
52075214
L: accessrunner-general@lists.sourceforge.net
52085215
S: Orphan

drivers/cxl/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ config CXL_PMEM
8282
config CXL_MEM
8383
tristate "CXL: Memory Expansion"
8484
depends on CXL_PCI
85+
select FW_UPLOAD
8586
default CXL_BUS
8687
help
8788
The CXL.mem protocol allows a device to act as a provider of "System
@@ -139,4 +140,17 @@ config CXL_REGION_INVALIDATION_TEST
139140
If unsure, or if this kernel is meant for production environments,
140141
say N.
141142

143+
config CXL_PMU
144+
tristate "CXL Performance Monitoring Unit"
145+
default CXL_BUS
146+
depends on PERF_EVENTS
147+
help
148+
Support performance monitoring as defined in CXL rev 3.0
149+
section 13.2: Performance Monitoring. CXL components may have
150+
one or more CXL Performance Monitoring Units (CPMUs).
151+
152+
Say 'y/m' to enable a driver that will attach to performance
153+
monitoring units and provide standard perf based interfaces.
154+
155+
If unsure say 'm'.
142156
endif

0 commit comments

Comments
 (0)