mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-25 03:55:09 +08:00
7592d935b7
tl;dr: Clean up an unnecessary export and enable cxl_test. An RCD (Restricted CXL Device), in contrast to a typical CXL device in a VH topology, obtains its component registers from the bottom half of the associated CXL host bridge RCRB (Root Complex Register Block). In turn this means that cxl_rcrb_to_component() needs to be called from devm_cxl_add_endpoint(). Presently devm_cxl_add_endpoint() is part of the CXL core, but the only user is the CXL mem module. Move it from cxl_core to cxl_mem to not only get rid of an unnecessary export, but to also enable its call out to cxl_rcrb_to_component(), in a subsequent patch, to be mocked by cxl_test. Recall that cxl_test can only mock exported symbols, and since cxl_rcrb_to_component() is itself inside the core, all callers must be outside of cxl_core to allow cxl_test to mock it. Reviewed-by: Robert Richter <rrichter@amd.com> Link: https://lore.kernel.org/r/166993045072.1882361.13944923741276843683.stgit@dwillia2-xfh.jf.intel.com Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
67 lines
2.2 KiB
C
67 lines
2.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright(c) 2020 Intel Corporation. */
|
|
|
|
#ifndef __CXL_CORE_H__
|
|
#define __CXL_CORE_H__
|
|
|
|
extern const struct device_type cxl_nvdimm_bridge_type;
|
|
extern const struct device_type cxl_nvdimm_type;
|
|
|
|
extern struct attribute_group cxl_base_attribute_group;
|
|
|
|
#ifdef CONFIG_CXL_REGION
|
|
extern struct device_attribute dev_attr_create_pmem_region;
|
|
extern struct device_attribute dev_attr_delete_region;
|
|
extern struct device_attribute dev_attr_region;
|
|
extern const struct device_type cxl_pmem_region_type;
|
|
extern const struct device_type cxl_region_type;
|
|
void cxl_decoder_kill_region(struct cxl_endpoint_decoder *cxled);
|
|
#define CXL_REGION_ATTR(x) (&dev_attr_##x.attr)
|
|
#define CXL_REGION_TYPE(x) (&cxl_region_type)
|
|
#define SET_CXL_REGION_ATTR(x) (&dev_attr_##x.attr),
|
|
#define CXL_PMEM_REGION_TYPE(x) (&cxl_pmem_region_type)
|
|
int cxl_region_init(void);
|
|
void cxl_region_exit(void);
|
|
#else
|
|
static inline void cxl_decoder_kill_region(struct cxl_endpoint_decoder *cxled)
|
|
{
|
|
}
|
|
static inline int cxl_region_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void cxl_region_exit(void)
|
|
{
|
|
}
|
|
#define CXL_REGION_ATTR(x) NULL
|
|
#define CXL_REGION_TYPE(x) NULL
|
|
#define SET_CXL_REGION_ATTR(x)
|
|
#define CXL_PMEM_REGION_TYPE(x) NULL
|
|
#endif
|
|
|
|
struct cxl_send_command;
|
|
struct cxl_mem_query_commands;
|
|
int cxl_query_cmd(struct cxl_memdev *cxlmd,
|
|
struct cxl_mem_query_commands __user *q);
|
|
int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s);
|
|
void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr,
|
|
resource_size_t length);
|
|
|
|
struct dentry *cxl_debugfs_create_dir(const char *dir);
|
|
int cxl_dpa_set_mode(struct cxl_endpoint_decoder *cxled,
|
|
enum cxl_decoder_mode mode);
|
|
int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size);
|
|
int cxl_dpa_free(struct cxl_endpoint_decoder *cxled);
|
|
resource_size_t cxl_dpa_size(struct cxl_endpoint_decoder *cxled);
|
|
resource_size_t cxl_dpa_resource_start(struct cxl_endpoint_decoder *cxled);
|
|
extern struct rw_semaphore cxl_dpa_rwsem;
|
|
|
|
bool is_switch_decoder(struct device *dev);
|
|
struct cxl_switch_decoder *to_cxl_switch_decoder(struct device *dev);
|
|
|
|
int cxl_memdev_init(void);
|
|
void cxl_memdev_exit(void);
|
|
void cxl_mbox_init(void);
|
|
|
|
#endif /* __CXL_CORE_H__ */
|