diff options
-rw-r--r-- | drivers/lguest/lguest_device.c | 3 | ||||
-rw-r--r-- | drivers/s390/kvm/kvm_virtio.c | 3 | ||||
-rw-r--r-- | drivers/virtio/virtio_pci.c | 3 | ||||
-rw-r--r-- | drivers/virtio/virtio_ring.c | 16 | ||||
-rw-r--r-- | include/linux/virtio_ring.h | 2 |
5 files changed, 27 insertions, 0 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 54fdc2aa4806..37344aaee22f 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -105,6 +105,9 @@ static void lg_finalize_features(struct virtio_device *vdev) | |||
105 | /* Second half of bitmap is features we accept. */ | 105 | /* Second half of bitmap is features we accept. */ |
106 | u8 *out_features = lg_features(desc) + desc->feature_len; | 106 | u8 *out_features = lg_features(desc) + desc->feature_len; |
107 | 107 | ||
108 | /* Give virtio_ring a chance to accept features. */ | ||
109 | vring_transport_features(vdev); | ||
110 | |||
108 | memset(out_features, 0, desc->feature_len); | 111 | memset(out_features, 0, desc->feature_len); |
109 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; | 112 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; |
110 | for (i = 0; i < bits; i++) { | 113 | for (i = 0; i < bits; i++) { |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 5953510e7d5f..79954bd6bfa5 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -95,6 +95,9 @@ static void kvm_finalize_features(struct virtio_device *vdev) | |||
95 | /* Second half of bitmap is features we accept. */ | 95 | /* Second half of bitmap is features we accept. */ |
96 | u8 *out_features = kvm_vq_features(desc) + desc->feature_len; | 96 | u8 *out_features = kvm_vq_features(desc) + desc->feature_len; |
97 | 97 | ||
98 | /* Give virtio_ring a chance to accept features. */ | ||
99 | vring_transport_features(vdev); | ||
100 | |||
98 | memset(out_features, 0, desc->feature_len); | 101 | memset(out_features, 0, desc->feature_len); |
99 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; | 102 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; |
100 | for (i = 0; i < bits; i++) { | 103 | for (i = 0; i < bits; i++) { |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 9855975a72a3..c7dc37c7cce9 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -99,6 +99,9 @@ static void vp_finalize_features(struct virtio_device *vdev) | |||
99 | { | 99 | { |
100 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | 100 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
101 | 101 | ||
102 | /* Give virtio_ring a chance to accept features. */ | ||
103 | vring_transport_features(vdev); | ||
104 | |||
102 | /* We only support 32 feature bits. */ | 105 | /* We only support 32 feature bits. */ |
103 | BUILD_BUG_ON(ARRAY_SIZE(vdev->features) != 1); | 106 | BUILD_BUG_ON(ARRAY_SIZE(vdev->features) != 1); |
104 | iowrite32(vdev->features[0], vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES); | 107 | iowrite32(vdev->features[0], vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES); |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 21d9a62767af..6eb5303fed11 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #include <linux/virtio.h> | 19 | #include <linux/virtio.h> |
20 | #include <linux/virtio_ring.h> | 20 | #include <linux/virtio_ring.h> |
21 | #include <linux/virtio_config.h> | ||
21 | #include <linux/device.h> | 22 | #include <linux/device.h> |
22 | 23 | ||
23 | #ifdef DEBUG | 24 | #ifdef DEBUG |
@@ -323,4 +324,19 @@ void vring_del_virtqueue(struct virtqueue *vq) | |||
323 | } | 324 | } |
324 | EXPORT_SYMBOL_GPL(vring_del_virtqueue); | 325 | EXPORT_SYMBOL_GPL(vring_del_virtqueue); |
325 | 326 | ||
327 | /* Manipulates transport-specific feature bits. */ | ||
328 | void vring_transport_features(struct virtio_device *vdev) | ||
329 | { | ||
330 | unsigned int i; | ||
331 | |||
332 | for (i = VIRTIO_TRANSPORT_F_START; i < VIRTIO_TRANSPORT_F_END; i++) { | ||
333 | switch (i) { | ||
334 | default: | ||
335 | /* We don't understand this bit. */ | ||
336 | clear_bit(i, vdev->features); | ||
337 | } | ||
338 | } | ||
339 | } | ||
340 | EXPORT_SYMBOL_GPL(vring_transport_features); | ||
341 | |||
326 | MODULE_LICENSE("GPL"); | 342 | MODULE_LICENSE("GPL"); |
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index abe481ed990e..c4a598fb3826 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -120,6 +120,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
120 | void (*notify)(struct virtqueue *vq), | 120 | void (*notify)(struct virtqueue *vq), |
121 | void (*callback)(struct virtqueue *vq)); | 121 | void (*callback)(struct virtqueue *vq)); |
122 | void vring_del_virtqueue(struct virtqueue *vq); | 122 | void vring_del_virtqueue(struct virtqueue *vq); |
123 | /* Filter out transport-specific feature bits. */ | ||
124 | void vring_transport_features(struct virtio_device *vdev); | ||
123 | 125 | ||
124 | irqreturn_t vring_interrupt(int irq, void *_vq); | 126 | irqreturn_t vring_interrupt(int irq, void *_vq); |
125 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |