drivers/misc/sgi-gru/grufile.c
Source file repositories/reference/linux-study-clean/drivers/misc/sgi-gru/grufile.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/sgi-gru/grufile.c- Extension
.c- Size
- 13340 bytes
- Lines
- 541
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/module.hlinux/kernel.hlinux/errno.hlinux/slab.hlinux/mm.hlinux/io.hlinux/spinlock.hlinux/device.hlinux/miscdevice.hlinux/interrupt.hlinux/proc_fs.hlinux/uaccess.hasm/uv/uv_irq.hasm/uv/uv.hgru.hgrulib.hgrutables.hasm/uv/uv_hub.hasm/uv/uv_mmrs.h
Detected Declarations
function gru_supportedfunction gru_vma_closefunction gru_file_mmapfunction gru_create_new_contextfunction infofunction gru_file_unlocked_ioctlfunction gru_init_chipletfunction gru_init_tablesfunction gru_free_tablesfunction gru_chiplet_cpu_to_mmrfunction gru_chiplet_setup_tlb_irqfunction gru_chiplet_teardown_tlb_irqfunction gru_teardown_tlb_irqsfunction for_each_online_cpufunction gru_setup_tlb_irqsfunction for_each_online_cpufunction gru_initfunction gru_exitmodule init gru_initmodule init gru_init
Annotated Snippet
static const struct file_operations gru_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = gru_file_unlocked_ioctl,
.mmap = gru_file_mmap,
.llseek = noop_llseek,
};
static struct miscdevice gru_miscdev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "gru",
.fops = &gru_fops,
};
const struct vm_operations_struct gru_vm_ops = {
.close = gru_vma_close,
.fault = gru_fault,
};
#ifndef MODULE
fs_initcall(gru_init);
#else
module_init(gru_init);
#endif
module_exit(gru_exit);
module_param(gru_options, ulong, 0644);
MODULE_PARM_DESC(gru_options, "Various debug options");
MODULE_AUTHOR("Silicon Graphics, Inc.");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(GRU_DRIVER_ID_STR GRU_DRIVER_VERSION_STR);
MODULE_VERSION(GRU_DRIVER_VERSION_STR);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/slab.h`, `linux/mm.h`, `linux/io.h`, `linux/spinlock.h`, `linux/device.h`.
- Detected declarations: `function gru_supported`, `function gru_vma_close`, `function gru_file_mmap`, `function gru_create_new_context`, `function info`, `function gru_file_unlocked_ioctl`, `function gru_init_chiplet`, `function gru_init_tables`, `function gru_free_tables`, `function gru_chiplet_cpu_to_mmr`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.