From: Ben Widawsky <ben.widawsky@intel.com>
To: linux-cxl@vger.kernel.org
Cc: 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: [RFC PATCH 2/4] cxl/region: Create attribute structure / verify
Date: Thu, 10 Jun 2021 11:57:23 -0700 [thread overview]
Message-ID: <20210610185725.897541-3-ben.widawsky@intel.com> (raw)
In-Reply-To: <20210610185725.897541-1-ben.widawsky@intel.com>
Introduce a verification mechanism for a region. Regions have complex
configuration requirements and it is beneficial to provide a way to
verify the constraints are met before trying to bind. Primarily it adds
ABI to inform userspace of more detailed information about what failed
rather than the limited choices of errno at bind time.
It's important to point out that a verified region can still fail to
bind, but the first step in binding will be to run the same verification
algorithm.
Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
--
Functionally it might make sense to squash this patch in with other
patches adding attributes. From a discussion standpoint however, it's
nice to have this broken out as I suspect there might be some debate
about it.
---
Documentation/ABI/testing/sysfs-bus-cxl | 13 +++++++++++++
drivers/cxl/region.c | 22 +++++++++++++++++++++-
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl
index 5bcbefd4ea38..699c8514fd7b 100644
--- a/Documentation/ABI/testing/sysfs-bus-cxl
+++ b/Documentation/ABI/testing/sysfs-bus-cxl
@@ -146,3 +146,16 @@ Contact: linux-cxl@vger.kernel.org
Description:
Deletes the named region. A region must be unbound from the
region driver before being deleted.
+
+What: /sys/bus/cxl/devices/decoderX.Y/regionX.Y:Z/verify
+Date: June, 2021
+KernelVersion: v5.14
+Contact: linux-cxl@vger.kernel.org
+Description:
+ Instructs the kernel to verify that the regionX.Y:Z is properly
+ configured and provide more detailed information about
+ configuration errors. A value of 0 indicates the region is
+ properly configured and ready to bind, otherwise a negative
+ integer is returned describing the first error found in the
+ configuration. A verified region can still fail binding due to
+ lack of resources.
diff --git a/drivers/cxl/region.c b/drivers/cxl/region.c
index 1f47bc17bd50..ea1ac848c713 100644
--- a/drivers/cxl/region.c
+++ b/drivers/cxl/region.c
@@ -20,11 +20,31 @@
* relationship between decoder and region when the region is interleaved.
*/
-static void cxl_region_release(struct device *dev);
+static ssize_t verify_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "0");
+}
+
+static DEVICE_ATTR_RO(verify);
+
+static struct attribute *region_attrs[] = {
+ &dev_attr_verify.attr,
+ NULL,
+};
+static const struct attribute_group region_group = {
+ .attrs = region_attrs,
+};
+
+static const struct attribute_group *region_groups[] = {
+ ®ion_group,
+};
+
+static void cxl_region_release(struct device *dev);
static const struct device_type cxl_region_type = {
.name = "cxl_region",
.release = cxl_region_release,
+ .groups = region_groups,
};
static struct cxl_region *to_cxl_region(struct device *dev)
--
2.32.0
next prev parent reply other threads:[~2021-06-10 18:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 18:57 [RFC PATCH 0/4] Region Creation Ben Widawsky
2021-06-10 18:57 ` [RFC PATCH 1/4] cxl/region: Add region creation ABI Ben Widawsky
2021-06-11 13:31 ` Jonathan Cameron
2021-06-16 17:38 ` Ben Widawsky
2021-06-10 18:57 ` Ben Widawsky [this message]
2021-06-11 13:37 ` [RFC PATCH 2/4] cxl/region: Create attribute structure / verify Jonathan Cameron
2021-06-12 0:59 ` Dan Williams
2021-06-14 16:12 ` Ben Widawsky
2021-06-10 18:57 ` [RFC PATCH 3/4] cxl: Move cxl_memdev conversion helper to mem.h Ben Widawsky
2021-06-10 18:57 ` [RFC PATCH 4/4] cxl/region: Introduce concept of region configuration Ben Widawsky
2021-06-11 13:52 ` Jonathan Cameron
2021-06-14 16:18 ` Ben Widawsky
2021-06-14 16:20 ` Jonathan Cameron
2021-06-11 13:11 ` [RFC PATCH 0/4] Region Creation Jonathan Cameron
2021-06-11 13:53 ` Jonathan Cameron
2021-06-11 16:12 ` Ben Widawsky
2021-06-12 0:44 ` Dan Williams
2021-06-14 8:20 ` Jonathan Cameron
2021-06-14 16:12 ` Ben Widawsky
2021-06-14 21:04 ` Dan Williams
2021-06-14 21:54 ` Ben Widawsky
2021-06-14 22:21 ` 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=20210610185725.897541-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=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;
as well as URLs for NNTP newsgroup(s).