drivers/cxl/cxl.h
Source file repositories/reference/linux-study-clean/drivers/cxl/cxl.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/cxl/cxl.h- Extension
.h- Size
- 32004 bytes
- Lines
- 933
- Domain
- Driver Families
- Bucket
- drivers/cxl
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/libnvdimm.hlinux/bitfield.hlinux/notifier.hlinux/bitops.hlinux/log2.hlinux/node.hlinux/io.hlinux/range.hcxl/cxl.h
Detected Declarations
struct cxl_dportstruct cxl_decoderstruct cxl_endpoint_decoderstruct cxl_switch_decoderstruct cxl_root_decoderstruct cxl_rd_opsstruct cxl_root_decoderstruct cxl_region_paramsstruct cxl_regionstruct cxl_nvdimm_bridgestruct cxl_nvdimmstruct cxl_pmem_region_mappingstruct cxl_pmem_regionstruct cxl_dax_regionstruct cxl_portstruct cxl_cdatstruct cxl_rootstruct cxl_root_opsstruct cxl_rootstruct cxl_rcrb_infostruct cxl_dportstruct cxl_epstruct cxl_region_refstruct cxl_cxims_datastruct pci_busstruct cxl_endpoint_dvsec_infostruct cxl_dev_statestruct cxl_driverenum cxl_regloc_typeenum cxl_decoder_typeenum cxl_decoder_stateenum cxl_config_statefunction cxl_hdm_decoder_countfunction eig_to_granularityfunction eiw_to_waysfunction granularity_to_eigfunction ways_to_eiwfunction to_cxl_rootfunction cxl_find_dport_by_devfunction is_cxl_rootfunction cxl_do_xormap_calcfunction cxl_setup_prm_address_translationfunction cxl_root_decoder_autoremovefunction is_cxl_pmem_regionfunction cxl_add_to_regionfunction cxl_port_get_spa_cache_aliasfunction cxl_region_contains_resource
Annotated Snippet
extern const struct bus_type cxl_bus_type;
/*
* Note, add_dport() is expressly for the cxl_port driver. TODO: investigate a
* type-safe driver model where probe()/remove() take the type of object implied
* by @id and the add_dport() op only defined for the CXL_DEVICE_PORT driver
* template.
*/
struct cxl_driver {
const char *name;
int (*probe)(struct device *dev);
void (*remove)(struct device *dev);
struct cxl_dport *(*add_dport)(struct cxl_port *port,
struct device *dport_dev);
struct device_driver drv;
int id;
};
#define to_cxl_drv(__drv) container_of_const(__drv, struct cxl_driver, drv)
int __cxl_driver_register(struct cxl_driver *cxl_drv, struct module *owner,
const char *modname);
#define cxl_driver_register(x) __cxl_driver_register(x, THIS_MODULE, KBUILD_MODNAME)
void cxl_driver_unregister(struct cxl_driver *cxl_drv);
#define module_cxl_driver(__cxl_driver) \
module_driver(__cxl_driver, cxl_driver_register, cxl_driver_unregister)
#define CXL_DEVICE_NVDIMM_BRIDGE 1
#define CXL_DEVICE_NVDIMM 2
#define CXL_DEVICE_PORT 3
#define CXL_DEVICE_ROOT 4
#define CXL_DEVICE_MEMORY_EXPANDER 5
#define CXL_DEVICE_REGION 6
#define CXL_DEVICE_PMEM_REGION 7
#define CXL_DEVICE_DAX_REGION 8
#define CXL_DEVICE_PMU 9
#define MODULE_ALIAS_CXL(type) MODULE_ALIAS("cxl:t" __stringify(type) "*")
#define CXL_MODALIAS_FMT "cxl:t%d"
struct cxl_nvdimm_bridge *to_cxl_nvdimm_bridge(struct device *dev);
struct cxl_nvdimm_bridge *devm_cxl_add_nvdimm_bridge(struct device *host,
struct cxl_port *port);
struct cxl_nvdimm_bridge *__devm_cxl_add_nvdimm_bridge(struct device *host,
struct cxl_port *port);
struct cxl_nvdimm *to_cxl_nvdimm(struct device *dev);
bool is_cxl_nvdimm(struct device *dev);
int devm_cxl_add_nvdimm(struct device *host, struct cxl_port *port,
struct cxl_memdev *cxlmd);
struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_port *port);
#ifdef CONFIG_CXL_REGION
bool is_cxl_pmem_region(struct device *dev);
struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev);
int cxl_add_to_region(struct cxl_endpoint_decoder *cxled);
struct cxl_dax_region *to_cxl_dax_region(struct device *dev);
u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa);
bool cxl_region_contains_resource(const struct resource *res);
#else
static inline bool is_cxl_pmem_region(struct device *dev)
{
return false;
}
static inline struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev)
{
return NULL;
}
static inline int cxl_add_to_region(struct cxl_endpoint_decoder *cxled)
{
return 0;
}
static inline struct cxl_dax_region *to_cxl_dax_region(struct device *dev)
{
return NULL;
}
static inline u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint,
u64 spa)
{
return 0;
}
static inline bool cxl_region_contains_resource(const struct resource *res)
{
return false;
}
#endif
void cxl_endpoint_parse_cdat(struct cxl_port *port);
void cxl_switch_parse_cdat(struct cxl_dport *dport);
Annotation
- Immediate include surface: `linux/libnvdimm.h`, `linux/bitfield.h`, `linux/notifier.h`, `linux/bitops.h`, `linux/log2.h`, `linux/node.h`, `linux/io.h`, `linux/range.h`.
- Detected declarations: `struct cxl_dport`, `struct cxl_decoder`, `struct cxl_endpoint_decoder`, `struct cxl_switch_decoder`, `struct cxl_root_decoder`, `struct cxl_rd_ops`, `struct cxl_root_decoder`, `struct cxl_region_params`, `struct cxl_region`, `struct cxl_nvdimm_bridge`.
- Atlas domain: Driver Families / drivers/cxl.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.