|
|
26ccd9 |
From 0be46d9c6638903978d16388c765a1907d5970bc Mon Sep 17 00:00:00 2001
|
|
|
26ccd9 |
From: Dan Williams <dan.j.williams@intel.com>
|
|
|
26ccd9 |
Date: Sun, 23 Jan 2022 16:52:47 -0800
|
|
|
26ccd9 |
Subject: [PATCH 097/217] cxl/lib: Rename nvdimm bridge to pmem
|
|
|
26ccd9 |
|
|
|
26ccd9 |
The kernel has 2 object classes for connecting CXL to NVDIMM. There is an
|
|
|
26ccd9 |
'nvdimm-bridge' object (one per root CXL port) that represents a CXL NVDIMM
|
|
|
26ccd9 |
Bus, and there are 'pmem' object that represent CXL NVDIMM DIMM devices.
|
|
|
26ccd9 |
The object that the library is currently calling an nvdimm-bridge is
|
|
|
26ccd9 |
actually the 'pmem' object. Rename accordingly.
|
|
|
26ccd9 |
|
|
|
26ccd9 |
The exported function cxl_memdev_nvdimm_bridge_active() is not renamed, but
|
|
|
26ccd9 |
since it is a cxl_memdev operation and 'struct cxl_pmem' is an
|
|
|
26ccd9 |
implementation detail it is fine as is.
|
|
|
26ccd9 |
|
|
|
26ccd9 |
Link: https://lore.kernel.org/r/164298556712.3021641.15612755067301105130.stgit@dwillia2-desk3.amr.corp.intel.com
|
|
|
26ccd9 |
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
|
|
26ccd9 |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
|
26ccd9 |
---
|
|
|
26ccd9 |
cxl/lib/libcxl.c | 56 +++++++++++++++++++++++------------------------
|
|
|
26ccd9 |
cxl/lib/private.h | 4 ++--
|
|
|
26ccd9 |
2 files changed, 30 insertions(+), 30 deletions(-)
|
|
|
26ccd9 |
|
|
|
26ccd9 |
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
|
|
|
26ccd9 |
index 8d3cf80..9839f26 100644
|
|
|
26ccd9 |
--- a/cxl/lib/libcxl.c
|
|
|
26ccd9 |
+++ b/cxl/lib/libcxl.c
|
|
|
26ccd9 |
@@ -45,11 +45,11 @@ struct cxl_ctx {
|
|
|
26ccd9 |
void *private_data;
|
|
|
26ccd9 |
};
|
|
|
26ccd9 |
|
|
|
26ccd9 |
-static void free_bridge(struct cxl_nvdimm_bridge *bridge)
|
|
|
26ccd9 |
+static void free_pmem(struct cxl_pmem *pmem)
|
|
|
26ccd9 |
{
|
|
|
26ccd9 |
- free(bridge->dev_buf);
|
|
|
26ccd9 |
- free(bridge->dev_path);
|
|
|
26ccd9 |
- free(bridge);
|
|
|
26ccd9 |
+ free(pmem->dev_buf);
|
|
|
26ccd9 |
+ free(pmem->dev_path);
|
|
|
26ccd9 |
+ free(pmem);
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
|
|
|
26ccd9 |
static void free_memdev(struct cxl_memdev *memdev, struct list_head *head)
|
|
|
26ccd9 |
@@ -57,7 +57,7 @@ static void free_memdev(struct cxl_memdev *memdev, struct list_head *head)
|
|
|
26ccd9 |
if (head)
|
|
|
26ccd9 |
list_del_from(head, &memdev->list);
|
|
|
26ccd9 |
kmod_module_unref(memdev->module);
|
|
|
26ccd9 |
- free_bridge(memdev->bridge);
|
|
|
26ccd9 |
+ free_pmem(memdev->pmem);
|
|
|
26ccd9 |
free(memdev->firmware_version);
|
|
|
26ccd9 |
free(memdev->dev_buf);
|
|
|
26ccd9 |
free(memdev->dev_path);
|
|
|
26ccd9 |
@@ -213,36 +213,36 @@ CXL_EXPORT void cxl_set_log_priority(struct cxl_ctx *ctx, int priority)
|
|
|
26ccd9 |
ctx->ctx.log_priority = priority;
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
|
|
|
26ccd9 |
-static void *add_cxl_bridge(void *parent, int id, const char *br_base)
|
|
|
26ccd9 |
+static void *add_cxl_pmem(void *parent, int id, const char *br_base)
|
|
|
26ccd9 |
{
|
|
|
26ccd9 |
const char *devname = devpath_to_devname(br_base);
|
|
|
26ccd9 |
struct cxl_memdev *memdev = parent;
|
|
|
26ccd9 |
struct cxl_ctx *ctx = memdev->ctx;
|
|
|
26ccd9 |
- struct cxl_nvdimm_bridge *bridge;
|
|
|
26ccd9 |
+ struct cxl_pmem *pmem;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- dbg(ctx, "%s: bridge_base: \'%s\'\n", devname, br_base);
|
|
|
26ccd9 |
+ dbg(ctx, "%s: pmem_base: \'%s\'\n", devname, br_base);
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- bridge = calloc(1, sizeof(*bridge));
|
|
|
26ccd9 |
- if (!bridge)
|
|
|
26ccd9 |
+ pmem = calloc(1, sizeof(*pmem));
|
|
|
26ccd9 |
+ if (!pmem)
|
|
|
26ccd9 |
goto err_dev;
|
|
|
26ccd9 |
- bridge->id = id;
|
|
|
26ccd9 |
+ pmem->id = id;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- bridge->dev_path = strdup(br_base);
|
|
|
26ccd9 |
- if (!bridge->dev_path)
|
|
|
26ccd9 |
+ pmem->dev_path = strdup(br_base);
|
|
|
26ccd9 |
+ if (!pmem->dev_path)
|
|
|
26ccd9 |
goto err_read;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- bridge->dev_buf = calloc(1, strlen(br_base) + 50);
|
|
|
26ccd9 |
- if (!bridge->dev_buf)
|
|
|
26ccd9 |
+ pmem->dev_buf = calloc(1, strlen(br_base) + 50);
|
|
|
26ccd9 |
+ if (!pmem->dev_buf)
|
|
|
26ccd9 |
goto err_read;
|
|
|
26ccd9 |
- bridge->buf_len = strlen(br_base) + 50;
|
|
|
26ccd9 |
+ pmem->buf_len = strlen(br_base) + 50;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- memdev->bridge = bridge;
|
|
|
26ccd9 |
- return bridge;
|
|
|
26ccd9 |
+ memdev->pmem = pmem;
|
|
|
26ccd9 |
+ return pmem;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
err_read:
|
|
|
26ccd9 |
- free(bridge->dev_buf);
|
|
|
26ccd9 |
- free(bridge->dev_path);
|
|
|
26ccd9 |
- free(bridge);
|
|
|
26ccd9 |
+ free(pmem->dev_buf);
|
|
|
26ccd9 |
+ free(pmem->dev_path);
|
|
|
26ccd9 |
+ free(pmem);
|
|
|
26ccd9 |
err_dev:
|
|
|
26ccd9 |
return NULL;
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
@@ -319,7 +319,7 @@ static void *add_cxl_memdev(void *parent, int id, const char *cxlmem_base)
|
|
|
26ccd9 |
goto err_read;
|
|
|
26ccd9 |
memdev->buf_len = strlen(cxlmem_base) + 50;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- sysfs_device_parse(ctx, cxlmem_base, "pmem", memdev, add_cxl_bridge);
|
|
|
26ccd9 |
+ sysfs_device_parse(ctx, cxlmem_base, "pmem", memdev, add_cxl_pmem);
|
|
|
26ccd9 |
|
|
|
26ccd9 |
cxl_memdev_foreach(ctx, memdev_dup)
|
|
|
26ccd9 |
if (memdev_dup->id == memdev->id) {
|
|
|
26ccd9 |
@@ -430,18 +430,18 @@ static int is_enabled(const char *drvpath)
|
|
|
26ccd9 |
CXL_EXPORT int cxl_memdev_nvdimm_bridge_active(struct cxl_memdev *memdev)
|
|
|
26ccd9 |
{
|
|
|
26ccd9 |
struct cxl_ctx *ctx = cxl_memdev_get_ctx(memdev);
|
|
|
26ccd9 |
- struct cxl_nvdimm_bridge *bridge = memdev->bridge;
|
|
|
26ccd9 |
+ struct cxl_pmem *pmem = memdev->pmem;
|
|
|
26ccd9 |
char *path;
|
|
|
26ccd9 |
int len;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- if (!bridge)
|
|
|
26ccd9 |
+ if (!pmem)
|
|
|
26ccd9 |
return 0;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- path = bridge->dev_buf;
|
|
|
26ccd9 |
- len = bridge->buf_len;
|
|
|
26ccd9 |
+ path = pmem->dev_buf;
|
|
|
26ccd9 |
+ len = pmem->buf_len;
|
|
|
26ccd9 |
|
|
|
26ccd9 |
- if (snprintf(path, len, "%s/driver", bridge->dev_path) >= len) {
|
|
|
26ccd9 |
- err(ctx, "%s: nvdimm bridge buffer too small!\n",
|
|
|
26ccd9 |
+ if (snprintf(path, len, "%s/driver", pmem->dev_path) >= len) {
|
|
|
26ccd9 |
+ err(ctx, "%s: nvdimm pmem buffer too small!\n",
|
|
|
26ccd9 |
cxl_memdev_get_devname(memdev));
|
|
|
26ccd9 |
return 0;
|
|
|
26ccd9 |
}
|
|
|
26ccd9 |
diff --git a/cxl/lib/private.h b/cxl/lib/private.h
|
|
|
26ccd9 |
index 28f7e16..7c81e24 100644
|
|
|
26ccd9 |
--- a/cxl/lib/private.h
|
|
|
26ccd9 |
+++ b/cxl/lib/private.h
|
|
|
26ccd9 |
@@ -10,7 +10,7 @@
|
|
|
26ccd9 |
|
|
|
26ccd9 |
#define CXL_EXPORT __attribute__ ((visibility("default")))
|
|
|
26ccd9 |
|
|
|
26ccd9 |
-struct cxl_nvdimm_bridge {
|
|
|
26ccd9 |
+struct cxl_pmem {
|
|
|
26ccd9 |
int id;
|
|
|
26ccd9 |
void *dev_buf;
|
|
|
26ccd9 |
size_t buf_len;
|
|
|
26ccd9 |
@@ -30,7 +30,7 @@ struct cxl_memdev {
|
|
|
26ccd9 |
int payload_max;
|
|
|
26ccd9 |
size_t lsa_size;
|
|
|
26ccd9 |
struct kmod_module *module;
|
|
|
26ccd9 |
- struct cxl_nvdimm_bridge *bridge;
|
|
|
26ccd9 |
+ struct cxl_pmem *pmem;
|
|
|
26ccd9 |
unsigned long long serial;
|
|
|
26ccd9 |
};
|
|
|
26ccd9 |
|
|
|
26ccd9 |
--
|
|
|
26ccd9 |
2.27.0
|
|
|
26ccd9 |
|