include/linux/hyperv.h
Source file repositories/reference/linux-study-clean/include/linux/hyperv.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/hyperv.h- Extension
.h- Size
- 50232 bytes
- Lines
- 1775
- 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.
- 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
uapi/linux/hyperv.hlinux/mm.hlinux/types.hlinux/scatterlist.hlinux/list.hlinux/timer.hlinux/completion.hlinux/device.hlinux/mod_devicetable.hlinux/interrupt.hlinux/reciprocal_div.hhyperv/hvhdk.h
Detected Declarations
struct hv_page_bufferstruct hv_multipage_bufferstruct hv_mpb_arraystruct hv_ring_bufferstruct hv_ring_buffer_infostruct vmbus_channel_offerstruct vmpacket_descriptorstruct vmpacket_headerstruct vmtransfer_page_rangestruct vmtransfer_page_packet_headerstruct gpa_rangestruct vmdata_gpa_directstruct vmbus_channel_message_headerstruct vmbus_channel_query_vmbus_versionstruct vmbus_channel_version_supportedstruct vmbus_channel_offer_channelstruct vmbus_channel_rescind_offerstruct vmbus_channel_open_channelstruct vmbus_channel_open_resultstruct vmbus_channel_modifychannel_responsestruct vmbus_channel_close_channelstruct vmbus_channel_gpadl_headerstruct vmbus_channel_gpadl_bodystruct vmbus_channel_gpadl_createdstruct vmbus_channel_gpadl_teardownstruct vmbus_channel_gpadl_torndownstruct vmbus_channel_relid_releasedstruct vmbus_channel_initiate_contactstruct vmbus_channel_tl_connect_requeststruct vmbus_channel_modifychannelstruct vmbus_channel_version_responsestruct vmbus_channel_msginfostruct vmbus_requestorstruct vmbus_devicestruct vmbus_gpadlstruct vmbus_channelstruct vmbus_channel_packet_page_bufferstruct vmbus_channel_packet_multipage_bufferstruct vmbus_packet_mpb_arraystruct hv_driverstruct hv_devicestruct hv_ring_buffer_debug_infostruct hv_util_servicestruct vmbuspipe_hdrstruct ic_versionstruct icmsg_hdrstruct icmsg_negotiatestruct shutdown_msg_data
Annotated Snippet
struct device_driver driver;
/* dynamic device GUID's */
struct {
spinlock_t lock;
struct list_head list;
} dynids;
int (*probe)(struct hv_device *, const struct hv_vmbus_device_id *);
void (*remove)(struct hv_device *dev);
void (*shutdown)(struct hv_device *);
int (*suspend)(struct hv_device *);
int (*resume)(struct hv_device *);
};
/* Base device object */
struct hv_device {
/* the device type id of this device */
guid_t dev_type;
/* the device instance id of this device */
guid_t dev_instance;
u16 vendor_id;
u16 device_id;
struct device device;
struct vmbus_channel *channel;
struct kset *channels_kset;
struct device_dma_parameters dma_parms;
u64 dma_mask;
/* place holder to keep track of the dir for hv device in debugfs */
struct dentry *debug_dir;
};
#define device_to_hv_device(d) container_of_const(d, struct hv_device, device)
#define drv_to_hv_drv(d) container_of_const(d, struct hv_driver, driver)
static inline void hv_set_drvdata(struct hv_device *dev, void *data)
{
dev_set_drvdata(&dev->device, data);
}
static inline void *hv_get_drvdata(struct hv_device *dev)
{
return dev_get_drvdata(&dev->device);
}
struct device *hv_get_vmbus_root_device(void);
#if IS_ENABLED(CONFIG_HYPERV_VMBUS)
bool hv_vmbus_exists(void);
#else
static inline bool hv_vmbus_exists(void) { return false; }
#endif
struct hv_ring_buffer_debug_info {
u32 current_interrupt_mask;
u32 current_read_index;
u32 current_write_index;
u32 bytes_avail_toread;
u32 bytes_avail_towrite;
};
int hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info);
bool hv_ringbuffer_spinlock_busy(struct vmbus_channel *channel);
/* Vmbus interface */
#define vmbus_driver_register(driver) \
__vmbus_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
int __must_check __vmbus_driver_register(struct hv_driver *hv_driver,
struct module *owner,
const char *mod_name);
void vmbus_driver_unregister(struct hv_driver *hv_driver);
void vmbus_hvsock_device_unregister(struct vmbus_channel *channel);
int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
resource_size_t min, resource_size_t max,
resource_size_t size, resource_size_t align,
bool fb_overlap_ok);
void vmbus_free_mmio(resource_size_t start, resource_size_t size);
Annotation
- Immediate include surface: `uapi/linux/hyperv.h`, `linux/mm.h`, `linux/types.h`, `linux/scatterlist.h`, `linux/list.h`, `linux/timer.h`, `linux/completion.h`, `linux/device.h`.
- Detected declarations: `struct hv_page_buffer`, `struct hv_multipage_buffer`, `struct hv_mpb_array`, `struct hv_ring_buffer`, `struct hv_ring_buffer_info`, `struct vmbus_channel_offer`, `struct vmpacket_descriptor`, `struct vmpacket_header`, `struct vmtransfer_page_range`, `struct vmtransfer_page_packet_header`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- 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.