|
|
2eb93d |
From b4262c8e65a4f5aa931b5451535084297968949d Mon Sep 17 00:00:00 2001
|
|
|
2eb93d |
From: Dan Williams <dan.j.williams@intel.com>
|
|
|
2eb93d |
Date: Thu, 14 Jul 2022 10:01:58 -0700
|
|
|
2eb93d |
Subject: [PATCH 176/217] cxl/list: Emit endpoint decoders filtered by memdev
|
|
|
2eb93d |
|
|
|
2eb93d |
For example, dump all the endpoint decoders from memdev 'mem8'.
|
|
|
2eb93d |
|
|
|
2eb93d |
cxl list -Di -m 8 -d endpoint
|
|
|
2eb93d |
|
|
|
2eb93d |
Link: https://lore.kernel.org/r/165781811836.1555691.1997564050287016121.stgit@dwillia2-xfh.jf.intel.com
|
|
|
2eb93d |
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
|
|
2eb93d |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
|
2eb93d |
---
|
|
|
2eb93d |
cxl/filter.c | 8 ++++++++
|
|
|
2eb93d |
1 file changed, 8 insertions(+)
|
|
|
2eb93d |
|
|
|
2eb93d |
diff --git a/cxl/filter.c b/cxl/filter.c
|
|
|
2eb93d |
index 66fd742..2f88a9d 100644
|
|
|
2eb93d |
--- a/cxl/filter.c
|
|
|
2eb93d |
+++ b/cxl/filter.c
|
|
|
2eb93d |
@@ -428,7 +428,9 @@ util_cxl_decoder_filter_by_memdev(struct cxl_decoder *decoder,
|
|
|
2eb93d |
const char *ident, const char *serial)
|
|
|
2eb93d |
{
|
|
|
2eb93d |
struct cxl_ctx *ctx = cxl_decoder_get_ctx(decoder);
|
|
|
2eb93d |
+ struct cxl_endpoint *endpoint;
|
|
|
2eb93d |
struct cxl_memdev *memdev;
|
|
|
2eb93d |
+ struct cxl_port *port;
|
|
|
2eb93d |
|
|
|
2eb93d |
if (!ident && !serial)
|
|
|
2eb93d |
return decoder;
|
|
|
2eb93d |
@@ -438,6 +440,12 @@ util_cxl_decoder_filter_by_memdev(struct cxl_decoder *decoder,
|
|
|
2eb93d |
continue;
|
|
|
2eb93d |
if (cxl_decoder_get_target_by_memdev(decoder, memdev))
|
|
|
2eb93d |
return decoder;
|
|
|
2eb93d |
+ port = cxl_decoder_get_port(decoder);
|
|
|
2eb93d |
+ if (!port || !cxl_port_is_endpoint(port))
|
|
|
2eb93d |
+ continue;
|
|
|
2eb93d |
+ endpoint = cxl_port_to_endpoint(port);
|
|
|
2eb93d |
+ if (cxl_endpoint_get_memdev(endpoint) == memdev)
|
|
|
2eb93d |
+ return decoder;
|
|
|
2eb93d |
}
|
|
|
2eb93d |
|
|
|
2eb93d |
return NULL;
|
|
|
2eb93d |
--
|
|
|
2eb93d |
2.27.0
|
|
|
2eb93d |
|