From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>, <qemu-block@nongnu.org>,
Hanna Reitz <hreitz@redhat.com>,
Laurent Vivier <lvivier@redhat.com>, Fam Zheng <fam@euphon.net>,
Fabiano Rosas <farosas@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH 1/5] vhost: use virtio_config_get_guest_notifier()
Date: Mon, 22 Sep 2025 18:01:45 -0400 [thread overview]
Message-ID: <20250922220149.498967-2-stefanha@redhat.com> (raw)
In-Reply-To: <20250922220149.498967-1-stefanha@redhat.com>
There is a getter function so avoid accessing the ->config_notifier
field directly.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/virtio/vhost.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 6557c58d12..37b39aa0c2 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1817,7 +1817,7 @@ void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask)
int r;
EventNotifier *notifier =
&hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
- EventNotifier *config_notifier = &vdev->config_notifier;
+ EventNotifier *config_notifier = virtio_config_get_guest_notifier(vdev);
assert(hdev->vhost_ops);
if ((hdev->started == false) ||
@@ -1848,13 +1848,15 @@ static void vhost_stop_config_intr(struct vhost_dev *dev)
static void vhost_start_config_intr(struct vhost_dev *dev)
{
int r;
+ EventNotifier *config_notifier =
+ virtio_config_get_guest_notifier(dev->vdev);
assert(dev->vhost_ops);
- int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
+ int fd = event_notifier_get_fd(config_notifier);
if (dev->vhost_ops->vhost_set_config_call) {
r = dev->vhost_ops->vhost_set_config_call(dev, fd);
if (!r) {
- event_notifier_set(&dev->vdev->config_notifier);
+ event_notifier_set(config_notifier);
}
}
}
@@ -2139,12 +2141,13 @@ static int do_vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev,
{
int i;
int rc = 0;
+ EventNotifier *config_notifier = virtio_config_get_guest_notifier(vdev);
/* should only be called after backend is connected */
assert(hdev->vhost_ops);
event_notifier_test_and_clear(
&hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
- event_notifier_test_and_clear(&vdev->config_notifier);
+ event_notifier_test_and_clear(config_notifier);
event_notifier_cleanup(
&hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
--
2.51.0
next prev parent reply other threads:[~2025-09-22 22:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 22:01 [PATCH 0/5] virtio: allow virtio_error() in IOThreads Stefan Hajnoczi
2025-09-22 22:01 ` Stefan Hajnoczi [this message]
2025-09-23 8:33 ` [PATCH 1/5] vhost: use virtio_config_get_guest_notifier() Philippe Mathieu-Daudé
2025-09-22 22:01 ` [PATCH 2/5] virtio: unify virtio_notify_irqfd() and virtio_notify() Stefan Hajnoczi
2025-09-23 8:41 ` Philippe Mathieu-Daudé
2025-09-22 22:01 ` [PATCH 3/5] virtio: support irqfd in virtio_notify_config() Stefan Hajnoczi
2025-09-22 22:01 ` [PATCH 4/5] tests/libqos: extract qvirtqueue_set_avail_idx() Stefan Hajnoczi
2025-09-23 8:45 ` Philippe Mathieu-Daudé
2025-09-23 13:07 ` Fabiano Rosas
2025-09-22 22:01 ` [PATCH 5/5] tests/virtio-scsi: add a virtio_error() IOThread test Stefan Hajnoczi
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=20250922220149.498967-2-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.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).