qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Jason Wang <jasowang@redhat.com>, Cindy Lu <lulu@redhat.com>
Subject: [PATCH 1/2] vhost-vdpa: define and use default value for vhostdev
Date: Thu,  3 Sep 2020 20:53:26 +0200	[thread overview]
Message-ID: <20200903185327.774708-2-lvivier@redhat.com> (raw)
In-Reply-To: <20200903185327.774708-1-lvivier@redhat.com>

vhostdev is defined as optional in net.json, and if not set
/dev/vhost-vdpa-0 should be used.

The default value is not set and if vhostdev is not provided
QEMU crashes with a SIGSEGV exception.

Fixes: 1e0a84ea49b6 ("vhost-vdpa: introduce vhost-vdpa net client")
Cc: lulu@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 net/vhost-vdpa.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index bc0e0d2d35b7..24103ef241e4 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -24,6 +24,9 @@
 #include "monitor/monitor.h"
 #include "hw/virtio/vhost.h"
 
+/* default vhostdev as defined in qapi/net.json */
+#define VHOST_VDPA_DEFAULT_VHOSTDEV "/dev/vhost-vdpa-0"
+
 /* Todo:need to add the multiqueue support here */
 typedef struct VhostVDPAState {
     NetClientState nc;
@@ -224,5 +227,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
                           (char *)name, errp)) {
         return -1;
     }
-    return net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, opts->vhostdev);
+    return net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name,
+                               opts->has_vhostdev ?
+                               opts->vhostdev : VHOST_VDPA_DEFAULT_VHOSTDEV);
 }
-- 
2.26.2



  reply	other threads:[~2020-09-03 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 18:53 [PATCH 0/2] vhost-vdpa: improve parameters error management Laurent Vivier
2020-09-03 18:53 ` Laurent Vivier [this message]
2020-09-09  1:50   ` [PATCH 1/2] vhost-vdpa: define and use default value for vhostdev Jason Wang
2020-09-03 18:53 ` [PATCH 2/2] vhost-vdpa: improve error reporting Laurent Vivier
2020-09-04 13:41   ` Philippe Mathieu-Daudé
2020-09-09  1:53   ` Jason Wang
2020-09-09  8:45     ` Laurent Vivier
2020-09-04 13:24 ` [PATCH 0/2] vhost-vdpa: improve parameters error management no-reply
2020-09-04 13:28 ` no-reply

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=20200903185327.774708-2-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lulu@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).