diff options
author | Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> | 2019-01-24 07:16:45 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2019-01-24 17:24:49 +0300 |
commit | 9825bd94e3a2baae1f4874767ae3a7d4c049720e (patch) | |
tree | 55012b2ec1b640962a78be8894eb272c6424b408 /drivers/iommu/intel-iommu.c | |
parent | da5d2748e4a4512237764d2a53bdf686eccee18b (diff) | |
download | linux-9825bd94e3a2baae1f4874767ae3a7d4c049720e.tar.xz |
iommu/amd: Fix IOMMU page flush when detach device from a domain
When a VM is terminated, the VFIO driver detaches all pass-through
devices from VFIO domain by clearing domain id and page table root
pointer from each device table entry (DTE), and then invalidates
the DTE. Then, the VFIO driver unmap pages and invalidate IOMMU pages.
Currently, the IOMMU driver keeps track of which IOMMU and how many
devices are attached to the domain. When invalidate IOMMU pages,
the driver checks if the IOMMU is still attached to the domain before
issuing the invalidate page command.
However, since VFIO has already detached all devices from the domain,
the subsequent INVALIDATE_IOMMU_PAGES commands are being skipped as
there is no IOMMU attached to the domain. This results in data
corruption and could cause the PCI device to end up in indeterministic
state.
Fix this by invalidate IOMMU pages when detach a device, and
before decrementing the per-domain device reference counts.
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Suggested-by: Joerg Roedel <joro@8bytes.org>
Co-developed-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Fixes: 6de8ad9b9ee0 ('x86/amd-iommu: Make iommu_flush_pages aware of multiple IOMMUs')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
0 files changed, 0 insertions, 0 deletions