Thread (89 messages) 89 messages, 6 authors, 2025-01-22

Re: [PATCH v9 22/27] cxl: allow region creation by type2 drivers

flat view

From: Jonathan Cameron <hidden>
Date: 2025-01-02 15:42:38
Also in: linux-cxl

On Mon, 30 Dec 2024 21:44:40 +0000
alejandro.lucero-palau@amd.com wrote:
From: Alejandro Lucero <redacted>

Creating a CXL region requires userspace intervention through the cxl
sysfs files. Type2 support should allow accelerator drivers to create
such cxl region from kernel code.

Adding that functionality and integrating it with current support for
memory expanders.

Based on https://lore.kernel.org/linux-cxl/168592159835.1948938.1647215579839222774.stgit@dwillia2-xfh.jf.intel.com/ (local)

Signed-off-by: Alejandro Lucero <redacted>
Co-developed-by: Dan Williams <redacted>
Reviewed-by: Zhi Wang <zhiw@nvidia.com>
Trivial comment inline. Either way
Reviewed-by: Jonathan Cameron <redacted>
quoted hunk ↗ jump to hunk
---
 drivers/cxl/core/region.c | 145 ++++++++++++++++++++++++++++++++++----
 drivers/cxl/cxlmem.h      |   2 +
 drivers/cxl/port.c        |   5 +-
 include/cxl/cxl.h         |   4 ++
 4 files changed, 141 insertions(+), 15 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 1b1d45c44b52..a2b92162edbd 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -2270,6 +2270,18 @@ static int cxl_region_detach(struct cxl_endpoint_decoder *cxled)
 	return rc;
 }
 
+int cxl_accel_region_detach(struct cxl_endpoint_decoder *cxled)
+{
+	int rc;
+
+	down_write(&cxl_region_rwsem);
Could use a guard here so you can return directly.
quoted hunk ↗ jump to hunk
+	cxled->mode = CXL_DECODER_DEAD;
+	rc = cxl_region_detach(cxled);
+	up_write(&cxl_region_rwsem);
+	return rc;
+}
+EXPORT_SYMBOL_NS_GPL(cxl_accel_region_detach, "CXL");
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help