android_kernel_samsung_sm8650/drivers/iommu
Vijayanand Jitta 1a097a86b9 arm-smmu: Add prepare callback in smmu dev_pm_ops
The following series of events cause race condition between run time
suspend and system suspend paths.

1. rpm_suspend  (RPM_GET_PUT | RPM_ASYNC | RPM_AUTO) decrements
   usage_count to 0
2. dpm_suspend_start()->dpm_prepare() completed which blocks runtime PM
   of ALL devices, increments usage_count to 1
3. rpm_suspend  (RPM_GET_PUT | RPM_ASYNC | RPM_AUTO) as usage_count==1
   runtime suspend do not continue.
4. dpm_suspend_start()->dpm_suspend()->adreno_pm_suspend() is waiting
   on mutex.
5. arm_smmu_pm_suspend, *would* execute and turn off gpu cx.

As adreno_pm_suspend and dispatcher thread waiting for gdsc to
toggle is serialized using mutex, dispatcher thread would timeout and
adreno_pm_suspend and arm_smmu_pm_suspend are never called.

To avoid this, register smmu device for prepare callback and return
error for system suspend for gfx smmu, in case runtime suspend is in
progress. Now pm_runtime_put() would get called and this decrements
usage_count and allows rpm_suspend to proceed, thus avoiding race.

Now as prepare failed, system suspend would fail and resumes the devices
and then retries for system suspend. This could have some power impact as
system suspend is being retried.

Change-Id: I7982140ae59b12329188fc974f47c3e80693f810
Signed-off-by: Vijayanand Jitta <quic_vjitta@quicinc.com>
2023-04-28 13:26:17 -07:00
..
amd iommu/amd: Fix error handling for pdev_pri_ats_enable() 2023-03-11 13:55:33 +01:00
arm arm-smmu: Add prepare callback in smmu dev_pm_ops 2023-04-28 13:26:17 -07:00
intel iommu/vt-d: Fix PASID directory pointer coherency 2023-03-10 09:34:32 +01:00
apple-dart.c iommu/dart: Fix apple_dart_device_group for PCI groups 2023-03-10 09:33:36 +01:00
dma-iommu.c ANDROID: iommu: Add vendor hook to select alloc_iova algorithm 2023-01-09 18:21:59 +00:00
dma-iommu.h iommu/dma: Make header private 2022-09-09 09:26:22 +02:00
dma-mapping-fast.c Merge keystone/android-mainline-keystone-qcom-release.6.1-rc5 (e9630af) into msm-pineapple 2022-12-10 23:51:29 -08:00
exynos-iommu.c iommu/exynos: Clean up bus_set_iommu() 2022-09-07 14:26:14 +02:00
fsl_pamu_domain.c iommu: Clean up bus_set_iommu() 2022-09-07 14:26:17 +02:00
fsl_pamu_domain.h
fsl_pamu.c iommu/fsl_pamu: Fix resource leak in fsl_pamu_probe() 2022-12-31 13:32:50 +01:00
fsl_pamu.h
hyperv-iommu.c iommu/hyper-v: Use helper instead of directly accessing affinity 2022-08-04 10:02:09 +01:00
io-pgfault.c
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit 2022-07-07 09:42:59 +02:00
io-pgtable-arm.c Merge branches 'apple/dart', 'arm/mediatek', 'arm/omap', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2022-09-26 15:52:31 +02:00
io-pgtable-arm.h
io-pgtable-dart.c iommu/io-pgtable-dart: Add DART PTE support for t6000 2022-09-26 13:49:40 +02:00
io-pgtable-fast.c arm-smmu-qcom: Export QCOM io-pagetables for adreno smmu 2023-02-06 11:01:22 -08:00
io-pgtable.c Merge branches 'apple/dart', 'arm/mediatek', 'arm/omap', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2022-09-26 15:52:31 +02:00
ioasid.c iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit 2022-02-15 11:31:35 +01:00
iommu-debugfs.c
iommu-logger.c arm-smmu-qcom: Export QCOM io-pagetables for adreno smmu 2023-02-06 11:01:22 -08:00
iommu-logger.h qcom-iommu-util: Take a snapshot of the qcom-iommu-util module from msm-5.15 2022-05-06 18:28:28 -07:00
iommu-sva-lib.c iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit 2022-02-15 11:31:35 +01:00
iommu-sva-lib.h iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit 2022-02-15 11:31:35 +01:00
iommu-sysfs.c
iommu-traces.c
iommu.c iommu: Attach device group to old domain in error path 2023-03-11 13:55:40 +01:00
iova.c ANDROID: iommu: Define vendor hook to limit max alignment 2023-01-20 18:48:47 +00:00
ipmmu-vmsa.c iommu/ipmmu-vmsa: Clean up bus_set_iommu() 2022-09-07 14:26:14 +02:00
irq_remapping.c
irq_remapping.h
Kconfig Merge keystone/android-mainline-keystone-qcom-release.6.1-rc5 (e9630af) into msm-pineapple 2022-12-10 23:51:29 -08:00
Makefile Merge keystone/android-mainline-keystone-qcom-release.6.1-rc5 (e9630af) into msm-pineapple 2022-12-10 23:51:29 -08:00
msm_dma_iommu_mapping.c dma-heap: qcom: Take a snapshot of our DMA-BUF heap driver from msm-5.15 2022-04-28 20:37:05 -07:00
msm_iommu_hw-8xxx.h
msm_iommu.c iommu: Clean up bus_set_iommu() 2022-09-07 14:26:17 +02:00
msm_iommu.h
mtk_iommu_v1.c iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe() 2023-01-18 11:58:21 +01:00
mtk_iommu.c iommu/mediatek: Fix crash on isr after kexec() 2023-01-04 11:28:57 +01:00
of_iommu.c Revert "iommu/of: Delete usage of driver_deferred_probe_check_state()" 2022-08-23 13:14:02 +02:00
omap-iommu-debug.c iommu/omap: Fix buffer overflow in debugfs 2022-09-07 10:42:28 +02:00
omap-iommu.c iommu/omap: Clean up bus_set_iommu() 2022-09-07 14:26:15 +02:00
omap-iommu.h
omap-iopgtable.h
qcom-dma-iommu-generic.c qcom-iommu-util: Remove dependency on CONFIG_DMA_REMAP 2023-01-19 06:50:11 -08:00
qcom-dma-iommu-generic.h qcom-iommu-util: Take a snapshot of the qcom-iommu-util module from msm-5.15 2022-05-06 18:28:28 -07:00
qcom-io-pgtable-alloc.c qcom-iommu-util: Switch to qcom_scm_assign_mem() from hyp_assign_phys() 2023-02-08 15:37:49 -08:00
qcom-io-pgtable-alloc.h qcom-iommu-util: Take a snapshot of the qcom-iommu-util module from msm-5.15 2022-05-06 18:28:28 -07:00
qcom-io-pgtable-arm.c iommu: qcom-io-pgtable-arm: Properly check for iommu_prot properties 2023-02-19 17:11:25 -08:00
qcom-iommu-debug-user.c qcom-iommu-debug: Fail incorrect fastmap usecases 2022-11-18 14:22:49 -08:00
qcom-iommu-debug.c qcom-iommu-debug: Fail incorrect fastmap usecases 2022-11-18 14:22:49 -08:00
qcom-iommu-debug.h qcom-iommu-debug: Fail incorrect fastmap usecases 2022-11-18 14:22:49 -08:00
qcom-iommu-util.c qcom-iommu-util: iommu: Use vendor hook for max_alignment 2023-04-20 23:40:09 -07:00
rockchip-iommu.c iommu/rockchip: fix permission bits in page table entries v2 2022-12-31 13:32:47 +01:00
s390-iommu.c iommu/s390: Fix duplicate domain attachments 2022-12-31 13:32:47 +01:00
sprd-iommu.c iommu: Clean up bus_set_iommu() 2022-09-07 14:26:17 +02:00
sun50i-iommu.c iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY 2022-12-31 13:32:51 +01:00
tegra-gart.c iommu: Make .release_device optional 2022-07-06 12:55:53 +02:00
tegra-smmu.c iommu/tegra-smmu: Clean up bus_set_iommu() 2022-09-07 14:26:16 +02:00
virtio-iommu.c iommu: Add gfp parameter to iommu_alloc_resv_region 2022-10-21 10:49:32 +02:00