qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] intel_iommu: Reset vIOMMU after all the rest of devices
@ 2024-01-17  9:15 peterx
  2024-01-17  9:15 ` [PATCH 1/4] reset: qemu_register_reset_one() peterx
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: peterx @ 2024-01-17  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Auger, Michael S . Tsirkin, Jason Wang, Alex Williamson,
	Igor Mammedov, peterx

From: Peter Xu <peterx@redhat.com>

There're issue reported that when syetem_reset the VM with an intel iommu
device and MT2892 PF(mlx5_core driver), the host kernel throws DMAR error.

  https://issues.redhat.com/browse/RHEL-7188

Alex quickly spot a possible issue on ordering of device resets.

It's verified by our QE team then that it is indeed the root cause of the
problem.  Consider when vIOMMU is reset before a VFIO device in a system
reset: the device can be doing DMAs even if the vIOMMU is gone; in this
specific context it means the shadow mapping can already be completely
destroyed.  Host will see these DMAs as malicious and report.

To fix it, we'll need to make sure all devices under the vIOMMU device
hierachy will be reset before the vIOMMU itself.  There's plenty of trick
inside, one can get those by reading the last patch.

I didn't check other vIOMMUs, but this series should fix the issue for VT-d
as of now.  The solution can be slightly ugly, but a beautiful one can be
very non-trivial.

Review comments welcomed, thanks.

Peter Xu (4):
  reset: qemu_register_reset_one()
  reset: Allow multiple stages of system resets
  intel_iommu: Tear down address spaces before IOMMU reset
  intel_iommu: Reset vIOMMU at the last stage of system reset

 include/sysemu/reset.h |  5 ++++
 hw/core/reset.c        | 67 ++++++++++++++++++++++++++++++------------
 hw/i386/intel_iommu.c  | 56 +++++++++++++++++++++++++++++++++--
 3 files changed, 107 insertions(+), 21 deletions(-)

-- 
2.43.0



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

end of thread, other threads:[~2025-01-29 18:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17  9:15 [PATCH 0/4] intel_iommu: Reset vIOMMU after all the rest of devices peterx
2024-01-17  9:15 ` [PATCH 1/4] reset: qemu_register_reset_one() peterx
2024-01-17 10:29   ` Eric Auger
2024-01-17  9:15 ` [PATCH 2/4] reset: Allow multiple stages of system resets peterx
2024-01-17 10:28   ` Eric Auger
2024-01-17 13:58     ` Cédric Le Goater
2024-01-17 17:46   ` Peter Maydell
2024-01-18 15:53     ` Philippe Mathieu-Daudé
2024-01-18 16:15       ` Peter Maydell
2024-01-19 11:10       ` Peter Xu
2024-01-17  9:15 ` [PATCH 3/4] intel_iommu: Tear down address spaces before IOMMU reset peterx
2024-01-17 10:29   ` Eric Auger
2024-01-18  8:09   ` Philippe Mathieu-Daudé
2024-01-17  9:15 ` [PATCH 4/4] intel_iommu: Reset vIOMMU at the last stage of system reset peterx
2024-01-17 10:38   ` Eric Auger
2024-01-17 10:29 ` [PATCH 0/4] intel_iommu: Reset vIOMMU after all the rest of devices Eric Auger
2024-01-19 10:46   ` Peter Xu
2025-01-23  9:16 ` Eric Auger
2025-01-23 17:57   ` Peter Xu
2025-01-23 18:02     ` Eric Auger
2025-01-29 18:22     ` Eric Auger

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).