drivers/soc/qcom/smp2p.c
Source file repositories/reference/linux-study-clean/drivers/soc/qcom/smp2p.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/qcom/smp2p.c- Extension
.c- Size
- 20279 bytes
- Lines
- 803
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- 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.
- 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/list.hlinux/io.hlinux/of.hlinux/irq.hlinux/irqdomain.hlinux/mailbox_client.hlinux/mfd/syscon.hlinux/module.hlinux/platform_device.hlinux/pm_wakeirq.hlinux/regmap.hlinux/seq_file.hlinux/soc/qcom/smem.hlinux/soc/qcom/smem_state.hlinux/spinlock.htrace-smp2p.h
Detected Declarations
struct smp2p_smem_itemstruct smp2p_entrystruct qcom_smp2pfunction qcom_smp2p_kickfunction qcom_smp2p_check_ssrfunction qcom_smp2p_do_ssr_ackfunction qcom_smp2p_negotiatefunction qcom_smp2p_in_versionfunction qcom_smp2p_start_infunction list_for_each_entryfunction qcom_smp2p_notify_infunction list_for_each_entryfunction for_each_set_bitfunction qcom_smp2p_intrfunction smp2p_mask_irqfunction smp2p_unmask_irqfunction smp2p_set_irq_typefunction smp2p_irq_print_chipfunction smp2p_irq_get_irqchip_statefunction smp2p_irq_mapfunction qcom_smp2p_inbound_entryfunction smp2p_update_bitsfunction qcom_smp2p_outbound_entryfunction qcom_smp2p_alloc_outbound_itemfunction smp2p_parse_ipcfunction qcom_smp2p_probefunction for_each_available_child_of_node_scopedfunction qcom_smp2p_remove
Annotated Snippet
struct smp2p_smem_item {
u32 magic;
u8 version;
unsigned features:24;
u16 local_pid;
u16 remote_pid;
u16 total_entries;
u16 valid_entries;
u32 flags;
struct {
u8 name[SMP2P_MAX_ENTRY_NAME];
u32 value;
} entries[SMP2P_MAX_ENTRY];
} __packed;
/**
* struct smp2p_entry - driver context matching one entry
* @node: list entry to keep track of allocated entries
* @smp2p: reference to the device driver context
* @name: name of the entry, to match against smp2p_smem_item
* @value: pointer to smp2p_smem_item entry value
* @last_value: last handled value
* @domain: irq_domain for inbound entries
* @irq_enabled:bitmap to track enabled irq bits
* @irq_rising: bitmap to mark irq bits for rising detection
* @irq_falling:bitmap to mark irq bits for falling detection
* @state: smem state handle
* @lock: spinlock to protect read-modify-write of the value
*/
struct smp2p_entry {
struct list_head node;
struct qcom_smp2p *smp2p;
const char *name;
u32 *value;
u32 last_value;
struct irq_domain *domain;
DECLARE_BITMAP(irq_enabled, 32);
DECLARE_BITMAP(irq_rising, 32);
DECLARE_BITMAP(irq_falling, 32);
struct qcom_smem_state *state;
spinlock_t lock;
};
#define SMP2P_INBOUND 0
#define SMP2P_OUTBOUND 1
/**
* struct qcom_smp2p - device driver context
* @dev: device driver handle
* @in: pointer to the inbound smem item
* @out: pointer to the outbound smem item
* @smem_items: ids of the two smem items
* @valid_entries: already scanned inbound entries
* @ssr_ack_enabled: SMP2P_FEATURE_SSR_ACK feature is supported and was enabled
* @ssr_ack: current cached state of the local ack bit
* @negotiation_done: whether negotiating finished
* @local_pid: processor id of the inbound edge
* @remote_pid: processor id of the outbound edge
* @ipc_regmap: regmap for the outbound ipc
* @ipc_offset: offset within the regmap
* @ipc_bit: bit in regmap@offset to kick to signal remote processor
* @mbox_client: mailbox client handle
* @mbox_chan: apcs ipc mailbox channel handle
* @inbound: list of inbound entries
* @outbound: list of outbound entries
*/
struct qcom_smp2p {
struct device *dev;
struct smp2p_smem_item *in;
struct smp2p_smem_item *out;
unsigned smem_items[SMP2P_OUTBOUND + 1];
unsigned valid_entries;
bool ssr_ack_enabled;
bool ssr_ack;
bool negotiation_done;
unsigned local_pid;
unsigned remote_pid;
struct regmap *ipc_regmap;
int ipc_offset;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/list.h`, `linux/io.h`, `linux/of.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/mailbox_client.h`, `linux/mfd/syscon.h`.
- Detected declarations: `struct smp2p_smem_item`, `struct smp2p_entry`, `struct qcom_smp2p`, `function qcom_smp2p_kick`, `function qcom_smp2p_check_ssr`, `function qcom_smp2p_do_ssr_ack`, `function qcom_smp2p_negotiate`, `function qcom_smp2p_in_version`, `function qcom_smp2p_start_in`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: source 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.