drivers/gpu/drm/imagination/pvr_fw_trace.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_fw_trace.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_fw_trace.c- Extension
.c- Size
- 15451 bytes
- Lines
- 564
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
pvr_device.hpvr_gem.hpvr_rogue_fwif.hpvr_rogue_fwif_sf.hpvr_fw_trace.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_print.hlinux/build_bug.hlinux/compiler_attributes.hlinux/dcache.hlinux/debugfs.hlinux/moduleparam.hlinux/sysfs.hlinux/types.h
Detected Declarations
struct pvr_fw_trace_seq_datafunction validate_group_maskfunction build_log_typefunction pvr_fw_trace_init_mask_setfunction tracebuf_ctrl_initfunction pvr_fw_trace_initfunction pvr_fw_trace_finifunction pvr_kccb_send_cmdfunction find_sfidfunction read_fw_tracefunction fw_trace_get_nextfunction fw_trace_get_firstfunction fw_trace_seq_stopfunction fw_trace_openfunction fw_trace_releasefunction pvr_fw_trace_mask_getfunction pvr_fw_trace_mask_setfunction pvr_fw_trace_debugfs_init
Annotated Snippet
static const struct file_operations pvr_fw_trace_fops = {
.owner = THIS_MODULE,
.open = fw_trace_open,
.read = seq_read,
.llseek = seq_lseek,
.release = fw_trace_release,
};
static int pvr_fw_trace_mask_get(void *data, u64 *value)
{
struct pvr_device *pvr_dev = data;
*value = pvr_dev->fw_dev.fw_trace.group_mask;
return 0;
}
static int pvr_fw_trace_mask_set(void *data, u64 value)
{
struct pvr_device *pvr_dev = data;
const u32 group_mask = (u32)value;
int err;
err = validate_group_mask(pvr_dev, group_mask);
if (err)
return err;
return update_logtype(pvr_dev, group_mask);
}
DEFINE_DEBUGFS_ATTRIBUTE(pvr_fw_trace_mask_fops, pvr_fw_trace_mask_get,
pvr_fw_trace_mask_set, "0x%08llx\n");
void
pvr_fw_trace_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir)
{
struct pvr_fw_trace *fw_trace = &pvr_dev->fw_dev.fw_trace;
if (!IS_ENABLED(CONFIG_DEBUG_FS))
return;
static_assert(ARRAY_SIZE(fw_trace->buffers) <= 10,
"The filename buffer is only large enough for a single-digit thread count");
for (u32 thread_nr = 0; thread_nr < ARRAY_SIZE(fw_trace->buffers); ++thread_nr) {
char filename[8];
snprintf(filename, ARRAY_SIZE(filename), "trace_%u", thread_nr);
debugfs_create_file(filename, 0400, dir,
&fw_trace->buffers[thread_nr],
&pvr_fw_trace_fops);
}
debugfs_create_file("trace_mask", 0600, dir, pvr_dev,
&pvr_fw_trace_mask_fops);
}
Annotation
- Immediate include surface: `pvr_device.h`, `pvr_gem.h`, `pvr_rogue_fwif.h`, `pvr_rogue_fwif_sf.h`, `pvr_fw_trace.h`, `drm/drm_drv.h`, `drm/drm_file.h`, `drm/drm_print.h`.
- Detected declarations: `struct pvr_fw_trace_seq_data`, `function validate_group_mask`, `function build_log_type`, `function pvr_fw_trace_init_mask_set`, `function tracebuf_ctrl_init`, `function pvr_fw_trace_init`, `function pvr_fw_trace_fini`, `function pvr_kccb_send_cmd`, `function find_sfid`, `function read_fw_trace`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
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.