[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231018171713.1883517-2-rrichter@amd.com>
Date: Wed, 18 Oct 2023 19:16:54 +0200
From: Robert Richter <rrichter@....com>
To: Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
"Alison Schofield" <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Ben Widawsky <bwidawsk@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
"Robert Richter" <rrichter@....com>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Terry Bowman <terry.bowman@....com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: [PATCH v12 01/20] cxl/port: Fix release of RCD endpoints
Binding and unbindind RCD endpoints (e.g. mem0 device) caused the
corresponding endpoint not being released. Reason for that is the
wrong port discovered for RCD endpoints. See cxl_mem_probe() for
proper endpoint parent detection. Fix delete_endpoint() respectively.
Fixes: 0a19bfc8de93 ("cxl/port: Add RCD endpoint port enumeration")
Signed-off-by: Robert Richter <rrichter@....com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
---
drivers/cxl/core/port.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 7ca01a834e18..d4572a02989a 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1222,12 +1222,17 @@ static void delete_endpoint(void *data)
struct cxl_memdev *cxlmd = data;
struct cxl_port *endpoint = cxlmd->endpoint;
struct cxl_port *parent_port;
+ struct cxl_dport *dport;
struct device *parent;
- parent_port = cxl_mem_find_port(cxlmd, NULL);
+ parent_port = cxl_mem_find_port(cxlmd, &dport);
if (!parent_port)
goto out;
- parent = &parent_port->dev;
+
+ if (dport->rch)
+ parent = parent_port->uport_dev;
+ else
+ parent = &parent_port->dev;
device_lock(parent);
if (parent->driver && !endpoint->dead) {
--
2.30.2
Powered by blists - more mailing lists