lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250912144514.526441-5-rrichter@amd.com>
Date: Fri, 12 Sep 2025 16:45:06 +0200
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 v3 04/11] cxl/region: Add @range argument to function cxl_find_root_decoder()

cxl_find_root_decoder() uses the endpoint decoder's HPA range to find
the root decoder. This requires endpoints and root decoders to be in
the same memory domain, which is not the case for systems that need
address translation.

Add a separate @range argument to function cxl_find_root_decoder() to
specify the root decoder's address range. Now it is possible to pass a
translated address range of an endpoint decoder to function
cxl_find_root_decoder().

Patch is a prerequisite to implement address translation.

Signed-off-by: Robert Richter <rrichter@....com>
---
 drivers/cxl/core/region.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 13113920aba7..8ccc171ac724 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3376,19 +3376,18 @@ cxl_port_find_switch_decoder(struct cxl_port *port, struct range *range)
 }
 
 static struct cxl_root_decoder *
-cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
+cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled, struct range *range)
 {
 	struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
 	struct cxl_port *port = cxled_to_port(cxled);
 	struct cxl_root *cxl_root __free(put_cxl_root) = find_cxl_root(port);
-	struct cxl_decoder *root, *cxld = &cxled->cxld;
-	struct range *range = &cxld->hpa_range;
+	struct cxl_decoder *root;
 
 	root = cxl_port_find_switch_decoder(&cxl_root->port, range);
 	if (!root) {
 		dev_err(cxlmd->dev.parent,
 			"%s:%s no CXL window for range %#llx:%#llx\n",
-			dev_name(&cxlmd->dev), dev_name(&cxld->dev),
+			dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
 			range->start, range->end);
 		return NULL;
 	}
@@ -3579,7 +3578,7 @@ int cxl_add_to_region(struct cxl_endpoint_decoder *cxled)
 	int rc;
 
 	struct cxl_root_decoder *cxlrd __free(put_cxl_root_decoder) =
-		cxl_find_root_decoder(cxled);
+		cxl_find_root_decoder(cxled, range);
 	if (!cxlrd)
 		return -ENXIO;
 
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ