From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Jiang, Dave" <dave.jiang@intel.com>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Subject: Re: [PATCH 3/4] ndctl/libndctl: Add retrieving of unique_id for cxl mem dev
Date: Tue, 13 Dec 2022 23:14:56 +0000 [thread overview]
Message-ID: <6bee8295626b1fd3e8d2fe87822e0dc7715a14e9.camel@intel.com> (raw)
In-Reply-To: <166379417347.433612.4934530706825880453.stgit@djiang5-desk3.ch.intel.com>
Also s/cxl/CXL/On Wed, 2022-09-21 at 14:02 -0700, Dave Jiang wrote:
> Subject: [PATCH 3/4] ndctl/libndctl: Add retrieving of unique_id for cxl mem dev
"Allow retrieving" or just "Retrieve unique_id for.."
> With bus_prefix, retrieve the unique_id of cxl mem device. This will
> allow selecting a specific cxl mem device for the security test code.
Also s/cxl/CXL/
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> ndctl/lib/libndctl.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index d2e800bc840a..c569178b9a3a 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -1749,6 +1749,33 @@ NDCTL_EXPORT void ndctl_dimm_refresh_flags(struct ndctl_dimm *dimm)
> parse_papr_flags(dimm, buf);
> }
>
> +static int populate_cxl_dimm_attributes(struct ndctl_dimm *dimm,
> + const char *dimm_base)
> +{
> + int rc = 0;
> + char buf[SYSFS_ATTR_SIZE];
> + struct ndctl_ctx *ctx = dimm->bus->ctx;
> + char *path = calloc(1, strlen(dimm_base) + 100);
> + const char *bus_prefix = dimm->bus_prefix;
> +
> + if (!path)
> + return -ENOMEM;
> +
> + sprintf(path, "%s/%s/id", dimm_base, bus_prefix);
> + if (sysfs_read_attr(ctx, path, buf) == 0) {
> + dimm->unique_id = strdup(buf);
> + if (!dimm->unique_id) {
> + rc = -ENOMEM;
> + goto err_read;
> + }
> + }
> +
> + err_read:
> +
> + free(path);
> + return rc;
> +}
> +
> static int populate_dimm_attributes(struct ndctl_dimm *dimm,
> const char *dimm_base)
> {
> @@ -2018,6 +2045,7 @@ static void *add_dimm(void *parent, int id, const char *dimm_base)
> rc = -ENOMEM;
> goto out;
> }
> + rc = populate_cxl_dimm_attributes(dimm, dimm_base);
> }
>
> if (rc == -ENODEV) {
>
>
next prev parent reply other threads:[~2022-12-13 23:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 21:02 [PATCH 0/4] ndctl: Add security test for cxl devices through nvdimm Dave Jiang
2022-09-21 21:02 ` [PATCH 1/4] ndctl: add cxl bus detection Dave Jiang
2022-12-13 23:07 ` Verma, Vishal L
2022-12-14 2:40 ` Alison Schofield
2022-09-21 21:02 ` [PATCH 2/4] ndctl/libndctl: Add bus_prefix for cxl Dave Jiang
2022-12-13 23:10 ` Verma, Vishal L
2022-09-21 21:02 ` [PATCH 3/4] ndctl/libndctl: Add retrieving of unique_id for cxl mem dev Dave Jiang
2022-12-13 23:14 ` Verma, Vishal L [this message]
2022-09-21 21:02 ` [PATCH 4/4] ndctl/test: Add CXL test for security Dave Jiang
2022-12-13 23:22 ` Verma, Vishal L
2022-12-14 1:02 ` 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=6bee8295626b1fd3e8d2fe87822e0dc7715a14e9.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
/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