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>
Subject: RE: [PATCH 1/2] cxl: export interleave address mask as port sysfs attribute
Date: Tue, 16 Aug 2022 13:50:44 -0700 [thread overview]
Message-ID: <62fc0323f1d91_f2f51294cf@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <166067375099.1614719.8244364251253955254.stgit@djiang5-desk4.jf.intel.com>
Dave Jiang wrote:
> Export the interleave address mask as a sysfs attribute for a port. The
> interleave address mask is created based off the CXL HDM Decoder Capability
> Register (CXL spec v3 8.2.4.19.1) and sets the bits indicated by th "A11to8
> Interleave Capable" bit and the "A14to12 Interleave Capable" bit. It
> indicates the decoder supports interleaveing based on those address bits.
> The exported sysfs attribute will help user region creation to do more valid
> configuration checking.
>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/cxl/port.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
This also needs updates to:
Documentation/driver-api/cxl/memory-devices.rst
>
> diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c
> index 5453771bf330..e3e93e1b663e 100644
> --- a/drivers/cxl/port.c
> +++ b/drivers/cxl/port.c
> @@ -123,8 +123,30 @@ static struct attribute_group cxl_cdat_attribute_group = {
> .is_bin_visible = cxl_port_bin_attr_is_visible,
> };
>
> +static ssize_t interleave_mask_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct cxl_hdm *cxlhdm = dev_get_drvdata(dev);
> +
> + if (!cxlhdm)
> + return 0;
Given that this is an attribute in 'struct device_driver'.dev_groups it
is guaranteed to only be visible while the device is successfully
attached to its driver. So this check is not necessary.
> +
> + return sysfs_emit(buf, "%#x\n", cxlhdm->interleave_mask);
> +}
> +static DEVICE_ATTR_RO(interleave_mask);
> +
> +static struct attribute *cxl_port_info_attributes[] = {
> + &dev_attr_interleave_mask.attr,
> + NULL,
> +};
> +
> +static struct attribute_group cxl_port_info_attribute_group = {
> + .attrs = cxl_port_info_attributes,
> +};
> +
> static const struct attribute_group *cxl_port_attribute_groups[] = {
Lets do a lead in patch to rename this to avoid the confusion with the
static port attributes in the core:
s/cxl_port_attribute_groups/cxl_port_dynamic_attr_groups/
next prev parent reply other threads:[~2022-08-16 20:50 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
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 [this message]
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=62fc0323f1d91_f2f51294cf@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.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