Skip to content

Commit bc0d9af

Browse files
Sam Protsenkojoergroedel
authored andcommitted
iommu/exynos: Reuse SysMMU constants for page size and order
Using SZ_4K in context of SysMMU driver is better than using PAGE_SIZE, as PAGE_SIZE might have different value on different platforms. Though it would be even better to use more specific constants, already existing in SysMMU driver. Make the code more strict by using SPAGE_ORDER and SPAGE_SIZE constants. It also makes sense, as __sysmmu_tlb_invalidate_entry() also uses SPAGE_* constants for further calculations with num_inv param, so it's logical that num_inv should be previously calculated using also SPAGE_* values. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/20220714165550.8884-2-semen.protsenko@linaro.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 3297724 commit bc0d9af

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iommu/exynos-iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static void __sysmmu_set_ptbase(struct sysmmu_drvdata *data, phys_addr_t pgd)
340340
if (MMU_MAJ_VER(data->version) < 5)
341341
writel(pgd, data->sfrbase + REG_PT_BASE_ADDR);
342342
else
343-
writel(pgd / SZ_4K, data->sfrbase + REG_V5_PT_BASE_PFN);
343+
writel(pgd >> SPAGE_ORDER, data->sfrbase + REG_V5_PT_BASE_PFN);
344344

345345
__sysmmu_tlb_invalidate(data);
346346
}
@@ -550,7 +550,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
550550
* 64KB page can be one of 16 consecutive sets.
551551
*/
552552
if (MMU_MAJ_VER(data->version) == 2)
553-
num_inv = min_t(unsigned int, size / SZ_4K, 64);
553+
num_inv = min_t(unsigned int, size / SPAGE_SIZE, 64);
554554

555555
if (sysmmu_block(data)) {
556556
__sysmmu_tlb_invalidate_entry(data, iova, num_inv);

0 commit comments

Comments
 (0)