From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: stefanha@redhat.com, mst@redhat.com, mlureau@redhat.com,
qemu-devel@nongnu.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [Qemu-devel] [RFC 1/5] vhost: send virtio device status update to the backend
Date: Fri, 16 Feb 2018 18:29:06 +0100 [thread overview]
Message-ID: <20180216172910.8549-2-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20180216172910.8549-1-maxime.coquelin@redhat.com>
This patch adds a function to notify the vhost backend with
virtio device status updates.
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
hw/virtio/vhost.c | 11 +++++++++++
include/hw/virtio/vhost-backend.h | 3 +++
include/hw/virtio/vhost.h | 3 +++
3 files changed, 17 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 338e4395b7..95981e5a32 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1546,6 +1546,17 @@ void vhost_dev_set_config_notifier(struct vhost_dev *hdev,
hdev->config_ops = ops;
}
+int vhost_dev_set_virtio_status(struct vhost_dev *hdev, uint8_t status)
+{
+ const VhostOps *vhost_ops = hdev->vhost_ops;
+
+ if (vhost_ops && vhost_ops->vhost_set_virtio_status) {
+ return vhost_ops->vhost_set_virtio_status(hdev, status);
+ }
+
+ return 0;
+}
+
/* Host notifiers must be enabled at this point. */
int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
{
diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index 592254f40d..45f6b8f6c5 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -94,6 +94,8 @@ typedef int (*vhost_set_config_op)(struct vhost_dev *dev, const uint8_t *data,
uint32_t flags);
typedef int (*vhost_get_config_op)(struct vhost_dev *dev, uint8_t *config,
uint32_t config_len);
+typedef int (*vhost_set_virtio_status_op)(struct vhost_dev *dev,
+ uint8_t status);
typedef struct VhostOps {
VhostBackendType backend_type;
@@ -130,6 +132,7 @@ typedef struct VhostOps {
vhost_send_device_iotlb_msg_op vhost_send_device_iotlb_msg;
vhost_get_config_op vhost_get_config;
vhost_set_config_op vhost_set_config;
+ vhost_set_virtio_status_op vhost_set_virtio_status;
} VhostOps;
extern const VhostOps user_ops;
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 1dc2d73d76..fe055b2bd5 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -121,4 +121,7 @@ int vhost_dev_set_config(struct vhost_dev *dev, const uint8_t *data,
*/
void vhost_dev_set_config_notifier(struct vhost_dev *dev,
const VhostDevConfigOps *ops);
+
+int vhost_dev_set_virtio_status(struct vhost_dev *hdev, uint8_t status);
+
#endif
--
2.14.3
next prev parent reply other threads:[~2018-02-16 17:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 17:29 [Qemu-devel] [RFC 0/5] vhost-user: Forward virtio device status updates Maxime Coquelin
2018-02-16 17:29 ` Maxime Coquelin [this message]
2018-02-16 17:29 ` [Qemu-devel] [RFC 2/5] vhost-user: Introduce new request to send virtio device status Maxime Coquelin
2018-02-27 15:01 ` Michael S. Tsirkin
2018-02-27 16:30 ` Maxime Coquelin
2018-02-16 17:29 ` [Qemu-devel] [RFC 3/5] vhost_net: send virtio device status update to the backend Maxime Coquelin
2018-02-16 17:29 ` [Qemu-devel] [RFC 4/5] vhost-user-blk: send virtio status " Maxime Coquelin
2018-02-16 17:29 ` [Qemu-devel] [RFC 5/5] vhost-user-scsi: " Maxime Coquelin
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=20180216172910.8549-2-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=mlureau@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).