[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251114004021.1310661-12-rrichter@amd.com>
Date: Fri, 14 Nov 2025 01:40:16 +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>,
Joshua Hahn <joshua.hahnjy@...il.com>, Robert Richter <rrichter@....com>
Subject: [PATCH v6 11/11] cxl/atl: Lock decoders that need address translation
There is only support to translate addresses from an endpoint to its
CXL host bridge, but not in the opposite direction from the bridge to
the endpoint. Thus, the endpoint address range cannot be determined
and setup manually for a given SPA range of a region. If the endpoint
has address translation enabled, lock it to prevent the kernel from
reconfiguring it.
This is more a limitation of the kernel implementation rather than the
BIOS. The BIOS provides enought information by CFMWS, PRM, HDM and PCI
topology. In theory and if there is demand for it, support could be
added for driver region setup. For that reason the lock bit should be
set by the kernel instead of the BIOS.
Reviewed-by: Gregory Price <gourry@...rry.net>
Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
Tested-by: Gregory Price <gourry@...rry.net>
Signed-off-by: Robert Richter <rrichter@....com>
---
drivers/cxl/core/atl.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/cxl/core/atl.c b/drivers/cxl/core/atl.c
index 3b02999d3c59..4f645f71b397 100644
--- a/drivers/cxl/core/atl.c
+++ b/drivers/cxl/core/atl.c
@@ -161,6 +161,16 @@ static int cxl_prm_translate_hpa_range(struct cxl_root *cxl_root, void *data)
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 address range
+ * was translated and modified, forbid reprogramming of the
+ * decoders and lock them.
+ */
+ cxld->flags |= CXL_DECODER_F_LOCK;
+
ctx->hpa_range = hpa_range;
ctx->interleave_ways = ways;
ctx->interleave_granularity = gran;
--
2.47.3
Powered by blists - more mailing lists