summaryrefslogtreecommitdiff
path: root/drivers/cxl/mem.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2022-05-18 16:34:37 -0700
committerDan Williams <dan.j.williams@intel.com>2022-05-19 08:50:41 -0700
commit75b7ae29991f945b69c10d75b861d7d5e90bd541 (patch)
treed373d2e53dea658a33c505278244c38bfea115a0 /drivers/cxl/mem.c
parent76a4121e86649bf381aa32cb69ede913def57202 (diff)
downloadlwn-75b7ae29991f945b69c10d75b861d7d5e90bd541.tar.gz
lwn-75b7ae29991f945b69c10d75b861d7d5e90bd541.zip
cxl/mem: Validate port connectivity before dvsec ranges
In preparation for validating DVSEC ranges against the platform declared CXL memory ranges (ACPI CFMWS) move port enumeration before the endpoint's decoder validation. Ultimately this logic will move to the port driver, but create a bisect point before that larger move. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/165291687749.1426646.18091538443879226995.stgit@dwillia2-xfh Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl/mem.c')
-rw-r--r--drivers/cxl/mem.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c
index 184549e5093f..80e75a410499 100644
--- a/drivers/cxl/mem.c
+++ b/drivers/cxl/mem.c
@@ -140,22 +140,6 @@ static int cxl_mem_probe(struct device *dev)
if (work_pending(&cxlmd->detach_work))
return -EBUSY;
- rc = cxlds->wait_media_ready(cxlds);
- if (rc) {
- dev_err(dev, "Media not active (%d)\n", rc);
- return rc;
- }
-
- /*
- * If DVSEC ranges are being used instead of HDM decoder registers there
- * is no use in trying to manage those.
- */
- if (!cxl_hdm_decode_init(cxlds)) {
- dev_err(dev,
- "Legacy range registers configuration prevents HDM operation.\n");
- return -EBUSY;
- }
-
rc = devm_cxl_enumerate_ports(cxlmd);
if (rc)
return rc;
@@ -181,6 +165,22 @@ unlock:
if (rc)
return rc;
+ rc = cxlds->wait_media_ready(cxlds);
+ if (rc) {
+ dev_err(dev, "Media not active (%d)\n", rc);
+ return rc;
+ }
+
+ /*
+ * If DVSEC ranges are being used instead of HDM decoder registers there
+ * is no use in trying to manage those.
+ */
+ if (!cxl_hdm_decode_init(cxlds)) {
+ dev_err(dev,
+ "Legacy range registers configuration prevents HDM operation.\n");
+ return -EBUSY;
+ }
+
/*
* The kernel may be operating out of CXL memory on this device,
* there is no spec defined way to determine whether this device