Linux CXL
 help / color / mirror / Atom feed
From: Ben Widawsky <ben.widawsky@intel.com>
To: linux-cxl@vger.kernel.org
Cc: patches@lists.linux.dev, Ben Widawsky <ben.widawsky@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Jonathan Cameron <Jonathan.Cameron@Huawei.com>,
	Vishal Verma <vishal.l.verma@intel.com>
Subject: [PATCH 2/4] cxl/core: Add more decoder attributes to sysfs
Date: Thu, 27 Jan 2022 13:29:09 -0800	[thread overview]
Message-ID: <20220127212911.127741-3-ben.widawsky@intel.com> (raw)
In-Reply-To: <20220127212911.127741-1-ben.widawsky@intel.com>

The decoder attributes are consumed by userspace in order to program and
verify the CXL topology.

An example of the new attributes is with x1 and 8192 granularity:
archlinux ~ # cat /sys/bus/cxl/devices/decoder0.0/interleave_{ways,granularity}
1
8192

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
 drivers/cxl/core/port.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index f49783d8c845..631dec0fa79e 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -99,6 +99,25 @@ static ssize_t size_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(size);
 
+static ssize_t interleave_ways_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
+{
+	struct cxl_decoder *cxld = to_cxl_decoder(dev);
+
+	return sysfs_emit(buf, "%d\n", cxld->interleave_ways);
+}
+static DEVICE_ATTR_RO(interleave_ways);
+
+static ssize_t interleave_granularity_show(struct device *dev,
+					   struct device_attribute *attr,
+					   char *buf)
+{
+	struct cxl_decoder *cxld = to_cxl_decoder(dev);
+
+	return sysfs_emit(buf, "%d\n", cxld->interleave_granularity);
+}
+static DEVICE_ATTR_RO(interleave_granularity);
+
 #define CXL_DECODER_FLAG_ATTR(name, flag)                            \
 static ssize_t name##_show(struct device *dev,                       \
 			   struct device_attribute *attr, char *buf) \
@@ -186,6 +205,8 @@ static struct attribute *cxl_decoder_base_attrs[] = {
 	&dev_attr_start.attr,
 	&dev_attr_size.attr,
 	&dev_attr_locked.attr,
+	&dev_attr_interleave_ways.attr,
+	&dev_attr_interleave_granularity.attr,
 	NULL,
 };
 
-- 
2.35.0


  parent reply	other threads:[~2022-01-27 21:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 21:29 [PATCH 0/4] Unify meaning of interleave attributes Ben Widawsky
2022-01-27 21:29 ` [PATCH 1/4] cxl/acpi: Store interleave granularity absolutely Ben Widawsky
2022-01-27 22:46   ` Dan Williams
2022-01-27 21:29 ` Ben Widawsky [this message]
2022-01-27 22:45   ` [PATCH 2/4] cxl/core: Add more decoder attributes to sysfs Dan Williams
2022-01-27 21:29 ` [PATCH 3/4] cxl/core: Extract IW/IG decoding Ben Widawsky
2022-01-27 23:01   ` Dan Williams
2022-01-27 21:29 ` [PATCH 4/4] cxl/acpi: Use common " Ben Widawsky
2022-01-28 10:15 ` [PATCH 0/4] Unify meaning of interleave attributes 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=20220127212911.127741-3-ben.widawsky@intel.com \
    --to=ben.widawsky@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=patches@lists.linux.dev \
    --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