drivers/remoteproc/qcom_sysmon.c
Source file repositories/reference/linux-study-clean/drivers/remoteproc/qcom_sysmon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/remoteproc/qcom_sysmon.c- Extension
.c- Size
- 20029 bytes
- Lines
- 811
- Domain
- Driver Families
- Bucket
- drivers/remoteproc
- 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/firmware.hlinux/module.hlinux/notifier.hlinux/slab.hlinux/interrupt.hlinux/io.hlinux/of_irq.hlinux/platform_device.hlinux/remoteproc/qcom_rproc.hlinux/rpmsg.hqcom_common.h
Detected Declarations
struct qcom_sysmonstruct sysmon_eventstruct ssctl_shutdown_respstruct ssctl_subsys_event_reqstruct ssctl_subsys_event_respfunction sysmon_send_eventfunction sysmon_request_shutdownfunction sysmon_callbackfunction sysmon_ind_cbfunction ssctl_request_shutdown_waitfunction ssctl_request_shutdownfunction ssctl_send_eventfunction ssctl_new_serverfunction ssctl_del_serverfunction sysmon_preparefunction sysmon_startfunction sysmon_stopfunction sysmon_unpreparefunction sysmon_notifyfunction sysmon_shutdown_interruptfunction qcom_add_sysmon_subdevfunction qcom_remove_sysmon_subdevfunction qcom_sysmon_shutdown_ackedfunction sysmon_probefunction sysmon_removeexport qcom_add_sysmon_subdevexport qcom_remove_sysmon_subdevexport qcom_sysmon_shutdown_acked
Annotated Snippet
struct qcom_sysmon {
struct rproc_subdev subdev;
struct rproc *rproc;
int state;
struct mutex state_lock;
struct list_head node;
const char *name;
int shutdown_irq;
int ssctl_version;
int ssctl_instance;
struct notifier_block nb;
struct device *dev;
struct rpmsg_endpoint *ept;
struct completion comp;
struct completion ind_comp;
struct completion shutdown_comp;
struct completion ssctl_comp;
struct mutex lock;
bool ssr_ack;
bool shutdown_acked;
struct qmi_handle qmi;
struct sockaddr_qrtr ssctl;
};
enum {
SSCTL_SSR_EVENT_BEFORE_POWERUP,
SSCTL_SSR_EVENT_AFTER_POWERUP,
SSCTL_SSR_EVENT_BEFORE_SHUTDOWN,
SSCTL_SSR_EVENT_AFTER_SHUTDOWN,
};
static const char * const sysmon_state_string[] = {
[SSCTL_SSR_EVENT_BEFORE_POWERUP] = "before_powerup",
[SSCTL_SSR_EVENT_AFTER_POWERUP] = "after_powerup",
[SSCTL_SSR_EVENT_BEFORE_SHUTDOWN] = "before_shutdown",
[SSCTL_SSR_EVENT_AFTER_SHUTDOWN] = "after_shutdown",
};
struct sysmon_event {
const char *subsys_name;
u32 ssr_event;
};
static DEFINE_MUTEX(sysmon_lock);
static LIST_HEAD(sysmon_list);
/**
* sysmon_send_event() - send notification of other remote's SSR event
* @sysmon: sysmon context
* @event: sysmon event context
*/
static void sysmon_send_event(struct qcom_sysmon *sysmon,
const struct sysmon_event *event)
{
char req[50];
int len;
int ret;
len = snprintf(req, sizeof(req), "ssr:%s:%s", event->subsys_name,
sysmon_state_string[event->ssr_event]);
if (len >= sizeof(req))
return;
mutex_lock(&sysmon->lock);
reinit_completion(&sysmon->comp);
sysmon->ssr_ack = false;
ret = rpmsg_send(sysmon->ept, req, len);
if (ret < 0) {
dev_err(sysmon->dev, "failed to send sysmon event\n");
goto out_unlock;
}
ret = wait_for_completion_timeout(&sysmon->comp,
msecs_to_jiffies(5000));
if (!ret) {
dev_err(sysmon->dev, "timeout waiting for sysmon ack\n");
goto out_unlock;
}
if (!sysmon->ssr_ack)
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/module.h`, `linux/notifier.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/io.h`, `linux/of_irq.h`, `linux/platform_device.h`.
- Detected declarations: `struct qcom_sysmon`, `struct sysmon_event`, `struct ssctl_shutdown_resp`, `struct ssctl_subsys_event_req`, `struct ssctl_subsys_event_resp`, `function sysmon_send_event`, `function sysmon_request_shutdown`, `function sysmon_callback`, `function sysmon_ind_cb`, `function ssctl_request_shutdown_wait`.
- Atlas domain: Driver Families / drivers/remoteproc.
- 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.