Skip to content

Commit 7aec71c

Browse files
committed
Merge tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull iommu fixes from Will Deacon: "Three IOMMU fixes for -rc4. The main one is a change to the Intel IOMMU driver to fix the handling of unaligned addresses when invalidating the TLB. The fix itself is a bit ugly (the caller does a bunch of shifting which is then effectively undone later in the callchain), but Lu has patches to clean all of this up in 5.12. Summary: - Fix address alignment handling for VT-D TLB invalidation - Enable workarounds for buggy Qualcomm firmware on two more SoCs - Drop duplicate #include" * tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: iommu/vt-d: Fix duplicate included linux/dma-map-ops.h iommu: arm-smmu-qcom: Add sdm630/msm8998 compatibles for qcom quirks iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev()
2 parents 02c06dc + 694a1c0 commit 7aec71c

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,9 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
325325
}
326326

327327
static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
328+
{ .compatible = "qcom,msm8998-smmu-v2" },
328329
{ .compatible = "qcom,sc7180-smmu-500" },
330+
{ .compatible = "qcom,sdm630-smmu-v2" },
329331
{ .compatible = "qcom,sdm845-smmu-500" },
330332
{ .compatible = "qcom,sm8150-smmu-500" },
331333
{ .compatible = "qcom,sm8250-smmu-500" },

drivers/iommu/intel/iommu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <linux/dmi.h>
3939
#include <linux/pci-ats.h>
4040
#include <linux/memblock.h>
41-
#include <linux/dma-map-ops.h>
4241
#include <linux/dma-direct.h>
4342
#include <linux/crash_dump.h>
4443
#include <linux/numa.h>

drivers/iommu/intel/svm.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ void intel_svm_check(struct intel_iommu *iommu)
118118
iommu->flags |= VTD_FLAG_SVM_CAPABLE;
119119
}
120120

121-
static void intel_flush_svm_range_dev (struct intel_svm *svm, struct intel_svm_dev *sdev,
122-
unsigned long address, unsigned long pages, int ih)
121+
static void __flush_svm_range_dev(struct intel_svm *svm,
122+
struct intel_svm_dev *sdev,
123+
unsigned long address,
124+
unsigned long pages, int ih)
123125
{
124126
struct qi_desc desc;
125127

@@ -170,6 +172,22 @@ static void intel_flush_svm_range_dev (struct intel_svm *svm, struct intel_svm_d
170172
}
171173
}
172174

175+
static void intel_flush_svm_range_dev(struct intel_svm *svm,
176+
struct intel_svm_dev *sdev,
177+
unsigned long address,
178+
unsigned long pages, int ih)
179+
{
180+
unsigned long shift = ilog2(__roundup_pow_of_two(pages));
181+
unsigned long align = (1ULL << (VTD_PAGE_SHIFT + shift));
182+
unsigned long start = ALIGN_DOWN(address, align);
183+
unsigned long end = ALIGN(address + (pages << VTD_PAGE_SHIFT), align);
184+
185+
while (start < end) {
186+
__flush_svm_range_dev(svm, sdev, start, align >> VTD_PAGE_SHIFT, ih);
187+
start += align;
188+
}
189+
}
190+
173191
static void intel_flush_svm_range(struct intel_svm *svm, unsigned long address,
174192
unsigned long pages, int ih)
175193
{

0 commit comments

Comments
 (0)