linux/drivers/cxl/core/pmem.c

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2020 Intel Corporation. */
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/idr.h>
#include <cxlmem.h>
#include <cxl.h>
#include "core.h"

/**
 * DOC: cxl pmem
 *
 * The core CXL PMEM infrastructure supports persistent memory
 * provisioning and serves as a bridge to the LIBNVDIMM subsystem. A CXL
 * 'bridge' device is added at the root of a CXL device topology if
 * platform firmware advertises at least one persistent memory capable
 * CXL window. That root-level bridge corresponds to a LIBNVDIMM 'bus'
 * device. Then for each cxl_memdev in the CXL device topology a bridge
 * device is added to host a LIBNVDIMM dimm object. When these bridges
 * are registered native LIBNVDIMM uapis are translated to CXL
 * operations, for example, namespace label access commands.
 */

static DEFINE_IDA(cxl_nvdimm_bridge_ida);

static void cxl_nvdimm_bridge_release(struct device *dev)
{}

static const struct attribute_group *cxl_nvdimm_bridge_attribute_groups[] =;

const struct device_type cxl_nvdimm_bridge_type =;

struct cxl_nvdimm_bridge *to_cxl_nvdimm_bridge(struct device *dev)
{}
EXPORT_SYMBOL_NS_GPL();

bool is_cxl_nvdimm_bridge(struct device *dev)
{}
EXPORT_SYMBOL_NS_GPL();

static int match_nvdimm_bridge(struct device *dev, void *data)
{}

/**
 * cxl_find_nvdimm_bridge() - find a bridge device relative to a port
 * @port: any descendant port of an nvdimm-bridge associated
 *        root-cxl-port
 */
struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_port *port)
{}
EXPORT_SYMBOL_NS_GPL();

static struct lock_class_key cxl_nvdimm_bridge_key;

static struct cxl_nvdimm_bridge *cxl_nvdimm_bridge_alloc(struct cxl_port *port)
{}

static void unregister_nvb(void *_cxl_nvb)
{}

/**
 * devm_cxl_add_nvdimm_bridge() - add the root of a LIBNVDIMM topology
 * @host: platform firmware root device
 * @port: CXL port at the root of a CXL topology
 *
 * Return: bridge device that can host cxl_nvdimm objects
 */
struct cxl_nvdimm_bridge *devm_cxl_add_nvdimm_bridge(struct device *host,
						     struct cxl_port *port)
{}
EXPORT_SYMBOL_NS_GPL();

static void cxl_nvdimm_release(struct device *dev)
{}

static const struct attribute_group *cxl_nvdimm_attribute_groups[] =;

const struct device_type cxl_nvdimm_type =;

bool is_cxl_nvdimm(struct device *dev)
{}
EXPORT_SYMBOL_NS_GPL();

struct cxl_nvdimm *to_cxl_nvdimm(struct device *dev)
{}
EXPORT_SYMBOL_NS_GPL();

static struct lock_class_key cxl_nvdimm_key;

static struct cxl_nvdimm *cxl_nvdimm_alloc(struct cxl_nvdimm_bridge *cxl_nvb,
					   struct cxl_memdev *cxlmd)
{}

static void cxlmd_release_nvdimm(void *_cxlmd)
{}

/**
 * devm_cxl_add_nvdimm() - add a bridge between a cxl_memdev and an nvdimm
 * @parent_port: parent port for the (to be added) @cxlmd endpoint port
 * @cxlmd: cxl_memdev instance that will perform LIBNVDIMM operations
 *
 * Return: 0 on success negative error code on failure.
 */
int devm_cxl_add_nvdimm(struct cxl_port *parent_port,
			struct cxl_memdev *cxlmd)
{}
EXPORT_SYMBOL_NS_GPL();