cxl/core: Generalize dport enumeration in the core
authorDan Williams <dan.j.williams@intel.com>
Tue, 1 Feb 2022 02:10:04 +0000 (18:10 -0800)
committerDan Williams <dan.j.williams@intel.com>
Wed, 9 Feb 2022 06:57:30 +0000 (22:57 -0800)
commit98d2d3a264543680281fd8a4e6ae490ca26b4f85
tree1ce89bb626619b06338215017fa821a0998f1590
parentaf9cae9facc2de773b4aa59916913cfd6e18bdd0
cxl/core: Generalize dport enumeration in the core

The core houses infrastructure for decoder resources. A CXL port's
dports are more closely related to decoder infrastructure than topology
enumeration. Implement generic PCI based dport enumeration in the core,
i.e. arrange for existing root port enumeration from cxl_acpi to share
code with switch port enumeration which just amounts to a small
difference in a pci_walk_bus() invocation once the appropriate 'struct
pci_bus' has been retrieved.

Set the convention that decoder objects are registered after all dports
are enumerated. This enables userspace to know when the CXL core is
finished establishing 'dportX' links underneath the 'portX' object.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/164368114191.354031.5270501846455462665.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/acpi.c
drivers/cxl/core/Makefile
drivers/cxl/core/pci.c [new file with mode: 0644]
drivers/cxl/core/port.c
drivers/cxl/cxl.h
drivers/cxl/cxlpci.h
tools/testing/cxl/Kbuild
tools/testing/cxl/mock_acpi.c
tools/testing/cxl/test/cxl.c
tools/testing/cxl/test/mock.c
tools/testing/cxl/test/mock.h