drivers/rpmsg/qcom_glink_native.c
Source file repositories/reference/linux-study-clean/drivers/rpmsg/qcom_glink_native.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rpmsg/qcom_glink_native.c- Extension
.c- Size
- 50893 bytes
- Lines
- 1990
- Domain
- Driver Families
- Bucket
- drivers/rpmsg
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/idr.hlinux/interrupt.hlinux/io.hlinux/list.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/regmap.hlinux/rpmsg.hlinux/sizes.hlinux/slab.hlinux/wait.hlinux/workqueue.hlinux/mailbox_client.hrpmsg_internal.hqcom_glink_native.hqcom_glink_trace.h
Detected Declarations
struct glink_msgstruct glink_defer_cmdstruct glink_core_rx_intentstruct qcom_glinkstruct glink_channelstruct commandstruct intent_pairfunction qcom_glink_channel_releasefunction idr_for_each_entryfunction qcom_glink_rx_availfunction qcom_glink_rx_peekfunction qcom_glink_rx_advancefunction qcom_glink_tx_availfunction qcom_glink_tx_writefunction qcom_glink_tx_kickfunction qcom_glink_send_read_notifyfunction qcom_glink_txfunction qcom_glink_send_versionfunction qcom_glink_send_version_ackfunction qcom_glink_send_open_ackfunction qcom_glink_handle_intent_req_ackfunction qcom_glink_intent_req_abortfunction qcom_glink_send_open_reqfunction qcom_glink_send_close_reqfunction qcom_glink_send_close_ackfunction qcom_glink_rx_done_workfunction qcom_glink_rx_donefunction qcom_glink_receive_versionfunction qcom_glink_receive_version_ackfunction qcom_glink_send_intent_req_ackfunction qcom_glink_advertise_intentfunction qcom_glink_alloc_intentfunction qcom_glink_handle_rx_donefunction qcom_glink_handle_intent_reqfunction qcom_glink_rx_deferfunction qcom_glink_rx_datafunction qcom_glink_rx_read_notiffunction qcom_glink_handle_intentfunction qcom_glink_rx_open_ackfunction qcom_glink_set_flow_controlfunction qcom_glink_handle_signalsfunction qcom_glink_native_rxfunction qcom_glink_create_remotefunction qcom_glink_announce_createfunction qcom_glink_remove_rpmsg_devicefunction qcom_glink_destroy_eptfunction qcom_glink_request_intentfunction __qcom_glink_send
Annotated Snippet
struct glink_msg {
/* New members MUST be added within the __struct_group() macro below. */
__struct_group(glink_msg_hdr, hdr, __packed,
__le16 cmd;
__le16 param1;
__le32 param2;
);
u8 data[];
} __packed;
static_assert(offsetof(struct glink_msg, data) == sizeof(struct glink_msg_hdr),
"struct member likely outside of __struct_group()");
/**
* struct glink_defer_cmd - deferred incoming control message
* @node: list node
* @msg: message header
* @data: payload of the message
*
* Copy of a received control message, to be added to @rx_queue and processed
* by @rx_work of @qcom_glink.
*/
struct glink_defer_cmd {
struct list_head node;
struct glink_msg_hdr msg;
u8 data[];
};
/**
* struct glink_core_rx_intent - RX intent
* RX intent
*
* @data: pointer to the data (may be NULL for zero-copy)
* @id: remote or local intent ID
* @size: size of the original intent (do not modify)
* @reuse: To mark if the intent can be reused after first use
* @in_use: To mark if intent is already in use for the channel
* @offset: next write offset (initially 0)
* @node: list node
*/
struct glink_core_rx_intent {
void *data;
u32 id;
size_t size;
bool reuse;
bool in_use;
u32 offset;
struct list_head node;
};
/**
* struct qcom_glink - driver context, relates to one remote subsystem
* @dev: reference to the associated struct device
* @label: identifier of the glink edge
* @rx_pipe: pipe object for receive FIFO
* @tx_pipe: pipe object for transmit FIFO
* @rx_work: worker for handling received control messages
* @rx_lock: protects the @rx_queue
* @rx_queue: queue of received control messages to be processed in @rx_work
* @tx_lock: synchronizes operations on the tx fifo
* @idr_lock: synchronizes @lcids and @rcids modifications
* @lcids: idr of all channels with a known local channel id
* @rcids: idr of all channels with a known remote channel id
* @features: remote features
* @intentless: flag to indicate that there is no intent
* @tx_avail_notify: Waitqueue for pending tx tasks
* @sent_read_notify: flag to check cmd sent or not
* @abort_tx: flag indicating that all tx attempts should fail
*/
struct qcom_glink {
struct device *dev;
const char *label;
struct qcom_glink_pipe *rx_pipe;
struct qcom_glink_pipe *tx_pipe;
struct work_struct rx_work;
spinlock_t rx_lock;
struct list_head rx_queue;
spinlock_t tx_lock;
spinlock_t idr_lock;
struct idr lcids;
struct idr rcids;
unsigned long features;
bool intentless;
Annotation
- Immediate include surface: `linux/idr.h`, `linux/interrupt.h`, `linux/io.h`, `linux/list.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`.
- Detected declarations: `struct glink_msg`, `struct glink_defer_cmd`, `struct glink_core_rx_intent`, `struct qcom_glink`, `struct glink_channel`, `struct command`, `struct intent_pair`, `function qcom_glink_channel_release`, `function idr_for_each_entry`, `function qcom_glink_rx_avail`.
- Atlas domain: Driver Families / drivers/rpmsg.
- Implementation status: integration 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.