diff mbox series

[RFC,24/27] cxl/mem: Store the endpoint's uport

Message ID 20211016051531.622613-25-ben.widawsky@intel.com
State Superseded
Headers show
Series CXL Region Creation / HDM decoder programming | expand

Commit Message

Ben Widawsky Oct. 16, 2021, 5:15 a.m. UTC
Keeping track of an endpoint's port is important when attempting to
assemble all relevant components in the CXL.mem route from root to
endpoint. Without this change, the endpoint's port can be obtained
through walks of the hierarchy.

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
 drivers/cxl/cxlmem.h | 1 +
 drivers/cxl/mem.c    | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index cc5844150ce0..02efb270acac 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -45,6 +45,7 @@  struct cxl_memdev {
 	int id;
 	resource_size_t creg_base;
 	struct cxl_dport *root_port;
+	struct cxl_port *uport;
 };
 
 static inline struct cxl_memdev *to_cxl_memdev(struct device *dev)
diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c
index fb0b3cb10482..345281e69b6b 100644
--- a/drivers/cxl/mem.c
+++ b/drivers/cxl/mem.c
@@ -62,6 +62,7 @@  static int create_endpoint_port(struct device *dev, struct device *host,
 	endpoint = devm_cxl_add_port(host, dev, cxlmd->creg_base, parent);
 	if (IS_ERR(endpoint))
 		return PTR_ERR(endpoint);
+	cxlmd->uport = endpoint;
 	dev_dbg(host, "add: %s\n", dev_name(&endpoint->dev));
 
 	return 0;