From: Dan Williams <dan.j.williams@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, <linux-cxl@vger.kernel.org>
Cc: <dan.j.williams@intel.com>, <vishal.l.verma@intel.com>,
<ira.weiny@intel.com>, <alison.schofield@intel.com>,
<Jonathan.Cameron@huawei.com>
Subject: RE: [PATCH v2 2/3] cxl: Add CXL spec v3.0 interleave support
Date: Thu, 11 Aug 2022 18:01:57 -0700 [thread overview]
Message-ID: <62f5a684eef9e_3ce68294f1@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <166026222055.1454405.5853343066246585992.stgit@djiang5-desk4.jf.intel.com>
Dave Jiang wrote:
> CXL spec v3.0 added 2 CAP bits to the CXL HDM Decoder Capability Register.
> CXL spec v3.0 8.2.4.19.1. Bit 11 indicates that 3, 6, and 12 way interleave
> is capable. Bit 12 indicates that 16 way interleave is capable.
>
> Add code to parse_hdm_decoder_caps() to cache those new bits. Add check in
> cxl_interleave_verify() call to make sure those CAP bits matches the passed
> in interleave value.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/cxl/core/hdm.c | 6 ++++++
> drivers/cxl/cxl.h | 2 ++
> drivers/cxl/cxlmem.h | 13 +++++++++++++
> 3 files changed, 21 insertions(+)
>
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 8143e2615957..0baf3c4820a5 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -80,6 +80,12 @@ 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->interleave_cap = CXL_HDM_INTERLEAVE_CAP_DEFAULT;
> + if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_3_6_12_WAY, hdm_cap))
> + cxlhdm->interleave_cap |= CXL_HDM_INTERLEAVE_CAP_3_6_12;
> + if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_16_WAY, hdm_cap))
> + cxlhdm->interleave_cap |= CXL_HDM_INTERLEAVE_CAP_16;
> }
>
> static void __iomem *map_hdm_decoder_regs(struct cxl_port *port,
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index bc604b7e44fb..105d814941e7 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -42,6 +42,8 @@
> #define CXL_HDM_DECODER_TARGET_COUNT_MASK GENMASK(7, 4)
> #define CXL_HDM_DECODER_INTERLEAVE_11_8 BIT(8)
> #define CXL_HDM_DECODER_INTERLEAVE_14_12 BIT(9)
> +#define CXL_HDM_DECODER_INTERLEAVE_3_6_12_WAY BIT(11)
> +#define CXL_HDM_DECODER_INTERLEAVE_16_WAY BIT(12)
> #define CXL_HDM_DECODER_CTRL_OFFSET 0x4
> #define CXL_HDM_DECODER_ENABLE BIT(1)
> #define CXL_HDM_DECODER0_BASE_LOW_OFFSET(i) (0x20 * (i) + 0x10)
> diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
> index 625fce0b6c2c..ebd645d8bbb4 100644
> --- a/drivers/cxl/cxlmem.h
> +++ b/drivers/cxl/cxlmem.h
> @@ -393,14 +393,24 @@ static inline void cxl_mem_active_dec(void)
> }
> #endif
>
> +#define CXL_HDM_INTERLEAVE_CAP_DEFAULT BIT(1) | BIT(2) | BIT(4) | BIT(8)
> +#define CXL_HDM_INTERLEAVE_CAP_3_6_12 BIT(3) | BIT(6) | BIT(12)
> +#define CXL_HDM_INTERLEAVE_CAP_16 BIT(16)
> +
> struct cxl_hdm {
> struct cxl_component_regs regs;
> unsigned int decoder_count;
> unsigned int target_count;
> unsigned int interleave_mask;
> + unsigned long interleave_cap;
> struct cxl_port *port;
> };
>
> +static inline bool valid_interleave_ways(struct cxl_hdm *cxlhdm, u8 iw)
> +{
> + return test_bit(iw, &cxlhdm->interleave_cap);
> +}
I think "test_bit(iw, &cxlhdm->interleave_cap)" is self explanatory, no
need for the valid_interleave_ways() wrapper.
Other than that:
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
next prev parent reply other threads:[~2022-08-12 1:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 23:56 [PATCH v2 0/3] Add sanity check for interleave setup Dave Jiang
2022-08-11 23:56 ` [PATCH v2 1/3] cxl: Add check for result of interleave ways plus granularity combo Dave Jiang
2022-08-12 0:59 ` Dan Williams
2022-08-11 23:57 ` [PATCH v2 2/3] cxl: Add CXL spec v3.0 interleave support Dave Jiang
2022-08-12 1:01 ` Dan Williams [this message]
2022-08-11 23:57 ` [PATCH v2 3/3] tools/testing/cxl: Add interleave check support to mock cxl port device Dave Jiang
2022-08-12 1:02 ` Dan Williams
2022-08-12 3:22 ` [PATCH v2 0/3] Add sanity check for interleave setup Dan Williams
2022-08-16 18:15 ` [PATCH 1/2] cxl: export interleave address mask as port sysfs attribute Dave Jiang
2022-08-16 20:50 ` Dan Williams
2022-08-16 18:15 ` [PATCH 2/2] cxl: export intereleave capability " Dave Jiang
2022-08-16 20:51 ` 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=62f5a684eef9e_3ce68294f1@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.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