drivers/soc/qcom/smsm.c
Source file repositories/reference/linux-study-clean/drivers/soc/qcom/smsm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/qcom/smsm.c- Extension
.c- Size
- 18581 bytes
- Lines
- 695
- 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/mailbox_client.hlinux/mfd/syscon.hlinux/module.hlinux/of_irq.hlinux/platform_device.hlinux/spinlock.hlinux/regmap.hlinux/soc/qcom/smem.hlinux/soc/qcom/smem_state.h
Detected Declarations
struct smsm_entrystruct smsm_hoststruct qcom_smsmstruct smsm_entrystruct smsm_hostfunction smsm_update_bitsfunction smsm_intrfunction for_each_set_bitfunction smsm_mask_irqfunction smsm_unmask_irqfunction smsm_set_irq_typefunction smsm_get_irqchip_statefunction smsm_irq_mapfunction smsm_parse_mboxfunction smsm_parse_ipcfunction smsm_inbound_entryfunction smsm_get_size_infofunction qcom_smsm_probefunction for_each_child_of_nodefunction qcom_smsm_remove
Annotated Snippet
struct qcom_smsm {
struct device *dev;
u32 local_host;
u32 num_hosts;
u32 num_entries;
u32 *local_state;
u32 *subscription;
struct qcom_smem_state *state;
spinlock_t lock;
struct smsm_entry *entries;
struct smsm_host *hosts;
struct mbox_client mbox_client;
};
/**
* struct smsm_entry - per remote processor entry context
* @smsm: back-reference to driver context
* @domain: IRQ domain for this entry, if representing a remote system
* @irq_enabled: bitmap of which state bits IRQs are enabled
* @irq_rising: bitmap tracking if rising bits should be propagated
* @irq_falling: bitmap tracking if falling bits should be propagated
* @last_value: snapshot of state bits last time the interrupts where propagated
* @remote_state: pointer to this entry's state bits
* @subscription: pointer to a row in the subscription matrix representing this
* entry
*/
struct smsm_entry {
struct qcom_smsm *smsm;
struct irq_domain *domain;
DECLARE_BITMAP(irq_enabled, 32);
DECLARE_BITMAP(irq_rising, 32);
DECLARE_BITMAP(irq_falling, 32);
unsigned long last_value;
u32 *remote_state;
u32 *subscription;
};
/**
* struct smsm_host - representation of a remote host
* @ipc_regmap: regmap for outgoing interrupt
* @ipc_offset: offset in @ipc_regmap for outgoing interrupt
* @ipc_bit: bit in @ipc_regmap + @ipc_offset for outgoing interrupt
* @mbox_chan: apcs ipc mailbox channel handle
*/
struct smsm_host {
struct regmap *ipc_regmap;
int ipc_offset;
int ipc_bit;
struct mbox_chan *mbox_chan;
};
/**
* smsm_update_bits() - change bit in outgoing entry and inform subscribers
* @data: smsm context pointer
* @mask: value mask
* @value: new value
*
* Used to set and clear the bits in the outgoing/local entry and inform
* subscribers about the change.
*/
static int smsm_update_bits(void *data, u32 mask, u32 value)
{
struct qcom_smsm *smsm = data;
struct smsm_host *hostp;
unsigned long flags;
u32 changes;
u32 host;
u32 orig;
u32 val;
spin_lock_irqsave(&smsm->lock, flags);
/* Update the entry */
val = orig = readl(smsm->local_state);
val &= ~mask;
val |= value;
/* Don't signal if we didn't change the value */
changes = val ^ orig;
if (!changes) {
spin_unlock_irqrestore(&smsm->lock, flags);
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/mailbox_client.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of_irq.h`, `linux/platform_device.h`, `linux/spinlock.h`, `linux/regmap.h`.
- Detected declarations: `struct smsm_entry`, `struct smsm_host`, `struct qcom_smsm`, `struct smsm_entry`, `struct smsm_host`, `function smsm_update_bits`, `function smsm_intr`, `function for_each_set_bit`, `function smsm_mask_irq`, `function smsm_unmask_irq`.
- 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.