drivers/virt/acrn/acrn_drv.h

Source file repositories/reference/linux-study-clean/drivers/virt/acrn/acrn_drv.h

File Facts

System
Linux kernel
Corpus path
drivers/virt/acrn/acrn_drv.h
Extension
.h
Size
7847 bytes
Lines
230
Domain
Driver Families
Bucket
drivers/virt
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 vm_memory_region_op {
	u32	type;
	u32	attr;
	u64	user_vm_pa;
	u64	service_vm_pa;
	u64	size;
};

/**
 * struct vm_memory_region_batch - A batch of vm_memory_region_op.
 * @vmid:		A User VM ID.
 * @reserved:		Reserved.
 * @regions_num:	The number of vm_memory_region_op.
 * @regions_gpa:	Physical address of a vm_memory_region_op array.
 * @regions_op:		Flexible array of vm_memory_region_op.
 *
 * HC_VM_SET_MEMORY_REGIONS uses this structure to manage EPT mappings of
 * multiple memory regions of a User VM. A &struct vm_memory_region_batch
 * contains multiple &struct vm_memory_region_op for batch processing in the
 * ACRN Hypervisor.
 */
struct vm_memory_region_batch {
	u16			   vmid;
	u16			   reserved[3];
	u32			   regions_num;
	u64			   regions_gpa;
	struct vm_memory_region_op regions_op[] __counted_by(regions_num);
};

/**
 * struct vm_memory_mapping - Memory map between a User VM and the Service VM
 * @pages:		Pages in Service VM kernel.
 * @npages:		Number of pages.
 * @service_vm_va:	Virtual address in Service VM kernel.
 * @user_vm_pa:		Physical address in User VM.
 * @size:		Size of this memory region.
 *
 * HSM maintains memory mappings between a User VM GPA and the Service VM
 * kernel VA for accelerating the User VM GPA translation.
 */
struct vm_memory_mapping {
	struct page	**pages;
	int		npages;
	void		*service_vm_va;
	u64		user_vm_pa;
	size_t		size;
};

/**
 * struct acrn_ioreq_buffer - Data for setting the ioreq buffer of User VM
 * @ioreq_buf:	The GPA of the IO request shared buffer of a VM
 *
 * The parameter for the HC_SET_IOREQ_BUFFER hypercall used to set up
 * the shared I/O request buffer between Service VM and ACRN hypervisor.
 */
struct acrn_ioreq_buffer {
	u64	ioreq_buf;
};

struct acrn_ioreq_range {
	struct list_head	list;
	u32			type;
	u64			start;
	u64			end;
};

#define ACRN_IOREQ_CLIENT_DESTROYING	0U
typedef	int (*ioreq_handler_t)(struct acrn_ioreq_client *client,
			       struct acrn_io_request *req);
/**
 * struct acrn_ioreq_client - Structure of I/O client.
 * @name:	Client name
 * @vm:		The VM that the client belongs to
 * @list:	List node for this acrn_ioreq_client
 * @is_default:	If this client is the default one
 * @flags:	Flags (ACRN_IOREQ_CLIENT_*)
 * @range_list:	I/O ranges
 * @range_lock:	Lock to protect range_list
 * @ioreqs_map:	The pending I/O requests bitmap.
 * @handler:	I/O requests handler of this client
 * @thread:	The thread which executes the handler
 * @wq:		The wait queue for the handler thread parking
 * @priv:	Data for the thread
 */
struct acrn_ioreq_client {
	char			name[ACRN_NAME_LEN];
	struct acrn_vm		*vm;
	struct list_head	list;
	bool			is_default;
	unsigned long		flags;

Annotation

Implementation Notes