Skip to content

Commit b031456

Browse files
committed
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
2 parents 4879f11 + 9c0644e commit b031456

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

drivers/virtio/virtio_ring.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ struct vring_virtqueue {
152152
/* Available for packed ring */
153153
struct {
154154
/* 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;
156161

157162
/* Driver ring wrap counter. */
158163
bool avail_wrap_counter;
@@ -1609,6 +1614,9 @@ static struct virtqueue *vring_create_virtqueue_packed(
16091614
!context;
16101615
vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX);
16111616

1617+
if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM))
1618+
vq->weak_barriers = false;
1619+
16121620
vq->packed.ring_dma_addr = ring_dma_addr;
16131621
vq->packed.driver_event_dma_addr = driver_event_dma_addr;
16141622
vq->packed.device_event_dma_addr = device_event_dma_addr;
@@ -2079,6 +2087,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index,
20792087
!context;
20802088
vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX);
20812089

2090+
if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM))
2091+
vq->weak_barriers = false;
2092+
20822093
vq->split.queue_dma_addr = 0;
20832094
vq->split.queue_size_in_bytes = 0;
20842095

@@ -2213,6 +2224,8 @@ void vring_transport_features(struct virtio_device *vdev)
22132224
break;
22142225
case VIRTIO_F_RING_PACKED:
22152226
break;
2227+
case VIRTIO_F_ORDER_PLATFORM:
2228+
break;
22162229
default:
22172230
/* We don't understand this bit. */
22182231
__virtio_clear_bit(vdev, i);

include/uapi/linux/virtio_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
/* This feature indicates support for the packed virtqueue layout. */
7979
#define VIRTIO_F_RING_PACKED 34
8080

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+
8187
/*
8288
* Does the device support Single Root I/O Virtualization?
8389
*/

include/uapi/linux/virtio_ring.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,4 @@ struct vring_packed_desc {
213213
__le16 flags;
214214
};
215215

216-
struct 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-
226216
#endif /* _UAPI_LINUX_VIRTIO_RING_H */

0 commit comments

Comments
 (0)