Skip to contentSkip to conversation

arm: mach-k3: Let the compiler size the mem_map lists

PATCH Superseded Andrew Davis 2 participants 3 messages Nov 6, 2023 – Nov 22, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: mach-k3: Let the compiler size the mem_map lists

NR_MMU_REGIONS is a copy/paste from another platform that extends this list later. We do not do that, so let the list be the size of the initializer list.

---
 arch/arm/mach-k3/arm64-mmu.c | 34 ++++++----------------------------
 1 file changed, 6 insertions(+), 28 deletions(-)
arch/arm/mach-k3/arm64-mmu.c +6 -28
index f8087d2421e..471295fa7eb 100644
@@ -14,11 +14,7 @@
 #include <asm/armv8/mmu.h>
 
 #ifdef CONFIG_SOC_K3_AM654
-/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 5)
-
-/* ToDo: Add 64bit IO */
-struct mm_region am654_mem_map[NR_MMU_REGIONS] = {
+struct mm_region am654_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
@@ -69,11 +65,7 @@ struct mm_region *mem_map = am654_mem_map;
 #ifdef CONFIG_SOC_K3_J721E
 
 #ifdef CONFIG_TARGET_J721E_A72_EVM
-/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 6)
-
-/* ToDo: Add 64bit IO */
-struct mm_region j721e_mem_map[NR_MMU_REGIONS] = {
+struct mm_region j721e_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
@@ -128,10 +120,7 @@ struct mm_region *mem_map = j721e_mem_map;
 #endif /* CONFIG_TARGET_J721E_A72_EVM */
 
 #ifdef CONFIG_TARGET_J7200_A72_EVM
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 5)
-
-/* ToDo: Add 64bit IO */
-struct mm_region j7200_mem_map[NR_MMU_REGIONS] = {
+struct mm_region j7200_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
@@ -182,10 +171,7 @@ struct mm_region *mem_map = j7200_mem_map;
 #endif /* CONFIG_SOC_K3_J721E */
 
 #ifdef CONFIG_SOC_K3_J721S2
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 3)
-
-/* ToDo: Add 64bit IO */
-struct mm_region j721s2_mem_map[NR_MMU_REGIONS] = {
+struct mm_region j721s2_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
@@ -224,11 +210,7 @@ struct mm_region *mem_map = j721s2_mem_map;
 
 #if defined(CONFIG_SOC_K3_AM625) || defined(CONFIG_SOC_K3_AM62A7)
 
-/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 4)
-
-/* ToDo: Add 64bit IO */
-struct mm_region am62_mem_map[NR_MMU_REGIONS] = {
+struct mm_region am62_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
@@ -273,11 +255,7 @@ struct mm_region *mem_map = am62_mem_map;
 
 #ifdef CONFIG_SOC_K3_AM642
 
-/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
-#define NR_MMU_REGIONS	(CONFIG_NR_DRAM_BANKS + 4)
-
-/* ToDo: Add 64bit IO */
-struct mm_region am64_mem_map[NR_MMU_REGIONS] = {
+struct mm_region am64_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
Signature · 1 line
2.39.2
#1 lore raw
Quoted 8 lines · Andrew Davis

NR_MMU_REGIONS is a copy/paste from another platform that extends this list later. We do not do that, so let the list be the size of the initializer list.

---
 arch/arm/mach-k3/arm64-mmu.c | 34 ++++++----------------------------
 1 file changed, 6 insertions(+), 28 deletions(-)

Please redo this on top of current next as the other series that have gone in make this no longer apply, thanks.

Signature · 1 line
Tom
#2 lore raw
Quoted 6 lines · Tom Rini
Quoted 4 lines · Andrew Davis

NR_MMU_REGIONS is a copy/paste from another platform that extends this list later. We do not do that, so let the list be the size of the initializer list.

Quoted 8 lines
Quoted 4 lines
---
  arch/arm/mach-k3/arm64-mmu.c | 34 ++++++----------------------------
  1 file changed, 6 insertions(+), 28 deletions(-)

Please redo this on top of current next as the other series that have gone in make this no longer apply, thanks.

Sure, sending v2 now.

Andrew