nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [NDCTL PATCH v2 1/2] cxl: Save the number of decoders committed to a port
@ 2023-11-28 20:43 Dave Jiang
  2023-11-28 20:43 ` [NDCTL PATCH v2 2/2] cxl: Add check for regions before disabling memdev Dave Jiang
  0 siblings, 1 reply; 18+ messages in thread
From: Dave Jiang @ 2023-11-28 20:43 UTC (permalink / raw)
  To: linux-cxl, nvdimm; +Cc: vishal.l.verma, alison.schofield, caoqq

Save the number of decoders committed to a port exposed by the kernel to the
libcxl cxl_port context. The attribute is helpful for determing if a region is
active.  Add libcxl API to retrieve the number of decoders committed.
Add the decoders_committed attribute to the port for cxl list command.

Link: https://lore.kernel.org/linux-cxl/169645700414.623072.3893376765415910289.stgit@djiang5-mobl3/T/#t
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
v2:
- Rebase against latest pending branch
---
 Documentation/cxl/lib/libcxl.txt |    1 +
 cxl/json.c                       |    4 ++++
 cxl/lib/libcxl.c                 |    9 +++++++++
 cxl/lib/libcxl.sym               |    1 +
 cxl/lib/private.h                |    1 +
 cxl/libcxl.h                     |    1 +
 6 files changed, 17 insertions(+)

diff --git a/Documentation/cxl/lib/libcxl.txt b/Documentation/cxl/lib/libcxl.txt
index bcb89288afaf..93c32b54f19e 100644
--- a/Documentation/cxl/lib/libcxl.txt
+++ b/Documentation/cxl/lib/libcxl.txt
@@ -295,6 +295,7 @@ bool cxl_port_is_endpoint(struct cxl_port *port);
 int cxl_port_get_depth(struct cxl_port *port);
 bool cxl_port_hosts_memdev(struct cxl_port *port, struct cxl_memdev *memdev);
 int cxl_port_get_nr_dports(struct cxl_port *port);
+struct cxl_port *cxl_port_decoders_committed(struct cxl_port *port);
 ----
 The port type is communicated via cxl_port_is_<type>(). An 'enabled' port
 is one that has succeeded in discovering the CXL component registers in
diff --git a/cxl/json.c b/cxl/json.c
index 6fb17582a1cb..477e35a5157a 100644
--- a/cxl/json.c
+++ b/cxl/json.c
@@ -1331,6 +1331,10 @@ static struct json_object *__util_cxl_port_to_json(struct cxl_port *port,
 			json_object_object_add(jport, "state", jobj);
 	}
 
+	jobj = json_object_new_int(cxl_port_decoders_committed(port));
+	if (jobj)
+		json_object_object_add(jport, "decoders_committed", jobj);
+
 	json_object_set_userdata(jport, port, NULL);
 	return jport;
 }
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
index bdec2959508b..c1a127f66a1d 100644
--- a/cxl/lib/libcxl.c
+++ b/cxl/lib/libcxl.c
@@ -1880,6 +1880,10 @@ static int cxl_port_init(struct cxl_port *port, struct cxl_port *parent_port,
 	if (sysfs_read_attr(ctx, path, buf) == 0)
 		port->module = util_modalias_to_module(ctx, buf);
 
+	sprintf(path, "%s/decoders_committed", cxlport_base);
+	if (sysfs_read_attr(ctx, path, buf) == 0)
+		port->decoders_committed = strtoul(buf, NULL, 0);
+
 	free(path);
 	return 0;
 err:
@@ -3121,6 +3125,11 @@ cxl_port_get_dport_by_memdev(struct cxl_port *port, struct cxl_memdev *memdev)
 	return NULL;
 }
 
+CXL_EXPORT int cxl_port_decoders_committed(struct cxl_port *port)
+{
+	return port->decoders_committed;
+}
+
 static void *add_cxl_bus(void *parent, int id, const char *cxlbus_base)
 {
 	const char *devname = devpath_to_devname(cxlbus_base);
diff --git a/cxl/lib/libcxl.sym b/cxl/lib/libcxl.sym
index 42f523fda16d..16eca09b3d8b 100644
--- a/cxl/lib/libcxl.sym
+++ b/cxl/lib/libcxl.sym
@@ -277,4 +277,5 @@ global:
 	cxl_cmd_new_set_alert_config;
 	cxl_memdev_trigger_poison_list;
 	cxl_region_trigger_poison_list;
+	cxl_port_decoders_committed;
 } LIBCXL_6;
diff --git a/cxl/lib/private.h b/cxl/lib/private.h
index b26a8629e047..30c898940dec 100644
--- a/cxl/lib/private.h
+++ b/cxl/lib/private.h
@@ -87,6 +87,7 @@ struct cxl_port {
 	int dports_init;
 	int nr_dports;
 	int depth;
+	int decoders_committed;
 	struct cxl_ctx *ctx;
 	struct cxl_bus *bus;
 	enum cxl_port_type type;
diff --git a/cxl/libcxl.h b/cxl/libcxl.h
index 1154f4ce34d1..f7db400f574a 100644
--- a/cxl/libcxl.h
+++ b/cxl/libcxl.h
@@ -145,6 +145,7 @@ bool cxl_port_hosts_memdev(struct cxl_port *port, struct cxl_memdev *memdev);
 int cxl_port_get_nr_dports(struct cxl_port *port);
 int cxl_port_disable_invalidate(struct cxl_port *port);
 int cxl_port_enable(struct cxl_port *port);
+int cxl_port_decoders_committed(struct cxl_port *port);
 struct cxl_port *cxl_port_get_next_all(struct cxl_port *port,
 				       const struct cxl_port *top);
 



^ permalink raw reply related	[flat|nested] 18+ messages in thread
* RE:
@ 2019-11-14 11:37 SGV INVESTMENT
  0 siblings, 0 replies; 18+ messages in thread
From: SGV INVESTMENT @ 2019-11-14 11:37 UTC (permalink / raw)
  To: linux-nvdimm

Did you receive our business proposal email ?
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re:
@ 2017-05-16 22:46 USPS Parcels Delivery
  0 siblings, 0 replies; 18+ messages in thread
From: USPS Parcels Delivery @ 2017-05-16 22:46 UTC (permalink / raw)
  To: linux-nvdimm-y27Ovi1pjclAfugRpC6u6w

Hello,

Your item has arrived at the USPS Post Office at  Wed, 17 May 2017 00:46:58
+0200, but the courier was unable to deliver parcel to you. 
You can download the shipment label attached!

Yours respectfully.
Mellicent Northan -  USPS Operation Manager.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re:
@ 2017-04-29 22:53 USPS Station Management
  0 siblings, 0 replies; 18+ messages in thread
From: USPS Station Management @ 2017-04-29 22:53 UTC (permalink / raw)
  To: linux-nvdimm-y27Ovi1pjclAfugRpC6u6w

Hello,

Your item has arrived at the USPS Post Office at  Sat, 29 Apr 2017 15:53:09
-0700, but the courier was unable to deliver parcel to you. 
You can find more details in this e-mail attachment!

With thanks and appreciation.
Fermina Khan -  USPS Support Agent.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re:
@ 2017-04-28 18:27 USPS Ground Support
  0 siblings, 0 replies; 18+ messages in thread
From: USPS Ground Support @ 2017-04-28 18:27 UTC (permalink / raw)
  To: linux-nvdimm-y27Ovi1pjclAfugRpC6u6w

Hello,

Your item has arrived at the USPS Post Office at  Fri, 28 Apr 2017 11:27:27
-0700, but the courier was unable to deliver parcel to you. 
You can download the shipment label attached!

With gratitude.
Lashan Simmering -  USPS Support Manager.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re:
@ 2017-04-11 14:37 USPS Priority Delivery
  0 siblings, 0 replies; 18+ messages in thread
From: USPS Priority Delivery @ 2017-04-11 14:37 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

Hello,

We can not deliver your parcel arrived at  Tue, 11 Apr 2017 15:37:40 +0100.

Please click on the link for more details.
http://uspswoiugue62677104.ideliverys.com/iq5866671

With anticipation.
Sophie Wadkins -  USPS Chief Office Manager.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re:
@ 2017-04-01  5:31 USPS Delivery
  0 siblings, 0 replies; 18+ messages in thread
From: USPS Delivery @ 2017-04-01  5:31 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

Hello,
Your item has arrived at Sat, 01 Apr 2017 06:31:34 +0100, but our courier
was not able to deliver the parcel. 
Review the document that is attached to this e-mail!

Most sincerely.
Gertruda Hendry -  USPS Mail Delivery Agent.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-04-26  1:58 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 20:43 [NDCTL PATCH v2 1/2] cxl: Save the number of decoders committed to a port Dave Jiang
2023-11-28 20:43 ` [NDCTL PATCH v2 2/2] cxl: Add check for regions before disabling memdev Dave Jiang
2023-11-30  1:41   ` Cao, Quanquan/曹 全全
2023-11-30  8:29   ` Cao, Quanquan/曹 全全
2023-11-30 16:07     ` Dave Jiang
2023-11-30 21:51     ` [NDCTL PATCH v3 " Dave Jiang
2024-04-17  6:46       ` Yao Xingtao
2024-04-17 18:14         ` Verma, Vishal L
2024-04-22  7:26           ` Re: Xingtao Yao (Fujitsu)
2024-04-25  5:30           ` [NDCTL PATCH v3 2/2] cxl: Add check for regions before disabling memdev Zhijian Li (Fujitsu)
2024-04-25 16:52             ` Alison Schofield
2024-04-26  1:57               ` Zhijian Li (Fujitsu)
  -- strict thread matches above, loose matches on Subject: below --
2019-11-14 11:37 SGV INVESTMENT
2017-05-16 22:46 USPS Parcels Delivery
2017-04-29 22:53 Re: USPS Station Management
2017-04-28 18:27 Re: USPS Ground Support
2017-04-11 14:37 Re: USPS Priority Delivery
2017-04-01  5:31 Re: USPS Delivery

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).