Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56cbc415 authored by Neeti Desai's avatar Neeti Desai
Browse files

iommu/arm-smmu: Fix size parameter in .unprepare_pgtable()



The size parameter in .unprepare_pgtable() and arm_smmu_assign_table()
needs to be the same since the functions are complimentary.

Use PAGE_SIZE in both functions instead of relying on the calling
function for .unprepare_pgtable().

Change-Id: Ic6fade307360254329968e1b4548732d045b8205
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
parent f0331928
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -920,7 +920,7 @@ static void arm_smmu_flush_pgtable(void *addr, size_t size, void *cookie)
}

static void arm_smmu_prepare_pgtable(void *addr, void *cookie);
static void arm_smmu_unprepare_pgtable(void *cookie, void *addr, size_t size);
static void arm_smmu_unprepare_pgtable(void *cookie, void *addr);

static struct iommu_gather_ops arm_smmu_gather_ops = {
	.tlb_flush_all	= arm_smmu_tlb_inv_context,
@@ -1654,7 +1654,7 @@ static void arm_smmu_assign_table(struct arm_smmu_domain *smmu_domain)
	}
}

static void arm_smmu_unprepare_pgtable(void *cookie, void *addr, size_t size)
static void arm_smmu_unprepare_pgtable(void *cookie, void *addr)
{
	struct arm_smmu_domain *smmu_domain = cookie;
	int ret;
@@ -1665,7 +1665,7 @@ static void arm_smmu_unprepare_pgtable(void *cookie, void *addr, size_t size)
	if (smmu_domain->secure_vmid == VMID_INVAL)
		return;

	ret = hyp_assign_phys((phys_addr_t)virt_to_phys(addr), size,
	ret = hyp_assign_phys((phys_addr_t)virt_to_phys(addr), PAGE_SIZE,
			source_vmlist, 2, &dest_vmids, &dest_perms, 1);
	WARN_ON(ret);
}
+1 −2
Original line number Diff line number Diff line
@@ -413,8 +413,7 @@ static void __arm_lpae_free_pgtable(struct arm_lpae_io_pgtable *data, int lvl,
		__arm_lpae_free_pgtable(data, lvl + 1, iopte_deref(pte, data));
	}

	data->iop.cfg.tlb->unprepare_pgtable(data->iop.cookie, start,
								table_size);
	data->iop.cfg.tlb->unprepare_pgtable(data->iop.cookie, start);
	free_pages_exact(start, table_size);
}

+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ struct iommu_gather_ops {
	void (*tlb_sync)(void *cookie);
	void (*flush_pgtable)(void *ptr, size_t size, void *cookie);
	void (*prepare_pgtable)(void *addr, void *cookie);
	void (*unprepare_pgtable)(void *cookie, void *addr, size_t size);
	void (*unprepare_pgtable)(void *cookie, void *addr);
};

/**