[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/28] vhost-user-blk: start vhost when guest kicks
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 06/28] vhost-user-blk: start vhost when guest kicks |
Date: |
Tue, 23 Oct 2018 19:41:31 -0400 |
From: Yongji Xie <address@hidden>
Some old guests (before commit 7a11370e5: "virtio_blk: enable VQs early")
kick virtqueue before setting VIRTIO_CONFIG_S_DRIVER_OK. This violates
the virtio spec. But virtio 1.0 transitional devices support this behaviour.
So we should start vhost when guest kicks in this case.
Signed-off-by: Yongji Xie <address@hidden>
Signed-off-by: Chai Wen <address@hidden>
Signed-off-by: Ni Xun <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/block/vhost-user-blk.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index d755223643..1451940845 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -217,7 +217,32 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice
*vdev,
static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
{
+ VHostUserBlk *s = VHOST_USER_BLK(vdev);
+ int i;
+ if (!(virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) &&
+ !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1))) {
+ return;
+ }
+
+ if (s->dev.started) {
+ return;
+ }
+
+ /* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start
+ * vhost here instead of waiting for .set_status().
+ */
+ vhost_user_blk_start(vdev);
+
+ /* Kick right away to begin processing requests already in vring */
+ for (i = 0; i < s->dev.nvqs; i++) {
+ VirtQueue *kick_vq = virtio_get_queue(vdev, i);
+
+ if (!virtio_queue_get_desc_addr(vdev, i)) {
+ continue;
+ }
+ event_notifier_set(virtio_queue_get_host_notifier(kick_vq));
+ }
}
static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
--
MST
- [Qemu-devel] [PULL 00/28] pci, pc, virtio: fixes, features, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 04/28] intel_iommu: move ce fetching out when sync shadow, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 01/28] virtio-blk: fix comment for virtio_blk_rw_complete, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 05/28] intel_iommu: handle invalid ce for shadow sync, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 02/28] intel_iommu: introduce vtd_reset_caches(), Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 07/28] x86_iommu: move the kernel-irqchip check in common code, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 09/28] x86_iommu/amd: remove V=1 check from amdvi_validate_dte(), Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 16/28] MAINTAINERS: list "tests/acpi-test-data" files in ACPI/SMBIOS section, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 06/28] vhost-user-blk: start vhost when guest kicks,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 17/28] pci-testdev: add optional memory bar, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 10/28] x86_iommu/amd: make the address space naming consistent with intel-iommu, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 24/28] pci_bridge: fix typo in comment, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 25/28] i440fx: use ARRAY_SIZE for pam_regions, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 08/28] x86_iommu: move vtd_generate_msi_message in common file, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 11/28] x86_iommu/amd: Prepare for interrupt remap support, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 19/28] hw/pci-host/x86: extend the 64-bit PCI hole relative to the fw-assigned base, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 03/28] intel_iommu: better handling of dmar state switch, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 20/28] tests/bios-tables-test: add 64-bit PCI MMIO aperture round-up test on Q35, Michael S. Tsirkin, 2018/10/23
- [Qemu-devel] [PULL 13/28] i386: acpi: add IVHD device entry for IOAPIC, Michael S. Tsirkin, 2018/10/23