diff mbox series

[ndctl,v3,15/21] libcxl: PLACEHOLDER: add an interface to determine whether a memdev is active

Message ID 20210701201005.3065299-16-vishal.l.verma@intel.com
State New, archived
Headers show
Series Initial CXL support | expand

Commit Message

Verma, Vishal L July 1, 2021, 8:09 p.m. UTC
Add an interface to determine whether a memdev is bound to a region
driver and therefore is currently active.

For now, this just returns '0' all the time - i.e. devices are always
considered inactive. Flesh this out fully once the region driver is
available.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 cxl/lib/libcxl.c   | 10 ++++++++++
 cxl/libcxl.h       |  1 +
 cxl/lib/libcxl.sym |  1 +
 3 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
index ae03e03..246fa2a 100644
--- a/cxl/lib/libcxl.c
+++ b/cxl/lib/libcxl.c
@@ -361,6 +361,16 @@  CXL_EXPORT size_t cxl_memdev_get_lsa_size(struct cxl_memdev *memdev)
 	return memdev->lsa_size;
 }
 
+CXL_EXPORT int cxl_memdev_is_active(struct cxl_memdev *memdev)
+{
+	/*
+	 * TODO: Currently memdevs are always considered inactive. Once we have
+	 * cxl_bus drivers that are bound/unbound to memdevs, we'd use that to
+	 * determine the active/inactive state.
+	 */
+	return 0;
+}
+
 CXL_EXPORT void cxl_cmd_unref(struct cxl_cmd *cmd)
 {
 	if (!cmd)
diff --git a/cxl/libcxl.h b/cxl/libcxl.h
index eeace11..65f6c62 100644
--- a/cxl/libcxl.h
+++ b/cxl/libcxl.h
@@ -43,6 +43,7 @@  unsigned long long cxl_memdev_get_pmem_size(struct cxl_memdev *memdev);
 unsigned long long cxl_memdev_get_ram_size(struct cxl_memdev *memdev);
 const char *cxl_memdev_get_firmware_verison(struct cxl_memdev *memdev);
 size_t cxl_memdev_get_lsa_size(struct cxl_memdev *memdev);
+int cxl_memdev_is_active(struct cxl_memdev *memdev);
 
 #define cxl_memdev_foreach(ctx, memdev) \
         for (memdev = cxl_memdev_get_first(ctx); \
diff --git a/cxl/lib/libcxl.sym b/cxl/lib/libcxl.sym
index a5a1371..d90502f 100644
--- a/cxl/lib/libcxl.sym
+++ b/cxl/lib/libcxl.sym
@@ -59,4 +59,5 @@  global:
 LIBCXL_4 {
 global:
 	cxl_memdev_get_lsa_size;
+	cxl_memdev_is_active;
 } LIBCXL_3;