linux/drivers/iommu
Jason Gunthorpe ae91f6552c iommu/arm-smmu-v3: Check that the RID domain is S1 in SVA
The SVA code only works if the RID domain is a S1 domain and has already
installed the cdtable.

Originally the check for this was in arm_smmu_sva_bind() but when the op
was removed the test didn't get copied over to the new
arm_smmu_sva_set_dev_pasid().

Without the test wrong usage usually will hit a WARN_ON() in
arm_smmu_write_ctx_desc() due to a missing ctx table.

However, the next patches wil change things so that an IDENTITY domain is
not a struct arm_smmu_domain and this will get into memory corruption if
the struct is wrongly casted.

Fail in arm_smmu_sva_set_dev_pasid() if the STE does not have a S1, which
is a proxy for the STE having a pointer to the CD table. Write it in a way
that will be compatible with the next patches.

Fixes: 386fa64fd5 ("arm-smmu-v3/sva: Add SVA domain support")
Reported-by: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Closes: https://lore.kernel.org/linux-iommu/2a828e481416405fb3a4cceb9e075a59@huawei.com/
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/11-v6-96275f25c39d+2d4-smmuv3_newapi_p1_jgg@nvidia.com
Signed-off-by: Will Deacon <will@kernel.org>
2024-02-29 15:12:22 +00:00
..
amd IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
arm iommu/arm-smmu-v3: Check that the RID domain is S1 in SVA 2024-02-29 15:12:22 +00:00
intel iommufd for 6.8 2024-01-18 15:28:15 -08:00
iommufd iommufd for 6.8 2024-01-18 15:28:15 -08:00
apple-dart.c Merge branches 'apple/dart', 'arm/rockchip', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2024-01-03 09:59:32 +01:00
dma-iommu.c IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
dma-iommu.h
exynos-iommu.c
fsl_pamu_domain.c
fsl_pamu_domain.h
fsl_pamu.c
fsl_pamu.h
hyperv-iommu.c
io-pgfault.c
io-pgtable-arm-v7s.c
io-pgtable-arm.c iommu: Extend LPAE page table format to support custom allocators 2023-11-27 11:10:12 +01:00
io-pgtable-arm.h
io-pgtable-dart.c
io-pgtable.c iommu: Allow passing custom allocators to pgtable drivers 2023-11-27 11:10:12 +01:00
iommu-debugfs.c
iommu-priv.h
iommu-sva.c iommu/sva: Fix memory leak in iommu_sva_bind_device() 2023-12-15 09:06:49 +01:00
iommu-sva.h
iommu-sysfs.c
iommu-traces.c
iommu.c iommu: Mark dev_iommu_priv_set() with a lockdep 2023-12-12 10:18:49 +01:00
iova.c
ipmmu-vmsa.c
irq_remapping.c
irq_remapping.h
Kconfig iommu: Change kconfig around IOMMU_SVA 2023-12-12 10:11:27 +01:00
Makefile
msm_iommu_hw-8xxx.h
msm_iommu.c
msm_iommu.h
mtk_iommu_v1.c iommu: Clean up open-coded ownership checks 2023-11-27 11:03:16 +01:00
mtk_iommu.c iommu: Clean up open-coded ownership checks 2023-11-27 11:03:16 +01:00
of_iommu.c Merge branches 'apple/dart', 'arm/rockchip', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2024-01-03 09:59:32 +01:00
omap-iommu-debug.c
omap-iommu.c iommu: Mark dev_iommu_priv_set() with a lockdep 2023-12-12 10:18:49 +01:00
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c
s390-iommu.c
sprd-iommu.c iommu: Clean up open-coded ownership checks 2023-11-27 11:03:16 +01:00
sun50i-iommu.c
tegra-smmu.c Merge branches 'iommu/fixes', 'arm/tegra', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd', 'core' and 's390' into next 2023-10-27 09:13:40 +02:00
virtio-iommu.c Merge branches 'apple/dart', 'arm/rockchip', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2024-01-03 09:59:32 +01:00