[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/13] vhost: fail device start if iotlb update fails
From: |
Michael S. Tsirkin |
Subject: |
[PULL 13/13] vhost: fail device start if iotlb update fails |
Date: |
Wed, 27 Nov 2024 08:58:02 -0500 |
From: Prasad Pandit <pjp@fedoraproject.org>
While starting a vhost device, updating iotlb entries
via 'vhost_device_iotlb_miss' may return an error.
qemu-kvm: vhost_device_iotlb_miss:
700871,700871: Fail to update device iotlb
Fail device start when such an error occurs.
Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
Message-Id: <20241107113247.46532-1-ppandit@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
hw/virtio/vhost.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 76f9b2aaad..c40f48ac4d 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -2095,11 +2095,22 @@ int vhost_dev_start(struct vhost_dev *hdev,
VirtIODevice *vdev, bool vrings)
* vhost-kernel code requires for this.*/
for (i = 0; i < hdev->nvqs; ++i) {
struct vhost_virtqueue *vq = hdev->vqs + i;
- vhost_device_iotlb_miss(hdev, vq->used_phys, true);
+ r = vhost_device_iotlb_miss(hdev, vq->used_phys, true);
+ if (r) {
+ goto fail_iotlb;
+ }
}
}
vhost_start_config_intr(hdev);
return 0;
+fail_iotlb:
+ if (vhost_dev_has_iommu(hdev) &&
+ hdev->vhost_ops->vhost_set_iotlb_callback) {
+ hdev->vhost_ops->vhost_set_iotlb_callback(hdev, false);
+ }
+ if (hdev->vhost_ops->vhost_dev_start) {
+ hdev->vhost_ops->vhost_dev_start(hdev, false);
+ }
fail_start:
if (vrings) {
vhost_dev_set_vring_enable(hdev, false);
--
MST
- [PULL 02/13] qtest: allow ACPI DSDT Table changes, (continued)
- [PULL 02/13] qtest: allow ACPI DSDT Table changes, Michael S. Tsirkin, 2024/11/27
- [PULL 03/13] Revert "hw/acpi: Update ACPI `_STA` method with QOM vCPU ACPI Hotplug states", Michael S. Tsirkin, 2024/11/27
- [PULL 04/13] Revert "hw/acpi: Make CPUs ACPI `presence` conditional during vCPU hot-unplug", Michael S. Tsirkin, 2024/11/27
- [PULL 06/13] hw/cxl: Check for zero length features in cmd_features_set_feature(), Michael S. Tsirkin, 2024/11/27
- [PULL 07/13] qapi: fix device-sync-config since-version, Michael S. Tsirkin, 2024/11/27
- [PULL 05/13] tests/acpi: update expected blobs, Michael S. Tsirkin, 2024/11/27
- [PULL 10/13] bios-tables-test: Allow for new acpihmat-generic-x test data., Michael S. Tsirkin, 2024/11/27
- [PULL 09/13] qapi/qom: Change Since entry for AcpiGenericPortProperties to 9.2, Michael S. Tsirkin, 2024/11/27
- [PULL 11/13] bios-tables-test: Add complex SRAT / HMAT test for GI GP, Michael S. Tsirkin, 2024/11/27
- [PULL 12/13] bios-tables-test: Add data for complex numa test (GI, GP etc), Michael S. Tsirkin, 2024/11/27
- [PULL 13/13] vhost: fail device start if iotlb update fails,
Michael S. Tsirkin <=
- [PULL 08/13] hw/acpi: Fix size of HID in build_append_srat_acpi_device_handle(), Michael S. Tsirkin, 2024/11/27
- Re: [PULL 00/13] virtio,pc,pci: bug fixes, new test, Peter Maydell, 2024/11/28