drivers/vfio/pci/nvgrace-gpu/main.c
Source file repositories/reference/linux-study-clean/drivers/vfio/pci/nvgrace-gpu/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/vfio/pci/nvgrace-gpu/main.c- Extension
.c- Size
- 41950 bytes
- Lines
- 1437
- Domain
- Driver Families
- Bucket
- drivers/vfio
- 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.
- 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/bitfield.hlinux/sizes.hlinux/time64.hlinux/vfio_pci_core.hlinux/delay.hlinux/jiffies.hlinux/sched.hlinux/pci-p2pdma.hlinux/pm_runtime.hlinux/memory-failure.h
Detected Declarations
struct mem_regionstruct nvgrace_gpu_pci_core_devicefunction nvgrace_gpu_init_fake_bar_emu_regsfunction nvgrace_gpu_memregionfunction pfn_memregion_offsetfunction nvgrace_gpu_pfn_to_vma_pgofffunction nvgrace_gpu_vfio_pci_register_pfn_rangefunction nvgrace_gpu_open_devicefunction nvgrace_gpu_close_devicefunction nvgrace_gpu_wait_device_ready_legacyfunction cxl_mem_active_timeout_msfunction cxl_dvsec_mem_is_activefunction nvgrace_gpu_test_device_ready_cxlfunction Memory_Active_Timeoutfunction nvgrace_gpu_check_device_readyfunction addr_to_pgofffunction nvgrace_gpu_vfio_pci_huge_faultfunction scoped_guardfunction nvgrace_gpu_vfio_pci_faultfunction nvgrace_gpu_mmapfunction nvgrace_gpu_ioctl_get_region_infofunction nvgrace_gpu_ioctlfunction nvgrace_gpu_get_read_valuefunction usablefunction nvgrace_gpu_write_config_emufunction nvgrace_gpu_map_device_memfunction memoryfunction nvgrace_gpu_read_memfunction scoped_guardfunction nvgrace_gpu_readfunction memoryfunction nvgrace_gpu_write_memfunction scoped_guardfunction nvgrace_gpu_writefunction nvgrace_get_dmabuf_physfunction nvgrace_gpu_fetch_memory_propertyfunction nvgrace_gpu_init_nvdev_structfunction memoryfunction nvgrace_gpu_has_mig_hw_bugfunction nvgrace_gpu_probe_check_device_readyfunction nvgrace_gpu_probefunction nvgrace_gpu_removefunction nvgrace_gpu_vfio_pci_reset_done
Annotated Snippet
static struct pci_driver nvgrace_gpu_vfio_pci_driver = {
.name = KBUILD_MODNAME,
.id_table = nvgrace_gpu_vfio_pci_table,
.probe = nvgrace_gpu_probe,
.remove = nvgrace_gpu_remove,
.err_handler = &nvgrace_gpu_vfio_pci_err_handlers,
.driver_managed_dma = true,
};
module_pci_driver(nvgrace_gpu_vfio_pci_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Ankit Agrawal <ankita@nvidia.com>");
MODULE_AUTHOR("Aniket Agashe <aniketa@nvidia.com>");
MODULE_DESCRIPTION("VFIO NVGRACE GPU PF - User Level driver for NVIDIA devices with CPU coherently accessible device memory");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/sizes.h`, `linux/time64.h`, `linux/vfio_pci_core.h`, `linux/delay.h`, `linux/jiffies.h`, `linux/sched.h`, `linux/pci-p2pdma.h`.
- Detected declarations: `struct mem_region`, `struct nvgrace_gpu_pci_core_device`, `function nvgrace_gpu_init_fake_bar_emu_regs`, `function nvgrace_gpu_memregion`, `function pfn_memregion_offset`, `function nvgrace_gpu_pfn_to_vma_pgoff`, `function nvgrace_gpu_vfio_pci_register_pfn_range`, `function nvgrace_gpu_open_device`, `function nvgrace_gpu_close_device`, `function nvgrace_gpu_wait_device_ready_legacy`.
- Atlas domain: Driver Families / drivers/vfio.
- 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.
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.