diff options
| -rw-r--r-- | MAINTAINERS | 4 | ||||
| -rw-r--r-- | drivers/hv/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/hv/vmbus_drv.c | 20 | ||||
| -rw-r--r-- | drivers/uio/uio_hv_generic.c | 7 |
4 files changed, 27 insertions, 6 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index b66404ff27fa..21ce79908418 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -6906,8 +6906,10 @@ Hyper-V CORE AND DRIVERS | |||
| 6906 | M: "K. Y. Srinivasan" <kys@microsoft.com> | 6906 | M: "K. Y. Srinivasan" <kys@microsoft.com> |
| 6907 | M: Haiyang Zhang <haiyangz@microsoft.com> | 6907 | M: Haiyang Zhang <haiyangz@microsoft.com> |
| 6908 | M: Stephen Hemminger <sthemmin@microsoft.com> | 6908 | M: Stephen Hemminger <sthemmin@microsoft.com> |
| 6909 | M: Sasha Levin <sashal@kernel.org> | ||
| 6910 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git | ||
| 6909 | L: devel@linuxdriverproject.org | 6911 | L: devel@linuxdriverproject.org |
| 6910 | S: Maintained | 6912 | S: Supported |
| 6911 | F: Documentation/networking/netvsc.txt | 6913 | F: Documentation/networking/netvsc.txt |
| 6912 | F: arch/x86/include/asm/mshyperv.h | 6914 | F: arch/x86/include/asm/mshyperv.h |
| 6913 | F: arch/x86/include/asm/trace/hyperv.h | 6915 | F: arch/x86/include/asm/trace/hyperv.h |
diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 97954f575c3f..1c1a2514d6f3 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig | |||
| @@ -4,7 +4,7 @@ menu "Microsoft Hyper-V guest support" | |||
| 4 | 4 | ||
| 5 | config HYPERV | 5 | config HYPERV |
| 6 | tristate "Microsoft Hyper-V client drivers" | 6 | tristate "Microsoft Hyper-V client drivers" |
| 7 | depends on X86 && ACPI && PCI && X86_LOCAL_APIC && HYPERVISOR_GUEST | 7 | depends on X86 && ACPI && X86_LOCAL_APIC && HYPERVISOR_GUEST |
| 8 | select PARAVIRT | 8 | select PARAVIRT |
| 9 | help | 9 | help |
| 10 | Select this option to run Linux as a Hyper-V client operating | 10 | Select this option to run Linux as a Hyper-V client operating |
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 283d184280af..d0ff65675292 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
| @@ -316,6 +316,8 @@ static ssize_t out_intr_mask_show(struct device *dev, | |||
| 316 | 316 | ||
| 317 | if (!hv_dev->channel) | 317 | if (!hv_dev->channel) |
| 318 | return -ENODEV; | 318 | return -ENODEV; |
| 319 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 320 | return -EINVAL; | ||
| 319 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 321 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); |
| 320 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); | 322 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); |
| 321 | } | 323 | } |
| @@ -329,6 +331,8 @@ static ssize_t out_read_index_show(struct device *dev, | |||
| 329 | 331 | ||
| 330 | if (!hv_dev->channel) | 332 | if (!hv_dev->channel) |
| 331 | return -ENODEV; | 333 | return -ENODEV; |
| 334 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 335 | return -EINVAL; | ||
| 332 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 336 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); |
| 333 | return sprintf(buf, "%d\n", outbound.current_read_index); | 337 | return sprintf(buf, "%d\n", outbound.current_read_index); |
| 334 | } | 338 | } |
| @@ -343,6 +347,8 @@ static ssize_t out_write_index_show(struct device *dev, | |||
| 343 | 347 | ||
| 344 | if (!hv_dev->channel) | 348 | if (!hv_dev->channel) |
| 345 | return -ENODEV; | 349 | return -ENODEV; |
| 350 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 351 | return -EINVAL; | ||
| 346 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 352 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); |
| 347 | return sprintf(buf, "%d\n", outbound.current_write_index); | 353 | return sprintf(buf, "%d\n", outbound.current_write_index); |
| 348 | } | 354 | } |
| @@ -357,6 +363,8 @@ static ssize_t out_read_bytes_avail_show(struct device *dev, | |||
| 357 | 363 | ||
| 358 | if (!hv_dev->channel) | 364 | if (!hv_dev->channel) |
| 359 | return -ENODEV; | 365 | return -ENODEV; |
| 366 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 367 | return -EINVAL; | ||
| 360 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 368 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); |
| 361 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); | 369 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); |
| 362 | } | 370 | } |
| @@ -371,6 +379,8 @@ static ssize_t out_write_bytes_avail_show(struct device *dev, | |||
| 371 | 379 | ||
| 372 | if (!hv_dev->channel) | 380 | if (!hv_dev->channel) |
| 373 | return -ENODEV; | 381 | return -ENODEV; |
| 382 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 383 | return -EINVAL; | ||
| 374 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 384 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); |
| 375 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); | 385 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); |
| 376 | } | 386 | } |
| @@ -384,6 +394,8 @@ static ssize_t in_intr_mask_show(struct device *dev, | |||
| 384 | 394 | ||
| 385 | if (!hv_dev->channel) | 395 | if (!hv_dev->channel) |
| 386 | return -ENODEV; | 396 | return -ENODEV; |
| 397 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 398 | return -EINVAL; | ||
| 387 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 399 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 388 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); | 400 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); |
| 389 | } | 401 | } |
| @@ -397,6 +409,8 @@ static ssize_t in_read_index_show(struct device *dev, | |||
| 397 | 409 | ||
| 398 | if (!hv_dev->channel) | 410 | if (!hv_dev->channel) |
| 399 | return -ENODEV; | 411 | return -ENODEV; |
| 412 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 413 | return -EINVAL; | ||
| 400 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 414 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 401 | return sprintf(buf, "%d\n", inbound.current_read_index); | 415 | return sprintf(buf, "%d\n", inbound.current_read_index); |
| 402 | } | 416 | } |
| @@ -410,6 +424,8 @@ static ssize_t in_write_index_show(struct device *dev, | |||
| 410 | 424 | ||
| 411 | if (!hv_dev->channel) | 425 | if (!hv_dev->channel) |
| 412 | return -ENODEV; | 426 | return -ENODEV; |
| 427 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 428 | return -EINVAL; | ||
| 413 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 429 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 414 | return sprintf(buf, "%d\n", inbound.current_write_index); | 430 | return sprintf(buf, "%d\n", inbound.current_write_index); |
| 415 | } | 431 | } |
| @@ -424,6 +440,8 @@ static ssize_t in_read_bytes_avail_show(struct device *dev, | |||
| 424 | 440 | ||
| 425 | if (!hv_dev->channel) | 441 | if (!hv_dev->channel) |
| 426 | return -ENODEV; | 442 | return -ENODEV; |
| 443 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 444 | return -EINVAL; | ||
| 427 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 445 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 428 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); | 446 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); |
| 429 | } | 447 | } |
| @@ -438,6 +456,8 @@ static ssize_t in_write_bytes_avail_show(struct device *dev, | |||
| 438 | 456 | ||
| 439 | if (!hv_dev->channel) | 457 | if (!hv_dev->channel) |
| 440 | return -ENODEV; | 458 | return -ENODEV; |
| 459 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | ||
| 460 | return -EINVAL; | ||
| 441 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 461 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 442 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); | 462 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); |
| 443 | } | 463 | } |
diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index c2493d011225..3c5169eb23f5 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c | |||
| @@ -204,9 +204,11 @@ hv_uio_open(struct uio_info *info, struct inode *inode) | |||
| 204 | if (atomic_inc_return(&pdata->refcnt) != 1) | 204 | if (atomic_inc_return(&pdata->refcnt) != 1) |
| 205 | return 0; | 205 | return 0; |
| 206 | 206 | ||
| 207 | vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind); | ||
| 208 | vmbus_set_sc_create_callback(dev->channel, hv_uio_new_channel); | ||
| 209 | |||
| 207 | ret = vmbus_connect_ring(dev->channel, | 210 | ret = vmbus_connect_ring(dev->channel, |
| 208 | hv_uio_channel_cb, dev->channel); | 211 | hv_uio_channel_cb, dev->channel); |
| 209 | |||
| 210 | if (ret == 0) | 212 | if (ret == 0) |
| 211 | dev->channel->inbound.ring_buffer->interrupt_mask = 1; | 213 | dev->channel->inbound.ring_buffer->interrupt_mask = 1; |
| 212 | else | 214 | else |
| @@ -334,9 +336,6 @@ hv_uio_probe(struct hv_device *dev, | |||
| 334 | goto fail_close; | 336 | goto fail_close; |
| 335 | } | 337 | } |
| 336 | 338 | ||
| 337 | vmbus_set_chn_rescind_callback(channel, hv_uio_rescind); | ||
| 338 | vmbus_set_sc_create_callback(channel, hv_uio_new_channel); | ||
| 339 | |||
| 340 | ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr); | 339 | ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr); |
| 341 | if (ret) | 340 | if (ret) |
| 342 | dev_notice(&dev->device, | 341 | dev_notice(&dev->device, |
