linux-stable/drivers/iommu
Yong Wu 77fbe028d5 media: iommu/mediatek: Add device_link between the consumer and the larb devices
[ Upstream commit 635319a4a7 ]

MediaTek IOMMU-SMI diagram is like below. all the consumer connect with
smi-larb, then connect with smi-common.

        M4U
         |
    smi-common
         |
  -------------
  |         |    ...
  |         |
larb1     larb2
  |         |
vdec       venc

When the consumer works, it should enable the smi-larb's power which
also need enable the smi-common's power firstly.

Thus, First of all, use the device link connect the consumer and the
smi-larbs. then add device link between the smi-larb and smi-common.

This patch adds device_link between the consumer and the larbs.

When device_link_add, I add the flag DL_FLAG_STATELESS to avoid calling
pm_runtime_xx to keep the original status of clocks. It can avoid two
issues:
1) Display HW show fastlogo abnormally reported in [1]. At the beggining,
all the clocks are enabled before entering kernel, but the clocks for
display HW(always in larb0) will be gated after clk_enable and clk_disable
called from device_link_add(->pm_runtime_resume) and rpm_idle. The clock
operation happened before display driver probe. At that time, the display
HW will be abnormal.

2) A deadlock issue reported in [2]. Use DL_FLAG_STATELESS to skip
pm_runtime_xx to avoid the deadlock.

Corresponding, DL_FLAG_AUTOREMOVE_CONSUMER can't be added, then
device_link_removed should be added explicitly.

Meanwhile, Currently we don't have a device connect with 2 larbs at the
same time. Disallow this case, print the error log.

[1] https://lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/
[2] https://lore.kernel.org/patchwork/patch/1086569/

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:59 +02:00
..
amd iommu/amd: Fix I/O page table memory leak 2022-03-08 19:12:49 +01:00
arm iommu/arm-smmu-qcom: Fix TTBR0 read 2022-01-27 11:04:11 +01:00
intel iommu/vt-d: Fix double list_add when enabling VMD in scalable mode 2022-03-08 19:12:43 +01:00
apple-dart.c iommu/dart: Initialize DART_STREAMS_ENABLE 2021-11-25 09:48:30 +01:00
dma-iommu.c iommu/dma: Fix incorrect error return on iommu deferred attach 2021-11-18 19:16:57 +01:00
exynos-iommu.c
fsl_pamu.c
fsl_pamu.h
fsl_pamu_domain.c
fsl_pamu_domain.h
hyperv-iommu.c
io-pgfault.c
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure 2022-01-27 11:02:58 +01:00
io-pgtable-arm.c iommu/io-pgtable-arm: Fix table descriptor paddr formatting 2022-01-27 11:04:10 +01:00
io-pgtable-arm.h
io-pgtable.c
ioasid.c
iommu-debugfs.c
iommu-sva-lib.c
iommu-sva-lib.h
iommu-sysfs.c
iommu-traces.c
iommu.c iommu: Fix potential use-after-free during probe 2022-02-16 12:56:41 +01:00
iova.c iommu/iova: Improve 32-bit free space estimate 2022-04-08 14:22:48 +02:00
ipmmu-vmsa.c iommu/ipmmu-vmsa: Check for error num after setting mask 2022-04-08 14:23:31 +02:00
irq_remapping.c
irq_remapping.h
Kconfig iommu/arm: fix ARM_SMMU_QCOM compilation 2021-10-13 21:28:44 +02:00
Makefile
msm_iommu.c
msm_iommu.h
msm_iommu_hw-8xxx.h
mtk_iommu.c media: iommu/mediatek: Add device_link between the consumer and the larb devices 2022-04-08 14:23:59 +02:00
mtk_iommu.h
mtk_iommu_v1.c media: iommu/mediatek: Add device_link between the consumer and the larb devices 2022-04-08 14:23:59 +02:00
of_iommu.c
omap-iommu-debug.c
omap-iommu.c
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c iommu/rockchip: Fix PAGE_DESC_HI_MASKs for RK3568 2021-12-01 09:04:54 +01:00
s390-iommu.c
sprd-iommu.c
sun50i-iommu.c
tegra-gart.c
tegra-smmu.c iommu/tegra-smmu: Fix missing put_device() call in tegra_smmu_find 2022-03-08 19:12:47 +01:00
virtio-iommu.c