From: Viktor Prutyanov <viktor@daynix.com>
To: mst@redhat.com, jasowang@redhat.com, marcel.apfelbaum@gmail.com,
pbonzini@redhat.com, peterx@redhat.com, david@redhat.com
Cc: philmd@linaro.org, qemu-devel@nongnu.org, yan@daynix.com,
yuri.benditovich@daynix.com, Viktor Prutyanov <viktor@daynix.com>
Subject: [RFC PATCH 0/4] vhost: register and change IOMMU flag depending on ATS state
Date: Mon, 24 Apr 2023 14:21:43 +0300 [thread overview]
Message-ID: <20230424112147.17083-1-viktor@daynix.com> (raw)
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 state change
memory: add interface for triggering IOMMU notify_flag_changed handler
vhost: register and change IOMMU flag depending on ATS state
hw/pci/pci.c | 1 +
hw/pci/pcie.c | 21 +++++++++++++++++++++
hw/virtio/vhost.c | 23 +++++++++++++++++++++--
hw/virtio/virtio-pci.c | 12 ++++++++++++
include/exec/memory.h | 2 ++
include/hw/pci/pci_device.h | 3 +++
include/hw/pci/pcie.h | 4 ++++
include/hw/virtio/virtio.h | 2 ++
softmmu/memory.c | 12 ++++++++++++
9 files changed, 78 insertions(+), 2 deletions(-)
--
2.21.0
next reply other threads:[~2023-04-24 11:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 11:21 Viktor Prutyanov [this message]
2023-04-24 11:21 ` [RFC PATCH 1/4] pci: add handling of Enable bit in ATS Control Register Viktor Prutyanov
2023-04-26 5:31 ` Jason Wang
2023-04-26 5:48 ` Jason Wang
2023-05-02 21:35 ` Viktor Prutyanov
2023-04-24 11:21 ` [RFC PATCH 2/4] virtio-pci: add handling of ATS state change Viktor Prutyanov
2023-04-26 5:50 ` Jason Wang
2023-04-24 11:21 ` [RFC PATCH 3/4] memory: add interface for triggering IOMMU notify_flag_changed handler Viktor Prutyanov
2023-04-26 14:20 ` Peter Xu
2023-04-24 11:21 ` [RFC PATCH 4/4] vhost: register and change IOMMU flag depending on ATS state Viktor Prutyanov
2023-04-26 5:54 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230424112147.17083-1-viktor@daynix.com \
--to=viktor@daynix.com \
--cc=david@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yan@daynix.com \
--cc=yuri.benditovich@daynix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).