linux-cxl.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-cxl@vger.kernel.org
Cc: vishal.l.verma@intel.com, dave.jiang@intel.com,
	ira.weiny@intel.com, alison.schofield@intel.com
Subject: [ndctl PATCH 4/6] cxl/list: Filter decoders by region
Date: Fri, 05 Aug 2022 13:38:14 -0700	[thread overview]
Message-ID: <165973189465.1528532.9072953032089147905.stgit@dwillia2-xfh.jf.intel.com> (raw)
In-Reply-To: <165973187080.1528532.8097010788284626448.stgit@dwillia2-xfh.jf.intel.com>

With a region name in hand, it is useful to be able to filter all the
decoders in the topology that are mapping that region.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 cxl/filter.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/cxl/filter.c b/cxl/filter.c
index 38ece5528794..9a3de8c75387 100644
--- a/cxl/filter.c
+++ b/cxl/filter.c
@@ -652,6 +652,26 @@ struct cxl_region *util_cxl_region_filter(struct cxl_region *region,
 
 }
 
+static struct cxl_decoder *
+util_cxl_decoder_filter_by_region(struct cxl_decoder *decoder,
+				  const char *__ident)
+{
+	struct cxl_region *region;
+
+	if (!__ident)
+		return decoder;
+
+	region = cxl_decoder_get_region(decoder);
+	if (!region)
+		return NULL;
+
+	region = util_cxl_region_filter(region, __ident);
+	if (!region)
+		return NULL;
+
+	return decoder;
+}
+
 static unsigned long params_to_flags(struct cxl_filter_params *param)
 {
 	unsigned long flags = 0;
@@ -790,6 +810,9 @@ static void walk_decoders(struct cxl_port *port, struct cxl_filter_params *p,
 		if (!util_cxl_decoder_filter_by_memdev(
 			    decoder, p->memdev_filter, p->serial_filter))
 			goto walk_children;
+		if (!util_cxl_decoder_filter_by_region(decoder,
+						       p->region_filter))
+			goto walk_children;
 		if (!p->idle && cxl_decoder_get_size(decoder) == 0)
 			continue;
 		jdecoder = util_cxl_decoder_to_json(decoder, flags);


  parent reply	other threads:[~2022-08-05 20:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 20:37 [ndctl PATCH 0/6] cxl/test: Add more region ABI validation Dan Williams
2022-08-05 20:37 ` [ndctl PATCH 1/6] cxl/test: Validate endpoint interleave geometry Dan Williams
2022-08-05 20:38 ` [ndctl PATCH 2/6] cxl/list: Add interleave parameters to decoder listings Dan Williams
2022-08-05 20:38 ` [ndctl PATCH 3/6] cxl/list: Add region " Dan Williams
2022-08-05 20:38 ` Dan Williams [this message]
2022-08-05 20:38 ` [ndctl PATCH 5/6] cxl/list: Add 'depth' to port listings Dan Williams
2022-08-05 20:38 ` [ndctl PATCH 6/6] cxl/test: Validate switch port settings in cxl-region-sysfs.sh Dan Williams
2022-09-20 21:19 ` [ndctl PATCH 0/6] cxl/test: Add more region ABI validation Dave Jiang

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=165973189465.1528532.9072953032089147905.stgit@dwillia2-xfh.jf.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@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).