include/linux/raspberrypi/vchiq_core.h

Source file repositories/reference/linux-study-clean/include/linux/raspberrypi/vchiq_core.h

File Facts

System
Linux kernel
Corpus path
include/linux/raspberrypi/vchiq_core.h
Extension
.h
Size
18256 bytes
Lines
647
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct vchiq_bulk {
	short mode;
	short dir;
	void *cb_data;
	void __user *cb_userdata;
	struct bulk_waiter *waiter;
	dma_addr_t dma_addr;
	int size;
	void *remote_data;
	int remote_size;
	int actual;
	void *offset;
	void __user *uoffset;
};

struct vchiq_bulk_queue {
	int local_insert;  /* Where to insert the next local bulk */
	int remote_insert; /* Where to insert the next remote bulk (master) */
	int process;       /* Bulk to transfer next */
	int remote_notify; /* Bulk to notify the remote client of next (mstr) */
	int remove;        /* Bulk to notify the local client of, and remove, next */
	struct vchiq_bulk bulks[VCHIQ_NUM_SERVICE_BULKS];
};

/*
 * Remote events provide a way of presenting several virtual doorbells to a
 * peer (ARM host to VPU) using only one physical doorbell. They can be thought
 * of as a way for the peer to signal a semaphore, in this case implemented as
 * a workqueue.
 *
 * Remote events remain signalled until acknowledged by the receiver, and they
 * are non-counting. They are designed in such a way as to minimise the number
 * of interrupts and avoid unnecessary waiting.
 *
 * A remote_event is as small data structures that live in shared memory. It
 * comprises two booleans - armed and fired:
 *
 * The sender sets fired when they signal the receiver.
 * If fired is set, the receiver has been signalled and need not wait.
 * The receiver sets the armed field before they begin to wait.
 * If armed is set, the receiver is waiting and wishes to be woken by interrupt.
 */
struct remote_event {
	int armed;
	int fired;
	u32 __unused;
};

struct opaque_platform_state;

struct vchiq_slot {
	char data[VCHIQ_SLOT_SIZE];
};

struct vchiq_slot_info {
	/* Use two counters rather than one to avoid the need for a mutex. */
	short use_count;
	short release_count;
};

/*
 * VCHIQ is a reliable connection-oriented datagram protocol.
 *
 * A VCHIQ service is equivalent to a TCP connection, except:
 * + FOURCCs are used for the rendezvous, and port numbers are assigned at the
 *   time the connection is established.
 * + There is less of a distinction between server and client sockets, the only
 *   difference being which end makes the first move.
 * + For a multi-client server, the server creates new "listening" services as
 *   the existing one becomes connected - there is no need to specify the
 *   maximum number of clients up front.
 * + Data transfer is reliable but packetized (messages have defined ends).
 * + Messages can be either short (capable of fitting in a slot) and in-band,
 *   or copied between external buffers (bulk transfers).
 */
struct vchiq_service {
	struct vchiq_service_base base;
	unsigned int handle;
	struct kref ref_count;
	struct rcu_head rcu;
	int srvstate;
	void (*userdata_term)(void *userdata);
	unsigned int localport;
	unsigned int remoteport;
	int public_fourcc;
	int client_id;
	char auto_close;
	char sync;
	char closing;
	char trace;

Annotation

Implementation Notes