#include <linux/platform_device.h>
#include <linux/memregion.h>
#include <linux/workqueue.h>
#include <linux/einj-cxl.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/idr.h>
#include <linux/node.h>
#include <cxlmem.h>
#include <cxlpci.h>
#include <cxl.h>
#include "core.h"
DECLARE_RWSEM(…) …;
static DEFINE_IDA(cxl_port_ida);
static DEFINE_XARRAY(cxl_root_buses);
int cxl_num_decoders_committed(struct cxl_port *port)
{ … }
static ssize_t devtype_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(devtype);
static int cxl_device_id(const struct device *dev)
{ … }
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(modalias);
static struct attribute *cxl_base_attributes[] = …;
struct attribute_group cxl_base_attribute_group = …;
static ssize_t start_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_ADMIN_RO(start);
static ssize_t size_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(size);
#define CXL_DECODER_FLAG_ATTR(name, flag) …
CXL_DECODER_FLAG_ATTR(…);
CXL_DECODER_FLAG_ATTR(…);
CXL_DECODER_FLAG_ATTR(…);
CXL_DECODER_FLAG_ATTR(…);
CXL_DECODER_FLAG_ATTR(…);
static ssize_t target_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(target_type);
static ssize_t emit_target_list(struct cxl_switch_decoder *cxlsd, char *buf)
{ … }
static ssize_t target_list_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(target_list);
static ssize_t mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t mode_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static DEVICE_ATTR_RW(mode);
static ssize_t dpa_resource_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(dpa_resource);
static ssize_t dpa_size_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t dpa_size_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static DEVICE_ATTR_RW(dpa_size);
static ssize_t interleave_granularity_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(interleave_granularity);
static ssize_t interleave_ways_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(interleave_ways);
static ssize_t qos_class_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(qos_class);
static struct attribute *cxl_decoder_base_attrs[] = …;
static struct attribute_group cxl_decoder_base_attribute_group = …;
static struct attribute *cxl_decoder_root_attrs[] = …;
static bool can_create_pmem(struct cxl_root_decoder *cxlrd)
{ … }
static bool can_create_ram(struct cxl_root_decoder *cxlrd)
{ … }
static umode_t cxl_root_decoder_visible(struct kobject *kobj, struct attribute *a, int n)
{ … }
static struct attribute_group cxl_decoder_root_attribute_group = …;
static const struct attribute_group *cxl_decoder_root_attribute_groups[] = …;
static struct attribute *cxl_decoder_switch_attrs[] = …;
static struct attribute_group cxl_decoder_switch_attribute_group = …;
static const struct attribute_group *cxl_decoder_switch_attribute_groups[] = …;
static struct attribute *cxl_decoder_endpoint_attrs[] = …;
static struct attribute_group cxl_decoder_endpoint_attribute_group = …;
static const struct attribute_group *cxl_decoder_endpoint_attribute_groups[] = …;
static void __cxl_decoder_release(struct cxl_decoder *cxld)
{ … }
static void cxl_endpoint_decoder_release(struct device *dev)
{ … }
static void cxl_switch_decoder_release(struct device *dev)
{ … }
struct cxl_root_decoder *to_cxl_root_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void cxl_root_decoder_release(struct device *dev)
{ … }
static const struct device_type cxl_decoder_endpoint_type = …;
static const struct device_type cxl_decoder_switch_type = …;
static const struct device_type cxl_decoder_root_type = …;
bool is_endpoint_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
bool is_root_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
bool is_switch_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_decoder *to_cxl_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_endpoint_decoder *to_cxl_endpoint_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_switch_decoder *to_cxl_switch_decoder(struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void cxl_ep_release(struct cxl_ep *ep)
{ … }
static void cxl_ep_remove(struct cxl_port *port, struct cxl_ep *ep)
{ … }
static void cxl_port_release(struct device *dev)
{ … }
static ssize_t decoders_committed_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(decoders_committed);
static struct attribute *cxl_port_attrs[] = …;
static struct attribute_group cxl_port_attribute_group = …;
static const struct attribute_group *cxl_port_attribute_groups[] = …;
static const struct device_type cxl_port_type = …;
bool is_cxl_port(const struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_port *to_cxl_port(const struct device *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void unregister_port(void *_port)
{ … }
static void cxl_unlink_uport(void *_port)
{ … }
static int devm_cxl_link_uport(struct device *host, struct cxl_port *port)
{ … }
static void cxl_unlink_parent_dport(void *_port)
{ … }
static int devm_cxl_link_parent_dport(struct device *host,
struct cxl_port *port,
struct cxl_dport *parent_dport)
{ … }
static struct lock_class_key cxl_port_key;
static struct cxl_port *cxl_port_alloc(struct device *uport_dev,
struct cxl_dport *parent_dport)
{ … }
static int cxl_setup_comp_regs(struct device *host, struct cxl_register_map *map,
resource_size_t component_reg_phys)
{ … }
static int cxl_port_setup_regs(struct cxl_port *port,
resource_size_t component_reg_phys)
{ … }
static int cxl_dport_setup_regs(struct device *host, struct cxl_dport *dport,
resource_size_t component_reg_phys)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
static int cxl_einj_inject(void *data, u64 type)
{ … }
DEFINE_DEBUGFS_ATTRIBUTE(…);
static void cxl_debugfs_create_dport_dir(struct cxl_dport *dport)
{ … }
static struct cxl_port *__devm_cxl_add_port(struct device *host,
struct device *uport_dev,
resource_size_t component_reg_phys,
struct cxl_dport *parent_dport)
{ … }
struct cxl_port *devm_cxl_add_port(struct device *host,
struct device *uport_dev,
resource_size_t component_reg_phys,
struct cxl_dport *parent_dport)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_root *devm_cxl_add_root(struct device *host,
const struct cxl_root_ops *ops)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct pci_bus *cxl_port_to_pci_bus(struct cxl_port *port)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void unregister_pci_bus(void *uport_dev)
{ … }
int devm_cxl_register_pci_bus(struct device *host, struct device *uport_dev,
struct pci_bus *bus)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static bool dev_is_cxl_root_child(struct device *dev)
{ … }
struct cxl_root *find_cxl_root(struct cxl_port *port)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
void put_cxl_root(struct cxl_root *cxl_root)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static struct cxl_dport *find_dport(struct cxl_port *port, int id)
{ … }
static int add_dport(struct cxl_port *port, struct cxl_dport *dport)
{ … }
static void cond_cxl_root_lock(struct cxl_port *port)
{ … }
static void cond_cxl_root_unlock(struct cxl_port *port)
{ … }
static void cxl_dport_remove(void *data)
{ … }
static void cxl_dport_unlink(void *data)
{ … }
static struct cxl_dport *
__devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev,
int port_id, resource_size_t component_reg_phys,
resource_size_t rcrb)
{ … }
struct cxl_dport *devm_cxl_add_dport(struct cxl_port *port,
struct device *dport_dev, int port_id,
resource_size_t component_reg_phys)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port,
struct device *dport_dev, int port_id,
resource_size_t rcrb)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static int add_ep(struct cxl_ep *new)
{ … }
static int cxl_add_ep(struct cxl_dport *dport, struct device *ep_dev)
{ … }
struct cxl_find_port_ctx { … };
static int match_port_by_dport(struct device *dev, const void *data)
{ … }
static struct cxl_port *__find_cxl_port(struct cxl_find_port_ctx *ctx)
{ … }
static struct cxl_port *find_cxl_port(struct device *dport_dev,
struct cxl_dport **dport)
{ … }
static struct cxl_port *find_cxl_port_at(struct cxl_port *parent_port,
struct device *dport_dev,
struct cxl_dport **dport)
{ … }
static struct device *grandparent(struct device *dev)
{ … }
static struct device *endpoint_host(struct cxl_port *endpoint)
{ … }
static void delete_endpoint(void *data)
{ … }
int cxl_endpoint_autoremove(struct cxl_memdev *cxlmd, struct cxl_port *endpoint)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void delete_switch_port(struct cxl_port *port)
{ … }
static void reap_dports(struct cxl_port *port)
{ … }
struct detach_ctx { … };
static int port_has_memdev(struct device *dev, const void *data)
{ … }
static void cxl_detach_ep(void *data)
{ … }
static resource_size_t find_component_registers(struct device *dev)
{ … }
static int add_port_attach_ep(struct cxl_memdev *cxlmd,
struct device *uport_dev,
struct device *dport_dev)
{ … }
int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_port *cxl_pci_find_port(struct pci_dev *pdev,
struct cxl_dport **dport)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_port *cxl_mem_find_port(struct cxl_memdev *cxlmd,
struct cxl_dport **dport)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static int decoder_populate_targets(struct cxl_switch_decoder *cxlsd,
struct cxl_port *port, int *target_map)
{ … }
static struct lock_class_key cxl_decoder_key;
static int cxl_decoder_init(struct cxl_port *port, struct cxl_decoder *cxld)
{ … }
static int cxl_switch_decoder_init(struct cxl_port *port,
struct cxl_switch_decoder *cxlsd,
int nr_targets)
{ … }
struct cxl_root_decoder *cxl_root_decoder_alloc(struct cxl_port *port,
unsigned int nr_targets)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_switch_decoder *cxl_switch_decoder_alloc(struct cxl_port *port,
unsigned int nr_targets)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct cxl_endpoint_decoder *cxl_endpoint_decoder_alloc(struct cxl_port *port)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
int cxl_decoder_add_locked(struct cxl_decoder *cxld, int *target_map)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
int cxl_decoder_add(struct cxl_decoder *cxld, int *target_map)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void cxld_unregister(void *dev)
{ … }
int cxl_decoder_autoremove(struct device *host, struct cxl_decoder *cxld)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
int __cxl_driver_register(struct cxl_driver *cxl_drv, struct module *owner,
const char *modname)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
void cxl_driver_unregister(struct cxl_driver *cxl_drv)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static int cxl_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
static int cxl_bus_match(struct device *dev, const struct device_driver *drv)
{ … }
static int cxl_bus_probe(struct device *dev)
{ … }
static void cxl_bus_remove(struct device *dev)
{ … }
static struct workqueue_struct *cxl_bus_wq;
static void cxl_bus_rescan_queue(struct work_struct *w)
{ … }
void cxl_bus_rescan(void)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
void cxl_bus_drain(void)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static void add_latency(struct access_coordinate *c, long latency)
{ … }
static bool coordinates_valid(struct access_coordinate *c)
{ … }
static void set_min_bandwidth(struct access_coordinate *c, unsigned int bw)
{ … }
static void set_access_coordinates(struct access_coordinate *out,
struct access_coordinate *in)
{ … }
static bool parent_port_is_cxl_root(struct cxl_port *port)
{ … }
int cxl_endpoint_get_perf_coordinates(struct cxl_port *port,
struct access_coordinate *coord)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static ssize_t flush_store(const struct bus_type *bus, const char *buf, size_t count)
{ … }
static BUS_ATTR_WO(flush);
static struct attribute *cxl_bus_attributes[] = …;
static struct attribute_group cxl_bus_attribute_group = …;
static const struct attribute_group *cxl_bus_attribute_groups[] = …;
struct bus_type cxl_bus_type = …;
EXPORT_SYMBOL_NS_GPL(…);
static struct dentry *cxl_debugfs;
struct dentry *cxl_debugfs_create_dir(const char *dir)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static __init int cxl_core_init(void)
{ … }
static void cxl_core_exit(void)
{ … }
subsys_initcall(cxl_core_init);
module_exit(cxl_core_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);