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.

Dependency Surface

Detected Declarations

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

Implementation Notes