* [PATCH] cxl: Add committed sysfs attribute to CXL decoder
@ 2023-09-25 18:05 Dave Jiang
2023-09-26 11:07 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2023-09-25 18:05 UTC (permalink / raw)
To: linux-cxl
Cc: dave, jonathan.cameron, alison.schofield, vishal.l.verma,
ira.weiny, dan.j.williams
Expose the committed status of a CXL decoder. The status assists CXL CLI in
determining as a sure way whether a region is active. Of coruse this is
still best effort as it's a snapshot of the state and not atomic for the
user region disable operation.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
Documentation/ABI/testing/sysfs-bus-cxl | 7 +++++++
drivers/cxl/core/port.c | 11 +++++++++++
2 files changed, 18 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl
index 087f762ebfd5..ef3fc9fe9d0d 100644
--- a/Documentation/ABI/testing/sysfs-bus-cxl
+++ b/Documentation/ABI/testing/sysfs-bus-cxl
@@ -369,6 +369,13 @@ Description:
provided it is currently idle / not bound to a driver.
+What: /sys/bus/cxl/devices/decoderX.Y/committed
+Date: Sep, 2023
+KernelVersion: v6.7
+Contact: linux-cxl@vger.kernel.org
+Description:
+ (RO) Indicates whether the decoder is committed.
+
What: /sys/bus/cxl/devices/regionZ/uuid
Date: May, 2022
KernelVersion: v6.0
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 724be8448eb4..ab5b9bc26d56 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -277,12 +277,23 @@ static ssize_t interleave_ways_show(struct device *dev,
static DEVICE_ATTR_RO(interleave_ways);
+static ssize_t committed_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->flags & CXL_DECODER_F_ENABLE));
+}
+
+static DEVICE_ATTR_RO(committed);
+
static struct attribute *cxl_decoder_base_attrs[] = {
&dev_attr_start.attr,
&dev_attr_size.attr,
&dev_attr_locked.attr,
&dev_attr_interleave_granularity.attr,
&dev_attr_interleave_ways.attr,
+ &dev_attr_committed.attr,
NULL,
};
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] cxl: Add committed sysfs attribute to CXL decoder
2023-09-25 18:05 [PATCH] cxl: Add committed sysfs attribute to CXL decoder Dave Jiang
@ 2023-09-26 11:07 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2023-09-26 11:07 UTC (permalink / raw)
To: Dave Jiang
Cc: linux-cxl, dave, alison.schofield, vishal.l.verma, ira.weiny,
dan.j.williams
On Mon, 25 Sep 2023 11:05:56 -0700
Dave Jiang <dave.jiang@intel.com> wrote:
> Expose the committed status of a CXL decoder. The status assists CXL CLI in
> determining as a sure way whether a region is active. Of coruse this is
Spell check.
> still best effort as it's a snapshot of the state and not atomic for the
> user region disable operation.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
One passing comment inline.
Seems reasonable to me.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> Documentation/ABI/testing/sysfs-bus-cxl | 7 +++++++
> drivers/cxl/core/port.c | 11 +++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl
> index 087f762ebfd5..ef3fc9fe9d0d 100644
> --- a/Documentation/ABI/testing/sysfs-bus-cxl
> +++ b/Documentation/ABI/testing/sysfs-bus-cxl
> @@ -369,6 +369,13 @@ Description:
> provided it is currently idle / not bound to a driver.
>
>
> +What: /sys/bus/cxl/devices/decoderX.Y/committed
> +Date: Sep, 2023
> +KernelVersion: v6.7
> +Contact: linux-cxl@vger.kernel.org
> +Description:
> + (RO) Indicates whether the decoder is committed.
> +
> What: /sys/bus/cxl/devices/regionZ/uuid
> Date: May, 2022
> KernelVersion: v6.0
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index 724be8448eb4..ab5b9bc26d56 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -277,12 +277,23 @@ static ssize_t interleave_ways_show(struct device *dev,
>
> static DEVICE_ATTR_RO(interleave_ways);
>
> +static ssize_t committed_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->flags & CXL_DECODER_F_ENABLE));
Could use FIELD_GET() though as it's not been used for these
before that I could quickly find, fair enough to maintain
consistent style
> +}
> +
> +static DEVICE_ATTR_RO(committed);
> +
> static struct attribute *cxl_decoder_base_attrs[] = {
> &dev_attr_start.attr,
> &dev_attr_size.attr,
> &dev_attr_locked.attr,
> &dev_attr_interleave_granularity.attr,
> &dev_attr_interleave_ways.attr,
> + &dev_attr_committed.attr,
> NULL,
> };
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-26 11:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 18:05 [PATCH] cxl: Add committed sysfs attribute to CXL decoder Dave Jiang
2023-09-26 11:07 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox