cxl/region: Move region-position validation to a helper
authorDan Williams <dan.j.williams@intel.com>
Fri, 10 Feb 2023 09:06:15 +0000 (01:06 -0800)
committerDan Williams <dan.j.williams@intel.com>
Sat, 11 Feb 2023 01:32:30 +0000 (17:32 -0800)
commit9995576cef48dcbb0ba3de068292ed14f72fa0eb
treeef7772e8fe86a6a6f1548a8f3ccc0a567cc1466a
parent86987c766276acf1289700cd38bd6d5b5a167fea
cxl/region: Move region-position validation to a helper

In preparation for region autodiscovery, that needs all devices
discovered before their relative position in the region can be
determined, consolidate all position dependent validation in a helper.

Recall that in the on-demand region creation flow the end-user picks the
position of a given endpoint decoder in a region. In the autodiscovery
case the position of an endpoint decoder can only be determined after
all other endpoint decoders that claim to decode the region's address
range have been enumerated and attached. So, in the autodiscovery case
endpoint decoders may be attached before their relative position is
known. Once all decoders arrive, then positions can be determined and
validated with cxl_region_validate_position() the same as user initiated
on-demand creation.

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Tested-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/167601997584.1924368.4615769326126138969.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/region.c