Skip to content

Commit 033af36

Browse files
committed
Merge tag 'cxl-for-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull compute express link (cxl) updates from Dave Jiang: "Major changes address HDM decoder initialization from DVSEC ranges, refactoring the code related to cxl mailboxes to be independent of the memory devices, and adding support for shared upstream link access_coordinate calculation, as well as a change to remove locking from memory notifier callback. In addition, a number of misc cleanups and refactoring of the code are also included. Address HDM decoder initialization from DVSEC ranges: - Only register non-zero DVSEC ranges - Remove duplicate implementation of waiting for memory_info_valid - Simplify the checking of mem_enabled in cxl_hdm_decode_init() Refactor the code related to cxl mailboxes to be independent of the memory devices: - Move cxl headers in include/linux/ to include/cxl - Move all mailbox related data to 'struct cxl_mailbox' - Refactor mailbox APIs with 'struct cxl_mailbox' as input instead of memory device state Add support for shared upstream link access_coordinate calculation for configurations that have multiple targets under a switch or a root port where the aggregated bandwidth can be greater than the upstream link of the switch/RP upstream link: - Preserve the CDAT access_coordinate from an endpoint - Add the support for shared upstream link access_coordinate calculation - Add documentation to explain how the calculations are done Remove locking from memory notifier callback. Misc cleanups: - Convert devm_cxl_add_root() to return using ERR_CAST() - cxl_test use dev_is_platform() instead of open coding - Remove duplicate include of header core.h in core/cdat.c - use scoped resource management to drop put_device() for cxl_port - Use scoped_guard to drop device_lock() for cxl_port - Refactor __devm_cxl_add_port() to drop gotos - Rename cxl_setup_parent_dport to cxl_dport_init_aer and cxl_dport_map_regs() to cxl_dport_map_ras() - Refactor cxl_dport_init_aer() to be more concise - Remove duplicate host_bridge->native_aer checking in cxl_dport_init_ras_reporting() - Fix comment for cxl_query_cmd()" * tag 'cxl-for-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (21 commits) cxl: Add documentation to explain the shared link bandwidth calculation cxl: Calculate region bandwidth of targets with shared upstream link cxl: Preserve the CDAT access_coordinate for an endpoint cxl: Fix comment regarding cxl_query_cmd() return data cxl: Convert cxl_internal_send_cmd() to use 'struct cxl_mailbox' as input cxl: Move mailbox related bits to the same context cxl: move cxl headers to new include/cxl/ directory cxl/region: Remove lock from memory notifier callback cxl/pci: simplify the check of mem_enabled in cxl_hdm_decode_init() cxl/pci: Check Mem_info_valid bit for each applicable DVSEC cxl/pci: Remove duplicated implementation of waiting for memory_info_valid cxl/pci: Fix to record only non-zero ranges cxl/pci: Remove duplicate host_bridge->native_aer checking cxl/pci: cxl_dport_map_rch_aer() cleanup cxl/pci: Rename cxl_setup_parent_dport() and cxl_dport_map_regs() cxl/port: Refactor __devm_cxl_add_port() to drop goto pattern cxl/port: Use scoped_guard()/guard() to drop device_lock() for cxl_port cxl/port: Use __free() to drop put_device() for cxl_port cxl: Remove duplicate included header file core.h tools/testing/cxl: Use dev_is_platform() ...
2 parents eee2808 + 2c70677 commit 033af36

File tree

26 files changed

+1089
-403
lines changed

26 files changed

+1089
-403
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
.. include:: <isonum.txt>
3+
4+
==================================
5+
CXL Access Coordinates Computation
6+
==================================
7+
8+
Shared Upstream Link Calculation
9+
================================
10+
For certain CXL region construction with endpoints behind CXL switches (SW) or
11+
Root Ports (RP), there is the possibility of the total bandwidth for all
12+
the endpoints behind a switch being more than the switch upstream link.
13+
A similar situation can occur within the host, upstream of the root ports.
14+
The CXL driver performs an additional pass after all the targets have
15+
arrived for a region in order to recalculate the bandwidths with possible
16+
upstream link being a limiting factor in mind.
17+
18+
The algorithm assumes the configuration is a symmetric topology as that
19+
maximizes performance. When asymmetric topology is detected, the calculation
20+
is aborted. An asymmetric topology is detected during topology walk where the
21+
number of RPs detected as a grandparent is not equal to the number of devices
22+
iterated in the same iteration loop. The assumption is made that subtle
23+
asymmetry in properties does not happen and all paths to EPs are equal.
24+
25+
There can be multiple switches under an RP. There can be multiple RPs under
26+
a CXL Host Bridge (HB). There can be multiple HBs under a CXL Fixed Memory
27+
Window Structure (CFMWS).
28+
29+
An example hierarchy:
30+
31+
> CFMWS 0
32+
> |
33+
> _________|_________
34+
> | |
35+
> ACPI0017-0 ACPI0017-1
36+
> GP0/HB0/ACPI0016-0 GP1/HB1/ACPI0016-1
37+
> | | | |
38+
> RP0 RP1 RP2 RP3
39+
> | | | |
40+
> SW 0 SW 1 SW 2 SW 3
41+
> | | | | | | | |
42+
> EP0 EP1 EP2 EP3 EP4 EP5 EP6 EP7
43+
44+
Computation for the example hierarchy:
45+
46+
Min (GP0 to CPU BW,
47+
Min(SW 0 Upstream Link to RP0 BW,
48+
Min(SW0SSLBIS for SW0DSP0 (EP0), EP0 DSLBIS, EP0 Upstream Link) +
49+
Min(SW0SSLBIS for SW0DSP1 (EP1), EP1 DSLBIS, EP1 Upstream link)) +
50+
Min(SW 1 Upstream Link to RP1 BW,
51+
Min(SW1SSLBIS for SW1DSP0 (EP2), EP2 DSLBIS, EP2 Upstream Link) +
52+
Min(SW1SSLBIS for SW1DSP1 (EP3), EP3 DSLBIS, EP3 Upstream link))) +
53+
Min (GP1 to CPU BW,
54+
Min(SW 2 Upstream Link to RP2 BW,
55+
Min(SW2SSLBIS for SW2DSP0 (EP4), EP4 DSLBIS, EP4 Upstream Link) +
56+
Min(SW2SSLBIS for SW2DSP1 (EP5), EP5 DSLBIS, EP5 Upstream link)) +
57+
Min(SW 3 Upstream Link to RP3 BW,
58+
Min(SW3SSLBIS for SW3DSP0 (EP6), EP6 DSLBIS, EP6 Upstream Link) +
59+
Min(SW3SSLBIS for SW3DSP1 (EP7), EP7 DSLBIS, EP7 Upstream link))))
60+
61+
The calculation starts at cxl_region_shared_upstream_perf_update(). A xarray
62+
is created to collect all the endpoint bandwidths via the
63+
cxl_endpoint_gather_bandwidth() function. The min() of bandwidth from the
64+
endpoint CDAT and the upstream link bandwidth is calculated. If the endpoint
65+
has a CXL switch as a parent, then min() of calculated bandwidth and the
66+
bandwidth from the SSLBIS for the switch downstream port that is associated
67+
with the endpoint is calculated. The final bandwidth is stored in a
68+
'struct cxl_perf_ctx' in the xarray indexed by a device pointer. If the
69+
endpoint is direct attached to a root port (RP), the device pointer would be an
70+
RP device. If the endpoint is behind a switch, the device pointer would be the
71+
upstream device of the parent switch.
72+
73+
At the next stage, the code walks through one or more switches if they exist
74+
in the topology. For endpoints directly attached to RPs, this step is skipped.
75+
If there is another switch upstream, the code takes the min() of the current
76+
gathered bandwidth and the upstream link bandwidth. If there's a switch
77+
upstream, then the SSLBIS of the upstream switch.
78+
79+
Once the topology walk reaches the RP, whether it's direct attached endpoints
80+
or walking through the switch(es), cxl_rp_gather_bandwidth() is called. At
81+
this point all the bandwidths are aggregated per each host bridge, which is
82+
also the index for the resulting xarray.
83+
84+
The next step is to take the min() of the per host bridge bandwidth and the
85+
bandwidth from the Generic Port (GP). The bandwidths for the GP is retrieved
86+
via ACPI tables SRAT/HMAT. The min bandwidth are aggregated under the same
87+
ACPI0017 device to form a new xarray.
88+
89+
Finally, the cxl_region_update_bandwidth() is called and the aggregated
90+
bandwidth from all the members of the last xarray is updated for the
91+
access coordinates residing in the cxl region (cxlr) context.

Documentation/driver-api/cxl/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Compute Express Link
88
:maxdepth: 1
99

1010
memory-devices
11+
access-coordinates
1112

1213
maturity-map
1314

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5728,8 +5728,7 @@ L: [email protected]
57285728
S: Maintained
57295729
F: Documentation/driver-api/cxl
57305730
F: drivers/cxl/
5731-
F: include/linux/einj-cxl.h
5732-
F: include/linux/cxl-event.h
5731+
F: include/cxl/
57335732
F: include/uapi/linux/cxl_mem.h
57345733
F: tools/testing/cxl/
57355734

drivers/acpi/apei/einj-cxl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Author: Ben Cheatham <[email protected]>
99
*/
10-
#include <linux/einj-cxl.h>
1110
#include <linux/seq_file.h>
1211
#include <linux/pci.h>
12+
#include <cxl/einj.h>
1313

1414
#include "apei-internal.h"
1515

drivers/acpi/apei/ghes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <linux/timer.h>
2828
#include <linux/cper.h>
2929
#include <linux/cleanup.h>
30-
#include <linux/cxl-event.h>
3130
#include <linux/platform_device.h>
3231
#include <linux/mutex.h>
3332
#include <linux/ratelimit.h>
@@ -50,6 +49,7 @@
5049
#include <acpi/apei.h>
5150
#include <asm/fixmap.h>
5251
#include <asm/tlbflush.h>
52+
#include <cxl/event.h>
5353
#include <ras/ras_event.h>
5454

5555
#include "apei-internal.h"

0 commit comments

Comments
 (0)