diff mbox series

[v3,06/16] libqos: add missing virtio-9p feature negotiation

Message ID 20191019063810.6944-7-stefanha@redhat.com (mailing list archive)
State New, archived
Headers show
Series libqos: add VIRTIO PCI 1.0 support | expand

Commit Message

Stefan Hajnoczi Oct. 19, 2019, 6:38 a.m. UTC
VIRTIO Device Initialization requires feature negotiation.  The libqos
virtio-9p driver lacks feature negotiation and is therefore
non-compliant.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/libqos/virtio-9p.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Thomas Huth Oct. 21, 2019, 12:14 p.m. UTC | #1
On 19/10/2019 08.38, Stefan Hajnoczi wrote:
> VIRTIO Device Initialization requires feature negotiation.  The libqos
> virtio-9p driver lacks feature negotiation and is therefore
> non-compliant.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  tests/libqos/virtio-9p.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/libqos/virtio-9p.c b/tests/libqos/virtio-9p.c
> index 8c9efce3e1..77dbfb62ad 100644
> --- a/tests/libqos/virtio-9p.c
> +++ b/tests/libqos/virtio-9p.c
> @@ -32,6 +32,12 @@ static void virtio_9p_cleanup(QVirtio9P *interface)
>  
>  static void virtio_9p_setup(QVirtio9P *interface)
>  {
> +    uint64_t features;
> +
> +    features = qvirtio_get_features(interface->vdev);
> +    features &= ~(QVIRTIO_F_BAD_FEATURE | (1ull << VIRTIO_RING_F_EVENT_IDX));
> +    qvirtio_set_features(interface->vdev, features);

Same question as with patch 4: Why just disabling these two bits and not
rather set the bits we know about?

 Thomas
diff mbox series

Patch

diff --git a/tests/libqos/virtio-9p.c b/tests/libqos/virtio-9p.c
index 8c9efce3e1..77dbfb62ad 100644
--- a/tests/libqos/virtio-9p.c
+++ b/tests/libqos/virtio-9p.c
@@ -32,6 +32,12 @@  static void virtio_9p_cleanup(QVirtio9P *interface)
 
 static void virtio_9p_setup(QVirtio9P *interface)
 {
+    uint64_t features;
+
+    features = qvirtio_get_features(interface->vdev);
+    features &= ~(QVIRTIO_F_BAD_FEATURE | (1ull << VIRTIO_RING_F_EVENT_IDX));
+    qvirtio_set_features(interface->vdev, features);
+
     interface->vq = qvirtqueue_setup(interface->vdev, alloc, 0);
     qvirtio_set_driver_ok(interface->vdev);
 }