cxl/port: Store the port's Component Register mappings in struct cxl_port
authorRobert Richter <rrichter@amd.com>
Thu, 22 Jun 2023 20:55:10 +0000 (15:55 -0500)
committerDan Williams <dan.j.williams@intel.com>
Sun, 25 Jun 2023 19:22:44 +0000 (12:22 -0700)
commit19ab69a60e3ba58b4942b9ab5095cf90477a54ce
tree7f8d4f4ed43b33464439ef29add8c1d1f031fea4
parent733b57f262b0e9f05ffeac102fe5bd729e263170
cxl/port: Store the port's Component Register mappings in struct cxl_port

CXL capabilities are stored in the Component Registers. To use them,
the specific I/O ranges of the capabilities must be determined by
probing the registers. For this, the whole Component Register range
needs to be mapped temporarily to detect the offset and length of a
capability range.

In order to use more than one capability of a component (e.g. RAS and
HDM) the Component Register are probed and its mappings created
multiple times. This also causes overlapping I/O ranges as the whole
Component Register range must be mapped again while a capability's I/O
range is already mapped.

Different capabilities cannot be setup at the same time. E.g. the RAS
capability must be made available as soon as the PCI driver is bound,
the HDM decoder is setup later during port enumeration. Moreover,
during early setup it is still unknown if a certain capability is
needed. A central capability setup is therefore not possible,
capabilities must be individually enabled once needed during
initialization.

To avoid a duplicate register probe and overlapping I/O mappings, only
probe the Component Registers one time and store the Component
Register mapping in struct port. The stored mappings can be used later
to iomap the capability register range when enabling the capability,
which will be implemented in a follow-on patch.

Signed-off-by: Robert Richter <rrichter@amd.com>
Signed-off-by: Terry Bowman <terry.bowman@amd.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230622205523.85375-15-terry.bowman@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/port.c
drivers/cxl/cxl.h