qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/4] vhost: register and change IOMMU flag depending on ATS state
@ 2023-05-01  2:02 Viktor Prutyanov
  2023-05-01  2:02 ` [RFC PATCH v2 1/4] pci: add handling of Enable bit in ATS Control Register Viktor Prutyanov
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Viktor Prutyanov @ 2023-05-01  2:02 UTC (permalink / raw)
  To: mst, jasowang, peterx, marcel.apfelbaum
  Cc: qemu-devel, viktor, yan, yuri.benditovich

When IOMMU and vhost are enabled together, QEMU tracks IOTLB or
Device-TLB unmap events depending on whether Device-TLB is enabled. But
even if Device-TLB and PCI ATS is enabled, the guest can reject to use
it. For example, this situation appears when Windows Server 2022 is
running with intel-iommu with device-iotlb=on and virtio-net-pci with
vhost=on. The guest implies that no address translation info cached in
device IOTLB and doesn't send device IOTLB invalidation commands. So,
it leads to irrelevant address translations in vhost-net in the host
kernel. Therefore network frames from the guest in host tap interface
contains wrong payload data.

This series adds checking of ATS state for proper unmap flag register
(IOMMU_NOTIFIER_UNMAP or IOMMU_NOTIFIER_DEVIOTLB_UNMAP).

Tested on Windows Server 2022, Windows 11 and Fedora guests with
 -device virtio-net-pci,bus=pci.3,netdev=nd0,iommu_platform=on,ats=on
 -netdev tap,id=nd0,ifname=tap1,script=no,downscript=no,vhost=on
 -device intel-iommu,intremap=on,eim=on,device-iotlb=on/off

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2001312

Viktor Prutyanov (4):
  pci: add handling of Enable bit in ATS Control Register
  virtio-pci: add handling of ATS and Device-TLB enable
  vhost: register and change IOMMU flag depending on Device-TLB state
  virtio-net: pass Device-TLB enable/disable events to vhost

 hw/net/vhost_net.c                | 11 +++++++++++
 hw/net/virtio-net.c               |  8 ++++++++
 hw/pci/pcie.c                     | 22 ++++++++++++++++++++++
 hw/virtio/vhost-backend.c         |  6 ++++++
 hw/virtio/vhost.c                 | 26 ++++++++++++++++++++++++--
 hw/virtio/virtio-pci.c            | 17 +++++++++++++++++
 include/hw/pci/pcie.h             |  5 +++++
 include/hw/virtio/vhost-backend.h |  4 ++++
 include/hw/virtio/vhost.h         |  1 +
 include/hw/virtio/virtio.h        |  2 ++
 include/net/vhost_net.h           |  2 ++
 11 files changed, 102 insertions(+), 2 deletions(-)

-- 
2.35.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-05-12 14:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-01  2:02 [RFC PATCH v2 0/4] vhost: register and change IOMMU flag depending on ATS state Viktor Prutyanov
2023-05-01  2:02 ` [RFC PATCH v2 1/4] pci: add handling of Enable bit in ATS Control Register Viktor Prutyanov
2023-05-01  2:02 ` [RFC PATCH v2 2/4] virtio-pci: add handling of ATS and Device-TLB enable Viktor Prutyanov
2023-05-08  4:14   ` Jason Wang
2023-05-01  2:02 ` [RFC PATCH v2 3/4] vhost: register and change IOMMU flag depending on Device-TLB state Viktor Prutyanov
2023-05-08  5:25   ` Jason Wang
2023-05-08  5:28     ` Jason Wang
2023-05-12 14:13       ` Viktor Prutyanov
2023-05-01  2:02 ` [RFC PATCH v2 4/4] virtio-net: pass Device-TLB enable/disable events to vhost Viktor Prutyanov
2023-05-08  5:26   ` Jason Wang
2023-05-12 14:06     ` Viktor Prutyanov
2023-05-08  4:09 ` [RFC PATCH v2 0/4] vhost: register and change IOMMU flag depending on ATS state Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).