virtio: Formally reserve bits 28-31 to be 'transport' features.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, July 25, 2008 - 11:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd7c7b...
Commit:     dd7c7bc46211785a1aa7d70feb15830f62682b3c
Parent:     faeba830b086bc9e58748869054e994cb09693cd
Author:     Rusty Russell <rusty@rustcorp.com.au>
AuthorDate: Fri Jul 25 12:06:07 2008 -0500
Committer:  Rusty Russell <rusty@rustcorp.com.au>
CommitDate: Fri Jul 25 12:06:07 2008 +1000

    virtio: Formally reserve bits 28-31 to be 'transport' features.
    
    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       |    5 +++++
 include/linux/virtio_config.h |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index fc85cba..baf1033 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -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);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7eb4b34..5a30cfb 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -18,6 +18,12 @@
 /* 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
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
virtio: Formally reserve bits 28-31 to be 'transport' feat ..., Linux Kernel Mailing ..., (Fri Jul 25, 11:59 am)