[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0279dabe-1c2f-46b2-a5c3-9a712a2c7311@intel.com>
Date: Thu, 20 Feb 2025 14:56:41 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Robert Richter <rrichter@....com>,
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>,
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>
Subject: Re: [PATCH v2 04/15] cxl/region: Calculate endpoint's region position
during init
On 2/18/25 6:23 AM, Robert Richter wrote:
> The calculation of an endpoint's position in a region traverses all
> ports up to the root port and determines the corresponding decoders
> for that particular address range. For address translation the HPA
> range must be recalculated between ports. In order to prepare the
> implementation of address translation, move code to
> cxl_endpoint_decoder_initialize() and reuse the existing iterator
> there.
>
> Signed-off-by: Robert Richter <rrichter@....com>
> ---
> drivers/cxl/core/region.c | 25 +++++++++++++++++++++----
> 1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index ad4a6ce37216..6f106bfa115f 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1903,7 +1903,6 @@ static int cxl_region_sort_targets(struct cxl_region *cxlr)
> for (i = 0; i < p->nr_targets; i++) {
> struct cxl_endpoint_decoder *cxled = p->targets[i];
>
> - cxled->pos = cxl_calc_interleave_pos(cxled);
> /*
> * Record that sorting failed, but still continue to calc
> * cxled->pos so that follow-on code paths can reliably
Do the comments need to be updated here with the deletion of that line above?
DJ
> @@ -3264,10 +3263,22 @@ static int cxl_endpoint_decoder_initialize(struct cxl_endpoint_decoder *cxled)
> struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> struct cxl_port *iter = cxled_to_port(cxled);
> struct cxl_decoder *root, *cxld = &cxled->cxld;
> - struct range *hpa = &cxld->hpa_range;
> + struct range hpa = cxld->hpa_range;
> + struct cxl_interleave_context ctx;
> + int rc;
>
> - while (iter && !is_cxl_root(iter))
> - iter = to_cxl_port(iter->dev.parent);
> + ctx = (struct cxl_interleave_context) {
> + .hpa_range = &hpa,
> + };
> +
> + while (iter && !is_cxl_root(iter)) {
> + /* Convert interleave settings to next port upstream. */
> + rc = cxl_port_calc_interleave(iter, &ctx);
> + if (rc < 0)
> + return rc;
> +
> + iter = parent_port_of(iter);
> + }
>
> if (!iter)
> return -ENXIO;
> @@ -3281,7 +3292,13 @@ static int cxl_endpoint_decoder_initialize(struct cxl_endpoint_decoder *cxled)
> return -ENXIO;
> }
>
> + dev_dbg(cxld->dev.parent,
> + "%s:%s: range:%#llx-%#llx pos:%d\n",
> + dev_name(&cxled->cxld.dev), dev_name(&cxld->dev),
> + hpa.start, hpa.end, ctx.pos);
> +
> cxled->cxlrd = to_cxl_root_decoder(&root->dev);
> + cxled->pos = ctx.pos;
>
> return 0;
> }
Powered by blists - more mailing lists