* [PATCH] iommu/exynos: Make driver independent of the system page size
[not found] <CGME20220623093641eucas1p11732bf2c875960f7a2bb1d6fe053bc81@eucas1p1.samsung.com>
@ 2022-06-23 9:36 ` Marek Szyprowski
0 siblings, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2022-06-23 9:36 UTC (permalink / raw)
To: iommu, linux-samsung-soc; +Cc: Marek Szyprowski, Robin Murphy, Joerg Roedel
PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but
the driver expects values calculated as for 4KB pages. Fix this.
Reported-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
Untested, because Exynos based boards I have doesn't boot with non-4KB
page size for other reasons.
---
drivers/iommu/exynos-iommu.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 71f2018e23fe..9c060505a46e 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -340,8 +340,7 @@ static void __sysmmu_set_ptbase(struct sysmmu_drvdata *data, phys_addr_t pgd)
if (MMU_MAJ_VER(data->version) < 5)
writel(pgd, data->sfrbase + REG_PT_BASE_ADDR);
else
- writel(pgd >> PAGE_SHIFT,
- data->sfrbase + REG_V5_PT_BASE_PFN);
+ writel(pgd / SZ_4K, data->sfrbase + REG_V5_PT_BASE_PFN);
__sysmmu_tlb_invalidate(data);
}
@@ -551,7 +550,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
* 64KB page can be one of 16 consecutive sets.
*/
if (MMU_MAJ_VER(data->version) == 2)
- num_inv = min_t(unsigned int, size / PAGE_SIZE, 64);
+ num_inv = min_t(unsigned int, size / SZ_4K, 64);
if (sysmmu_block(data)) {
__sysmmu_tlb_invalidate_entry(data, iova, num_inv);
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] iommu/exynos: Make driver independent of the system page size
@ 2022-06-23 9:36 ` Marek Szyprowski
0 siblings, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2022-06-23 9:36 UTC (permalink / raw)
To: iommu, linux-samsung-soc; +Cc: Robin Murphy
PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but
the driver expects values calculated as for 4KB pages. Fix this.
Reported-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
Untested, because Exynos based boards I have doesn't boot with non-4KB
page size for other reasons.
---
drivers/iommu/exynos-iommu.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 71f2018e23fe..9c060505a46e 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -340,8 +340,7 @@ static void __sysmmu_set_ptbase(struct sysmmu_drvdata *data, phys_addr_t pgd)
if (MMU_MAJ_VER(data->version) < 5)
writel(pgd, data->sfrbase + REG_PT_BASE_ADDR);
else
- writel(pgd >> PAGE_SHIFT,
- data->sfrbase + REG_V5_PT_BASE_PFN);
+ writel(pgd / SZ_4K, data->sfrbase + REG_V5_PT_BASE_PFN);
__sysmmu_tlb_invalidate(data);
}
@@ -551,7 +550,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
* 64KB page can be one of 16 consecutive sets.
*/
if (MMU_MAJ_VER(data->version) == 2)
- num_inv = min_t(unsigned int, size / PAGE_SIZE, 64);
+ num_inv = min_t(unsigned int, size / SZ_4K, 64);
if (sysmmu_block(data)) {
__sysmmu_tlb_invalidate_entry(data, iova, num_inv);
--
2.17.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] iommu/exynos: Make driver independent of the system page size
2022-06-23 9:36 ` Marek Szyprowski
@ 2022-06-23 12:21 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-23 12:21 UTC (permalink / raw)
To: Marek Szyprowski, iommu, linux-samsung-soc; +Cc: Robin Murphy, Joerg Roedel
On 23/06/2022 11:36, Marek Szyprowski wrote:
> PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but
> the driver expects values calculated as for 4KB pages. Fix this.
>
> Reported-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Untested, because Exynos based boards I have doesn't boot with non-4KB
> page size for other reasons.
> ---
> drivers/iommu/exynos-iommu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iommu/exynos: Make driver independent of the system page size
@ 2022-06-23 12:21 ` Krzysztof Kozlowski
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-23 12:21 UTC (permalink / raw)
To: Marek Szyprowski, iommu, linux-samsung-soc; +Cc: Robin Murphy
On 23/06/2022 11:36, Marek Szyprowski wrote:
> PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but
> the driver expects values calculated as for 4KB pages. Fix this.
>
> Reported-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Untested, because Exynos based boards I have doesn't boot with non-4KB
> page size for other reasons.
> ---
> drivers/iommu/exynos-iommu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iommu/exynos: Make driver independent of the system page size
2022-06-23 9:36 ` Marek Szyprowski
@ 2022-06-23 12:25 ` Sam Protsenko
-1 siblings, 0 replies; 8+ messages in thread
From: Sam Protsenko @ 2022-06-23 12:25 UTC (permalink / raw)
To: Marek Szyprowski; +Cc: iommu, linux-samsung-soc, Robin Murphy, Joerg Roedel
Hi Marek,
On Thu, 23 Jun 2022 at 12:36, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but
> the driver expects values calculated as for 4KB pages. Fix this.
>
> Reported-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
with one note: SPAGE_SIZE and SPAGE_ORDER could be used instead of
SZ_4K. But that's just a matter of taste, I'm ok with that as is,
hence R-b tag.
Thanks!
> Untested, because Exynos based boards I have doesn't boot with non-4KB
> page size for other reasons.
> ---
> drivers/iommu/exynos-iommu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 71f2018e23fe..9c060505a46e 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -340,8 +340,7 @@ static void __sysmmu_set_ptbase(struct sysmmu_drvdata *data, phys_addr_t pgd)
> if (MMU_MAJ_VER(data->version) < 5)
> writel(pgd, data->sfrbase + REG_PT_BASE_ADDR);
> else
> - writel(pgd >> PAGE_SHIFT,
> - data->sfrbase + REG_V5_PT_BASE_PFN);
> + writel(pgd / SZ_4K, data->sfrbase + REG_V5_PT_BASE_PFN);
>
> __sysmmu_tlb_invalidate(data);
> }
> @@ -551,7 +550,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
> * 64KB page can be one of 16 consecutive sets.
> */
> if (MMU_MAJ_VER(data->version) == 2)
> - num_inv = min_t(unsigned int, size / PAGE_SIZE, 64);
> + num_inv = min_t(unsigned int, size / SZ_4K, 64);
>
> if (sysmmu_block(data)) {
> __sysmmu_tlb_invalidate_entry(data, iova, num_inv);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iommu/exynos: Make driver independent of the system page size
@ 2022-06-23 12:25 ` Sam Protsenko
0 siblings, 0 replies; 8+ messages in thread
From: Sam Protsenko @ 2022-06-23 12:25 UTC (permalink / raw)
To: Marek Szyprowski; +Cc: iommu, linux-samsung-soc, Robin Murphy
Hi Marek,
On Thu, 23 Jun 2022 at 12:36, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> PAGE_{SIZE,SHIFT} macros depend on the configured kernel's page size, but
> the driver expects values calculated as for 4KB pages. Fix this.
>
> Reported-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
with one note: SPAGE_SIZE and SPAGE_ORDER could be used instead of
SZ_4K. But that's just a matter of taste, I'm ok with that as is,
hence R-b tag.
Thanks!
> Untested, because Exynos based boards I have doesn't boot with non-4KB
> page size for other reasons.
> ---
> drivers/iommu/exynos-iommu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 71f2018e23fe..9c060505a46e 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -340,8 +340,7 @@ static void __sysmmu_set_ptbase(struct sysmmu_drvdata *data, phys_addr_t pgd)
> if (MMU_MAJ_VER(data->version) < 5)
> writel(pgd, data->sfrbase + REG_PT_BASE_ADDR);
> else
> - writel(pgd >> PAGE_SHIFT,
> - data->sfrbase + REG_V5_PT_BASE_PFN);
> + writel(pgd / SZ_4K, data->sfrbase + REG_V5_PT_BASE_PFN);
>
> __sysmmu_tlb_invalidate(data);
> }
> @@ -551,7 +550,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
> * 64KB page can be one of 16 consecutive sets.
> */
> if (MMU_MAJ_VER(data->version) == 2)
> - num_inv = min_t(unsigned int, size / PAGE_SIZE, 64);
> + num_inv = min_t(unsigned int, size / SZ_4K, 64);
>
> if (sysmmu_block(data)) {
> __sysmmu_tlb_invalidate_entry(data, iova, num_inv);
> --
> 2.17.1
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iommu/exynos: Make driver independent of the system page size
2022-06-23 9:36 ` Marek Szyprowski
@ 2022-07-06 10:58 ` Joerg Roedel
-1 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2022-07-06 10:58 UTC (permalink / raw)
To: Marek Szyprowski; +Cc: iommu, linux-samsung-soc, Robin Murphy
On Thu, Jun 23, 2022 at 11:36:29AM +0200, Marek Szyprowski wrote:
> drivers/iommu/exynos-iommu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iommu/exynos: Make driver independent of the system page size
@ 2022-07-06 10:58 ` Joerg Roedel
0 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2022-07-06 10:58 UTC (permalink / raw)
To: Marek Szyprowski; +Cc: iommu, linux-samsung-soc, Robin Murphy
On Thu, Jun 23, 2022 at 11:36:29AM +0200, Marek Szyprowski wrote:
> drivers/iommu/exynos-iommu.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Applied, thanks.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-07-06 10:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20220623093641eucas1p11732bf2c875960f7a2bb1d6fe053bc81@eucas1p1.samsung.com>
2022-06-23 9:36 ` [PATCH] iommu/exynos: Make driver independent of the system page size Marek Szyprowski
2022-06-23 9:36 ` Marek Szyprowski
2022-06-23 12:21 ` Krzysztof Kozlowski
2022-06-23 12:21 ` Krzysztof Kozlowski
2022-06-23 12:25 ` Sam Protsenko
2022-06-23 12:25 ` Sam Protsenko
2022-07-06 10:58 ` Joerg Roedel
2022-07-06 10:58 ` Joerg Roedel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.