kernel_optimize_test/drivers/iommu
Zhen Lei 0f02477d16 iommu/arm-smmu-v3: Fix unexpected CMD_SYNC timeout
The condition break condition of:

	(int)(VAL - sync_idx) >= 0

in the __arm_smmu_sync_poll_msi() polling loop requires that sync_idx
must be increased monotonically according to the sequence of the CMDs in
the cmdq.

However, since the msidata is populated using atomic_inc_return_relaxed()
before taking the command-queue spinlock, then the following scenario
can occur:

CPU0			CPU1
msidata=0
			msidata=1
			insert cmd1
insert cmd0
			smmu execute cmd1
smmu execute cmd0
			poll timeout, because msidata=1 is overridden by
			cmd0, that means VAL=0, sync_idx=1.

This is not a functional problem, since the caller will eventually either
timeout or exit due to another CMD_SYNC, however it's clearly not what
the code is supposed to be doing. Fix it, by incrementing the sequence
count with the command-queue lock held, allowing us to drop the atomic
operations altogether.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
[will: dropped the specialised cmd building routine for now]
Signed-off-by: Will Deacon <will.deacon@arm.com>
2018-10-01 13:01:30 +01:00
..
amd_iommu_debugfs.c
amd_iommu_init.c
amd_iommu_proto.h
amd_iommu_types.h
amd_iommu_v2.c
amd_iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
arm-smmu-regs.h
arm-smmu-v3.c iommu/arm-smmu-v3: Fix unexpected CMD_SYNC timeout 2018-10-01 13:01:30 +01:00
arm-smmu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
dma-iommu.c
dmar.c
exynos-iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
fsl_pamu_domain.c
fsl_pamu_domain.h
fsl_pamu.c
fsl_pamu.h
intel_irq_remapping.c
intel-iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
intel-pasid.c
intel-pasid.h
intel-svm.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
io-pgtable-arm-v7s.c
io-pgtable-arm.c iommu/io-pgtable-arm: Fix race handling in split_blk_unmap() 2018-10-01 13:01:29 +01:00
io-pgtable.c
io-pgtable.h
iommu-debugfs.c
iommu-sysfs.c
iommu-traces.c
iommu.c
iova.c
ipmmu-vmsa.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
irq_remapping.c
irq_remapping.h
Kconfig
Makefile
msm_iommu_hw-8xxx.h
msm_iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
msm_iommu.h
mtk_iommu_v1.c
mtk_iommu.c
mtk_iommu.h
of_iommu.c
omap-iommu-debug.c
omap-iommu.c
omap-iommu.h
omap-iopgtable.h
qcom_iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
rockchip-iommu.c ARM: SoC: late updates 2018-08-25 14:12:36 -07:00
s390-iommu.c
tegra-gart.c
tegra-smmu.c