]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio_iommu: Clear IOMMUPciBus pointer cache when system reset
authorZhenzhong Duan <zhenzhong.duan@intel.com>
Thu, 25 Jan 2024 07:37:05 +0000 (15:37 +0800)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 15 Feb 2024 08:12:27 +0000 (11:12 +0300)
commit10981da02263ecc5e73e55ad1159d23009e3703c
treef04713c1c1886b0c239a3b52b82846b05b368479
parent4bfbb4ed9a97876cdfa07c79116a2f6d4a3ca26b
virtio_iommu: Clear IOMMUPciBus pointer cache when system reset

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>
hw/virtio/virtio-iommu.c