Skip to content

Commit bceddc2

Browse files
committed
drm/msm: Fix display fault handling
It turns out that when the display is enabled by the bootloader, we can get some transient iommu faults from the display. Which doesn't go over too well when we install a fault handler that is gpu specific. To avoid this, defer installing the fault handler until we get around to setting up per-process pgtables (which is adreno_smmu specific). The arm-smmu fallback error reporting is sufficient for reporting display related faults (and in fact was all we had prior to f8f934c) Reported-by: Dmitry Baryshkov <[email protected]> Reported-by: Yassine Oudjana <[email protected]> Fixes: 2a574cc ("drm/msm: Improve the a6xx page fault handler") Signed-off-by: Rob Clark <[email protected]> Tested-by: John Stultz <[email protected]> Tested-by: Yassine Oudjana <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]>
1 parent b910a02 commit bceddc2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/gpu/drm/msm/msm_iommu.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static const struct iommu_flush_ops null_tlb_ops = {
142142
.tlb_add_page = msm_iommu_tlb_add_page,
143143
};
144144

145+
static int msm_fault_handler(struct iommu_domain *domain, struct device *dev,
146+
unsigned long iova, int flags, void *arg);
147+
145148
struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent)
146149
{
147150
struct adreno_smmu_priv *adreno_smmu = dev_get_drvdata(parent->dev);
@@ -157,6 +160,13 @@ struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent)
157160
if (!ttbr1_cfg)
158161
return ERR_PTR(-ENODEV);
159162

163+
/*
164+
* Defer setting the fault handler until we have a valid adreno_smmu
165+
* to avoid accidentially installing a GPU specific fault handler for
166+
* the display's iommu
167+
*/
168+
iommu_set_fault_handler(iommu->domain, msm_fault_handler, iommu);
169+
160170
pagetable = kzalloc(sizeof(*pagetable), GFP_KERNEL);
161171
if (!pagetable)
162172
return ERR_PTR(-ENOMEM);
@@ -300,7 +310,6 @@ struct msm_mmu *msm_iommu_new(struct device *dev, struct iommu_domain *domain)
300310

301311
iommu->domain = domain;
302312
msm_mmu_init(&iommu->base, dev, &funcs, MSM_MMU_IOMMU);
303-
iommu_set_fault_handler(domain, msm_fault_handler, iommu);
304313

305314
atomic_set(&iommu->pagetables, 0);
306315

0 commit comments

Comments
 (0)