]> git.ipfire.org Git - thirdparty/qemu.git/commit
intel-iommu: add iommu lock
authorPeter Xu <peterx@redhat.com>
Fri, 18 May 2018 07:25:11 +0000 (15:25 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 21 Jun 2018 01:45:05 +0000 (20:45 -0500)
commit3585497e8669fae18b59bd6a6ee7954289015447
tree92a51e4a8a5e1580901ee7c95f7b7f66b849e82c
parent99fc962b62f6419f09e2d09670e176359da06ce7
intel-iommu: add iommu lock

SECURITY IMPLICATION: this patch fixes a potential race when multiple
threads access the IOMMU IOTLB cache.

Add a per-iommu big lock to protect IOMMU status.  Currently the only
thing to be protected is the IOTLB/context cache, since that can be
accessed even without BQL, e.g., in IO dataplane.

Note that we don't need to protect device page tables since that's fully
controlled by the guest kernel.  However there is still possibility that
malicious drivers will program the device to not obey the rule.  In that
case QEMU can't really do anything useful, instead the guest itself will
be responsible for all uncertainties.

CC: QEMU Stable <qemu-stable@nongnu.org>
Reported-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1d9efa73e12ddf361ea997c2d532cc4afa6674d1)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/i386/intel_iommu.c
include/hw/i386/intel_iommu.h