[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.2 35/60] virtio_iommu: Clear IOMMUPciBus pointer cache when
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.2 35/60] virtio_iommu: Clear IOMMUPciBus pointer cache when system reset |
Date: |
Wed, 21 Feb 2024 11:20:23 +0300 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
s->iommu_pcibus_by_bus_num is a IOMMUPciBus pointer cache indexed
by bus number, bus number may not always be a fixed value,
i.e., guest reboot to different kernel which set bus number with
different algorithm.
This could lead to endpoint binding to wrong iommu MR in
virtio_iommu_get_endpoint(), then vfio device setup wrong
mapping from other device.
Remove the memset in virtio_iommu_device_realize() to avoid
redundancy with memset in system reset.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Message-Id: <20240125073706.339369-2-zhenzhong.duan@intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 9a457383ce9d309d4679b079fafb51f0a2d949aa)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index 9d463efc52..90a7ca2d25 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -1264,6 +1264,8 @@ static void virtio_iommu_system_reset(void *opaque)
trace_virtio_iommu_system_reset();
+ memset(s->iommu_pcibus_by_bus_num, 0, sizeof(s->iommu_pcibus_by_bus_num));
+
/*
* config.bypass is sticky across device reset, but should be restored on
* system reset
@@ -1302,8 +1304,6 @@ static void virtio_iommu_device_realize(DeviceState *dev,
Error **errp)
virtio_init(vdev, VIRTIO_ID_IOMMU, sizeof(struct virtio_iommu_config));
- memset(s->iommu_pcibus_by_bus_num, 0, sizeof(s->iommu_pcibus_by_bus_num));
-
s->req_vq = virtio_add_queue(vdev, VIOMMU_DEFAULT_QUEUE_SIZE,
virtio_iommu_handle_command);
s->event_vq = virtio_add_queue(vdev, VIOMMU_DEFAULT_QUEUE_SIZE, NULL);
--
2.39.2
- [Stable-8.2.2 60/60] tests/qtest: Depend on dbus_display1_dep, (continued)
- [Stable-8.2.2 60/60] tests/qtest: Depend on dbus_display1_dep, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 53/60] target/i386: Generate an illegal opcode exception on cmp instructions with lock prefix, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 43/60] target/arm: Split out make_svemte_desc, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 41/60] target/arm: Fix nregs computation in do_{ld, st}_zpa, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 37/60] tests/acpi: Allow update of DSDT.cxl, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 46/60] target/arm: Don't get MDCR_EL2 in pmu_counter_enabled() before checking ARM_FEATURE_PMU, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 32/60] hw/cxl/device: read from register values in mdev_reg_read(), Michael Tokarev, 2024/02/21
- [Stable-8.2.2 49/60] i386/cpu: Clear FEAT_XSAVE_XSS_LO/HI leafs when CPUID_EXT_XSAVE is not available, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 44/60] target/arm: Handle mte in do_ldrq, do_ldro, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 55/60] ui/clipboard: mark type as not available when there is no data, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 35/60] virtio_iommu: Clear IOMMUPciBus pointer cache when system reset,
Michael Tokarev <=
- [Stable-8.2.2 57/60] ui/console: Fix console resize with placeholder surface, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 19/60] virtio-blk: avoid using ioeventfd state in irqfd conditional, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 26/60] hw/net/tulip: add chip status register values, Michael Tokarev, 2024/02/21