[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251205115248.772945-14-alejandro.lucero-palau@amd.com>
Date: Fri, 5 Dec 2025 11:52:36 +0000
From: <alejandro.lucero-palau@....com>
To: <linux-cxl@...r.kernel.org>, <netdev@...r.kernel.org>,
<dan.j.williams@...el.com>, <edward.cree@....com>, <davem@...emloft.net>,
<kuba@...nel.org>, <pabeni@...hat.com>, <edumazet@...gle.com>,
<dave.jiang@...el.com>
CC: Alejandro Lucero <alucerop@....com>
Subject: [PATCH v22 13/25] cxl: Export functions for unwinding cxl by accelerators
From: Alejandro Lucero <alucerop@....com>
Add unregister_region() and cxl_decoder_detach() to the accelerator
driver API for a clean exit.
Signed-off-by: Alejandro Lucero <alucerop@....com>
---
drivers/cxl/core/core.h | 5 -----
drivers/cxl/core/region.c | 4 +++-
include/cxl/cxl.h | 9 +++++++++
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h
index 1c1726856139..9a6775845afe 100644
--- a/drivers/cxl/core/core.h
+++ b/drivers/cxl/core/core.h
@@ -15,11 +15,6 @@ extern const struct device_type cxl_pmu_type;
extern struct attribute_group cxl_base_attribute_group;
-enum cxl_detach_mode {
- DETACH_ONLY,
- DETACH_INVALIDATE,
-};
-
#ifdef CONFIG_CXL_REGION
extern struct device_attribute dev_attr_create_pmem_region;
extern struct device_attribute dev_attr_create_ram_region;
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 8166a402373e..104caa33b7bb 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -2199,6 +2199,7 @@ int cxl_decoder_detach(struct cxl_region *cxlr,
}
return 0;
}
+EXPORT_SYMBOL_NS_GPL(cxl_decoder_detach, "CXL");
static int __attach_target(struct cxl_region *cxlr,
struct cxl_endpoint_decoder *cxled, int pos,
@@ -2393,7 +2394,7 @@ static struct cxl_region *to_cxl_region(struct device *dev)
return container_of(dev, struct cxl_region, dev);
}
-static void unregister_region(void *_cxlr)
+void unregister_region(void *_cxlr)
{
struct cxl_region *cxlr = _cxlr;
struct cxl_region_params *p = &cxlr->params;
@@ -2412,6 +2413,7 @@ static void unregister_region(void *_cxlr)
cxl_region_iomem_release(cxlr);
put_device(&cxlr->dev);
}
+EXPORT_SYMBOL_NS_GPL(unregister_region, "CXL");
static struct lock_class_key cxl_region_key;
diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h
index f02dd817b40f..b8683c75dfde 100644
--- a/include/cxl/cxl.h
+++ b/include/cxl/cxl.h
@@ -255,4 +255,13 @@ struct cxl_endpoint_decoder *cxl_get_committed_decoder(struct cxl_memdev *cxlmd,
struct cxl_region **cxlr);
struct range;
int cxl_get_region_range(struct cxl_region *region, struct range *range);
+enum cxl_detach_mode {
+ DETACH_ONLY,
+ DETACH_INVALIDATE,
+};
+
+int cxl_decoder_detach(struct cxl_region *cxlr,
+ struct cxl_endpoint_decoder *cxled, int pos,
+ enum cxl_detach_mode mode);
+void unregister_region(void *_cxlr);
#endif /* __CXL_CXL_H__ */
--
2.34.1
Powered by blists - more mailing lists