From: Alison Schofield <alison.schofield@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: vishal.l.verma@intel.com, linux-cxl@vger.kernel.org
Subject: Re: [NDCTL PATCH 1/3] ndctl: Add QTG ID support for the root decoder
Date: Thu, 20 Apr 2023 09:05:51 -0700 [thread overview]
Message-ID: <ZEFi38e2OTg1flyj@aschofie-mobl2> (raw)
In-Reply-To: <168149418140.4013891.18368466862769013304.stgit@djiang5-mobl3>
On Fri, Apr 14, 2023 at 10:43:01AM -0700, Dave Jiang wrote:
> Add libcxl API to retrieve the QoS Throttling Group (QTG) ID for the root
> decoder. Also add support to display the QTG ID for the root decoder
> through the 'cxl list' command.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> cxl/json.c | 10 ++++++++++
> cxl/lib/libcxl.c | 11 +++++++++++
> cxl/lib/libcxl.sym | 1 +
> cxl/lib/private.h | 1 +
> cxl/libcxl.h | 3 +++
> 5 files changed, 26 insertions(+)
>
> diff --git a/cxl/json.c b/cxl/json.c
> index e87bdd49a776..8dd65f942c6a 100644
> --- a/cxl/json.c
> +++ b/cxl/json.c
> @@ -760,6 +760,16 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
> jobj);
> }
>
> + if (cxl_port_is_root(port)) {
> + int qtg_id = cxl_decoder_get_qtg_id(decoder);
> +
> + if (qtg_id != CXL_QTG_ID_NONE) {
> + jobj = json_object_new_int(qtg_id);
> + if (jobj)
> + json_object_object_add(jdecoder, "qtg_id", jobj);
> + }
> + }
IIUC,
- root decoders don't always have a valid qtg_id, and the field is
omitted from the listing in that case.
- memdev's (next patch) always have a valid (not -1) qtg_id.
I guess it's customary, in cxl list, to not display empty fields.
Well, that was my question and I think I answered it ;)
Alison
> +
> json_object_set_userdata(jdecoder, decoder, NULL);
> return jdecoder;
> }
> diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
> index 59e5bdbcc750..26985c9344b4 100644
> --- a/cxl/lib/libcxl.c
> +++ b/cxl/lib/libcxl.c
> @@ -1879,6 +1879,12 @@ static void *add_cxl_decoder(void *parent, int id, const char *cxldecoder_base)
> else
> decoder->interleave_ways = strtoul(buf, NULL, 0);
>
> + sprintf(path, "%s/qtg_id", cxldecoder_base);
> + if (sysfs_read_attr(ctx, path, buf) < 0)
> + decoder->qtg_id = CXL_QTG_ID_NONE;
> + else
> + decoder->qtg_id = atoi(buf);
> +
> switch (port->type) {
> case CXL_PORT_ENDPOINT:
> sprintf(path, "%s/dpa_resource", cxldecoder_base);
> @@ -2073,6 +2079,11 @@ CXL_EXPORT unsigned long long cxl_decoder_get_size(struct cxl_decoder *decoder)
> return decoder->size;
> }
>
> +CXL_EXPORT int cxl_decoder_get_qtg_id(struct cxl_decoder *decoder)
> +{
> + return decoder->qtg_id;
> +}
> +
> CXL_EXPORT unsigned long long
> cxl_decoder_get_dpa_resource(struct cxl_decoder *decoder)
> {
> diff --git a/cxl/lib/libcxl.sym b/cxl/lib/libcxl.sym
> index 1c6177c7dcae..d1c61f9252fe 100644
> --- a/cxl/lib/libcxl.sym
> +++ b/cxl/lib/libcxl.sym
> @@ -248,4 +248,5 @@ global:
> cxl_region_get_mode;
> cxl_decoder_create_ram_region;
> cxl_region_get_daxctl_region;
> + cxl_decoder_get_qtg_id;
> } LIBCXL_4;
> diff --git a/cxl/lib/private.h b/cxl/lib/private.h
> index d648992b808d..ac6f111b5956 100644
> --- a/cxl/lib/private.h
> +++ b/cxl/lib/private.h
> @@ -126,6 +126,7 @@ struct cxl_decoder {
> struct list_head targets;
> struct list_head regions;
> struct list_head stale_regions;
> + int qtg_id;
> };
>
> enum cxl_decode_state {
> diff --git a/cxl/libcxl.h b/cxl/libcxl.h
> index 54d9f10537dd..66ce4a021c62 100644
> --- a/cxl/libcxl.h
> +++ b/cxl/libcxl.h
> @@ -135,6 +135,8 @@ struct cxl_dport *cxl_port_get_dport_by_memdev(struct cxl_port *port,
> for (dport = cxl_dport_get_first(port); dport != NULL; \
> dport = cxl_dport_get_next(dport))
>
> +#define CXL_QTG_ID_NONE -1
> +
> struct cxl_decoder;
> struct cxl_decoder *cxl_decoder_get_first(struct cxl_port *port);
> struct cxl_decoder *cxl_decoder_get_next(struct cxl_decoder *decoder);
> @@ -146,6 +148,7 @@ unsigned long long cxl_decoder_get_dpa_resource(struct cxl_decoder *decoder);
> unsigned long long cxl_decoder_get_dpa_size(struct cxl_decoder *decoder);
> unsigned long long
> cxl_decoder_get_max_available_extent(struct cxl_decoder *decoder);
> +int cxl_decoder_get_qtg_id(struct cxl_decoder *decoder);
>
> enum cxl_decoder_mode {
> CXL_DECODER_MODE_NONE,
>
>
next prev parent reply other threads:[~2023-04-20 16:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 17:42 [NDCTL PATCH 0/3] ndctl: Add support of QoS Throttling Group (QTG) id for CXL CLI Dave Jiang
2023-04-14 17:43 ` [NDCTL PATCH 1/3] ndctl: Add QTG ID support for the root decoder Dave Jiang
2023-04-20 16:05 ` Alison Schofield [this message]
2023-04-14 17:43 ` [NDCTL PATCH 2/3] ndctl: Add QTG ID support for the memory device Dave Jiang
2023-04-14 17:43 ` [NDCTL PATCH 3/3] ndctl: add QTG ID check for region creation Dave Jiang
2023-04-14 21:49 ` [NDCTL PATCH 0/3] ndctl: Add support of QoS Throttling Group (QTG) id for CXL CLI Alison Schofield
2023-04-14 23:27 ` Dave Jiang
2023-04-20 16:15 ` 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=ZEFi38e2OTg1flyj@aschofie-mobl2 \
--to=alison.schofield@intel.com \
--cc=dave.jiang@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