drivers/staging/media/atomisp/include/hmm/hmm_bo.h

Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/include/hmm/hmm_bo.h

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/include/hmm/hmm_bo.h
Extension
.h
Size
7223 bytes
Lines
262
Domain
Driver Families
Bucket
drivers/staging
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 hmm_bo_device {
	struct isp_mmu		mmu;

	/* start/pgnr/size is used to record the virtual memory of this bo */
	unsigned int start;
	unsigned int pgnr;
	unsigned int size;

	/* list lock is used to protect the entire_bo_list */
	spinlock_t	list_lock;
	int flag;

	/* linked list for entire buffer object */
	struct list_head entire_bo_list;
	/* rbtree for maintain entire allocated vm */
	struct rb_root allocated_rbtree;
	/* rbtree for maintain entire free vm */
	struct rb_root free_rbtree;
	struct mutex rbtree_mutex;
	struct kmem_cache *bo_cache;
};

struct hmm_buffer_object {
	struct hmm_bo_device	*bdev;
	struct list_head	list;
	struct kref	kref;

	struct page **pages;

	/* mutex protecting this BO */
	struct mutex		mutex;
	enum hmm_bo_type	type;
	int		mmap_count;
	int		status;
	void		*vmap_addr; /* kernel virtual address by vmap */

	struct rb_node	node;
	unsigned int	start;
	unsigned int	end;
	unsigned int	pgnr;
	/*
	 * When insert a bo which has the same pgnr with an existed
	 * bo node in the free_rbtree, using "prev & next" pointer
	 * to maintain a bo linked list instead of insert this bo
	 * into free_rbtree directly, it will make sure each node
	 * in free_rbtree has different pgnr.
	 * "prev & next" default is NULL.
	 */
	struct hmm_buffer_object	*prev;
	struct hmm_buffer_object	*next;
};

struct hmm_buffer_object *hmm_bo_alloc(struct hmm_bo_device *bdev,
				       unsigned int pgnr);

void hmm_bo_release(struct hmm_buffer_object *bo);

int hmm_bo_device_init(struct hmm_bo_device *bdev,
		       struct isp_mmu_client *mmu_driver,
		       unsigned int vaddr_start, unsigned int size);

/*
 * clean up all hmm_bo_device related things.
 */
void hmm_bo_device_exit(struct hmm_bo_device *bdev);

/*
 * whether the bo device is inited or not.
 */
int hmm_bo_device_inited(struct hmm_bo_device *bdev);

/*
 * increase buffer object reference.
 */
void hmm_bo_ref(struct hmm_buffer_object *bo);

/*
 * decrease buffer object reference. if reference reaches 0,
 * release function of the buffer object will be called.
 *
 * this call is also used to release hmm_buffer_object or its
 * upper level object with it embedded in. you need to call
 * this function when it is no longer used.
 *
 * Note:
 *
 * user dont need to care about internal resource release of
 * the buffer object in the release callback, it will be
 * handled internally.
 *

Annotation

Implementation Notes