aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-02-07 03:05:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-02-07 03:05:28 -0500
commitb0314565da2b95e73feab484467ad171fcce6dff (patch)
treea2e4d0d2f8c51db2b85bf0fc84299db525aff42c
parent4879f11615d29d7b91cd5a4cfbff8e563ada991d (diff)
parent9c0644ee4aa8792f1e60a2b014b4710faaddafeb (diff)
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio fixes from Michael Tsirkin: "A small fix for a uapi header, and a fix for VDPA for non-x86 guests" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio: drop internal struct from UAPI virtio: support VIRTIO_F_ORDER_PLATFORM
-rw-r--r--drivers/virtio/virtio_ring.c15
-rw-r--r--include/uapi/linux/virtio_config.h6
-rw-r--r--include/uapi/linux/virtio_ring.h10
3 files changed, 20 insertions, 11 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index cd7e755484e3..a0b07c331255 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -152,7 +152,12 @@ struct vring_virtqueue {
152 /* Available for packed ring */ 152 /* Available for packed ring */
153 struct { 153 struct {
154 /* Actual memory layout for this queue. */ 154 /* Actual memory layout for this queue. */
155 struct vring_packed vring; 155 struct {
156 unsigned int num;
157 struct vring_packed_desc *desc;
158 struct vring_packed_desc_event *driver;
159 struct vring_packed_desc_event *device;
160 } vring;
156 161
157 /* Driver ring wrap counter. */ 162 /* Driver ring wrap counter. */
158 bool avail_wrap_counter; 163 bool avail_wrap_counter;
@@ -1609,6 +1614,9 @@ static struct virtqueue *vring_create_virtqueue_packed(
1609 !context; 1614 !context;
1610 vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); 1615 vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX);
1611 1616
1617 if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM))
1618 vq->weak_barriers = false;
1619
1612 vq->packed.ring_dma_addr = ring_dma_addr; 1620 vq->packed.ring_dma_addr = ring_dma_addr;
1613 vq->packed.driver_event_dma_addr = driver_event_dma_addr; 1621 vq->packed.driver_event_dma_addr = driver_event_dma_addr;
1614 vq->packed.device_event_dma_addr = device_event_dma_addr; 1622 vq->packed.device_event_dma_addr = device_event_dma_addr;
@@ -2079,6 +2087,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index,
2079 !context; 2087 !context;
2080 vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); 2088 vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX);
2081 2089
2090 if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM))
2091 vq->weak_barriers = false;
2092
2082 vq->split.queue_dma_addr = 0; 2093 vq->split.queue_dma_addr = 0;
2083 vq->split.queue_size_in_bytes = 0; 2094 vq->split.queue_size_in_bytes = 0;
2084 2095
@@ -2213,6 +2224,8 @@ void vring_transport_features(struct virtio_device *vdev)
2213 break; 2224 break;
2214 case VIRTIO_F_RING_PACKED: 2225 case VIRTIO_F_RING_PACKED:
2215 break; 2226 break;
2227 case VIRTIO_F_ORDER_PLATFORM:
2228 break;
2216 default: 2229 default:
2217 /* We don't understand this bit. */ 2230 /* We don't understand this bit. */
2218 __virtio_clear_bit(vdev, i); 2231 __virtio_clear_bit(vdev, i);
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 1196e1c1d4f6..ff8e7dc9d4dd 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -79,6 +79,12 @@
79#define VIRTIO_F_RING_PACKED 34 79#define VIRTIO_F_RING_PACKED 34
80 80
81/* 81/*
82 * This feature indicates that memory accesses by the driver and the
83 * device are ordered in a way described by the platform.
84 */
85#define VIRTIO_F_ORDER_PLATFORM 36
86
87/*
82 * Does the device support Single Root I/O Virtualization? 88 * Does the device support Single Root I/O Virtualization?
83 */ 89 */
84#define VIRTIO_F_SR_IOV 37 90#define VIRTIO_F_SR_IOV 37
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 2414f8af26b3..4c4e24c291a5 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -213,14 +213,4 @@ struct vring_packed_desc {
213 __le16 flags; 213 __le16 flags;
214}; 214};
215 215
216struct vring_packed {
217 unsigned int num;
218
219 struct vring_packed_desc *desc;
220
221 struct vring_packed_desc_event *driver;
222
223 struct vring_packed_desc_event *device;
224};
225
226#endif /* _UAPI_LINUX_VIRTIO_RING_H */ 216#endif /* _UAPI_LINUX_VIRTIO_RING_H */