From: Alison Schofield <alison.schofield@intel.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Fan Ni <fan.ni@samsung.com>,
Sushant1 Kumar <sushant1.kumar@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Subject: Re: [ndctl PATCH v4 5/9] libcxl: Add Dynamic Capacity region support
Date: Mon, 10 Feb 2025 19:12:36 -0800 [thread overview]
Message-ID: <Z6rAJK_SZuY0BBO9@aschofie-mobl2.lan> (raw)
In-Reply-To: <20241214-dcd-region2-v4-5-36550a97f8e2@intel.com>
On Sat, Dec 14, 2024 at 08:58:32PM -0600, Ira Weiny wrote:
> CXL Dynamic Capacity Devices (DCDs) optionally support dynamic capacity
> with up to eight partitions (Regions) (dc0-dc7). CXL regions can now be
> sparse and defined as dynamic capacity (dc).
>
> Add support for DCD devices and regions to libcxl. Add documentation
> for the new interfaces.
It seems helpers (defined or modified) in this set can be used more.
I gave one example below. Again, I'll catch it on the next rev.
>
> Based on an original patch from Navneet Singh.
>
> Signed-off-by: Sushant1 Kumar <sushant1.kumar@intel.com>
> Co-developed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> ---
> Documentation/cxl/lib/libcxl.txt | 17 ++++++-
> cxl/lib/libcxl.c | 98 ++++++++++++++++++++++++++++++++++++++++
> cxl/lib/libcxl.sym | 3 ++
> cxl/lib/private.h | 4 ++
> cxl/libcxl.h | 52 ++++++++++++++++++++-
> 5 files changed, 171 insertions(+), 3 deletions(-)
snip
> @@ -2275,6 +2305,22 @@ static void *add_cxl_decoder(void *parent, int id, const char *cxldecoder_base)
> decoder->mode = CXL_DECODER_MODE_RAM;
> else if (strcmp(buf, "pmem") == 0)
> decoder->mode = CXL_DECODER_MODE_PMEM;
> + else if (strcmp(buf, "dc0") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC0;
> + else if (strcmp(buf, "dc1") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC1;
> + else if (strcmp(buf, "dc2") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC2;
> + else if (strcmp(buf, "dc3") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC3;
> + else if (strcmp(buf, "dc4") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC4;
> + else if (strcmp(buf, "dc5") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC5;
> + else if (strcmp(buf, "dc6") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC6;
> + else if (strcmp(buf, "dc7") == 0)
> + decoder->mode = CXL_DECODER_MODE_DC7;
> else if (strcmp(buf, "mixed") == 0)
> decoder->mode = CXL_DECODER_MODE_MIXED;
> else if (strcmp(buf, "none") == 0)
If the modes survive, above can be simplified, probably as a separate
function using cxl_region_mode_name(), cxl_decoder_mode_is_dc() to get
to the mode without all those strcmps. Check all the predefined modes
first, then all the dc modes.
snip
> @@ -2592,6 +2648,30 @@ CXL_EXPORT int cxl_decoder_set_mode(struct cxl_decoder *decoder,
> case CXL_DECODER_MODE_RAM:
> sprintf(buf, "ram");
> break;
> + case CXL_DECODER_MODE_DC0:
> + sprintf(buf, "dc0");
> + break;
> + case CXL_DECODER_MODE_DC1:
> + sprintf(buf, "dc1");
> + break;
> + case CXL_DECODER_MODE_DC2:
> + sprintf(buf, "dc2");
> + break;
> + case CXL_DECODER_MODE_DC3:
> + sprintf(buf, "dc3");
> + break;
> + case CXL_DECODER_MODE_DC4:
> + sprintf(buf, "dc4");
> + break;
> + case CXL_DECODER_MODE_DC5:
> + sprintf(buf, "dc5");
> + break;
> + case CXL_DECODER_MODE_DC6:
> + sprintf(buf, "dc6");
> + break;
> + case CXL_DECODER_MODE_DC7:
> + sprintf(buf, "dc7");
> + break;
> default:
> err(ctx, "%s: unsupported mode: %d\n",
> cxl_decoder_get_devname(decoder), mode);
Again, if all these modes survive, this can tidy up like:
@@ -2593,9 +2646,14 @@ CXL_EXPORT int cxl_decoder_set_mode(struct cxl_decoder *decoder,
sprintf(buf, "ram");
break;
default:
- err(ctx, "%s: unsupported mode: %d\n",
- cxl_decoder_get_devname(decoder), mode);
- return -EINVAL;
+ if (cxl_decoder_mode_is_dc(mode)) {
+ sprintf(buf, "dc%d", mode - CXL_DECODER_MODE_DC0);
+ } else {
+ err(ctx, "%s: unsupported mode: %d\n",
+ cxl_decoder_get_devname(decoder), mode);
+ return -EINVAL;
+ }
+ break;
}
snip to end.
next prev parent reply other threads:[~2025-02-11 3:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-15 2:58 [ndctl PATCH v4 0/9] ndctl: Dynamic Capacity additions for cxl-cli Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 1/9] ndctl/cxl-events: Don't fail test until event counts are reported Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 2/9] ndctl/cxl/region: Report max size for region creation Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 3/9] libcxl: Separate region mode from decoder mode Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 4/9] cxl/region: Use new region mode in cxl-cli Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 5/9] libcxl: Add Dynamic Capacity region support Ira Weiny
2025-02-11 3:12 ` Alison Schofield [this message]
2024-12-15 2:58 ` [ndctl PATCH v4 6/9] cxl/region: Add cxl-cli support for DCD regions Ira Weiny
2025-02-11 3:21 ` Alison Schofield
2024-12-15 2:58 ` [ndctl PATCH v4 7/9] libcxl: Add extent functionality to DC regions Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 8/9] cxl/region: Add extent output to region query Ira Weiny
2025-02-11 3:24 ` Alison Schofield
2025-02-12 22:03 ` Ira Weiny
2024-12-15 2:58 ` [ndctl PATCH v4 9/9] cxl/test: Add Dynamic Capacity tests Ira Weiny
2025-02-11 3:33 ` Alison Schofield
2025-02-11 2:47 ` [ndctl PATCH v4 0/9] ndctl: Dynamic Capacity additions for cxl-cli Alison Schofield
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=Z6rAJK_SZuY0BBO9@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=fan.ni@samsung.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=sushant1.kumar@intel.com \
--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