From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Cindy Lu" <lulu@redhat.com>, "Jason Wang" <jasowang@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Gonglei (Arei)" <arei.gonglei@huawei.com>,
virtio-fs@redhat.com
Subject: [PULL 15/51] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
Date: Thu, 5 Jan 2023 04:15:05 -0500 [thread overview]
Message-ID: <20230105091310.263867-16-mst@redhat.com> (raw)
In-Reply-To: <20230105091310.263867-1-mst@redhat.com>
From: Cindy Lu <lulu@redhat.com>
To support configure interrupt for vhost-vdpa
Introduce VIRTIO_CONFIG_IRQ_IDX -1 as configure interrupt's queue index,
Then we can reuse the functions guest_notifier_mask and guest_notifier_pending.
Add the check of queue index in these drivers, if the driver does not support
configure interrupt, the function will just return
Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-2-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio.h | 3 +++
hw/display/vhost-user-gpu.c | 18 ++++++++++++++++++
hw/net/virtio-net.c | 22 ++++++++++++++++++++--
hw/virtio/vhost-user-fs.c | 18 ++++++++++++++++++
hw/virtio/vhost-user-gpio.c | 10 ++++++++++
hw/virtio/vhost-vsock-common.c | 18 ++++++++++++++++++
hw/virtio/virtio-crypto.c | 18 ++++++++++++++++++
7 files changed, 105 insertions(+), 2 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 24561e933a..8266d240cc 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -79,6 +79,9 @@ typedef struct VirtQueueElement
#define VIRTIO_NO_VECTOR 0xffff
+/* special index value used internally for config irqs */
+#define VIRTIO_CONFIG_IRQ_IDX -1
+
#define TYPE_VIRTIO_DEVICE "virtio-device"
OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index 19c0e20103..4380a5e672 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -486,6 +486,15 @@ vhost_user_gpu_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VhostUserGPU *g = VHOST_USER_GPU(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return false;
+ }
return vhost_virtqueue_pending(&g->vhost->dev, idx);
}
@@ -494,6 +503,15 @@ vhost_user_gpu_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
{
VhostUserGPU *g = VHOST_USER_GPU(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return;
+ }
vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask);
}
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index b342d66160..0bfe454c23 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3325,6 +3325,15 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
} else {
nc = qemu_get_subqueue(n->nic, vq2q(idx));
}
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return false
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return false;
+ }
return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
}
@@ -3348,8 +3357,17 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
} else {
nc = qemu_get_subqueue(n->nic, vq2q(idx));
}
- vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
- vdev, idx, mask);
+ /*
+ *Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return;
+ }
+
+ vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
}
static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index d97b179e6f..f5049735ac 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -159,6 +159,15 @@ static void vuf_guest_notifier_mask(VirtIODevice *vdev, int idx,
{
VHostUserFS *fs = VHOST_USER_FS(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return;
+ }
vhost_virtqueue_mask(&fs->vhost_dev, vdev, idx, mask);
}
@@ -166,6 +175,15 @@ static bool vuf_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VHostUserFS *fs = VHOST_USER_FS(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return false;
+ }
return vhost_virtqueue_pending(&fs->vhost_dev, idx);
}
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index b7b82a1099..fe3da32c74 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -191,6 +191,16 @@ static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
{
VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return;
+ }
+
vhost_virtqueue_mask(&gpio->vhost_dev, vdev, idx, mask);
}
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index d21c72b401..d2b5519d5a 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -127,6 +127,15 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
{
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return;
+ }
vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
}
@@ -135,6 +144,15 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
{
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return false;
+ }
return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
}
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 97da74e719..516425e26a 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1182,6 +1182,15 @@ static void virtio_crypto_guest_notifier_mask(VirtIODevice *vdev, int idx,
assert(vcrypto->vhost_started);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return;
+ }
cryptodev_vhost_virtqueue_mask(vdev, queue, idx, mask);
}
@@ -1192,6 +1201,15 @@ static bool virtio_crypto_guest_notifier_pending(VirtIODevice *vdev, int idx)
assert(vcrypto->vhost_started);
+ /*
+ * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+ * as the Marco of configure interrupt's IDX, If this driver does not
+ * support, the function will return
+ */
+
+ if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+ return false;
+ }
return cryptodev_vhost_virtqueue_pending(vdev, queue, idx);
}
--
MST
next prev parent reply other threads:[~2023-01-05 9:43 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 01/51] virtio_net: Modify virtio_net_get_config to early return Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 03/51] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 04/51] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 05/51] hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9 Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 06/51] hw/acpi/Kconfig: Add missing dependencies " Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 07/51] hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 08/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4 Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 09/51] hw/isa/Kconfig: Add missing dependency to VT82C686 Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 10/51] i386, mips: Resolve redundant ACPI and APM dependencies Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 11/51] hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2 Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 12/51] vhost-user: Refactor vhost acked features saving Michael S. Tsirkin
2023-01-05 9:14 ` [PULL 13/51] vhost-user: Refactor the chr_closed_bh Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 14/51] vhost-user: Fix the virtio features negotiation flaw Michael S. Tsirkin
2023-01-05 9:15 ` Michael S. Tsirkin [this message]
2023-01-05 9:15 ` [PULL 16/51] virtio-pci: decouple notifier from interrupt process Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 17/51] virtio-pci: decouple the single vector from the " Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 18/51] vhost: introduce new VhostOps vhost_set_config_call Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 19/51] vhost-vdpa: add support for config interrupt Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 20/51] virtio: add support for configure interrupt Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 21/51] vhost: " Michael S. Tsirkin
2023-01-05 9:21 ` Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 22/51] virtio-net: " Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 23/51] virtio-mmio: " Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 24/51] virtio-pci: " Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 25/51] hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device() Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 26/51] hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 27/51] include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h Michael S. Tsirkin
2023-01-05 9:21 ` Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 29/51] include/hw/cxl: Include hw/cxl/*.h where needed Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 30/51] include/hw/pci: Clean up a few things checkpatch.pl would flag Michael S. Tsirkin
2023-01-05 9:15 ` [PULL 31/51] include/hw/pci: Split pci_device.h off pci.h Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 34/51] include/hw/virtio: Break inclusion loop Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 35/51] include: Include headers where needed Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 36/51] include: Don't include qemu/osdep.h Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 37/51] docs/devel: Rules on #include in headers Michael S. Tsirkin
2023-01-09 12:03 ` Markus Armbruster
2023-01-05 9:16 ` [PULL 38/51] vdpa-dev: get iova range explicitly Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 39/51] vdpa: harden the error path if get_iova_range failed Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 40/51] vhost: simplify vhost_dev_enable_notifiers Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 41/51] vhost: configure all host notifiers in a single MR transaction Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 42/51] vdpa: commit all host notifier MRs " Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 43/51] virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 44/51] tests: virt: Allow changes to PPTT test table Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified Michael S. Tsirkin
2023-05-10 10:13 ` Philippe Mathieu-Daudé
2023-05-13 7:22 ` Yicong Yang via
2023-01-05 9:16 ` [PULL 46/51] tests: virt: Update expected ACPI tables for virt test Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 47/51] tests: acpi: Add and whitelist *.topology blobs Michael S. Tsirkin
2023-01-05 9:16 ` [PULL 48/51] tests: acpi: aarch64: Add topology test for aarch64 Michael S. Tsirkin
2023-01-05 9:17 ` [PULL 49/51] tests: acpi: aarch64: Add *.topology tables Michael S. Tsirkin
2023-01-05 9:17 ` [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
2023-01-05 9:56 ` Michael S. Tsirkin
2023-01-05 16:01 ` Laszlo Ersek
2023-01-05 16:29 ` Philippe Mathieu-Daudé
2023-01-05 16:35 ` Michael S. Tsirkin
2023-01-05 9:17 ` [PULL 51/51] vhost-scsi: fix memleak of vsc->inflight Michael S. Tsirkin
2023-01-05 9:21 ` [PULL 28/51] include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use Michael S. Tsirkin
2023-01-05 9:22 ` [PULL 32/51] include/hw/pci: Include hw/pci/pci.h where needed Michael S. Tsirkin
2023-01-05 9:22 ` [PULL 33/51] include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h Michael S. Tsirkin
2023-01-05 9:56 ` [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
2023-01-05 16:31 ` Michael S. Tsirkin
2023-01-05 21:04 ` Peter Maydell
2023-01-05 21:50 ` Michael S. Tsirkin
2023-01-05 21:53 ` Michael S. Tsirkin
2023-01-06 15:29 ` Peter Maydell
2023-01-08 13:57 ` Michael S. Tsirkin
2023-01-09 13:43 ` Markus Armbruster
2023-01-10 18:28 ` Markus Armbruster
2023-01-09 15:54 ` Peter Maydell
2023-01-05 16:30 ` [PULL v2 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
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=20230105091310.263867-16-mst@redhat.com \
--to=mst@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=lulu@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=viresh.kumar@linaro.org \
--cc=virtio-fs@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).