From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Yao Xingtao <yaoxt.fnst@fujitsu.com>, <dave@stgolabs.net>,
<alison.schofield@intel.com>, <vishal.l.verma@intel.com>,
<ira.weiny@intel.com>, <dan.j.williams@intel.com>,
<jim.harris@samsung.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH v6] cxl/region: check interleave capability
Date: Tue, 11 Jun 2024 17:46:18 +0100 [thread overview]
Message-ID: <20240611174618.000040ff@Huawei.com> (raw)
In-Reply-To: <d7416f60-28fa-4848-a0cc-61431528db8a@intel.com>
> > drivers/cxl/core/hdm.c | 10 +++++
> > drivers/cxl/core/region.c | 89 +++++++++++++++++++++++++++++++++++++++
> > drivers/cxl/cxl.h | 2 +
> > drivers/cxl/cxlmem.h | 1 +
> > 4 files changed, 102 insertions(+)
> >
> > diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> > index 7d97790b893d..5b7dff19bbfa 100644
> > --- a/drivers/cxl/core/hdm.c
> > +++ b/drivers/cxl/core/hdm.c
> > @@ -52,6 +52,11 @@ int devm_cxl_add_passthrough_decoder(struct cxl_port *port)
> > struct cxl_dport *dport = NULL;
> > int single_port_map[1];
> > unsigned long index;
> > + struct cxl_hdm *cxlhdm = dev_get_drvdata(&port->dev);
> > +
> > + /* allow all the interleave capabilities for passthrough decoder */
> > + cxlhdm->interleave_mask = GENMASK(14, 8);
> > + cxlhdm->iw_cap_mask = BIT(1) | BIT(2) | BIT(4) | BIT(8);
> >
> > cxlsd = cxl_switch_decoder_alloc(port, 1);
> > if (IS_ERR(cxlsd))
> > @@ -79,6 +84,11 @@ static void parse_hdm_decoder_caps(struct cxl_hdm *cxlhdm)
> > cxlhdm->interleave_mask |= GENMASK(11, 8);
> > if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_14_12, hdm_cap))
> > cxlhdm->interleave_mask |= GENMASK(14, 12);
> > + cxlhdm->iw_cap_mask = BIT(1) | BIT(2) | BIT(4) | BIT(8);
>
> Should define a mask for this. Probably should have defined masks for all of the open coded BIT() sets.
I don't agreed. These bits are logically independent specifying each
supported value of interleave ways.
Put them under a define and I think you end up with less readable code.
>
> > + if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_3_6_12_WAY, hdm_cap))
> > + cxlhdm->iw_cap_mask |= BIT(3) | BIT(6) | BIT(12);
> > + if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_16_WAY, hdm_cap))
> > + cxlhdm->iw_cap_mask |= BIT(16);
> > }
next prev parent reply other threads:[~2024-06-11 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 2:15 [PATCH v6] cxl/region: check interleave capability Yao Xingtao
2024-06-11 15:52 ` Dave Jiang
2024-06-11 16:46 ` Jonathan Cameron [this message]
2024-06-11 17:14 ` Dave Jiang
2024-06-12 0:37 ` Xingtao Yao (Fujitsu)
2024-06-12 4:18 ` Dan Williams
2024-06-11 23:27 ` Dan Williams
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=20240611174618.000040ff@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jim.harris@samsung.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
--cc=yaoxt.fnst@fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.