[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250107141015.3367194-12-rrichter@amd.com>
Date: Tue, 7 Jan 2025 15:09:57 +0100
From: Robert Richter <rrichter@....com>
To: Alison Schofield <alison.schofield@...el.com>, Vishal Verma
<vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>, Dan Williams
<dan.j.williams@...el.com>, Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>, Davidlohr Bueso <dave@...olabs.net>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Gregory Price
<gourry@...rry.net>, "Fabio M. De Francesco"
<fabio.m.de.francesco@...ux.intel.com>, Terry Bowman <terry.bowman@....com>,
Robert Richter <rrichter@....com>
Subject: [PATCH v1 11/29] cxl/region: Unfold cxl_find_root_decoder() into cxl_endpoint_initialize()
To determine other endpoint parameters such as interleaving parameters
during endpoint initialization, the iterator function in
cxl_find_root_decoder() can be used. Unfold this function into
cxl_endpoint_initialize() and make the iterator available there.
Signed-off-by: Robert Richter <rrichter@....com>
---
drivers/cxl/core/region.c | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 48add814924b..6fcf56806606 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3218,8 +3218,7 @@ cxl_port_find_switch_decoder(struct cxl_port *port, struct range *hpa)
return cxld_dev ? to_cxl_decoder(cxld_dev) : NULL;
}
-static struct cxl_root_decoder *
-cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
+static int cxl_endpoint_initialize(struct cxl_endpoint_decoder *cxled)
{
struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
struct cxl_port *iter = cxled_to_port(cxled);
@@ -3230,7 +3229,7 @@ cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
iter = to_cxl_port(iter->dev.parent);
if (!iter)
- return NULL;
+ return -ENXIO;
cxld = cxl_port_find_switch_decoder(iter, hpa);
if (!cxld) {
@@ -3238,12 +3237,12 @@ cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
"%s:%s no CXL window for range %#llx:%#llx\n",
dev_name(&cxlmd->dev), dev_name(&cxld->dev),
cxld->hpa_range.start, cxld->hpa_range.end);
- return NULL;
+ return -ENXIO;
}
+ cxled->cxlrd = to_cxl_root_decoder(&cxld->dev);
-
- return to_cxl_root_decoder(&cxld->dev);
+ return 0;
}
static int match_region_by_range(struct device *dev, void *data)
@@ -3364,19 +3363,6 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
return ERR_PTR(rc);
}
-static int cxl_endpoint_initialize(struct cxl_endpoint_decoder *cxled)
-{
- struct cxl_root_decoder *cxlrd;
-
- cxlrd = cxl_find_root_decoder(cxled);
- if (!cxlrd)
- return -ENXIO;
-
- cxled->cxlrd = cxlrd;
-
- return 0;
-}
-
static int cxl_endpoint_add(struct cxl_endpoint_decoder *cxled)
{
struct range *hpa = &cxled->cxld.hpa_range;
--
2.39.5
Powered by blists - more mailing lists