virtio: Formally reserve bits 28-31 to be 'transport' features.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 25 Jul 2008 17:06:07 +0000 (12:06 -0500)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 25 Jul 2008 02:06:07 +0000 (12:06 +1000)
We assign feature bits as required, but it makes sense to reserve some
for the particular transport, rather than the particular device.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio.c
include/linux/virtio_config.h

index fc85cba6457831430b76a4f8e1059f35c8c3e325..baf103361e3a2053f255f7f7782f955bd4883320 100644 (file)
@@ -113,6 +113,11 @@ static int virtio_dev_probe(struct device *_d)
                        set_bit(f, dev->features);
        }
 
+       /* Transport features are always preserved to pass to set_features. */
+       for (i = VIRTIO_TRANSPORT_F_START; i < VIRTIO_TRANSPORT_F_END; i++)
+               if (device_features & (1 << i))
+                       set_bit(i, dev->features);
+
        err = drv->probe(dev);
        if (err)
                add_status(dev, VIRTIO_CONFIG_S_FAILED);
index 7eb4b34d13bb719e6e44f1225f721830dd5b7d56..5a30cfb7934b3fb02caefe7cdf988d3ec6df0953 100644 (file)
 /* We've given up on this device. */
 #define VIRTIO_CONFIG_S_FAILED         0x80
 
+/* Some virtio feature bits (currently bits 28 through 31) are reserved for the
+ * transport being used (eg. virtio_ring), the rest are per-device feature
+ * bits. */
+#define VIRTIO_TRANSPORT_F_START       28
+#define VIRTIO_TRANSPORT_F_END         32
+
 /* Do we get callbacks when the ring is completely used, even if we've
  * suppressed them? */
 #define VIRTIO_F_NOTIFY_ON_EMPTY       24