Skip to content

Commit

Permalink
virtio: Formally reserve bits 28-31 to be 'transport' features.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell committed Jul 25, 2008
1 parent faeba83 commit dd7c7bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/virtio/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions include/linux/virtio_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dd7c7bc

Please sign in to comment.