virtio: support VIRTIO_F_IO_BARRIER
PATCH 1/1 virtio: support VIRTIO_F_IO_BARRIER
This patch introduces the support for VIRTIO_F_IO_BARRIER. When this feature is negotiated, driver will use the barriers suitable for hardware devices.
---
This patch depends on below proposal for virtio-spec:
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00019.html
This patch also depends on below patch:
https://lkml.org/lkml/2018/4/19/789
RFC -> v1:
- Address the changes in the proposal;
drivers/virtio/virtio_ring.c | 5 +++++ include/uapi/linux/virtio_config.h | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +5 -0
@@ -996,6 +996,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, !context; vq->event =virtio_has_feature (vdev,VIRTIO_RING_F_EVENT_IDX ); +if (virtio_has_feature (vdev,VIRTIO_F_IO_BARRIER )) + vq->weak_barriers = false; +/* No callback? Tell other side not to bother us. */ if (!callback) { vq->avail_flags_shadow |=VRING_AVAIL_F_NO_INTERRUPT ;
@@ -1164,6 +1167,8 @@ void vring_transport_features(struct virtio_device *vdev)break ;case VIRTIO_F_IOMMU_PLATFORM :break ; +case VIRTIO_F_IO_BARRIER : +break ;default :/* We don't understand this bit. */ __virtio_clear_bit (vdev, i);
include/uapi/linux/virtio_config.h +7 -1
@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've
@@ -71,4 +71,10 @@* this is for compatibility with legacy systems. */ #define VIRTIO_F_IOMMU_PLATFORM 33 + +/* +* If clear - driver may use barriers suitable for CPU cores. +* If set - driver must use barriers suitable for hardware devices. +*/ +#define VIRTIO_F_IO_BARRIER 36#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
Signature · 1 line
2.11.0
include/uapi/linux/virtio_config.h line 52
Quoted 10 lines · Tiwei Bie
include/uapi/linux/virtio_config.h +1
-1@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37
Have you updated "2.2 Feature Bits" in the VIRTIO spec?
In 1.0 it says:
24 to 32
Feature bits reserved for extensions to the queue and feature negotiation mechanisms
This information is out-of-date.
Stefan
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 14 lines · Stefan Hajnoczi
include/uapi/linux/virtio_config.h line 52
Quoted 10 lines · Tiwei Bie
include/uapi/linux/virtio_config.h +1
-1@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37Have you updated "2.2 Feature Bits" in the VIRTIO spec?
Quoted 7 lines
In 1.0 it says:
24 to 32
Feature bits reserved for extensions to the queue and feature negotiation mechanismsThis information is out-of-date.
No. In the latest spec draft, it's 24 to 33. And it becomes out-of-date since VIRTIO_F_RING_PACKED(34) and VIRTIO_F_IN_ORDER(35) were introduced. Do you want me to update it in the IO_BARRIER patch or do you want me to update it in a new patch?
Best regards,
Tiwei Bie
Quoted 20 lines · Tiwei Bie
Quoted 19 lines · Stefan Hajnoczi
include/uapi/linux/virtio_config.h line 52
Quoted 10 lines · Tiwei Bie
include/uapi/linux/virtio_config.h +1
-1@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37Have you updated "2.2 Feature Bits" in the VIRTIO spec?
In 1.0 it says:
24 to 32
Feature bits reserved for extensions to the queue and feature negotiation mechanisms
Quoted 8 lines
Quoted 2 lines
This information is out-of-date.
No. In the latest spec draft, it's 24 to 33. And it becomes out-of-date since
VIRTIO_F_RING_PACKED(34)andVIRTIO_F_IN_ORDER(35)were introduced. Do you want me to update it in theIO_BARRIERpatch or do you want me to update it in a new patch?
Please update it to 37 in the IO_BARRIER patch.
Stefan
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 20 lines · Tiwei Bie
Quoted 19 lines · Stefan Hajnoczi
include/uapi/linux/virtio_config.h line 52
Quoted 10 lines · Tiwei Bie
include/uapi/linux/virtio_config.h +1
-1@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37Have you updated "2.2 Feature Bits" in the VIRTIO spec?
In 1.0 it says:
24 to 32
Feature bits reserved for extensions to the queue and feature negotiation mechanisms
Quoted 8 lines
Quoted 2 lines
This information is out-of-date.
No. In the latest spec draft, it's 24 to 33. And it becomes out-of-date since
VIRTIO_F_RING_PACKED(34)andVIRTIO_F_IN_ORDER(35)were introduced. Do you want me to update it in theIO_BARRIERpatch or do you want me to update it in a new patch?
Please update it to 37 in the IO_BARRIER patch.
Stefan
Quoted 24 lines · Stefan Hajnoczi
Quoted 23 lines · Tiwei Bie
Quoted 21 lines · Stefan Hajnoczi
include/uapi/linux/virtio_config.h line 52
Quoted 10 lines · Tiwei Bie
include/uapi/linux/virtio_config.h +1
-1@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37Have you updated "2.2 Feature Bits" in the VIRTIO spec?
In 1.0 it says:
24 to 32
Feature bits reserved for extensions to the queue and feature negotiation mechanismsThis information is out-of-date.
Quoted 7 lines
Quoted 5 lines
No. In the latest spec draft, it's 24 to 33. And it becomes out-of-date since
VIRTIO_F_RING_PACKED(34)andVIRTIO_F_IN_ORDER(35)were introduced. Do you want me to update it in theIO_BARRIERpatch or do you want me to update it in a new patch?Please update it to 37 in the
IO_BARRIERpatch.
Will do it! Thanks!
Best regards,
Tiwei Bie
Quoted 14 lines · Stefan Hajnoczi
include/uapi/linux/virtio_config.h line 52
Quoted 10 lines · Tiwei Bie
include/uapi/linux/virtio_config.h +1
-1@@ -49,7 +49,7 @@* transport being used (eg. virtio_ring), the rest are per-device feature * bits. */ #define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 34 +#define VIRTIO_TRANSPORT_F_END 37Have you updated "2.2 Feature Bits" in the VIRTIO spec?
Quoted 7 lines
In 1.0 it says:
24 to 32
Feature bits reserved for extensions to the queue and feature negotiation mechanismsThis information is out-of-date.
No. In the latest spec draft, it's 24 to 33. And it becomes out-of-date since VIRTIO_F_RING_PACKED(34) and VIRTIO_F_IN_ORDER(35) were introduced. Do you want me to update it in the IO_BARRIER patch or do you want me to update it in a new patch?
Best regards,
Tiwei Bie