* [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation
@ 2023-12-01 15:10 Sascha Hauer
2023-12-01 15:10 ` [PATCH 2/3] ARM64: mmu: panic when out of PTEs Sascha Hauer
2023-12-01 15:10 ` [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-12-01 15:10 UTC (permalink / raw)
To: Barebox List; +Cc: Alexander Shiyan
get_ttb() returns an uint64_t * which means that with
get_ttb() + idx * GRANULE_SIZE
the distance between two PTEs is wrongly calculated as 0x8000 bytes
instead of 0x1000 bytes. With this we leave the space allocated for PTEs
quite fast and the available space check also doesn't work.
Fix this by explicitly casting to void *.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/cpu/mmu_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index 716e717c72..d62527809e 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -45,7 +45,7 @@ static uint64_t *alloc_pte(void)
if (idx * GRANULE_SIZE >= ARM_EARLY_PAGETABLE_SIZE)
return NULL;
- return get_ttb() + idx * GRANULE_SIZE;
+ return (void *)get_ttb() + idx * GRANULE_SIZE;
}
#else
static uint64_t *alloc_pte(void)
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] ARM64: mmu: panic when out of PTEs
2023-12-01 15:10 [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation Sascha Hauer
@ 2023-12-01 15:10 ` Sascha Hauer
2023-12-01 15:10 ` [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-12-01 15:10 UTC (permalink / raw)
To: Barebox List; +Cc: Alexander Shiyan
When running out of PTEs panic with an appropriate message instead of
continuing with NULL pointers.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/cpu/mmu_64.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index d62527809e..12c4dc90b3 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -99,6 +99,9 @@ static void split_block(uint64_t *pte, int level)
levelshift = level2shift(level + 1);
new_table = alloc_pte();
+ if (!new_table)
+ panic("Unable to allocate PTE\n");
+
for (i = 0; i < MAX_PTE_ENTRIES; i++) {
new_table[i] = old_pte | (i << levelshift);
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex
2023-12-01 15:10 [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation Sascha Hauer
2023-12-01 15:10 ` [PATCH 2/3] ARM64: mmu: panic when out of PTEs Sascha Hauer
@ 2023-12-01 15:10 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-12-01 15:10 UTC (permalink / raw)
To: Barebox List; +Cc: Alexander Shiyan
Large decimal numbers are not readable and useful, print memory sizes in
hexadecimal instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-rockchip/dmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/dmc.c b/arch/arm/mach-rockchip/dmc.c
index e23eb92110..6bc9d9aabc 100644
--- a/arch/arm/mach-rockchip/dmc.c
+++ b/arch/arm/mach-rockchip/dmc.c
@@ -174,7 +174,7 @@ resource_size_t rk3588_ram0_size(void)
size1 = rockchip_sdram_size(sys_reg2, sys_reg3);
size2 = rockchip_sdram_size(sys_reg4, sys_reg5);
- pr_info("%s() size1 = %llu, size2 = %llu\n", __func__, (u64)size1, (u64)size2);
+ pr_info("%s() size1 = 0x%08llx, size2 = 0x%08llx\n", __func__, (u64)size1, (u64)size2);
size = min_t(resource_size_t, RK3568_INT_REG_START, size1 + size2);
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-01 15:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 15:10 [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation Sascha Hauer
2023-12-01 15:10 ` [PATCH 2/3] ARM64: mmu: panic when out of PTEs Sascha Hauer
2023-12-01 15:10 ` [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox