Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 1 | /* |
| 2 | * uio_hv_generic - generic UIO driver for VMBus |
| 3 | * |
| 4 | * Copyright (c) 2013-2016 Brocade Communications Systems, Inc. |
| 5 | * Copyright (c) 2016, Microsoft Corporation. |
| 6 | * |
| 7 | * |
| 8 | * This work is licensed under the terms of the GNU GPL, version 2. |
| 9 | * |
| 10 | * Since the driver does not declare any device ids, you must allocate |
| 11 | * id and bind the device to the driver yourself. For example: |
| 12 | * |
Stephen Hemminger | 4289696 | 2018-01-04 14:13:27 -0800 | [diff] [blame] | 13 | * Associate Network GUID with UIO device |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 14 | * # echo "f8615163-df3e-46c5-913f-f2d2f965ed0e" \ |
Stephen Hemminger | 4289696 | 2018-01-04 14:13:27 -0800 | [diff] [blame] | 15 | * > /sys/bus/vmbus/drivers/uio_hv_generic/new_id |
| 16 | * Then rebind |
| 17 | * # echo -n "ed963694-e847-4b2a-85af-bc9cfc11d6f3" \ |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 18 | * > /sys/bus/vmbus/drivers/hv_netvsc/unbind |
Stephen Hemminger | 4289696 | 2018-01-04 14:13:27 -0800 | [diff] [blame] | 19 | * # echo -n "ed963694-e847-4b2a-85af-bc9cfc11d6f3" \ |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 20 | * > /sys/bus/vmbus/drivers/uio_hv_generic/bind |
| 21 | */ |
Stephen Hemminger | ce3d153 | 2018-04-16 11:19:27 -0700 | [diff] [blame] | 22 | #define DEBUG 1 |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 24 | |
| 25 | #include <linux/device.h> |
| 26 | #include <linux/kernel.h> |
| 27 | #include <linux/module.h> |
| 28 | #include <linux/uio_driver.h> |
| 29 | #include <linux/netdevice.h> |
| 30 | #include <linux/if_ether.h> |
| 31 | #include <linux/skbuff.h> |
| 32 | #include <linux/hyperv.h> |
| 33 | #include <linux/vmalloc.h> |
| 34 | #include <linux/slab.h> |
| 35 | |
| 36 | #include "../hv/hyperv_vmbus.h" |
| 37 | |
| 38 | #define DRIVER_VERSION "0.02.0" |
| 39 | #define DRIVER_AUTHOR "Stephen Hemminger <sthemmin at microsoft.com>" |
| 40 | #define DRIVER_DESC "Generic UIO driver for VMBus devices" |
| 41 | |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 42 | #define HV_RING_SIZE 512 /* pages */ |
| 43 | #define SEND_BUFFER_SIZE (15 * 1024 * 1024) |
| 44 | #define RECV_BUFFER_SIZE (15 * 1024 * 1024) |
| 45 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 46 | /* |
| 47 | * List of resources to be mapped to user space |
| 48 | * can be extended up to MAX_UIO_MAPS(5) items |
| 49 | */ |
| 50 | enum hv_uio_map { |
| 51 | TXRX_RING_MAP = 0, |
| 52 | INT_PAGE_MAP, |
| 53 | MON_PAGE_MAP, |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 54 | RECV_BUF_MAP, |
| 55 | SEND_BUF_MAP |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 56 | }; |
| 57 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 58 | struct hv_uio_private_data { |
| 59 | struct uio_info info; |
| 60 | struct hv_device *device; |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 61 | |
| 62 | void *recv_buf; |
| 63 | u32 recv_gpadl; |
| 64 | char recv_name[32]; /* "recv_4294967295" */ |
| 65 | |
| 66 | void *send_buf; |
| 67 | u32 send_gpadl; |
| 68 | char send_name[32]; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 69 | }; |
| 70 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 71 | /* |
| 72 | * This is the irqcontrol callback to be registered to uio_info. |
| 73 | * It can be used to disable/enable interrupt from user space processes. |
| 74 | * |
| 75 | * @param info |
| 76 | * pointer to uio_info. |
| 77 | * @param irq_state |
| 78 | * state value. 1 to enable interrupt, 0 to disable interrupt. |
| 79 | */ |
| 80 | static int |
| 81 | hv_uio_irqcontrol(struct uio_info *info, s32 irq_state) |
| 82 | { |
| 83 | struct hv_uio_private_data *pdata = info->priv; |
| 84 | struct hv_device *dev = pdata->device; |
| 85 | |
| 86 | dev->channel->inbound.ring_buffer->interrupt_mask = !irq_state; |
| 87 | virt_mb(); |
| 88 | |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | * Callback from vmbus_event when something is in inbound ring. |
| 94 | */ |
| 95 | static void hv_uio_channel_cb(void *context) |
| 96 | { |
Stephen Hemminger | 135db38 | 2018-04-16 11:19:26 -0700 | [diff] [blame] | 97 | struct vmbus_channel *chan = context; |
| 98 | struct hv_device *hv_dev = chan->device_obj; |
| 99 | struct hv_uio_private_data *pdata = hv_get_drvdata(hv_dev); |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 100 | |
Stephen Hemminger | 135db38 | 2018-04-16 11:19:26 -0700 | [diff] [blame] | 101 | chan->inbound.ring_buffer->interrupt_mask = 1; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 102 | virt_mb(); |
| 103 | |
| 104 | uio_event_notify(&pdata->info); |
| 105 | } |
| 106 | |
Stephen Hemminger | ca3cda6 | 2018-01-09 12:57:32 -0800 | [diff] [blame] | 107 | /* |
| 108 | * Callback from vmbus_event when channel is rescinded. |
| 109 | */ |
| 110 | static void hv_uio_rescind(struct vmbus_channel *channel) |
| 111 | { |
| 112 | struct hv_device *hv_dev = channel->primary_channel->device_obj; |
| 113 | struct hv_uio_private_data *pdata = hv_get_drvdata(hv_dev); |
| 114 | |
| 115 | /* |
| 116 | * Turn off the interrupt file handle |
| 117 | * Next read for event will return -EIO |
| 118 | */ |
| 119 | pdata->info.irq = 0; |
| 120 | |
| 121 | /* Wake up reader */ |
| 122 | uio_event_notify(&pdata->info); |
| 123 | } |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 124 | |
Stephen Hemminger | ce3d153 | 2018-04-16 11:19:27 -0700 | [diff] [blame] | 125 | /* Sysfs API to allow mmap of the ring buffers |
| 126 | * The ring buffer is allocated as contiguous memory by vmbus_open |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 127 | */ |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 128 | static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj, |
| 129 | struct bin_attribute *attr, |
| 130 | struct vm_area_struct *vma) |
| 131 | { |
| 132 | struct vmbus_channel *channel |
| 133 | = container_of(kobj, struct vmbus_channel, kobj); |
Stephen Hemminger | ce3d153 | 2018-04-16 11:19:27 -0700 | [diff] [blame] | 134 | struct hv_device *dev = channel->primary_channel->device_obj; |
| 135 | u16 q_idx = channel->offermsg.offer.sub_channel_index; |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 136 | |
Stephen Hemminger | ce3d153 | 2018-04-16 11:19:27 -0700 | [diff] [blame] | 137 | dev_dbg(&dev->device, "mmap channel %u pages %#lx at %#lx\n", |
| 138 | q_idx, vma_pages(vma), vma->vm_pgoff); |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 139 | |
Stephen Hemminger | ce3d153 | 2018-04-16 11:19:27 -0700 | [diff] [blame] | 140 | return vm_iomap_memory(vma, virt_to_phys(channel->ringbuffer_pages), |
| 141 | channel->ringbuffer_pagecount << PAGE_SHIFT); |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 142 | } |
| 143 | |
Stephen Hemminger | 6e3d66b | 2018-04-16 11:19:24 -0700 | [diff] [blame] | 144 | static const struct bin_attribute ring_buffer_bin_attr = { |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 145 | .attr = { |
| 146 | .name = "ring", |
| 147 | .mode = 0600, |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 148 | }, |
Stephen Hemminger | 6e3d66b | 2018-04-16 11:19:24 -0700 | [diff] [blame] | 149 | .size = 2 * HV_RING_SIZE * PAGE_SIZE, |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 150 | .mmap = hv_uio_ring_mmap, |
| 151 | }; |
| 152 | |
Stephen Hemminger | 135db38 | 2018-04-16 11:19:26 -0700 | [diff] [blame] | 153 | /* Callback from VMBUS subsystem when new channel created. */ |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 154 | static void |
| 155 | hv_uio_new_channel(struct vmbus_channel *new_sc) |
| 156 | { |
| 157 | struct hv_device *hv_dev = new_sc->primary_channel->device_obj; |
| 158 | struct device *device = &hv_dev->device; |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 159 | const size_t ring_bytes = HV_RING_SIZE * PAGE_SIZE; |
| 160 | int ret; |
| 161 | |
| 162 | /* Create host communication ring */ |
| 163 | ret = vmbus_open(new_sc, ring_bytes, ring_bytes, NULL, 0, |
Stephen Hemminger | 135db38 | 2018-04-16 11:19:26 -0700 | [diff] [blame] | 164 | hv_uio_channel_cb, new_sc); |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 165 | if (ret) { |
| 166 | dev_err(device, "vmbus_open subchannel failed: %d\n", ret); |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | /* Disable interrupts on sub channel */ |
| 171 | new_sc->inbound.ring_buffer->interrupt_mask = 1; |
| 172 | set_channel_read_mode(new_sc, HV_CALL_ISR); |
| 173 | |
| 174 | ret = sysfs_create_bin_file(&new_sc->kobj, &ring_buffer_bin_attr); |
| 175 | if (ret) { |
| 176 | dev_err(device, "sysfs create ring bin file failed; %d\n", ret); |
| 177 | vmbus_close(new_sc); |
| 178 | } |
| 179 | } |
| 180 | |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 181 | static void |
| 182 | hv_uio_cleanup(struct hv_device *dev, struct hv_uio_private_data *pdata) |
| 183 | { |
| 184 | if (pdata->send_gpadl) |
| 185 | vmbus_teardown_gpadl(dev->channel, pdata->send_gpadl); |
| 186 | vfree(pdata->send_buf); |
| 187 | |
| 188 | if (pdata->recv_gpadl) |
| 189 | vmbus_teardown_gpadl(dev->channel, pdata->recv_gpadl); |
| 190 | vfree(pdata->recv_buf); |
| 191 | } |
| 192 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 193 | static int |
| 194 | hv_uio_probe(struct hv_device *dev, |
| 195 | const struct hv_vmbus_device_id *dev_id) |
| 196 | { |
| 197 | struct hv_uio_private_data *pdata; |
| 198 | int ret; |
| 199 | |
| 200 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); |
| 201 | if (!pdata) |
| 202 | return -ENOMEM; |
| 203 | |
| 204 | ret = vmbus_open(dev->channel, HV_RING_SIZE * PAGE_SIZE, |
| 205 | HV_RING_SIZE * PAGE_SIZE, NULL, 0, |
Stephen Hemminger | 135db38 | 2018-04-16 11:19:26 -0700 | [diff] [blame] | 206 | hv_uio_channel_cb, dev->channel); |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 207 | if (ret) |
| 208 | goto fail; |
| 209 | |
Stephen Hemminger | 06028d1 | 2018-01-09 12:57:31 -0800 | [diff] [blame] | 210 | /* Communicating with host has to be via shared memory not hypercall */ |
| 211 | if (!dev->channel->offermsg.monitor_allocated) { |
| 212 | dev_err(&dev->device, "vmbus channel requires hypercall\n"); |
| 213 | ret = -ENOTSUPP; |
| 214 | goto fail_close; |
| 215 | } |
| 216 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 217 | dev->channel->inbound.ring_buffer->interrupt_mask = 1; |
Stephen Hemminger | 2141a84 | 2018-01-04 14:13:31 -0800 | [diff] [blame] | 218 | set_channel_read_mode(dev->channel, HV_CALL_ISR); |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 219 | |
| 220 | /* Fill general uio info */ |
| 221 | pdata->info.name = "uio_hv_generic"; |
| 222 | pdata->info.version = DRIVER_VERSION; |
| 223 | pdata->info.irqcontrol = hv_uio_irqcontrol; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 224 | pdata->info.irq = UIO_IRQ_CUSTOM; |
| 225 | |
| 226 | /* mem resources */ |
| 227 | pdata->info.mem[TXRX_RING_MAP].name = "txrx_rings"; |
| 228 | pdata->info.mem[TXRX_RING_MAP].addr |
Arnd Bergmann | 72d1465 | 2018-01-10 17:42:38 +0100 | [diff] [blame] | 229 | = (uintptr_t)dev->channel->ringbuffer_pages; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 230 | pdata->info.mem[TXRX_RING_MAP].size |
Stephen Hemminger | 9c40546 | 2018-01-04 14:13:28 -0800 | [diff] [blame] | 231 | = dev->channel->ringbuffer_pagecount << PAGE_SHIFT; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 232 | pdata->info.mem[TXRX_RING_MAP].memtype = UIO_MEM_LOGICAL; |
| 233 | |
| 234 | pdata->info.mem[INT_PAGE_MAP].name = "int_page"; |
Stephen Hemminger | 9c40546 | 2018-01-04 14:13:28 -0800 | [diff] [blame] | 235 | pdata->info.mem[INT_PAGE_MAP].addr |
Arnd Bergmann | 72d1465 | 2018-01-10 17:42:38 +0100 | [diff] [blame] | 236 | = (uintptr_t)vmbus_connection.int_page; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 237 | pdata->info.mem[INT_PAGE_MAP].size = PAGE_SIZE; |
| 238 | pdata->info.mem[INT_PAGE_MAP].memtype = UIO_MEM_LOGICAL; |
| 239 | |
Stephen Hemminger | 9c40546 | 2018-01-04 14:13:28 -0800 | [diff] [blame] | 240 | pdata->info.mem[MON_PAGE_MAP].name = "monitor_page"; |
| 241 | pdata->info.mem[MON_PAGE_MAP].addr |
Arnd Bergmann | 72d1465 | 2018-01-10 17:42:38 +0100 | [diff] [blame] | 242 | = (uintptr_t)vmbus_connection.monitor_pages[1]; |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 243 | pdata->info.mem[MON_PAGE_MAP].size = PAGE_SIZE; |
| 244 | pdata->info.mem[MON_PAGE_MAP].memtype = UIO_MEM_LOGICAL; |
| 245 | |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 246 | pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE); |
| 247 | if (pdata->recv_buf == NULL) { |
| 248 | ret = -ENOMEM; |
| 249 | goto fail_close; |
| 250 | } |
| 251 | |
| 252 | ret = vmbus_establish_gpadl(dev->channel, pdata->recv_buf, |
| 253 | RECV_BUFFER_SIZE, &pdata->recv_gpadl); |
| 254 | if (ret) |
| 255 | goto fail_close; |
| 256 | |
| 257 | /* put Global Physical Address Label in name */ |
| 258 | snprintf(pdata->recv_name, sizeof(pdata->recv_name), |
| 259 | "recv:%u", pdata->recv_gpadl); |
| 260 | pdata->info.mem[RECV_BUF_MAP].name = pdata->recv_name; |
| 261 | pdata->info.mem[RECV_BUF_MAP].addr |
Arnd Bergmann | d6088e9 | 2018-01-12 16:51:14 +0100 | [diff] [blame] | 262 | = (uintptr_t)pdata->recv_buf; |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 263 | pdata->info.mem[RECV_BUF_MAP].size = RECV_BUFFER_SIZE; |
| 264 | pdata->info.mem[RECV_BUF_MAP].memtype = UIO_MEM_VIRTUAL; |
| 265 | |
| 266 | |
| 267 | pdata->send_buf = vzalloc(SEND_BUFFER_SIZE); |
| 268 | if (pdata->send_buf == NULL) { |
| 269 | ret = -ENOMEM; |
| 270 | goto fail_close; |
| 271 | } |
| 272 | |
| 273 | ret = vmbus_establish_gpadl(dev->channel, pdata->send_buf, |
| 274 | SEND_BUFFER_SIZE, &pdata->send_gpadl); |
| 275 | if (ret) |
| 276 | goto fail_close; |
| 277 | |
| 278 | snprintf(pdata->send_name, sizeof(pdata->send_name), |
| 279 | "send:%u", pdata->send_gpadl); |
| 280 | pdata->info.mem[SEND_BUF_MAP].name = pdata->send_name; |
| 281 | pdata->info.mem[SEND_BUF_MAP].addr |
Arnd Bergmann | d6088e9 | 2018-01-12 16:51:14 +0100 | [diff] [blame] | 282 | = (uintptr_t)pdata->send_buf; |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 283 | pdata->info.mem[SEND_BUF_MAP].size = SEND_BUFFER_SIZE; |
| 284 | pdata->info.mem[SEND_BUF_MAP].memtype = UIO_MEM_VIRTUAL; |
| 285 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 286 | pdata->info.priv = pdata; |
| 287 | pdata->device = dev; |
| 288 | |
| 289 | ret = uio_register_device(&dev->device, &pdata->info); |
| 290 | if (ret) { |
| 291 | dev_err(&dev->device, "hv_uio register failed\n"); |
| 292 | goto fail_close; |
| 293 | } |
| 294 | |
Stephen Hemminger | ca3cda6 | 2018-01-09 12:57:32 -0800 | [diff] [blame] | 295 | vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind); |
Stephen Hemminger | 37b96a4 | 2018-02-05 10:40:27 -0800 | [diff] [blame] | 296 | vmbus_set_sc_create_callback(dev->channel, hv_uio_new_channel); |
Stephen Hemminger | ca3cda6 | 2018-01-09 12:57:32 -0800 | [diff] [blame] | 297 | |
Stephen Hemminger | 9ab877a | 2018-04-16 11:19:25 -0700 | [diff] [blame] | 298 | ret = sysfs_create_bin_file(&dev->channel->kobj, &ring_buffer_bin_attr); |
| 299 | if (ret) |
| 300 | dev_notice(&dev->device, |
| 301 | "sysfs create ring bin file failed; %d\n", ret); |
| 302 | |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 303 | hv_set_drvdata(dev, pdata); |
| 304 | |
| 305 | return 0; |
| 306 | |
| 307 | fail_close: |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 308 | hv_uio_cleanup(dev, pdata); |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 309 | vmbus_close(dev->channel); |
| 310 | fail: |
| 311 | kfree(pdata); |
| 312 | |
| 313 | return ret; |
| 314 | } |
| 315 | |
| 316 | static int |
| 317 | hv_uio_remove(struct hv_device *dev) |
| 318 | { |
| 319 | struct hv_uio_private_data *pdata = hv_get_drvdata(dev); |
| 320 | |
| 321 | if (!pdata) |
| 322 | return 0; |
| 323 | |
| 324 | uio_unregister_device(&pdata->info); |
Stephen Hemminger | e7d2146 | 2018-01-09 12:57:30 -0800 | [diff] [blame] | 325 | hv_uio_cleanup(dev, pdata); |
Stephen Hemminger | 95096f2 | 2016-12-03 12:34:40 -0800 | [diff] [blame] | 326 | hv_set_drvdata(dev, NULL); |
| 327 | vmbus_close(dev->channel); |
| 328 | kfree(pdata); |
| 329 | return 0; |
| 330 | } |
| 331 | |
| 332 | static struct hv_driver hv_uio_drv = { |
| 333 | .name = "uio_hv_generic", |
| 334 | .id_table = NULL, /* only dynamic id's */ |
| 335 | .probe = hv_uio_probe, |
| 336 | .remove = hv_uio_remove, |
| 337 | }; |
| 338 | |
| 339 | static int __init |
| 340 | hyperv_module_init(void) |
| 341 | { |
| 342 | return vmbus_driver_register(&hv_uio_drv); |
| 343 | } |
| 344 | |
| 345 | static void __exit |
| 346 | hyperv_module_exit(void) |
| 347 | { |
| 348 | vmbus_driver_unregister(&hv_uio_drv); |
| 349 | } |
| 350 | |
| 351 | module_init(hyperv_module_init); |
| 352 | module_exit(hyperv_module_exit); |
| 353 | |
| 354 | MODULE_VERSION(DRIVER_VERSION); |
| 355 | MODULE_LICENSE("GPL v2"); |
| 356 | MODULE_AUTHOR(DRIVER_AUTHOR); |
| 357 | MODULE_DESCRIPTION(DRIVER_DESC); |