|
1 | 1 | // SPDX-License-Identifier: GPL-2.0-only
|
2 | 2 | /* Copyright(c) 2020 Intel Corporation. */
|
3 |
| - |
4 | 3 | #include <linux/device.h>
|
5 | 4 | #include <linux/slab.h>
|
6 | 5 | #include <cxlmem.h>
|
7 | 6 | #include <cxl.h>
|
8 |
| - |
9 | 7 | #include "core.h"
|
10 | 8 |
|
| 9 | +/** |
| 10 | + * DOC: cxl pmem |
| 11 | + * |
| 12 | + * The core CXL PMEM infrastructure supports persistent memory |
| 13 | + * provisioning and serves as a bridge to the LIBNVDIMM subsystem. A CXL |
| 14 | + * 'bridge' device is added at the root of a CXL device topology if |
| 15 | + * platform firmware advertises at least one persistent memory capable |
| 16 | + * CXL window. That root-level bridge corresponds to a LIBNVDIMM 'bus' |
| 17 | + * device. Then for each cxl_memdev in the CXL device topology a bridge |
| 18 | + * device is added to host a LIBNVDIMM dimm object. When these bridges |
| 19 | + * are registered native LIBNVDIMM uapis are translated to CXL |
| 20 | + * operations, for example, namespace label access commands. |
| 21 | + */ |
| 22 | + |
11 | 23 | static void cxl_nvdimm_bridge_release(struct device *dev)
|
12 | 24 | {
|
13 | 25 | struct cxl_nvdimm_bridge *cxl_nvb = to_cxl_nvdimm_bridge(dev);
|
@@ -85,6 +97,13 @@ static void unregister_nvb(void *_cxl_nvb)
|
85 | 97 | device_unregister(&cxl_nvb->dev);
|
86 | 98 | }
|
87 | 99 |
|
| 100 | +/** |
| 101 | + * devm_cxl_add_nvdimm_bridge() - add the root of a LIBNVDIMM topology |
| 102 | + * @host: platform firmware root device |
| 103 | + * @port: CXL port at the root of a CXL topology |
| 104 | + * |
| 105 | + * Return: bridge device that can host cxl_nvdimm objects |
| 106 | + */ |
88 | 107 | struct cxl_nvdimm_bridge *devm_cxl_add_nvdimm_bridge(struct device *host,
|
89 | 108 | struct cxl_port *port)
|
90 | 109 | {
|
@@ -173,6 +192,13 @@ static struct cxl_nvdimm *cxl_nvdimm_alloc(struct cxl_memdev *cxlmd)
|
173 | 192 | return cxl_nvd;
|
174 | 193 | }
|
175 | 194 |
|
| 195 | +/** |
| 196 | + * devm_cxl_add_nvdimm() - add a bridge between a cxl_memdev and an nvdimm |
| 197 | + * @host: same host as @cxlmd |
| 198 | + * @cxlmd: cxl_memdev instance that will perform LIBNVDIMM operations |
| 199 | + * |
| 200 | + * Return: 0 on success negative error code on failure. |
| 201 | + */ |
176 | 202 | int devm_cxl_add_nvdimm(struct device *host, struct cxl_memdev *cxlmd)
|
177 | 203 | {
|
178 | 204 | struct cxl_nvdimm *cxl_nvd;
|
|
0 commit comments