drivers/misc/mei/interrupt.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/interrupt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/interrupt.c- Extension
.c- Size
- 16098 bytes
- Lines
- 686
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- 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/export.hlinux/kthread.hlinux/interrupt.hlinux/fs.hlinux/jiffies.hlinux/slab.hlinux/pm_runtime.hlinux/mei.hmei_dev.hhbm.hclient.h
Detected Declarations
function Copyrightfunction list_for_each_entry_safefunction mei_cl_hbm_equalfunction mei_irq_discard_msgfunction mei_cl_irq_read_msgfunction mei_cl_irq_disconnect_rspfunction mei_cl_irq_readfunction hdr_is_hbmfunction hdr_is_fixedfunction hdr_is_validfunction mei_irq_read_handlerfunction mei_irq_write_handlerfunction list_for_each_entry_safefunction mei_connect_timeoutfunction mei_schedule_stall_timerfunction mei_timerexport mei_irq_compl_handlerexport mei_irq_read_handlerexport mei_irq_write_handler
Annotated Snippet
if (!mei_cl_is_fixed_address(cl)) {
cl_err(dev, cl, "pending read cb not found\n");
goto discard;
}
cb = mei_cl_alloc_cb(cl, mei_cl_mtu(cl), MEI_FOP_READ, cl->fp);
if (!cb)
goto discard;
list_add_tail(&cb->list, &cl->rd_pending);
}
if (mei_hdr->extended) {
struct mei_ext_hdr *ext = mei_ext_begin(meta);
do {
switch (ext->type) {
case MEI_EXT_HDR_VTAG:
vtag_hdr = (struct mei_ext_hdr_vtag *)ext;
break;
case MEI_EXT_HDR_GSC:
gsc_f2h = (struct mei_ext_hdr_gsc_f2h *)ext;
cb->ext_hdr = (struct mei_ext_hdr *) kzalloc_obj(*gsc_f2h);
if (!cb->ext_hdr) {
cb->status = -ENOMEM;
goto discard;
}
break;
case MEI_EXT_HDR_NONE:
fallthrough;
default:
cl_err(dev, cl, "unknown extended header\n");
cb->status = -EPROTO;
break;
}
ext = mei_ext_next(ext);
} while (!mei_ext_last(meta, ext));
if (!vtag_hdr && !gsc_f2h) {
cl_dbg(dev, cl, "no vtag or gsc found in extended header.\n");
cb->status = -EPROTO;
goto discard;
}
}
if (vtag_hdr) {
cl_dbg(dev, cl, "vtag: %d\n", vtag_hdr->vtag);
if (cb->vtag && cb->vtag != vtag_hdr->vtag) {
cl_err(dev, cl, "mismatched tag: %d != %d\n",
cb->vtag, vtag_hdr->vtag);
cb->status = -EPROTO;
goto discard;
}
cb->vtag = vtag_hdr->vtag;
}
if (gsc_f2h) {
u32 ext_hdr_len = mei_ext_hdr_len(&gsc_f2h->hdr);
if (!dev->hbm_f_gsc_supported) {
cl_err(dev, cl, "gsc extended header is not supported\n");
cb->status = -EPROTO;
goto discard;
}
if (length) {
cl_err(dev, cl, "no data allowed in cb with gsc\n");
cb->status = -EPROTO;
goto discard;
}
if (ext_hdr_len > sizeof(*gsc_f2h)) {
cl_err(dev, cl, "gsc extended header is too big %u\n", ext_hdr_len);
cb->status = -EPROTO;
goto discard;
}
memcpy(cb->ext_hdr, gsc_f2h, ext_hdr_len);
}
if (!mei_cl_is_connected(cl)) {
cl_dbg(dev, cl, "not connected\n");
cb->status = -ENODEV;
goto discard;
}
if (mei_hdr->dma_ring)
length = mei_hdr->extension[mei_data2slots(ext_len)];
buf_sz = length + cb->buf_idx;
/* catch for integer overflow */
if (buf_sz < cb->buf_idx) {
cl_err(dev, cl, "message is too big len %d idx %zu\n",
length, cb->buf_idx);
Annotation
- Immediate include surface: `linux/export.h`, `linux/kthread.h`, `linux/interrupt.h`, `linux/fs.h`, `linux/jiffies.h`, `linux/slab.h`, `linux/pm_runtime.h`, `linux/mei.h`.
- Detected declarations: `function Copyright`, `function list_for_each_entry_safe`, `function mei_cl_hbm_equal`, `function mei_irq_discard_msg`, `function mei_cl_irq_read_msg`, `function mei_cl_irq_disconnect_rsp`, `function mei_cl_irq_read`, `function hdr_is_hbm`, `function hdr_is_fixed`, `function hdr_is_valid`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.