// SPDX-License-Identifier: GPL-2.0-only /* * * Copyright (c) 2009, Microsoft Corporation. * * Authors: * Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> */ #define pr_fmt(fmt) … #include <linux/kernel.h> #include <linux/sched.h> #include <linux/wait.h> #include <linux/delay.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/hyperv.h> #include <linux/export.h> #include <linux/io.h> #include <linux/set_memory.h> #include <asm/mshyperv.h> #include "hyperv_vmbus.h" struct vmbus_connection vmbus_connection = …; EXPORT_SYMBOL_GPL(…); /* * Negotiated protocol version with the host. */ __u32 vmbus_proto_version; EXPORT_SYMBOL_GPL(…); /* * Table of VMBus versions listed from newest to oldest. * VERSION_WIN7 and VERSION_WS2008 are no longer supported in * Linux guests and are not listed. */ static __u32 vmbus_versions[] = …; /* * Maximal VMBus protocol version guests can negotiate. Useful to cap the * VMBus version for testing and debugging purpose. */ static uint max_version = …; module_param(max_version, uint, S_IRUGO); MODULE_PARM_DESC(…) …; int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) { … } /* * vmbus_connect - Sends a connect request on the partition service connection */ int vmbus_connect(void) { … } void vmbus_disconnect(void) { … } /* * relid2channel - Get the channel object given its * child relative id (ie channel id) */ struct vmbus_channel *relid2channel(u32 relid) { … } /* * vmbus_on_event - Process a channel event notification * * For batched channels (default) optimize host to guest signaling * by ensuring: * 1. While reading the channel, we disable interrupts from host. * 2. Ensure that we process all posted messages from the host * before returning from this callback. * 3. Once we return, enable signaling from the host. Once this * state is set we check to see if additional packets are * available to read. In this case we repeat the process. * If this tasklet has been running for a long time * then reschedule ourselves. */ void vmbus_on_event(unsigned long data) { … } /* * vmbus_post_msg - Send a msg on the vmbus's message connection */ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep) { … } /* * vmbus_set_event - Send an event notification to the parent */ void vmbus_set_event(struct vmbus_channel *channel) { … } EXPORT_SYMBOL_GPL(…);