include/linux/virtio_pci_modern.h
Source file repositories/reference/linux-study-clean/include/linux/virtio_pci_modern.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/virtio_pci_modern.h- Extension
.h- Size
- 5395 bytes
- Lines
- 166
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/virtio_config.hlinux/virtio_pci.h
Detected Declarations
struct virtio_pci_modern_devicefunction vp_ioread8function vp_ioread16function vp_ioread32function vp_iowrite8function vp_iowrite16function vp_iowrite32function vp_iowrite64_twopartfunction vp_modern_get_featuresfunction vp_modern_get_driver_featuresfunction vp_modern_set_features
Annotated Snippet
struct virtio_pci_modern_device {
struct pci_dev *pci_dev;
struct virtio_pci_common_cfg __iomem *common;
void __iomem *device;
void __iomem *notify_base;
resource_size_t notify_pa;
u8 __iomem *isr;
size_t notify_len;
size_t device_len;
size_t common_len;
int notify_map_cap;
u32 notify_offset_multiplier;
int modern_bars;
struct virtio_device_id id;
int (*device_id_check)(struct pci_dev *pdev);
u64 dma_mask;
};
/*
* Type-safe wrappers for io accesses.
* Use these to enforce at compile time the following spec requirement:
*
* The driver MUST access each field using the “natural” access
* method, i.e. 32-bit accesses for 32-bit fields, 16-bit accesses
* for 16-bit fields and 8-bit accesses for 8-bit fields.
*/
static inline u8 vp_ioread8(const u8 __iomem *addr)
{
return ioread8(addr);
}
static inline u16 vp_ioread16 (const __le16 __iomem *addr)
{
return ioread16(addr);
}
static inline u32 vp_ioread32(const __le32 __iomem *addr)
{
return ioread32(addr);
}
static inline void vp_iowrite8(u8 value, u8 __iomem *addr)
{
iowrite8(value, addr);
}
static inline void vp_iowrite16(u16 value, __le16 __iomem *addr)
{
iowrite16(value, addr);
}
static inline void vp_iowrite32(u32 value, __le32 __iomem *addr)
{
iowrite32(value, addr);
}
static inline void vp_iowrite64_twopart(u64 val,
__le32 __iomem *lo,
__le32 __iomem *hi)
{
vp_iowrite32((u32)val, lo);
vp_iowrite32(val >> 32, hi);
}
void
vp_modern_get_driver_extended_features(struct virtio_pci_modern_device *mdev,
u64 *features);
void vp_modern_get_extended_features(struct virtio_pci_modern_device *mdev,
u64 *features);
void vp_modern_set_extended_features(struct virtio_pci_modern_device *mdev,
const u64 *features);
static inline u64
vp_modern_get_features(struct virtio_pci_modern_device *mdev)
{
u64 features_array[VIRTIO_FEATURES_U64S];
vp_modern_get_extended_features(mdev, features_array);
return features_array[0];
}
static inline u64
vp_modern_get_driver_features(struct virtio_pci_modern_device *mdev)
{
u64 features_array[VIRTIO_FEATURES_U64S];
int i;
Annotation
- Immediate include surface: `linux/pci.h`, `linux/virtio_config.h`, `linux/virtio_pci.h`.
- Detected declarations: `struct virtio_pci_modern_device`, `function vp_ioread8`, `function vp_ioread16`, `function vp_ioread32`, `function vp_iowrite8`, `function vp_iowrite16`, `function vp_iowrite32`, `function vp_iowrite64_twopart`, `function vp_modern_get_features`, `function vp_modern_get_driver_features`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source 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.