drivers/virtio/virtio_pci_common.c
Source file repositories/reference/linux-study-clean/drivers/virtio/virtio_pci_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/virtio/virtio_pci_common.c- Extension
.c- Size
- 22189 bytes
- Lines
- 865
- Domain
- Driver Families
- Bucket
- drivers/virtio
- 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.
- 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
virtio_pci_common.h
Detected Declarations
enum vp_vq_vector_policyfunction vp_is_avqfunction vp_synchronize_vectorsfunction vp_notifyfunction vp_vring_slow_path_interruptfunction vp_config_changedfunction vp_vring_interruptfunction vp_interruptfunction vp_request_msix_vectorsfunction vp_is_slow_path_vectorfunction voidfunction vp_del_vqfunction vp_del_vqsfunction list_for_each_entry_safefunction vp_find_one_vq_msixfunction vp_find_vqs_msixfunction vp_find_vqs_intxfunction vp_find_vqsfunction vp_set_vq_affinityfunction virtio_pci_freezefunction virtio_pci_restorefunction vp_supports_pm_no_resetfunction virtio_pci_suspendfunction virtio_pci_resumefunction virtio_pci_release_devfunction virtio_pci_probefunction virtio_pci_removefunction virtio_pci_sriov_configurefunction virtio_pci_reset_preparefunction virtio_pci_reset_done
Annotated Snippet
static struct pci_driver virtio_pci_driver = {
.name = "virtio-pci",
.id_table = virtio_pci_id_table,
.probe = virtio_pci_probe,
.remove = virtio_pci_remove,
#ifdef CONFIG_PM_SLEEP
.driver.pm = &virtio_pci_pm_ops,
#endif
.sriov_configure = virtio_pci_sriov_configure,
.err_handler = &virtio_pci_err_handler,
};
struct virtio_device *virtio_pci_vf_get_pf_dev(struct pci_dev *pdev)
{
struct virtio_pci_device *pf_vp_dev;
pf_vp_dev = pci_iov_get_pf_drvdata(pdev, &virtio_pci_driver);
if (IS_ERR(pf_vp_dev))
return NULL;
return &pf_vp_dev->vdev;
}
module_pci_driver(virtio_pci_driver);
MODULE_AUTHOR("Anthony Liguori <aliguori@us.ibm.com>");
MODULE_DESCRIPTION("virtio-pci");
MODULE_LICENSE("GPL");
MODULE_VERSION("1");
Annotation
- Immediate include surface: `virtio_pci_common.h`.
- Detected declarations: `enum vp_vq_vector_policy`, `function vp_is_avq`, `function vp_synchronize_vectors`, `function vp_notify`, `function vp_vring_slow_path_interrupt`, `function vp_config_changed`, `function vp_vring_interrupt`, `function vp_interrupt`, `function vp_request_msix_vectors`, `function vp_is_slow_path_vector`.
- Atlas domain: Driver Families / drivers/virtio.
- Implementation status: pattern implementation candidate.
- 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.