Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010, Microsoft Corporation. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, |
| 6 | * version 2, as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | * more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along with |
| 14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
| 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 16 | * |
| 17 | * Authors: |
| 18 | * Haiyang Zhang <haiyangz@microsoft.com> |
| 19 | * Hank Janssen <hjanssen@microsoft.com> |
| 20 | */ |
Hank Janssen | af7a5b6 | 2011-03-29 13:58:49 -0700 | [diff] [blame] | 21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 22 | |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 23 | #include <linux/kernel.h> |
| 24 | #include <linux/init.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/slab.h> |
| 27 | #include <linux/sysctl.h> |
Greg Kroah-Hartman | 9e62907 | 2010-05-04 08:26:23 -0700 | [diff] [blame] | 28 | #include <linux/reboot.h> |
Haiyang Zhang | d750785 | 2010-05-19 15:56:28 +0000 | [diff] [blame] | 29 | #include <linux/dmi.h> |
| 30 | #include <linux/pci.h> |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 31 | |
K. Y. Srinivasan | 3f335ea | 2011-05-12 19:34:15 -0700 | [diff] [blame] | 32 | #include "hyperv.h" |
Ky Srinivasan | 245ba56 | 2010-12-16 18:54:16 -0700 | [diff] [blame] | 33 | #include "hv_kvp.h" |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 34 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 35 | static u8 *shut_txf_buf; |
| 36 | static u8 *time_txf_buf; |
| 37 | static u8 *hbeat_txf_buf; |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 38 | |
Greg Kroah-Hartman | 6610944 | 2010-05-04 14:31:18 -0700 | [diff] [blame] | 39 | static void shutdown_onchannelcallback(void *context) |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 40 | { |
| 41 | struct vmbus_channel *channel = context; |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 42 | u32 recvlen; |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 43 | u64 requestid; |
| 44 | u8 execute_shutdown = false; |
| 45 | |
| 46 | struct shutdown_msg_data *shutdown_msg; |
| 47 | |
| 48 | struct icmsg_hdr *icmsghdrp; |
| 49 | struct icmsg_negotiate *negop = NULL; |
| 50 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 51 | vmbus_recvpacket(channel, shut_txf_buf, |
| 52 | PAGE_SIZE, &recvlen, &requestid); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 53 | |
| 54 | if (recvlen > 0) { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 55 | icmsghdrp = (struct icmsg_hdr *)&shut_txf_buf[ |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 56 | sizeof(struct vmbuspipe_hdr)]; |
| 57 | |
| 58 | if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 59 | prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 60 | } else { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 61 | shutdown_msg = |
| 62 | (struct shutdown_msg_data *)&shut_txf_buf[ |
| 63 | sizeof(struct vmbuspipe_hdr) + |
| 64 | sizeof(struct icmsg_hdr)]; |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 65 | |
| 66 | switch (shutdown_msg->flags) { |
| 67 | case 0: |
| 68 | case 1: |
| 69 | icmsghdrp->status = HV_S_OK; |
| 70 | execute_shutdown = true; |
| 71 | |
Hank Janssen | af7a5b6 | 2011-03-29 13:58:49 -0700 | [diff] [blame] | 72 | pr_info("Shutdown request received -" |
Greg Kroah-Hartman | 32235b0 | 2011-04-13 12:14:05 -0700 | [diff] [blame] | 73 | " graceful shutdown initiated\n"); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 74 | break; |
| 75 | default: |
| 76 | icmsghdrp->status = HV_E_FAIL; |
| 77 | execute_shutdown = false; |
| 78 | |
Hank Janssen | af7a5b6 | 2011-03-29 13:58:49 -0700 | [diff] [blame] | 79 | pr_info("Shutdown request received -" |
| 80 | " Invalid request\n"); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 81 | break; |
Joe Perches | 95cd17c | 2011-04-10 14:31:35 -0700 | [diff] [blame] | 82 | } |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION |
| 86 | | ICMSGHDRFLAG_RESPONSE; |
| 87 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 88 | vmbus_sendpacket(channel, shut_txf_buf, |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 89 | recvlen, requestid, |
Haiyang Zhang | 415f228 | 2011-01-26 12:12:13 -0800 | [diff] [blame] | 90 | VM_PKT_DATA_INBAND, 0); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 93 | if (execute_shutdown == true) |
Greg Kroah-Hartman | 9e62907 | 2010-05-04 08:26:23 -0700 | [diff] [blame] | 94 | orderly_poweroff(false); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 97 | /* |
Haiyang Zhang | e9ec360 | 2010-05-11 15:11:24 +0000 | [diff] [blame] | 98 | * Set guest time to host UTC time. |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 99 | */ |
Haiyang Zhang | e9ec360 | 2010-05-11 15:11:24 +0000 | [diff] [blame] | 100 | static inline void do_adj_guesttime(u64 hosttime) |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 101 | { |
| 102 | s64 host_tns; |
| 103 | struct timespec host_ts; |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 104 | |
| 105 | host_tns = (hosttime - WLTIMEDELTA) * 100; |
| 106 | host_ts = ns_to_timespec(host_tns); |
| 107 | |
Haiyang Zhang | e9ec360 | 2010-05-11 15:11:24 +0000 | [diff] [blame] | 108 | do_settimeofday(&host_ts); |
| 109 | } |
| 110 | |
| 111 | /* |
| 112 | * Synchronize time with host after reboot, restore, etc. |
| 113 | * |
| 114 | * ICTIMESYNCFLAG_SYNC flag bit indicates reboot, restore events of the VM. |
| 115 | * After reboot the flag ICTIMESYNCFLAG_SYNC is included in the first time |
| 116 | * message after the timesync channel is opened. Since the hv_utils module is |
| 117 | * loaded after hv_vmbus, the first message is usually missed. The other |
| 118 | * thing is, systime is automatically set to emulated hardware clock which may |
| 119 | * not be UTC time or in the same time zone. So, to override these effects, we |
| 120 | * use the first 50 time samples for initial system time setting. |
| 121 | */ |
| 122 | static inline void adj_guesttime(u64 hosttime, u8 flags) |
| 123 | { |
| 124 | static s32 scnt = 50; |
| 125 | |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 126 | if ((flags & ICTIMESYNCFLAG_SYNC) != 0) { |
Haiyang Zhang | e9ec360 | 2010-05-11 15:11:24 +0000 | [diff] [blame] | 127 | do_adj_guesttime(hosttime); |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 128 | return; |
| 129 | } |
| 130 | |
Haiyang Zhang | e9ec360 | 2010-05-11 15:11:24 +0000 | [diff] [blame] | 131 | if ((flags & ICTIMESYNCFLAG_SAMPLE) != 0 && scnt > 0) { |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 132 | scnt--; |
Haiyang Zhang | e9ec360 | 2010-05-11 15:11:24 +0000 | [diff] [blame] | 133 | do_adj_guesttime(hosttime); |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 134 | } |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | /* |
| 138 | * Time Sync Channel message handler. |
| 139 | */ |
| 140 | static void timesync_onchannelcallback(void *context) |
| 141 | { |
| 142 | struct vmbus_channel *channel = context; |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 143 | u32 recvlen; |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 144 | u64 requestid; |
| 145 | struct icmsg_hdr *icmsghdrp; |
| 146 | struct ictimesync_data *timedatap; |
| 147 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 148 | vmbus_recvpacket(channel, time_txf_buf, |
| 149 | PAGE_SIZE, &recvlen, &requestid); |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 150 | |
| 151 | if (recvlen > 0) { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 152 | icmsghdrp = (struct icmsg_hdr *)&time_txf_buf[ |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 153 | sizeof(struct vmbuspipe_hdr)]; |
| 154 | |
| 155 | if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 156 | prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf); |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 157 | } else { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 158 | timedatap = (struct ictimesync_data *)&time_txf_buf[ |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 159 | sizeof(struct vmbuspipe_hdr) + |
| 160 | sizeof(struct icmsg_hdr)]; |
| 161 | adj_guesttime(timedatap->parenttime, timedatap->flags); |
| 162 | } |
| 163 | |
| 164 | icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION |
| 165 | | ICMSGHDRFLAG_RESPONSE; |
| 166 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 167 | vmbus_sendpacket(channel, time_txf_buf, |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 168 | recvlen, requestid, |
Haiyang Zhang | 415f228 | 2011-01-26 12:12:13 -0800 | [diff] [blame] | 169 | VM_PKT_DATA_INBAND, 0); |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 170 | } |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 171 | } |
| 172 | |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 173 | /* |
| 174 | * Heartbeat functionality. |
| 175 | * Every two seconds, Hyper-V send us a heartbeat request message. |
| 176 | * we respond to this message, and Hyper-V knows we are alive. |
| 177 | */ |
| 178 | static void heartbeat_onchannelcallback(void *context) |
| 179 | { |
| 180 | struct vmbus_channel *channel = context; |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 181 | u32 recvlen; |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 182 | u64 requestid; |
| 183 | struct icmsg_hdr *icmsghdrp; |
| 184 | struct heartbeat_msg_data *heartbeat_msg; |
| 185 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 186 | vmbus_recvpacket(channel, hbeat_txf_buf, |
| 187 | PAGE_SIZE, &recvlen, &requestid); |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 188 | |
| 189 | if (recvlen > 0) { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 190 | icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[ |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 191 | sizeof(struct vmbuspipe_hdr)]; |
| 192 | |
| 193 | if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 194 | prep_negotiate_resp(icmsghdrp, NULL, hbeat_txf_buf); |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 195 | } else { |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 196 | heartbeat_msg = |
| 197 | (struct heartbeat_msg_data *)&hbeat_txf_buf[ |
| 198 | sizeof(struct vmbuspipe_hdr) + |
| 199 | sizeof(struct icmsg_hdr)]; |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 200 | |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 201 | heartbeat_msg->seq_num += 1; |
| 202 | } |
| 203 | |
| 204 | icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION |
| 205 | | ICMSGHDRFLAG_RESPONSE; |
| 206 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 207 | vmbus_sendpacket(channel, hbeat_txf_buf, |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 208 | recvlen, requestid, |
Haiyang Zhang | 415f228 | 2011-01-26 12:12:13 -0800 | [diff] [blame] | 209 | VM_PKT_DATA_INBAND, 0); |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 210 | } |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 211 | } |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 212 | |
Haiyang Zhang | d750785 | 2010-05-19 15:56:28 +0000 | [diff] [blame] | 213 | static const struct pci_device_id __initconst |
| 214 | hv_utils_pci_table[] __maybe_unused = { |
| 215 | { PCI_DEVICE(0x1414, 0x5353) }, /* Hyper-V emulated VGA controller */ |
| 216 | { 0 } |
| 217 | }; |
| 218 | MODULE_DEVICE_TABLE(pci, hv_utils_pci_table); |
| 219 | |
| 220 | |
| 221 | static const struct dmi_system_id __initconst |
| 222 | hv_utils_dmi_table[] __maybe_unused = { |
| 223 | { |
| 224 | .ident = "Hyper-V", |
| 225 | .matches = { |
| 226 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), |
| 227 | DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), |
| 228 | DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"), |
| 229 | }, |
| 230 | }, |
| 231 | { }, |
| 232 | }; |
| 233 | MODULE_DEVICE_TABLE(dmi, hv_utils_dmi_table); |
| 234 | |
| 235 | |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 236 | static int __init init_hyperv_utils(void) |
| 237 | { |
Hank Janssen | af7a5b6 | 2011-03-29 13:58:49 -0700 | [diff] [blame] | 238 | pr_info("Registering HyperV Utility Driver\n"); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 239 | |
Ky Srinivasan | 245ba56 | 2010-12-16 18:54:16 -0700 | [diff] [blame] | 240 | if (hv_kvp_init()) |
| 241 | return -ENODEV; |
| 242 | |
| 243 | |
Haiyang Zhang | d750785 | 2010-05-19 15:56:28 +0000 | [diff] [blame] | 244 | if (!dmi_check_system(hv_utils_dmi_table)) |
| 245 | return -ENODEV; |
| 246 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 247 | shut_txf_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 248 | time_txf_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 249 | hbeat_txf_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 250 | |
| 251 | if (!shut_txf_buf || !time_txf_buf || !hbeat_txf_buf) { |
Hank Janssen | af7a5b6 | 2011-03-29 13:58:49 -0700 | [diff] [blame] | 252 | pr_info("Unable to allocate memory for receive buffer\n"); |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 253 | kfree(shut_txf_buf); |
| 254 | kfree(time_txf_buf); |
| 255 | kfree(hbeat_txf_buf); |
| 256 | return -ENOMEM; |
| 257 | } |
| 258 | |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 259 | hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; |
| 260 | |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 261 | hv_cb_utils[HV_TIMESYNC_MSG].callback = ×ync_onchannelcallback; |
| 262 | |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 263 | hv_cb_utils[HV_HEARTBEAT_MSG].callback = &heartbeat_onchannelcallback; |
| 264 | |
K. Y. Srinivasan | b9d8e35 | 2011-05-16 06:44:36 -0700 | [diff] [blame] | 265 | hv_cb_utils[HV_KVP_MSG].callback = &hv_kvp_onchannelcallback; |
Ky Srinivasan | 245ba56 | 2010-12-16 18:54:16 -0700 | [diff] [blame] | 266 | |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 267 | return 0; |
| 268 | } |
| 269 | |
| 270 | static void exit_hyperv_utils(void) |
| 271 | { |
Hank Janssen | af7a5b6 | 2011-03-29 13:58:49 -0700 | [diff] [blame] | 272 | pr_info("De-Registered HyperV Utility Driver\n"); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 273 | |
K. Y. Srinivasan | b9d8e35 | 2011-05-16 06:44:36 -0700 | [diff] [blame] | 274 | if (hv_cb_utils[HV_SHUTDOWN_MSG].channel != NULL) |
| 275 | hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback = |
| 276 | &chn_cb_negotiate; |
| 277 | hv_cb_utils[HV_SHUTDOWN_MSG].callback = NULL; |
Haiyang Zhang | 39c4e9c | 2010-05-05 19:23:46 +0000 | [diff] [blame] | 278 | |
K. Y. Srinivasan | b9d8e35 | 2011-05-16 06:44:36 -0700 | [diff] [blame] | 279 | if (hv_cb_utils[HV_TIMESYNC_MSG].channel != NULL) |
| 280 | hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback = |
| 281 | &chn_cb_negotiate; |
| 282 | hv_cb_utils[HV_TIMESYNC_MSG].callback = NULL; |
Hank Janssen | 9153f7b | 2010-05-15 14:39:58 -0700 | [diff] [blame] | 283 | |
K. Y. Srinivasan | b9d8e35 | 2011-05-16 06:44:36 -0700 | [diff] [blame] | 284 | if (hv_cb_utils[HV_HEARTBEAT_MSG].channel != NULL) |
| 285 | hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback = |
| 286 | &chn_cb_negotiate; |
| 287 | hv_cb_utils[HV_HEARTBEAT_MSG].callback = NULL; |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 288 | |
K. Y. Srinivasan | b9d8e35 | 2011-05-16 06:44:36 -0700 | [diff] [blame] | 289 | if (hv_cb_utils[HV_KVP_MSG].channel != NULL) |
| 290 | hv_cb_utils[HV_KVP_MSG].channel->onchannel_callback = |
| 291 | &chn_cb_negotiate; |
| 292 | hv_cb_utils[HV_KVP_MSG].callback = NULL; |
| 293 | |
Ky Srinivasan | 245ba56 | 2010-12-16 18:54:16 -0700 | [diff] [blame] | 294 | hv_kvp_deinit(); |
| 295 | |
Hank Janssen | 45241e5 | 2010-12-13 16:23:36 -0800 | [diff] [blame] | 296 | kfree(shut_txf_buf); |
| 297 | kfree(time_txf_buf); |
| 298 | kfree(hbeat_txf_buf); |
Hank Janssen | c88c4e4 | 2010-05-04 15:55:05 -0700 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | module_init(init_hyperv_utils); |
| 302 | module_exit(exit_hyperv_utils); |
| 303 | |
| 304 | MODULE_DESCRIPTION("Hyper-V Utilities"); |
| 305 | MODULE_VERSION(HV_DRV_VERSION); |
| 306 | MODULE_LICENSE("GPL"); |