virtio: add support for 64 bit features.

Change u32 to u64, and use BIT_ULL and 1ULL everywhere.

Note: transports are unchanged, and only set low 32 bit.
This guarantees that no transport sets e.g. VERSION_1
by mistake without proper support.

Based on patch by Rusty.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
Michael S. Tsirkin
2014-10-07 16:39:43 +02:00
parent 0ffaeadfc4
commit d025477368
11 changed files with 23 additions and 23 deletions

View File

@@ -66,7 +66,7 @@ struct virtio_config_ops {
vq_callback_t *callbacks[],
const char *names[]);
void (*del_vqs)(struct virtio_device *);
u32 (*get_features)(struct virtio_device *vdev);
u64 (*get_features)(struct virtio_device *vdev);
void (*finalize_features)(struct virtio_device *vdev);
const char *(*bus_name)(struct virtio_device *vdev);
int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
@@ -88,11 +88,11 @@ static inline bool __virtio_test_bit(const struct virtio_device *vdev,
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
BUILD_BUG_ON(fbit >= 32);
BUILD_BUG_ON(fbit >= 64);
else
BUG_ON(fbit >= 32);
BUG_ON(fbit >= 64);
return vdev->features & BIT(fbit);
return vdev->features & BIT_ULL(fbit);
}
/**
@@ -105,11 +105,11 @@ static inline void __virtio_set_bit(struct virtio_device *vdev,
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
BUILD_BUG_ON(fbit >= 32);
BUILD_BUG_ON(fbit >= 64);
else
BUG_ON(fbit >= 32);
BUG_ON(fbit >= 64);
vdev->features |= BIT(fbit);
vdev->features |= BIT_ULL(fbit);
}
/**
@@ -122,11 +122,11 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev,
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
BUILD_BUG_ON(fbit >= 32);
BUILD_BUG_ON(fbit >= 64);
else
BUG_ON(fbit >= 32);
BUG_ON(fbit >= 64);
vdev->features &= ~BIT(fbit);
vdev->features &= ~BIT_ULL(fbit);
}
/**