drivers/rpmsg/qcom_smd.c
Source file repositories/reference/linux-study-clean/drivers/rpmsg/qcom_smd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rpmsg/qcom_smd.c- Extension
.c- Size
- 42001 bytes
- Lines
- 1623
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/interrupt.hlinux/io.hlinux/mailbox_client.hlinux/mfd/syscon.hlinux/module.hlinux/of_irq.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.hlinux/sched.hlinux/sizes.hlinux/slab.hlinux/soc/qcom/smem.hlinux/wait.hlinux/rpmsg.hlinux/rpmsg/qcom_smd.hrpmsg_internal.h
Detected Declarations
struct smd_channel_infostruct smd_channel_info_pairstruct smd_channel_info_wordstruct smd_channel_info_word_pairstruct qcom_smd_edgestruct qcom_smd_devicestruct qcom_smd_endpointstruct qcom_smd_channelstruct smd_channel_infostruct smd_channel_info_pairstruct smd_channel_info_wordstruct smd_channel_info_word_pairstruct qcom_smd_alloc_entryenum smd_channel_statefunction qcom_smd_signal_channelfunction qcom_smd_channel_resetfunction qcom_smd_channel_set_callbackfunction qcom_smd_channel_get_rx_availfunction qcom_smd_channel_set_statefunction smd_copy_to_fifofunction smd_copy_from_fifofunction qcom_smd_channel_peekfunction qcom_smd_channel_advancefunction qcom_smd_channel_recv_singlefunction qcom_smd_channel_intrfunction qcom_smd_edge_intrfunction qcom_smd_get_tx_availfunction qcom_smd_write_fifofunction __qcom_smd_sendfunction qcom_smd_channel_openfunction qcom_smd_channel_closefunction qcom_smd_find_channelfunction __ept_releasefunction qcom_smd_destroy_eptfunction qcom_smd_sendfunction qcom_smd_trysendfunction qcom_smd_sendtofunction qcom_smd_trysendtofunction qcom_smd_pollfunction for_each_available_child_of_nodefunction qcom_smd_announce_createfunction qcom_smd_release_devicefunction qcom_smd_create_devicefunction qcom_smd_create_chrdevfunction qcom_smd_create_channelfunction qcom_channel_state_workerfunction qcom_smd_parse_edgefunction qcom_smd_edge_release
Annotated Snippet
struct qcom_smd_edge {
struct device dev;
const char *name;
struct device_node *of_node;
unsigned edge_id;
unsigned remote_pid;
int irq;
struct regmap *ipc_regmap;
int ipc_offset;
int ipc_bit;
struct mbox_client mbox_client;
struct mbox_chan *mbox_chan;
struct list_head channels;
spinlock_t channels_lock;
DECLARE_BITMAP(allocated[SMD_ALLOC_TBL_COUNT], SMD_ALLOC_TBL_SIZE);
unsigned smem_available;
wait_queue_head_t new_channel_event;
struct work_struct scan_work;
struct work_struct state_work;
};
/*
* SMD channel states.
*/
enum smd_channel_state {
SMD_CHANNEL_CLOSED,
SMD_CHANNEL_OPENING,
SMD_CHANNEL_OPENED,
SMD_CHANNEL_FLUSHING,
SMD_CHANNEL_CLOSING,
SMD_CHANNEL_RESET,
SMD_CHANNEL_RESET_OPENING
};
struct qcom_smd_device {
struct rpmsg_device rpdev;
struct qcom_smd_edge *edge;
};
struct qcom_smd_endpoint {
struct rpmsg_endpoint ept;
struct qcom_smd_channel *qsch;
};
#define to_smd_device(r) container_of(r, struct qcom_smd_device, rpdev)
#define to_smd_edge(d) container_of(d, struct qcom_smd_edge, dev)
#define to_smd_endpoint(e) container_of(e, struct qcom_smd_endpoint, ept)
/**
* struct qcom_smd_channel - smd channel struct
* @edge: qcom_smd_edge this channel is living on
* @qsept: reference to a associated smd endpoint
* @registered: flag to indicate if the channel is registered
* @name: name of the channel
* @state: local state of the channel
* @remote_state: remote state of the channel
* @state_change_event: state change event
* @info: byte aligned outgoing/incoming channel info
* @info_word: word aligned outgoing/incoming channel info
* @tx_lock: lock to make writes to the channel mutually exclusive
* @fblockread_event: wakeup event tied to tx fBLOCKREADINTR
* @tx_fifo: pointer to the outgoing ring buffer
* @rx_fifo: pointer to the incoming ring buffer
* @fifo_size: size of each ring buffer
* @bounce_buffer: bounce buffer for reading wrapped packets
* @cb: callback function registered for this channel
* @recv_lock: guard for rx info modifications and cb pointer
* @pkt_size: size of the currently handled packet
* @drvdata: driver private data
* @list: lite entry for @channels in qcom_smd_edge
*/
struct qcom_smd_channel {
struct qcom_smd_edge *edge;
struct qcom_smd_endpoint *qsept;
bool registered;
char *name;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/io.h`, `linux/mailbox_client.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of_irq.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `struct smd_channel_info`, `struct smd_channel_info_pair`, `struct smd_channel_info_word`, `struct smd_channel_info_word_pair`, `struct qcom_smd_edge`, `struct qcom_smd_device`, `struct qcom_smd_endpoint`, `struct qcom_smd_channel`, `struct smd_channel_info`, `struct smd_channel_info_pair`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.