diff options
author | Jason Wang <jasowang@redhat.com> | 2021-08-04 11:48:03 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-09-04 16:35:17 -0400 |
commit | ae4003738ff0e1e5e6e6ff6e7c593bb443d5df04 (patch) | |
tree | 0cfe0e10703760c5ff79c7e6e9853da7215d014b /util/lockcnt.c | |
parent | 3d1e5d86feab9402be448ab3bc507ae21acfa298 (diff) | |
download | qemu-ae4003738ff0e1e5e6e6ff6e7c593bb443d5df04.zip qemu-ae4003738ff0e1e5e6e6ff6e7c593bb443d5df04.tar.gz qemu-ae4003738ff0e1e5e6e6ff6e7c593bb443d5df04.tar.bz2 |
vhost: correctly detect the enabling IOMMU
Vhost used to compare the dma_as against the address_space_memory to
detect whether the IOMMU is enabled or not. This might not work well
since the virito-bus may call get_dma_as if VIRTIO_F_IOMMU_PLATFORM is
set without an actual IOMMU enabled when device is plugged. In the
case of PCI where pci_get_address_space() is used, the bus master as
is returned. So vhost actually tries to enable device IOTLB even if
the IOMMU is not enabled. This will lead a lots of unnecessary
transactions between vhost and Qemu and will introduce a huge drop of
the performance.
For PCI, an ideal approach is to use pci_device_iommu_address_space()
just for get_dma_as. But Qemu may choose to initialize the IOMMU after
the virtio-pci which lead a wrong address space is returned during
device plugged. So this patch switch to use transport specific way via
iommu_enabled() to detect the IOMMU during vhost start. In this case,
we are fine since we know the IOMMU is initialized correctly.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20210804034803.1644-4-jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'util/lockcnt.c')
0 files changed, 0 insertions, 0 deletions