Commit 8216e7e3 authored by Vincent Whitchurch's avatar Vincent Whitchurch Committed by Greg Kroah-Hartman

vop: Fix handling of >32 feature bits

This is needed, for example, for VIRTIO_F_IOMMU_PLATFORM.
Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 417406f2
...@@ -117,7 +117,7 @@ _vop_total_desc_size(struct mic_device_desc __iomem *desc) ...@@ -117,7 +117,7 @@ _vop_total_desc_size(struct mic_device_desc __iomem *desc)
static u64 vop_get_features(struct virtio_device *vdev) static u64 vop_get_features(struct virtio_device *vdev)
{ {
unsigned int i, bits; unsigned int i, bits;
u32 features = 0; u64 features = 0;
struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc; struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc;
u8 __iomem *in_features = _vop_vq_features(desc); u8 __iomem *in_features = _vop_vq_features(desc);
int feature_len = ioread8(&desc->feature_len); int feature_len = ioread8(&desc->feature_len);
...@@ -125,7 +125,7 @@ static u64 vop_get_features(struct virtio_device *vdev) ...@@ -125,7 +125,7 @@ static u64 vop_get_features(struct virtio_device *vdev)
bits = min_t(unsigned, feature_len, sizeof(vdev->features)) * 8; bits = min_t(unsigned, feature_len, sizeof(vdev->features)) * 8;
for (i = 0; i < bits; i++) for (i = 0; i < bits; i++)
if (ioread8(&in_features[i / 8]) & (BIT(i % 8))) if (ioread8(&in_features[i / 8]) & (BIT(i % 8)))
features |= BIT(i); features |= BIT_ULL(i);
return features; return features;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment