Skip to content

Commit 0f6a904

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Do not use IOMMU_DOMAIN_DMA if CONFIG_IOMMU_DMA is not enabled
msm_iommu platforms do not select either CONFIG_IOMMU_DMA or CONFIG_ARM_DMA_USE_IOMMU so they create a IOMMU_DOMAIN_DMA domain by default and never populate it. This acts like a BLOCKED domain and breaks the GPU driver on the platform. Detect this and force use of IDENTITY instead. Fixes: 98ac73f ("iommu: Require a default_domain for all iommu drivers") Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/linux-iommu/CAA8EJprz7VVmBG68U9zLuqPd0UdSRHYoLDJSP6tCj6H6qanuTQ@mail.gmail.com/ Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/0-v1-20700abdf239+19c-iommu_no_dma_iommu_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent ccb76c5 commit 0f6a904

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/iommu/iommu.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,6 +1920,18 @@ static int iommu_get_default_domain_type(struct iommu_group *group,
19201920
}
19211921
}
19221922

1923+
/*
1924+
* If the common dma ops are not selected in kconfig then we cannot use
1925+
* IOMMU_DOMAIN_DMA at all. Force IDENTITY if nothing else has been
1926+
* selected.
1927+
*/
1928+
if (!IS_ENABLED(CONFIG_IOMMU_DMA)) {
1929+
if (WARN_ON(driver_type == IOMMU_DOMAIN_DMA))
1930+
return -1;
1931+
if (!driver_type)
1932+
driver_type = IOMMU_DOMAIN_IDENTITY;
1933+
}
1934+
19231935
if (untrusted) {
19241936
if (driver_type && driver_type != IOMMU_DOMAIN_DMA) {
19251937
dev_err_ratelimited(

0 commit comments

Comments
 (0)