drivers/net/ipa/ipa_smp2p.c
Source file repositories/reference/linux-study-clean/drivers/net/ipa/ipa_smp2p.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ipa/ipa_smp2p.c- Extension
.c- Size
- 9554 bytes
- Lines
- 349
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/notifier.hlinux/panic_notifier.hlinux/platform_device.hlinux/pm_runtime.hlinux/types.hlinux/soc/qcom/smem_state.hipa.hipa_smp2p.hipa_uc.h
Detected Declarations
struct ipa_smp2pfunction ipa_smp2p_notifyfunction ipa_smp2p_modem_clk_query_isrfunction ipa_smp2p_panic_notifierfunction ipa_smp2p_panic_notifier_registerfunction ipa_smp2p_panic_notifier_unregisterfunction ipa_smp2p_modem_setup_ready_isrfunction ipa_smp2p_irq_initfunction ipa_smp2p_irq_exitfunction ipa_smp2p_power_releasefunction ipa_smp2p_initfunction ipa_smp2p_exitfunction ipa_smp2p_irq_disable_setupfunction ipa_smp2p_notify_reset
Annotated Snippet
struct ipa_smp2p {
struct ipa *ipa;
struct qcom_smem_state *valid_state;
struct qcom_smem_state *enabled_state;
u32 valid_bit;
u32 enabled_bit;
u32 clock_query_irq;
u32 setup_ready_irq;
bool power_on;
bool notified;
bool setup_disabled;
struct mutex mutex;
struct notifier_block panic_notifier;
};
/**
* ipa_smp2p_notify() - use SMP2P to tell modem about IPA power state
* @smp2p: SMP2P information
*
* This is called either when the modem has requested it (by triggering
* the modem power query IPA interrupt) or whenever the AP is shutting down
* (via a panic notifier). It sets the two SMP2P state bits--one saying
* whether the IPA power is on, and the other indicating the first bit
* is valid.
*/
static void ipa_smp2p_notify(struct ipa_smp2p *smp2p)
{
u32 value;
u32 mask;
if (smp2p->notified)
return;
smp2p->power_on = pm_runtime_get_if_active(smp2p->ipa->dev) > 0;
/* Signal whether the IPA power is enabled */
mask = BIT(smp2p->enabled_bit);
value = smp2p->power_on ? mask : 0;
qcom_smem_state_update_bits(smp2p->enabled_state, mask, value);
/* Now indicate that the enabled flag is valid */
mask = BIT(smp2p->valid_bit);
value = mask;
qcom_smem_state_update_bits(smp2p->valid_state, mask, value);
smp2p->notified = true;
}
/* Threaded IRQ handler for modem "ipa-clock-query" SMP2P interrupt */
static irqreturn_t ipa_smp2p_modem_clk_query_isr(int irq, void *dev_id)
{
struct ipa_smp2p *smp2p = dev_id;
ipa_smp2p_notify(smp2p);
return IRQ_HANDLED;
}
static int ipa_smp2p_panic_notifier(struct notifier_block *nb,
unsigned long action, void *data)
{
struct ipa_smp2p *smp2p;
smp2p = container_of(nb, struct ipa_smp2p, panic_notifier);
ipa_smp2p_notify(smp2p);
if (smp2p->power_on)
ipa_uc_panic_notifier(smp2p->ipa);
return NOTIFY_DONE;
}
static int ipa_smp2p_panic_notifier_register(struct ipa_smp2p *smp2p)
{
/* IPA panic handler needs to run before modem shuts down */
smp2p->panic_notifier.notifier_call = ipa_smp2p_panic_notifier;
smp2p->panic_notifier.priority = INT_MAX; /* Do it early */
return atomic_notifier_chain_register(&panic_notifier_list,
&smp2p->panic_notifier);
}
static void ipa_smp2p_panic_notifier_unregister(struct ipa_smp2p *smp2p)
{
atomic_notifier_chain_unregister(&panic_notifier_list,
&smp2p->panic_notifier);
}
/* Threaded IRQ handler for modem "ipa-setup-ready" SMP2P interrupt */
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/notifier.h`, `linux/panic_notifier.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/types.h`, `linux/soc/qcom/smem_state.h`, `ipa.h`.
- Detected declarations: `struct ipa_smp2p`, `function ipa_smp2p_notify`, `function ipa_smp2p_modem_clk_query_isr`, `function ipa_smp2p_panic_notifier`, `function ipa_smp2p_panic_notifier_register`, `function ipa_smp2p_panic_notifier_unregister`, `function ipa_smp2p_modem_setup_ready_isr`, `function ipa_smp2p_irq_init`, `function ipa_smp2p_irq_exit`, `function ipa_smp2p_power_release`.
- Atlas domain: Driver Families / drivers/net.
- 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.