From: Alison Schofield <alison.schofield@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
linux-cxl@vger.kernel.org,
Dmytro Adamenko <dmytro.adamenko@intel.com>
Subject: Re: [PATCH v2 1/3] cxl/region: Prepare the decoder match range helper for reuse
Date: Mon, 23 Oct 2023 16:30:10 -0700 [thread overview]
Message-ID: <ZTcCAvus2giVK7ry@aschofie-mobl2> (raw)
In-Reply-To: <6536dd82d3b6d_725832949a@dwillia2-xfh.jf.intel.com.notmuch>
On Mon, Oct 23, 2023 at 01:54:26PM -0700, Dan Williams wrote:
> alison.schofield@ wrote:
> > From: Alison Schofield <alison.schofield@intel.com>
> >
> > match_decoder_by_range() and decoder_match_range() both determine
> > if an HPA range matches a decoder. The first does it for root
> > decoders and the second one operates on switch decoders.
> >
> > Tidy these up with clear naming and make the switch helper more
> > like the root decoder helper in style and functionality. Make it
> > take the actual range, rather than an endpoint decoder from which
> > it extracts the range.
> >
> > Aside from aesthetics and maintainability, this is in preparation
> > for reuse.
>
> Some minor changelog comments:
>
> >
> > Fixes: a32320b71f08 ("cxl/region: Add region autodiscovery")
>
> Save "Fixes:" for commits that need to be backported to address an
> issue. This will be a dependency for backporting patch2, but on its own
> it does not fix anything.
>
> > Reported-by: Dmytro Adamenko <dmytro.adamenko@intel.com>
>
> Along the same lines this probably moves to the patch that fixes the
> report.
>
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> > Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > ---
> > drivers/cxl/core/region.c | 16 ++++++++++------
> > 1 file changed, 10 insertions(+), 6 deletions(-)
snip
> >
> > +static int match_switch_decoder_by_range(struct device *dev, void *data)
> > {
> > - struct cxl_endpoint_decoder *cxled = data;
> > + struct range *r1, *r2 = data;
> > struct cxl_switch_decoder *cxlsd;
> >
> > if (!is_switch_decoder(dev))
> > return 0;
> >
> > cxlsd = to_cxl_switch_decoder(dev);
> > - return range_contains(&cxlsd->cxld.hpa_range, &cxled->cxld.hpa_range);
> > + r1 = &cxlsd->cxld.hpa_range;
> > + return range_contains(r1, r2);
>
> I know this is just maintaining the status quo, but thinking about it a
> bit deeper I think range_contains() is only correct for root decoders.
> For a given region the root decoder will contain the region, but all the
> switch decoders must be a 1:1 mapping. Linux only supports scenarios
> where all endpoint decoders map the same HPA range and identify only 1
> decoder per-switch port to map that region.
>
> So "range_contains(r1, r2)" becomes "return *r1 == *r2".
Thanks Dan - picked up your changelog suggestions and replace this
range_contains w an 1:1 comparison.
Alison
next prev parent reply other threads:[~2023-10-23 23:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 6:02 [PATCH v2 0/3] cxl/region: Autodiscovery position repair alison.schofield
2023-10-16 6:02 ` [PATCH v2 1/3] cxl/region: Prepare the decoder match range helper for reuse alison.schofield
2023-10-17 16:21 ` Jim Harris
2023-10-17 17:24 ` Jim Harris
2023-10-23 23:22 ` Alison Schofield
2023-10-17 20:43 ` Alison Schofield
2023-10-17 22:59 ` Jim Harris
2023-10-23 17:51 ` Alison Schofield
2023-10-23 20:54 ` Dan Williams
2023-10-23 23:30 ` Alison Schofield [this message]
2023-10-16 6:02 ` [PATCH v2 2/3] cxl/region: Calculate a target position in a region interleave alison.schofield
2023-10-17 17:33 ` Jim Harris
2023-10-23 18:10 ` Alison Schofield
2023-10-23 18:34 ` Jim Harris
2023-10-23 21:47 ` Dan Williams
2023-10-16 6:02 ` [PATCH v2 3/3] cxl/region: Use calc_interleave_pos() with autodiscovered regions alison.schofield
2023-10-17 17:40 ` Jim Harris
2023-10-23 21:58 ` Dan Williams
2023-10-24 0:42 ` Alison Schofield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZTcCAvus2giVK7ry@aschofie-mobl2 \
--to=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=dmytro.adamenko@intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox