aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/kvm/kvm_virtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/kvm/kvm_virtio.c')
-rw-r--r--drivers/s390/kvm/kvm_virtio.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 643129070c51..dd65c8b4c7fe 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -80,7 +80,7 @@ static unsigned desc_size(const struct kvm_device_desc *desc)
80} 80}
81 81
82/* This gets the device's feature bits. */ 82/* This gets the device's feature bits. */
83static u32 kvm_get_features(struct virtio_device *vdev) 83static u64 kvm_get_features(struct virtio_device *vdev)
84{ 84{
85 unsigned int i; 85 unsigned int i;
86 u32 features = 0; 86 u32 features = 0;
@@ -93,7 +93,7 @@ static u32 kvm_get_features(struct virtio_device *vdev)
93 return features; 93 return features;
94} 94}
95 95
96static void kvm_finalize_features(struct virtio_device *vdev) 96static int kvm_finalize_features(struct virtio_device *vdev)
97{ 97{
98 unsigned int i, bits; 98 unsigned int i, bits;
99 struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; 99 struct kvm_device_desc *desc = to_kvmdev(vdev)->desc;
@@ -103,12 +103,17 @@ static void kvm_finalize_features(struct virtio_device *vdev)
103 /* Give virtio_ring a chance to accept features. */ 103 /* Give virtio_ring a chance to accept features. */
104 vring_transport_features(vdev); 104 vring_transport_features(vdev);
105 105
106 /* Make sure we don't have any features > 32 bits! */
107 BUG_ON((u32)vdev->features != vdev->features);
108
106 memset(out_features, 0, desc->feature_len); 109 memset(out_features, 0, desc->feature_len);
107 bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; 110 bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8;
108 for (i = 0; i < bits; i++) { 111 for (i = 0; i < bits; i++) {
109 if (test_bit(i, vdev->features)) 112 if (__virtio_test_bit(vdev, i))
110 out_features[i / 8] |= (1 << (i % 8)); 113 out_features[i / 8] |= (1 << (i % 8));
111 } 114 }
115
116 return 0;
112} 117}
113 118
114/* 119/*