From: Dave Jiang <dave.jiang@intel.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: linux-cxl@vger.kernel.org, dan.j.williams@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com,
alison.schofield@intel.com
Subject: Re: [PATCH v4 2/6] cxl: Add CXL spec v3.0 interleave support
Date: Wed, 24 Aug 2022 14:04:37 -0700 [thread overview]
Message-ID: <8e7c43b6-1fd2-8010-d64f-00c713f44212@intel.com> (raw)
In-Reply-To: <20220824155624.000079ea@huawei.com>
On 8/24/2022 7:56 AM, Jonathan Cameron wrote:
> On Wed, 17 Aug 2022 14:21:48 -0700
> Dave Jiang <dave.jiang@intel.com> 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
> Whilst looking at mocking patch, I noticed there isn't a cxl_interleave_verify()
> renamed? Looks like that was in v2 from your change log.
I need to fixup the commit headers all to cxl_interleave_capable().
Forgot about that.
>
>> in interleave value.
>>
>> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>> drivers/cxl/core/hdm.c | 6 ++++++
>> drivers/cxl/core/region.c | 3 +++
>> drivers/cxl/cxl.h | 2 ++
>> drivers/cxl/cxlmem.h | 5 +++++
>> 4 files changed, 16 insertions(+)
>>
>> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
>> index d1d2caea5c62..2f91ff9b0227 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/core/region.c b/drivers/cxl/core/region.c
>> index 28272b0196e6..9851ab2782f2 100644
>> --- a/drivers/cxl/core/region.c
>> +++ b/drivers/cxl/core/region.c
>> @@ -960,6 +960,9 @@ static int cxl_interleave_capable(struct cxl_port *port, struct device *dev,
>> if (eiw == 0)
>> return 0;
>>
>> + if (!test_bit(ways, &cxlhdm->interleave_cap))
>> + return -EINVAL;
>> +
>> if (is_power_of_2(eiw))
>> addr_mask = GENMASK(eig + 8 + eiw - 1, eig + 8);
>> else
>> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
>> index f680450f0b16..11f2a14f42eb 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 88e3a8e54b6a..4e65c9cc1d30 100644
>> --- a/drivers/cxl/cxlmem.h
>> +++ b/drivers/cxl/cxlmem.h
>> @@ -393,11 +393,16 @@ 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;
>> };
>>
>>
>>
next prev parent reply other threads:[~2022-08-24 21:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 21:21 [PATCH v4 0/6] Add sanity check for interleave setup Dave Jiang
2022-08-17 21:21 ` [PATCH v4 1/6] cxl: Add check for result of interleave ways plus granularity combo Dave Jiang
2022-08-17 21:21 ` [PATCH v4 2/6] cxl: Add CXL spec v3.0 interleave support Dave Jiang
2022-08-24 14:46 ` Jonathan Cameron
2022-08-24 21:03 ` Dave Jiang
2022-08-24 14:56 ` Jonathan Cameron
2022-08-24 21:04 ` Dave Jiang [this message]
2022-08-17 21:21 ` [PATCH v4 3/6] tools/testing/cxl: Add interleave check support to mock cxl port device Dave Jiang
2022-08-24 14:59 ` Jonathan Cameron
2022-08-24 21:13 ` Dave Jiang
2022-08-17 21:21 ` [PATCH v4 4/6] cxl: change cxl_port_attribute_groups naming to avoid confusion Dave Jiang
2022-08-24 14:48 ` Jonathan Cameron
2022-08-17 21:22 ` [PATCH v4 5/6] cxl: export interleave address mask as port sysfs attribute Dave Jiang
2022-08-24 14:34 ` Jonathan Cameron
2022-08-17 21:22 ` [PATCH v4 6/6] cxl: export intereleave capability " Dave Jiang
2022-08-24 14:28 ` Jonathan Cameron
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=8e7c43b6-1fd2-8010-d64f-00c713f44212@intel.com \
--to=dave.jiang@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@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