include/uapi/linux/virtio_pci.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/virtio_pci.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/virtio_pci.h- Extension
.h- Size
- 13228 bytes
- Lines
- 436
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/const.h
Detected Declarations
struct virtio_pci_capstruct virtio_pci_vndr_datastruct virtio_pci_cap64struct virtio_pci_notify_capstruct virtio_pci_common_cfgstruct virtio_pci_modern_common_cfgstruct virtio_pci_cfg_capstruct virtio_admin_cmd_hdrstruct virtio_admin_cmd_statusstruct virtio_admin_cmd_legacy_wr_datastruct virtio_admin_cmd_legacy_rd_datastruct virtio_admin_cmd_notify_info_datastruct virtio_admin_cmd_notify_info_resultstruct virtio_dev_parts_capstruct virtio_admin_cmd_query_cap_id_resultstruct virtio_admin_cmd_cap_get_datastruct virtio_admin_cmd_cap_set_datastruct virtio_admin_cmd_resource_obj_cmd_hdrstruct virtio_admin_cmd_resource_obj_create_datastruct virtio_resource_obj_dev_partsstruct virtio_admin_cmd_dev_parts_metadata_datastruct virtio_dev_part_hdrstruct virtio_dev_partstruct virtio_admin_cmd_dev_parts_metadata_resultstruct virtio_admin_cmd_dev_parts_get_datastruct virtio_admin_cmd_dev_parts_set_datastruct virtio_admin_cmd_dev_mode_set_data
Annotated Snippet
struct virtio_pci_cap {
__u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */
__u8 cap_next; /* Generic PCI field: next ptr. */
__u8 cap_len; /* Generic PCI field: capability length */
__u8 cfg_type; /* Identifies the structure. */
__u8 bar; /* Where to find it. */
__u8 id; /* Multiple capabilities of the same type */
__u8 padding[2]; /* Pad to full dword. */
__le32 offset; /* Offset within bar. */
__le32 length; /* Length of the structure, in bytes. */
};
/* This is the PCI vendor data capability header: */
struct virtio_pci_vndr_data {
__u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */
__u8 cap_next; /* Generic PCI field: next ptr. */
__u8 cap_len; /* Generic PCI field: capability length */
__u8 cfg_type; /* Identifies the structure. */
__u16 vendor_id; /* Identifies the vendor-specific format. */
/* For Vendor Definition */
/* Pads structure to a multiple of 4 bytes */
/* Reads must not have side effects */
};
struct virtio_pci_cap64 {
struct virtio_pci_cap cap;
__le32 offset_hi; /* Most sig 32 bits of offset */
__le32 length_hi; /* Most sig 32 bits of length */
};
struct virtio_pci_notify_cap {
struct virtio_pci_cap cap;
__le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */
};
/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
struct virtio_pci_common_cfg {
/* About the whole device. */
__le32 device_feature_select; /* read-write */
__le32 device_feature; /* read-only */
__le32 guest_feature_select; /* read-write */
__le32 guest_feature; /* read-write */
__le16 msix_config; /* read-write */
__le16 num_queues; /* read-only */
__u8 device_status; /* read-write */
__u8 config_generation; /* read-only */
/* About a specific virtqueue. */
__le16 queue_select; /* read-write */
__le16 queue_size; /* read-write, power of 2. */
__le16 queue_msix_vector; /* read-write */
__le16 queue_enable; /* read-write */
__le16 queue_notify_off; /* read-only */
__le32 queue_desc_lo; /* read-write */
__le32 queue_desc_hi; /* read-write */
__le32 queue_avail_lo; /* read-write */
__le32 queue_avail_hi; /* read-write */
__le32 queue_used_lo; /* read-write */
__le32 queue_used_hi; /* read-write */
};
/*
* Warning: do not use sizeof on this: use offsetofend for
* specific fields you need.
*/
struct virtio_pci_modern_common_cfg {
struct virtio_pci_common_cfg cfg;
__le16 queue_notify_data; /* read-write */
__le16 queue_reset; /* read-write */
__le16 admin_queue_index; /* read-only */
__le16 admin_queue_num; /* read-only */
};
/* Fields in VIRTIO_PCI_CAP_PCI_CFG: */
struct virtio_pci_cfg_cap {
struct virtio_pci_cap cap;
__u8 pci_cfg_data[4]; /* Data for BAR access. */
};
/* Macro versions of offsets for the Old Timers! */
#define VIRTIO_PCI_CAP_VNDR 0
#define VIRTIO_PCI_CAP_NEXT 1
#define VIRTIO_PCI_CAP_LEN 2
#define VIRTIO_PCI_CAP_CFG_TYPE 3
#define VIRTIO_PCI_CAP_BAR 4
#define VIRTIO_PCI_CAP_OFFSET 8
#define VIRTIO_PCI_CAP_LENGTH 12
Annotation
- Immediate include surface: `linux/types.h`, `linux/const.h`.
- Detected declarations: `struct virtio_pci_cap`, `struct virtio_pci_vndr_data`, `struct virtio_pci_cap64`, `struct virtio_pci_notify_cap`, `struct virtio_pci_common_cfg`, `struct virtio_pci_modern_common_cfg`, `struct virtio_pci_cfg_cap`, `struct virtio_admin_cmd_hdr`, `struct virtio_admin_cmd_status`, `struct virtio_admin_cmd_legacy_wr_data`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- 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.