cxl/mem: Enumerate port targets before adding endpoints
authorDan Williams <dan.j.williams@intel.com>
Tue, 7 Jun 2022 17:35:39 +0000 (10:35 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 22 Jul 2022 00:19:25 +0000 (17:19 -0700)
commit7f8faf96a2fb562833db73595640329ca8da7b1d
treeaa1d56a296dd10cf81a951324fe07594e9773722
parent538831f1beb818c93e5879bf19de37d89ec88ed6
cxl/mem: Enumerate port targets before adding endpoints

The port scanning algorithm in devm_cxl_enumerate_ports() walks up the
topology and adds cxl_port objects starting from the root down to the
endpoint. When those ports are initially created they know all their
dports, but they do not know the downstream cxl_port instance that
represents the next descendant in the topology. Rework create_endpoint()
into devm_cxl_add_endpoint() that enumerates the downstream cxl_port
topology into each port's 'struct cxl_ep' record for each endpoint it
that the port is an ancestor.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220624041950.559155-7-dan.j.williams@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/port.c
drivers/cxl/cxl.h
drivers/cxl/mem.c