drivers/dax/dax-private.h

Source file repositories/reference/linux-study-clean/drivers/dax/dax-private.h

File Facts

System
Linux kernel
Corpus path
drivers/dax/dax-private.h
Extension
.h
Size
3874 bytes
Lines
139
Domain
Driver Families
Bucket
drivers/dax
Inferred role
Driver Families: implementation source
Status
source 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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dax_region {
	int id;
	int target_node;
	struct kref kref;
	struct device *dev;
	unsigned int align;
	struct ida ida;
	struct resource res;
	struct device *seed;
	struct device *youngest;
};

/**
 * struct dax_mapping - device to display mapping range attributes
 * @dev: device representing this range
 * @range_id: index within dev_dax ranges array
 * @id: ida of this mapping
 */
struct dax_mapping {
	struct device dev;
	int range_id;
	int id;
};

/**
 * struct dev_dax_range - tuple represenging a range of memory used by dev_dax
 * @pgoff: page offset
 * @range: resource-span
 * @mapping: reference to the dax_mapping for this range
 */
struct dev_dax_range {
	unsigned long pgoff;
	struct range range;
	struct dax_mapping *mapping;
};

/**
 * struct dev_dax - instance data for a subdivision of a dax region, and
 * data while the device is activated in the driver.
 * @region: parent region
 * @dax_dev: core dax functionality
 * @virt_addr: kva from memremap; used by fsdev_dax
 * @cached_size: size of daxdev cached by fsdev_dax
 * @align: alignment of this instance
 * @target_node: effective numa node if dev_dax memory range is onlined
 * @dyn_id: is this a dynamic or statically created instance
 * @id: ida allocated id when the dax_region is not static
 * @ida: mapping id allocator
 * @dev: device core
 * @pgmap: pgmap for memmap setup / lifetime (driver owned)
 * @memmap_on_memory: allow kmem to put the memmap in the memory
 * @nr_range: size of @ranges
 * @ranges: range tuples of memory used
 */
struct dev_dax {
	struct dax_region *region;
	struct dax_device *dax_dev;
	void *virt_addr;
	u64 cached_size;
	unsigned int align;
	int target_node;
	bool dyn_id;
	int id;
	struct ida ida;
	struct device dev;
	struct dev_pagemap *pgmap;
	bool memmap_on_memory;
	int nr_range;
	struct dev_dax_range *ranges;
};

/*
 * While run_dax() is potentially a generic operation that could be
 * defined in include/linux/dax.h we don't want to grow any users
 * outside of drivers/dax/
 */
void run_dax(struct dax_device *dax_dev);

static inline struct dev_dax *to_dev_dax(struct device *dev)
{
	return container_of(dev, struct dev_dax, dev);
}

static inline struct dax_mapping *to_dax_mapping(struct device *dev)
{
	return container_of(dev, struct dax_mapping, dev);
}

phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, unsigned long size);

Annotation

Implementation Notes