[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250107141015.3367194-22-rrichter@amd.com>
Date: Tue, 7 Jan 2025 15:10:07 +0100
From: Robert Richter <rrichter@....com>
To: Alison Schofield <alison.schofield@...el.com>, Vishal Verma
<vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>, Dan Williams
<dan.j.williams@...el.com>, Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>, Davidlohr Bueso <dave@...olabs.net>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Gregory Price
<gourry@...rry.net>, "Fabio M. De Francesco"
<fabio.m.de.francesco@...ux.intel.com>, Terry Bowman <terry.bowman@....com>,
Robert Richter <rrichter@....com>
Subject: [PATCH v1 21/29] cxl/region: Lock decoders that need address translation
There is only support to translate from the endpoint to its parent
port, but not in the opposite direction from the parent to the
endpoint. Thus, the endpoint address range cannot be determined and
setup manually. If the parent implements the ->to_hpa() callback and
needs address translation, forbit reprogramming of the decoders and
lock them.
Signed-off-by: Robert Richter <rrichter@....com>
---
drivers/cxl/core/region.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 8d7893878362..681c26abc26e 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3353,6 +3353,17 @@ static int cxl_endpoint_initialize(struct cxl_endpoint_decoder *cxled)
if (cxl_port_calc_hpa(parent, cxld, &hpa))
return -ENXIO;
+ /*
+ * There is only support to translate from the endpoint to its
+ * parent port, but not in the opposite direction from the
+ * parent to the endpoint. Thus, the endpoint address range
+ * cannot be determined and setup manually. If the parent
+ * implements the ->to_hpa() callback and needs address
+ * translation, forbit reprogramming of the decoders and lock
+ * them.
+ */
+ cxld->flags |= CXL_DECODER_F_LOCK;
+
/* Iterate from endpoint to root_port refining the position */
pos = cxl_port_calc_pos(iter, &hpa, pos);
if (pos < 0)
--
2.39.5
Powered by blists - more mailing lists