* [PATCH 0/2] vdpa: Check for existence of opts.vhostdev
@ 2021-11-12 19:34 Eugenio Pérez
2021-11-12 19:34 ` [PATCH 1/2] vdpa: Replace qemu_open_old by qemu_open at Eugenio Pérez
2021-11-12 19:34 ` [PATCH 2/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
0 siblings, 2 replies; 5+ messages in thread
From: Eugenio Pérez @ 2021-11-12 19:34 UTC (permalink / raw)
To: qemu-trivial, qemu-devel
Cc: Laurent Vivier, Jason Wang, Cindy Lu, Michael S . Tsirkin
Since net_init_vhost_vdpa is trying to open it. Not specifying it in the
command line crash qemu.
While we're at it, stop using qemu_open_old.
Eugenio Pérez (2):
vdpa: Replace qemu_open_old by qemu_open at
vdpa: Check for existence of opts.vhostdev
net/vhost-vdpa.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] vdpa: Replace qemu_open_old by qemu_open at
2021-11-12 19:34 [PATCH 0/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
@ 2021-11-12 19:34 ` Eugenio Pérez
2021-11-15 4:22 ` Jason Wang
2021-11-12 19:34 ` [PATCH 2/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
1 sibling, 1 reply; 5+ messages in thread
From: Eugenio Pérez @ 2021-11-12 19:34 UTC (permalink / raw)
To: qemu-trivial, qemu-devel
Cc: Laurent Vivier, Jason Wang, Cindy Lu, Michael S . Tsirkin
There is no reason to keep using the old one, since we neither use the
variadics arguments nor open it with O_DIRECT.
Also, net_client_init1, the caller of net_init_vhost_vdpa, wants all
net_client_init_fun to use Error API, so it's a good step in that
direction.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
net/vhost-vdpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 49ab322511..6ffb29f4da 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -261,7 +261,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
opts = &netdev->u.vhost_vdpa;
- vdpa_device_fd = qemu_open_old(opts->vhostdev, O_RDWR);
+ vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR, errp);
if (vdpa_device_fd == -1) {
return -errno;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] vdpa: Check for existence of opts.vhostdev
2021-11-12 19:34 [PATCH 0/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
2021-11-12 19:34 ` [PATCH 1/2] vdpa: Replace qemu_open_old by qemu_open at Eugenio Pérez
@ 2021-11-12 19:34 ` Eugenio Pérez
2021-11-15 4:24 ` Jason Wang
1 sibling, 1 reply; 5+ messages in thread
From: Eugenio Pérez @ 2021-11-12 19:34 UTC (permalink / raw)
To: qemu-trivial, qemu-devel
Cc: Laurent Vivier, Jason Wang, Cindy Lu, Michael S . Tsirkin
Since net_init_vhost_vdpa is trying to open it. Not specifying it in the
command line crash qemu.
Fixes: 7327813d17 ("vhost-vdpa: open device fd in net_init_vhost_vdpa()")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
net/vhost-vdpa.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 6ffb29f4da..bbd3576f23 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -260,6 +260,10 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
opts = &netdev->u.vhost_vdpa;
+ if (!opts->vhostdev) {
+ error_setg(errp, "vdpa character device not specified with vhostdev");
+ return -1;
+ }
vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR, errp);
if (vdpa_device_fd == -1) {
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] vdpa: Replace qemu_open_old by qemu_open at
2021-11-12 19:34 ` [PATCH 1/2] vdpa: Replace qemu_open_old by qemu_open at Eugenio Pérez
@ 2021-11-15 4:22 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-11-15 4:22 UTC (permalink / raw)
To: Eugenio Pérez
Cc: qemu-trivial, Laurent Vivier, qemu-devel, Cindy Lu, Michael S . Tsirkin
On Sat, Nov 13, 2021 at 3:34 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> There is no reason to keep using the old one, since we neither use the
> variadics arguments nor open it with O_DIRECT.
>
> Also, net_client_init1, the caller of net_init_vhost_vdpa, wants all
> net_client_init_fun to use Error API, so it's a good step in that
> direction.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> net/vhost-vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 49ab322511..6ffb29f4da 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -261,7 +261,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
> opts = &netdev->u.vhost_vdpa;
>
> - vdpa_device_fd = qemu_open_old(opts->vhostdev, O_RDWR);
> + vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR, errp);
> if (vdpa_device_fd == -1) {
> return -errno;
> }
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] vdpa: Check for existence of opts.vhostdev
2021-11-12 19:34 ` [PATCH 2/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
@ 2021-11-15 4:24 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-11-15 4:24 UTC (permalink / raw)
To: Eugenio Pérez
Cc: qemu-trivial, Laurent Vivier, qemu-devel, Cindy Lu, Michael S . Tsirkin
On Sat, Nov 13, 2021 at 3:35 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> Since net_init_vhost_vdpa is trying to open it. Not specifying it in the
> command line crash qemu.
>
> Fixes: 7327813d17 ("vhost-vdpa: open device fd in net_init_vhost_vdpa()")
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> net/vhost-vdpa.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 6ffb29f4da..bbd3576f23 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -260,6 +260,10 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
>
> assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
> opts = &netdev->u.vhost_vdpa;
> + if (!opts->vhostdev) {
> + error_setg(errp, "vdpa character device not specified with vhostdev");
> + return -1;
> + }
>
> vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR, errp);
> if (vdpa_device_fd == -1) {
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-15 4:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 19:34 [PATCH 0/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
2021-11-12 19:34 ` [PATCH 1/2] vdpa: Replace qemu_open_old by qemu_open at Eugenio Pérez
2021-11-15 4:22 ` Jason Wang
2021-11-12 19:34 ` [PATCH 2/2] vdpa: Check for existence of opts.vhostdev Eugenio Pérez
2021-11-15 4:24 ` Jason Wang
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).