[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z5zwQiic51BfULdd@rric.localdomain>
Date: Fri, 31 Jan 2025 16:46:10 +0100
From: Robert Richter <rrichter@....com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: 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>,
Dave Jiang <dave.jiang@...el.com>,
Davidlohr Bueso <dave@...olabs.net>, 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 v1 15/29] cxl/region: Use an endpoint's SPA range to find
a region
On 14.01.25 10:59:27, Jonathan Cameron wrote:
> On Tue, 7 Jan 2025 15:10:01 +0100
> Robert Richter <rrichter@....com> wrote:
> > +static int cxl_port_calc_hpa(struct cxl_port *port, struct cxl_decoder *cxld,
> > + struct range *hpa_range)
> > +{
> > + struct range hpa = *hpa_range;
> > + u64 len = range_len(&hpa);
> > +
> > + if (!port->to_hpa)
> > + return 0;
> > +
> > + /* Translate HPA to the next upper domain. */
> > + hpa.start = port->to_hpa(cxld, hpa.start);
> > + hpa.end = port->to_hpa(cxld, hpa.end);
> > +
> > + if (!hpa.start || !hpa.end ||
>
> On general basis, why can't hpa.start be 0?
> It is an unusual physical memory map, but technically possible on some
> architectures.
>
> > + hpa.start == ULLONG_MAX || hpa.end == ULLONG_MAX) {
> > + dev_warn(&port->dev,
> > + "CXL address translation: HPA range invalid: %#llx-%#llx:%#llx-%#llx(%s)\n",
> > + hpa.start, hpa.end, hpa_range->start,
> > + hpa_range->end, dev_name(&cxld->dev));
> > + return -ENXIO;
> > + }
> > @@ -3214,26 +3249,47 @@ cxl_port_find_switch_decoder(struct cxl_port *port, struct range *hpa)
> > 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);
> > - struct range *hpa = &cxled->cxld.hpa_range;
> > + struct cxl_port *parent, *iter = cxled_to_port(cxled);
>
> I'd prefer that spit into two lines. Mixing cases that allocate and ones
> that don't isn't great for readability. Would also reduce the diff a little
> which is always nice!
>
> > + struct range hpa = cxled->cxld.hpa_range;
> > struct cxl_decoder *cxld = &cxled->cxld;
> >
Changed both, thanks.
-Robert
Powered by blists - more mailing lists