include/linux/vdpa.h
Source file repositories/reference/linux-study-clean/include/linux/vdpa.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/vdpa.h- Extension
.h- Size
- 22720 bytes
- Lines
- 629
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/kernel.hlinux/device.hlinux/interrupt.hlinux/virtio.hlinux/vhost_iotlb.hlinux/virtio_net.hlinux/virtio_blk.hlinux/if_ether.h
Detected Declarations
struct vdpa_callbackstruct vdpa_notification_areastruct vdpa_vq_state_splitstruct vdpa_vq_state_packedstruct vdpa_vq_statestruct vdpa_mgmt_devstruct vdpa_devicestruct vdpa_iova_rangestruct vdpa_dev_set_configstruct vdpa_map_filestruct vdpa_config_opsstruct vdpa_driverstruct vdpa_mgmtdev_opsstruct vdpa_mgmt_devfunction vdpa_set_drvdatafunction vdpa_get_mapfunction vdpa_resetfunction vdpa_set_features_unlockedfunction vdpa_set_features
Annotated Snippet
struct device_driver driver;
int (*probe)(struct vdpa_device *vdev);
void (*remove)(struct vdpa_device *vdev);
};
#define vdpa_register_driver(drv) \
__vdpa_register_driver(drv, THIS_MODULE)
int __vdpa_register_driver(struct vdpa_driver *drv, struct module *owner);
void vdpa_unregister_driver(struct vdpa_driver *drv);
#define module_vdpa_driver(__vdpa_driver) \
module_driver(__vdpa_driver, vdpa_register_driver, \
vdpa_unregister_driver)
static inline struct vdpa_driver *drv_to_vdpa(struct device_driver *driver)
{
return container_of(driver, struct vdpa_driver, driver);
}
static inline struct vdpa_device *dev_to_vdpa(struct device *_dev)
{
return container_of(_dev, struct vdpa_device, dev);
}
static inline void *vdpa_get_drvdata(const struct vdpa_device *vdev)
{
return dev_get_drvdata(&vdev->dev);
}
static inline void vdpa_set_drvdata(struct vdpa_device *vdev, void *data)
{
dev_set_drvdata(&vdev->dev, data);
}
static inline union virtio_map vdpa_get_map(struct vdpa_device *vdev)
{
return vdev->vmap;
}
static inline int vdpa_reset(struct vdpa_device *vdev, u32 flags)
{
const struct vdpa_config_ops *ops = vdev->config;
int ret;
down_write(&vdev->cf_lock);
vdev->features_valid = false;
if (ops->compat_reset && flags)
ret = ops->compat_reset(vdev, flags);
else
ret = ops->reset(vdev);
up_write(&vdev->cf_lock);
return ret;
}
static inline int vdpa_set_features_unlocked(struct vdpa_device *vdev, u64 features)
{
const struct vdpa_config_ops *ops = vdev->config;
int ret;
vdev->features_valid = true;
ret = ops->set_driver_features(vdev, features);
return ret;
}
static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features)
{
int ret;
down_write(&vdev->cf_lock);
ret = vdpa_set_features_unlocked(vdev, features);
up_write(&vdev->cf_lock);
return ret;
}
void vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
void *buf, unsigned int len);
void vdpa_set_config(struct vdpa_device *dev, unsigned int offset,
const void *buf, unsigned int length);
void vdpa_set_status(struct vdpa_device *vdev, u8 status);
/**
* struct vdpa_mgmtdev_ops - vdpa device ops
* @dev_add: Add a vdpa device using alloc and register
* @mdev: parent device to use for device addition
* @name: name of the new vdpa device
* @config: config attributes to apply to the device under creation
* Driver need to add a new device using _vdpa_register_device()
* after fully initializing the vdpa device. Driver must return 0
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/device.h`, `linux/interrupt.h`, `linux/virtio.h`, `linux/vhost_iotlb.h`, `linux/virtio_net.h`, `linux/virtio_blk.h`, `linux/if_ether.h`.
- Detected declarations: `struct vdpa_callback`, `struct vdpa_notification_area`, `struct vdpa_vq_state_split`, `struct vdpa_vq_state_packed`, `struct vdpa_vq_state`, `struct vdpa_mgmt_dev`, `struct vdpa_device`, `struct vdpa_iova_range`, `struct vdpa_dev_set_config`, `struct vdpa_map_file`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern 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.