[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/33] vhost-user-blk: start vhost when guest kicks
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 10/33] vhost-user-blk: start vhost when guest kicks |
Date: |
Mon, 5 Nov 2018 13:16:20 -0500 |
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
- Re: [Qemu-devel] [PULL 05/33] virtio-blk: fix comment for virtio_blk_rw_complete, (continued)
- [Qemu-devel] [PULL 07/33] intel_iommu: better handling of dmar state switch, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 08/33] intel_iommu: move ce fetching out when sync shadow, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 09/33] intel_iommu: handle invalid ce for shadow sync, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 16/33] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 13/33] x86_iommu/amd: remove V=1 check from amdvi_validate_dte(), Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 18/33] x86_iommu/amd: Add interrupt remap support when VAPIC is enabled, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 14/33] x86_iommu/amd: make the address space naming consistent with intel-iommu, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 21/33] pci-testdev: add optional memory bar, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 10/33] vhost-user-blk: start vhost when guest kicks,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 11/33] x86_iommu: move the kernel-irqchip check in common code, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 23/33] hw/pci-host/x86: extend the 64-bit PCI hole relative to the fw-assigned base, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 20/33] MAINTAINERS: list "tests/acpi-test-data" files in ACPI/SMBIOS section, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 19/33] x86_iommu/amd: Enable Guest virtual APIC support, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 17/33] i386: acpi: add IVHD device entry for IOAPIC, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 12/33] x86_iommu: move vtd_generate_msi_message in common file, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 15/33] x86_iommu/amd: Prepare for interrupt remap support, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 24/33] bios-tables-test: prepare expected files for mmio64, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 26/33] hw/pci-bridge/xio3130: Remove unused functions, Michael S. Tsirkin, 2018/11/05
- [Qemu-devel] [PULL 25/33] tests/bios-tables-test: add 64-bit PCI MMIO aperture round-up test on Q35, Michael S. Tsirkin, 2018/11/05