Skip to content

Commit 4ea7944

Browse files
srejoergroedel
authored andcommitted
iommu/mediatek: Always check runtime PM status in tlb flush range callback
In case of v4l2_reqbufs() it is possible, that a TLB flush is done without runtime PM being enabled. In that case the "Partial TLB flush timed out, falling back to full flush" warning is printed. Commit c0b5758 ("iommu/mediatek: Add power-domain operation") introduced has_pm as optimization to avoid checking runtime PM when there is no power domain attached. But without the PM domain there is still the device driver's runtime PM suspend handler, which disables the clock. Thus flushing should also be avoided when there is no PM domain involved. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Yong Wu <yong.wu@mediatek.com> Link: https://lore.kernel.org/r/20211208120744.2415-3-dafna.hirschfeld@collabora.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 17224e0 commit 4ea7944

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

drivers/iommu/mtk_iommu.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,13 @@ static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size,
225225
size_t granule,
226226
struct mtk_iommu_data *data)
227227
{
228-
bool has_pm = !!data->dev->pm_domain;
229228
unsigned long flags;
230229
int ret;
231230
u32 tmp;
232231

233232
for_each_m4u(data) {
234-
if (has_pm) {
235-
if (pm_runtime_get_if_in_use(data->dev) <= 0)
236-
continue;
237-
}
233+
if (pm_runtime_get_if_in_use(data->dev) <= 0)
234+
continue;
238235

239236
spin_lock_irqsave(&data->tlb_lock, flags);
240237
writel_relaxed(F_INVLD_EN1 | F_INVLD_EN0,
@@ -259,8 +256,7 @@ static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size,
259256
writel_relaxed(0, data->base + REG_MMU_CPE_DONE);
260257
spin_unlock_irqrestore(&data->tlb_lock, flags);
261258

262-
if (has_pm)
263-
pm_runtime_put(data->dev);
259+
pm_runtime_put(data->dev);
264260
}
265261
}
266262

0 commit comments

Comments
 (0)