iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev()
authorLu Baolu <baolu.lu@linux.intel.com>
Thu, 31 Dec 2020 00:53:20 +0000 (08:53 +0800)
committerWill Deacon <will@kernel.org>
Tue, 12 Jan 2021 15:47:54 +0000 (15:47 +0000)
commit2d6ffc63f12417b979955a5b22ad9a76d2af5de9
treebe3bdbced758014fb3a62b7e538ef3ce36f71393
parent7c29ada5e70083805bc3a68daa23441df421fbee
iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev()

The VT-d hardware will ignore those Addr bits which have been masked by
the AM field in the PASID-based-IOTLB invalidation descriptor. As the
result, if the starting address in the descriptor is not aligned with
the address mask, some IOTLB caches might not invalidate. Hence people
will see below errors.

[ 1093.704661] dmar_fault: 29 callbacks suppressed
[ 1093.704664] DMAR: DRHD: handling fault status reg 3
[ 1093.712738] DMAR: [DMA Read] Request device [7a:02.0] PASID 2
               fault addr 7f81c968d000 [fault reason 113]
               SM: Present bit in first-level paging entry is clear

Fix this by using aligned address for PASID-based-IOTLB invalidation.

Fixes: 1c4f88b7f1f9 ("iommu/vt-d: Shared virtual address in scalable mode")
Reported-and-tested-by: Guo Kaijie <Kaijie.Guo@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20201231005323.2178523-2-baolu.lu@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/intel/svm.c