OSDN Git Service

uio_hv_generic: check that host supports monitor page
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 9 Jan 2018 20:57:31 +0000 (12:57 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jan 2018 16:40:53 +0000 (17:40 +0100)
In order for userspace application to signal host, it needs the
host to support the monitor page property. Check for the flag
and fail if this is not supported.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_hv_generic.c

index dcd80aa..ee6d862 100644 (file)
@@ -133,6 +133,13 @@ hv_uio_probe(struct hv_device *dev,
        if (ret)
                goto fail;
 
+       /* Communicating with host has to be via shared memory not hypercall */
+       if (!dev->channel->offermsg.monitor_allocated) {
+               dev_err(&dev->device, "vmbus channel requires hypercall\n");
+               ret = -ENOTSUPP;
+               goto fail_close;
+       }
+
        dev->channel->inbound.ring_buffer->interrupt_mask = 1;
        set_channel_read_mode(dev->channel, HV_CALL_ISR);