iommu/tegra: smmu: Fix unsleepable memory allocation
authorHiroshi DOYU <[email protected]>
Wed, 27 Jun 2012 09:54:01 +0000 (12:54 +0300)
committerJoerg Roedel <[email protected]>
Mon, 2 Jul 2012 09:56:44 +0000 (11:56 +0200)
allo_pdir() is called in smmu_iommu_domain_init() with spin_lock
held. memory allocations in it have to be atomic/unsleepable.

Signed-off-by: Hiroshi DOYU <[email protected]>
Reported-by: Chris Wright <[email protected]>
Acked-by: Chris Wright <[email protected]>
Cc: [email protected]
Signed-off-by: Joerg Roedel <[email protected]>
drivers/iommu/tegra-smmu.c

index ecd679043d7740e6883aae9cbee68da6321fedc1..3f3d09d560ea3c6ce5e3bc7d019e377ac9e63dfe 100644 (file)
@@ -550,13 +550,13 @@ static int alloc_pdir(struct smmu_as *as)
                return 0;
 
        as->pte_count = devm_kzalloc(smmu->dev,
-                    sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL);
+                    sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC);
        if (!as->pte_count) {
                dev_err(smmu->dev,
                        "failed to allocate smmu_device PTE cunters\n");
                return -ENOMEM;
        }
-       as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA);
+       as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA);
        if (!as->pdir_page) {
                dev_err(smmu->dev,
                        "failed to allocate smmu_device page directory\n");