drivers/accel/qaic/qaic_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/accel/qaic/qaic_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accel/qaic/qaic_debugfs.c- Extension
.c- Size
- 7410 bytes
- Lines
- 307
- Domain
- Driver Families
- Bucket
- drivers/accel
- 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.
- 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/debugfs.hlinux/device.hlinux/fs.hlinux/list.hlinux/mhi.hlinux/mutex.hlinux/overflow.hlinux/pci.hlinux/seq_file.hlinux/sprintf.hlinux/string.hlinux/types.hlinux/workqueue.hqaic.hqaic_debugfs.h
Detected Declarations
struct bootlog_msgstruct bootlog_pagefunction bootlog_showfunction fifo_size_showfunction queued_showfunction qaic_debugfs_initfunction reset_bootlogfunction bootlog_commitfunction bootlog_logfunction qaic_bootlog_mhi_probefunction qaic_bootlog_mhi_removefunction qaic_bootlog_mhi_ul_xfer_cbfunction qaic_bootlog_registerfunction qaic_bootlog_unregister
Annotated Snippet
struct bootlog_msg {
/* Buffer for bootlog messages */
char str[BOOTLOG_MSG_SIZE];
/* Length of bootlog message */
size_t len;
/* Root struct of device, used to access device resources */
struct qaic_device *qdev;
/* Work struct to schedule work coming on QAIC_LOGGING channel */
struct work_struct work;
};
struct bootlog_page {
/* Node in list of bootlog pages maintained by root device struct */
struct list_head node;
/* Total size of the buffer that holds the bootlogs. It is PAGE_SIZE */
unsigned int size;
/* Offset for the next bootlog */
unsigned int offset;
};
static int bootlog_show(struct seq_file *s, void *unused)
{
struct bootlog_page *page;
struct qaic_device *qdev;
size_t len;
void *log;
qdev = s->private;
mutex_lock(&qdev->bootlog_mutex);
list_for_each_entry(page, &qdev->bootlog, node) {
log = page + 1;
len = page->offset - sizeof(*page);
seq_write(s, log, len);
}
mutex_unlock(&qdev->bootlog_mutex);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(bootlog);
static int fifo_size_show(struct seq_file *s, void *unused)
{
struct dma_bridge_chan *dbc = s->private;
seq_printf(s, "%u\n", dbc->nelem);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(fifo_size);
static int queued_show(struct seq_file *s, void *unused)
{
struct dma_bridge_chan *dbc = s->private;
u32 tail = 0, head = 0;
qaic_data_get_fifo_info(dbc, &head, &tail);
if (head == U32_MAX || tail == U32_MAX)
seq_printf(s, "%u\n", 0);
else if (head > tail)
seq_printf(s, "%u\n", dbc->nelem - head + tail);
else
seq_printf(s, "%u\n", tail - head);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(queued);
void qaic_debugfs_init(struct qaic_drm_device *qddev)
{
struct qaic_device *qdev = qddev->qdev;
struct dentry *debugfs_root;
struct dentry *debugfs_dir;
char name[QAIC_DBC_DIR_NAME];
u32 i;
debugfs_root = to_drm(qddev)->debugfs_root;
debugfs_create_file("bootlog", 0400, debugfs_root, qdev, &bootlog_fops);
/*
* 256 dbcs per device is likely the max we will ever see and lets static checking see a
* reasonable range.
*/
for (i = 0; i < qdev->num_dbc && i < 256; ++i) {
snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i);
debugfs_dir = debugfs_create_dir(name, debugfs_root);
debugfs_create_file("fifo_size", 0400, debugfs_dir, &qdev->dbc[i], &fifo_size_fops);
debugfs_create_file("queued", 0400, debugfs_dir, &qdev->dbc[i], &queued_fops);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/device.h`, `linux/fs.h`, `linux/list.h`, `linux/mhi.h`, `linux/mutex.h`, `linux/overflow.h`, `linux/pci.h`.
- Detected declarations: `struct bootlog_msg`, `struct bootlog_page`, `function bootlog_show`, `function fifo_size_show`, `function queued_show`, `function qaic_debugfs_init`, `function reset_bootlog`, `function bootlog_commit`, `function bootlog_log`, `function qaic_bootlog_mhi_probe`.
- Atlas domain: Driver Families / drivers/accel.
- Implementation status: source 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.