mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-12 08:45:11 +08:00
09d09e04d2
While platform firmware takes some responsibility for mapping the RAM capacity of CXL devices present at boot, the OS is responsible for mapping the remainder and hot-added devices. Platform firmware is also responsible for identifying the platform general purpose memory pool, typically DDR attached DRAM, and arranging for the remainder to be 'Soft Reserved'. That reservation allows the CXL subsystem to route the memory to core-mm via memory-hotplug (dax_kmem), or leave it for dedicated access (device-dax). The new 'struct cxl_dax_region' object allows for a CXL memory resource (region) to be published, but also allow for udev and module policy to act on that event. It also prevents cxl_core.ko from having a module loading dependency on any drivers/dax/ modules. Tested-by: Fan Ni <fan.ni@samsung.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/167602003896.1924368.10335442077318970468.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
68 lines
2.3 KiB
C
68 lines
2.3 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_create_ram_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_dax_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)
|
|
#define CXL_DAX_REGION_TYPE(x) (&cxl_dax_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
|
|
#define CXL_DAX_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;
|
|
|
|
int cxl_memdev_init(void);
|
|
void cxl_memdev_exit(void);
|
|
void cxl_mbox_init(void);
|
|
|
|
#endif /* __CXL_CORE_H__ */
|