cxl/region: Program target lists
authorDan Williams <dan.j.williams@intel.com>
Mon, 6 Jun 2022 22:18:31 +0000 (15:18 -0700)
committerDan Williams <dan.j.williams@intel.com>
Mon, 25 Jul 2022 19:18:07 +0000 (12:18 -0700)
commit27b3f8d13830cdbd8deae2b709af182d88237ba5
treec00a25cbb7df72c757373c6f6acc134fdde3988c
parent384e624bb211b406db40edc900bb51af8bb267d0
cxl/region: Program target lists

Once the region's interleave geometry (ways, granularity, size) is
established and all the endpoint decoder targets are assigned, the next
phase is to program all the intermediate decoders. Specifically, each
CXL switch in the path between the endpoint and its CXL host-bridge
(including the logical switch internal to the host-bridge) needs to have
its decoders programmed and the target list order assigned.

The difficulty in this implementation lies in determining which endpoint
decoder ordering combinations are valid. Consider the cxl_test case of 2
host bridges, each of those host-bridges attached to 2 switches, and
each of those switches attached to 2 endpoints for a potential 8-way
interleave. The x2 interleave at the host-bridge level requires that all
even numbered endpoint decoder positions be located on the "left" hand
side of the topology tree, and the odd numbered positions on the other.
The endpoints that are peers on the same switch need to have a position
that can be routed with a dedicated address bit per-endpoint. See
check_last_peer() for the details.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/165784337827.1758207.132121746122685208.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/core.h
drivers/cxl/core/port.c
drivers/cxl/core/region.c
drivers/cxl/cxl.h