qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Hawkins Jiawei <yin31149@gmail.com>,
	si-wei.liu@oracle.com, Jason Wang <jasowang@redhat.com>,
	Lei Yang <leiyang@redhat.com>
Subject: [PATCH 3/3] vdpa net: follow VirtIO initialization properly at cvq isolation probing
Date: Fri, 15 Sep 2023 19:03:22 +0200	[thread overview]
Message-ID: <20230915170322.3076956-4-eperezma@redhat.com> (raw)
In-Reply-To: <20230915170322.3076956-1-eperezma@redhat.com>

This patch solves a few issues.  The most obvious is that the feature
set was done previous to ACKNOWLEDGE | DRIVER status bit set.  Current
vdpa devices are permissive with this, but it is better to follow the
standard.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 net/vhost-vdpa.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 51d8144070..4b30325977 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -1270,8 +1270,7 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features,
     uint64_t backend_features;
     int64_t cvq_group;
     uint8_t status = VIRTIO_CONFIG_S_ACKNOWLEDGE |
-                     VIRTIO_CONFIG_S_DRIVER |
-                     VIRTIO_CONFIG_S_FEATURES_OK;
+                     VIRTIO_CONFIG_S_DRIVER;
     int r;
 
     ERRP_GUARD();
@@ -1286,15 +1285,22 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features,
         return 0;
     }
 
+    r = ioctl(device_fd, VHOST_VDPA_SET_STATUS, &status);
+    if (unlikely(r)) {
+        error_setg_errno(errp, -r, "Cannot set device status");
+        goto out;
+    }
+
     r = ioctl(device_fd, VHOST_SET_FEATURES, &features);
     if (unlikely(r)) {
-        error_setg_errno(errp, errno, "Cannot set features");
+        error_setg_errno(errp, -r, "Cannot set features");
         goto out;
     }
 
+    status |= VIRTIO_CONFIG_S_FEATURES_OK;
     r = ioctl(device_fd, VHOST_VDPA_SET_STATUS, &status);
     if (unlikely(r)) {
-        error_setg_errno(errp, -r, "Cannot set status");
+        error_setg_errno(errp, -r, "Cannot set device status");
         goto out;
     }
 
-- 
2.39.3



  parent reply	other threads:[~2023-09-15 17:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 17:03 [PATCH 0/3] Follow VirtIO initialization properly at vdpa net cvq isolation probing Eugenio Pérez
2023-09-15 17:03 ` [PATCH 1/3] vdpa net: fix error message setting virtio status Eugenio Pérez
2023-09-15 17:05   ` Philippe Mathieu-Daudé
2023-09-18  8:55   ` Jason Wang
2023-09-15 17:03 ` [PATCH 2/3] vdpa net: stop probing if cannot set features Eugenio Pérez
2023-09-15 17:07   ` Philippe Mathieu-Daudé
2023-09-18  8:55   ` Jason Wang
2023-09-15 17:03 ` Eugenio Pérez [this message]
2023-09-18  8:56   ` [PATCH 3/3] vdpa net: follow VirtIO initialization properly at cvq isolation probing Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230915170322.3076956-4-eperezma@redhat.com \
    --to=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=leiyang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=si-wei.liu@oracle.com \
    --cc=yin31149@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).