From 3398816a644b5c0f4de84ffb95e26574d0ea31e8 Mon Sep 17 00:00:00 2001 From: Faiyaz Mohammed Date: Fri, 8 May 2020 17:24:58 +0530 Subject: [PATCH] iommu/arm-smmu: Updates probe defer handle from secure_buffer - If probe_defer from secure_buffer received, we are raising the below warning from arm_smmu_assign_table. arm_smmu_assign_table+0x124/0x130arm_smmu_attach_dev+0x9c8/0x1098 iommu_group_add_device+0x1ac/0x460 iommu_group_get_for_dev+0xc4/0x2b4 arm_smmu_add_device+0x330/0x4f8 iommu_probe_device+0x98/0x110 of_iommu_configure+0xac/0x1b4 of_dma_configure+0x198/0x320 platform_dma_configure+0x1c/0x30 really_probe+0x234/0x8a8 driver_probe_device+0x70/0x144 __device_attach_driver+0x138/0x1fc bus_for_each_drv+0xa4/0x120 - with this change we will be clearing the smmu domain, if probe_defer from secure_buffer driver received. Change-Id: Iad8a262e7d0ec8f49d94f521c4d43d3ec6931c8d Signed-off-by: Faiyaz Mohammed --- drivers/iommu/arm-smmu.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index aaf9cf59dca9..678f648f491d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1992,7 +1992,11 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, * during alloc_io_pgtable_ops */ arm_smmu_secure_domain_lock(smmu_domain); - arm_smmu_assign_table(smmu_domain); + ret = arm_smmu_assign_table(smmu_domain); + if (ret == -EPROBE_DEFER) { + arm_smmu_secure_domain_unlock(smmu_domain); + goto out_clear_smmu; + } arm_smmu_secure_domain_unlock(smmu_domain); /* Update the domain's page sizes to reflect the page table format */ @@ -2480,6 +2484,10 @@ static int arm_smmu_assign_table(struct arm_smmu_domain *smmu_domain) ret = hyp_assign_phys(virt_to_phys(pte_info->virt_addr), PAGE_SIZE, &source_vmid, 1, dest_vmids, dest_perms, 2); + + if (ret == -EPROBE_DEFER) + return ret; + if (WARN_ON(ret)) break; } @@ -2507,6 +2515,10 @@ static void arm_smmu_unassign_table(struct arm_smmu_domain *smmu_domain) ret = hyp_assign_phys(virt_to_phys(pte_info->virt_addr), PAGE_SIZE, source_vmlist, 2, &dest_vmids, &dest_perms, 1); + + if (ret == -EPROBE_DEFER) + return; + if (WARN_ON(ret)) break; free_pages_exact(pte_info->virt_addr, pte_info->size);