23 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25 #include <linux/kernel.h>
26 #include <linux/sched.h>
27 #include <linux/wait.h>
30 #include <linux/slab.h>
50 struct vmbus_channel_initiate_contact *
msg;
64 INIT_LIST_HEAD(&vmbus_connection.
chn_list);
80 (
void *)((
unsigned long)vmbus_connection.
int_page +
94 msginfo = kzalloc(
sizeof(*msginfo) +
95 sizeof(
struct vmbus_channel_initiate_contact),
97 if (msginfo ==
NULL) {
102 init_completion(&msginfo->waitevent);
104 msg = (
struct vmbus_channel_initiate_contact *)msginfo->msg;
106 msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
107 msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
125 sizeof(
struct vmbus_channel_initiate_contact));
151 if (msginfo->response.version_response.version_supported) {
154 pr_err(
"Unable to connect, "
155 "Version %d not supported by Hyper-V\n",
156 VMBUS_REVISION_NUMBER);
193 struct vmbus_channel *found_channel =
NULL;
198 if (channel->offermsg.child_relid == relid) {
203 spin_unlock_irqrestore(&vmbus_connection.
channel_lock, flags);
205 return found_channel;
211 static void process_chn_event(
u32 relid)
223 pr_err(
"channel not found for relid - %u\n", relid);
237 if (channel->onchannel_callback !=
NULL)
238 channel->onchannel_callback(channel->channel_callback_context);
240 pr_err(
"no channel callback for relid - %u\n", relid);
242 spin_unlock_irqrestore(&channel->inbound_lock, flags);
259 for (dword = 0; dword < maxdword; dword++) {
260 if (!recv_int_page[dword])
262 for (bit = 0; bit < 32; bit++) {
264 (
unsigned long *)&recv_int_page[dword])) {
265 relid = (dword << 5) + bit;
274 process_chn_event(relid);
297 while (retries < 3) {