All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org,
	"Akihiko Odaki" <akihiko.odaki@daynix.com>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Michael Tokarev" <mjt@tls.msk.ru>
Subject: [PATCH 33/47] vhost-user-gpio: Configure vhost_dev when connecting
Date: Wed,  8 Mar 2023 19:57:36 +0300	[thread overview]
Message-ID: <20230308165815.2098148-33-mjt@msgid.tls.msk.ru> (raw)
In-Reply-To: <20230308165035.2097594-1-mjt@msgid.tls.msk.ru>

From: Akihiko Odaki <akihiko.odaki@daynix.com>

vhost_dev_cleanup(), called from vu_gpio_disconnect(), clears vhost_dev
so vhost-user-gpio must set the members of vhost_dev each time
connecting.

do_vhost_user_cleanup() should also acquire the pointer to vqs directly
from VHostUserGPIO instead of referring to vhost_dev as it can be called
after vhost_dev_cleanup().

Fixes: 27ba7b027f ("hw/virtio: add boilerplate for vhost-user-gpio device")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230130140320.77999-1-akihiko.odaki@daynix.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit daae36c13abc73cf1055abc2d33cb71cc5d34310)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/virtio/vhost-user-gpio.c         | 10 ++++++----
 include/hw/virtio/vhost-user-gpio.h |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index 5851cb3bc9..72af765f33 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -16,6 +16,7 @@
 #include "trace.h"
 
 #define REALIZE_CONNECTION_RETRIES 3
+#define VHOST_NVQS 2
 
 /* Features required from VirtIO */
 static const int feature_bits[] = {
@@ -201,8 +202,7 @@ static void do_vhost_user_cleanup(VirtIODevice *vdev, VHostUserGPIO *gpio)
 {
     virtio_delete_queue(gpio->command_vq);
     virtio_delete_queue(gpio->interrupt_vq);
-    g_free(gpio->vhost_dev.vqs);
-    gpio->vhost_dev.vqs = NULL;
+    g_free(gpio->vhost_vqs);
     virtio_cleanup(vdev);
     vhost_user_cleanup(&gpio->vhost_user);
 }
@@ -222,6 +222,9 @@ static int vu_gpio_connect(DeviceState *dev, Error **errp)
     vhost_dev_set_config_notifier(vhost_dev, &gpio_ops);
     gpio->vhost_user.supports_config = true;
 
+    gpio->vhost_dev.nvqs = VHOST_NVQS;
+    gpio->vhost_dev.vqs = gpio->vhost_vqs;
+
     ret = vhost_dev_init(vhost_dev, &gpio->vhost_user,
                          VHOST_BACKEND_TYPE_USER, 0, errp);
     if (ret < 0) {
@@ -331,10 +334,9 @@ static void vu_gpio_device_realize(DeviceState *dev, Error **errp)
 
     virtio_init(vdev, VIRTIO_ID_GPIO, sizeof(gpio->config));
 
-    gpio->vhost_dev.nvqs = 2;
     gpio->command_vq = virtio_add_queue(vdev, 256, vu_gpio_handle_output);
     gpio->interrupt_vq = virtio_add_queue(vdev, 256, vu_gpio_handle_output);
-    gpio->vhost_dev.vqs = g_new0(struct vhost_virtqueue, gpio->vhost_dev.nvqs);
+    gpio->vhost_vqs = g_new0(struct vhost_virtqueue, VHOST_NVQS);
 
     gpio->connected = false;
 
diff --git a/include/hw/virtio/vhost-user-gpio.h b/include/hw/virtio/vhost-user-gpio.h
index 4fe9aeecc0..c17a5a351a 100644
--- a/include/hw/virtio/vhost-user-gpio.h
+++ b/include/hw/virtio/vhost-user-gpio.h
@@ -23,7 +23,7 @@ struct VHostUserGPIO {
     VirtIODevice parent_obj;
     CharBackend chardev;
     struct virtio_gpio_config config;
-    struct vhost_virtqueue *vhost_vq;
+    struct vhost_virtqueue *vhost_vqs;
     struct vhost_dev vhost_dev;
     VhostUserState vhost_user;
     VirtQueue *command_vq;
-- 
2.30.2



  parent reply	other threads:[~2023-03-08 17:10 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 16:57 [RFC PATCH 00/47] Patch Round-up for stable 7.2.1 Michael Tokarev
2023-03-08 16:57 ` [PATCH 01/47] target/sh4: Mask restore of env->flags from tb->flags Michael Tokarev
2023-03-08 16:57 ` [PATCH 02/47] vhost: fix vq dirty bitmap syncing when vIOMMU is enabled Michael Tokarev
2023-03-08 16:57 ` [PATCH 03/47] virtio-mem: Fix the bitmap index of the section offset Michael Tokarev
2023-03-08 16:57 ` [PATCH 04/47] virtio-mem: Fix the iterator variable in a vmem->rdl_list loop Michael Tokarev
2023-03-08 16:57 ` [PATCH 05/47] target/arm: fix handling of HLT semihosting in system mode Michael Tokarev
2023-03-08 16:57 ` [PATCH 06/47] meson: accept relative symlinks in "meson introspect --installed" data Michael Tokarev
2023-03-08 16:57 ` [PATCH 07/47] target/riscv: Set pc_succ_insn for !rvc illegal insn Michael Tokarev
2023-03-08 16:57 ` [PATCH 08/47] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael Tokarev
2023-03-08 16:57 ` [PATCH 09/47] hw/nvme: fix missing endian conversions for doorbell buffers Michael Tokarev
2023-03-08 16:57 ` [PATCH 10/47] hw/nvme: fix missing cq eventidx update Michael Tokarev
2023-03-08 16:57 ` [PATCH 11/47] configure: fix GLIB_VERSION for cross-compilation Michael Tokarev
2023-03-08 16:57 ` [PATCH 12/47] target/arm: Fix sve_probe_page Michael Tokarev
2023-03-08 16:57 ` [PATCH 13/47] target/arm: allow writes to SCR_EL3.HXEn bit when FEAT_HCX is enabled Michael Tokarev
2023-03-08 16:57 ` [PATCH 14/47] target/arm: Fix in_debug path in S1_ptw_translate Michael Tokarev
2023-03-08 16:57 ` [PATCH 15/47] target/arm: Fix physical address resolution for Stage2 Michael Tokarev
2023-03-08 16:57 ` [PATCH 16/47] migration/ram: Fix error handling in ram_write_tracking_start() Michael Tokarev
2023-03-08 16:57 ` [PATCH 17/47] migration/ram: Fix populate_read_range() Michael Tokarev
2023-03-08 16:57 ` [PATCH 18/47] qcow2: Fix theoretical corruption in store_bitmap() error path Michael Tokarev
2023-03-08 16:57 ` [PATCH 19/47] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF Michael Tokarev
2023-03-08 16:57 ` [PATCH 20/47] tests/tcg/i386: Introduce and use reg_t consistently Michael Tokarev
2023-03-08 16:57 ` [PATCH 21/47] target/i386: Fix BEXTR instruction Michael Tokarev
2023-03-08 16:57 ` [PATCH 22/47] target/i386: Fix C flag for BLSI, BLSMSK, BLSR Michael Tokarev
2023-03-08 16:57 ` [PATCH 23/47] target/i386: fix ADOX followed by ADCX Michael Tokarev
2023-03-08 16:57 ` [PATCH 24/47] target/i386: Fix BZHI instruction Michael Tokarev
2023-03-08 16:57 ` [PATCH 25/47] block/iscsi: fix double-free on BUSY or similar statuses Michael Tokarev
2023-03-08 16:57 ` [PATCH 26/47] hw/smbios: fix field corruption in type 4 table Michael Tokarev
2023-03-08 16:57 ` [PATCH 27/47] Revert "x86: do not re-randomize RNG seed on snapshot load" Michael Tokarev
2023-03-08 16:57 ` [PATCH 28/47] Revert "x86: re-initialize RNG seed when selecting kernel" Michael Tokarev
2023-03-08 16:57 ` [PATCH 29/47] Revert "x86: reinitialize RNG seed on system reboot" Michael Tokarev
2023-03-08 16:57 ` [PATCH 30/47] Revert "x86: use typedef for SetupData struct" Michael Tokarev
2023-03-08 16:57 ` [PATCH 31/47] Revert "x86: return modified setup_data only if read as memory, not as file" Michael Tokarev
2023-03-08 16:57 ` [PATCH 32/47] Revert "hw/i386: pass RNG seed via setup_data entry" Michael Tokarev
2023-03-08 16:57 ` Michael Tokarev [this message]
2023-03-08 16:57 ` [PATCH 34/47] vhost-user-i2c: Back up vqs before cleaning up vhost_dev Michael Tokarev
2023-03-08 16:57 ` [PATCH 35/47] vhost-user-rng: " Michael Tokarev
2023-03-08 16:57 ` [PATCH 37/47] virtio-rng-pci: fix transitional migration compat for vectors Michael Tokarev
2023-03-08 16:57 ` [PATCH 38/47] hw/timer/hpet: Fix expiration time overflow Michael Tokarev
2023-03-08 16:57 ` [PATCH 39/47] vdpa: stop all svq on device deletion Michael Tokarev
2023-03-08 16:57 ` [PATCH 40/47] vhost: avoid a potential use of an uninitialized variable in vhost_svq_poll() Michael Tokarev
2023-03-08 16:57 ` [PATCH 41/47] libvhost-user: check for NULL when allocating a virtqueue element Michael Tokarev
2023-03-08 16:57 ` [PATCH 42/47] chardev/char-socket: set s->listener = NULL in char_socket_finalize Michael Tokarev
2023-03-08 16:57 ` [PATCH 43/47] intel-iommu: fail MAP notifier without caching mode Michael Tokarev
2023-03-08 16:57 ` [PATCH 44/47] intel-iommu: fail DEVIOTLB_UNMAP without dt mode Michael Tokarev
2023-03-08 16:57 ` [PATCH 45/47] block: Handle curl 7.55.0, 7.85.0 version changes Michael Tokarev
2023-03-08 16:57 ` [PATCH 46/47] tests/tcg: fix unused variable in linux-test Michael Tokarev
2023-03-08 16:57 ` [PATCH 47/47] build-sys: fix crlf-ending C code Michael Tokarev
2023-03-08 19:22 ` [PATCH 36/47] virtio-rng-pci: fix migration compat for vectors Michael Tokarev
2023-03-22  9:09 ` [RFC PATCH 00/47] Patch Round-up for stable 7.2.1 Thomas Huth
2023-03-22 20:27   ` Michael Tokarev

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=20230308165815.2098148-33-mjt@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=akihiko.odaki@daynix.com \
    --cc=alex.bennee@linaro.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=viresh.kumar@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.