UPSTREAM: iommu: Don't use lazy flush for untrusted device

The lazy IOTLB flushing setup leaves a time window, in which the device
can still access some system memory, which has already been unmapped by
the device driver. It's not suitable for untrusted devices. A malicious
device might use this to attack the system by obtaining data that it
shouldn't obtain.

Fixes: c588072bba6b5 ("iommu/vt-d: Convert intel iommu driver to the iommu ops")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20210225061454.2864009-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
(cherry picked from commit 82c3cefb9f1652e7470f442ff96c613e8c8ed8f4)

BUG=b:195152713
TEST=1. Bootup on Volteer and Brya and Volteer
2. check for no new kernel errors
3. Try to manually switch devices from "strict" to non-strict and check
it works.

Signed-off-by: Rajat Jain <rajatja@google.com>
Change-Id: I17e927ede1be38007e527e7541ff000f1ebd36f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3087511
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Benson Leung <bleung@google.com>
1 file changed