summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>2017-08-15 14:13:54 -0400
committerVineet Gupta <vgupta@synopsys.com>2017-09-01 14:26:27 -0400
commit9ed68785f7f2b001a6911d64fbd10cfc6fa49b27 (patch)
tree57bf1ba37285d0a090eb52d24f15115f58d64e4f
parentbee91c3a3ce63daf64bb53ae60e6a2fb2961d3d7 (diff)
ARC: mm: Decouple RAM base address from kernel link address
[Needed for HSDK] Currently the first page of system (hence RAM base) is assumed to be @ CONFIG_LINUX_LINK_BASE, where kernel itself is linked. However is case of HSDK platform, for reasons explained in that patch, this is not true. kernel needs to be linked @ 0x9000_0000 while DDR is still wired at 0x8000_0000. To properly account for this 256M of RAM, we need to introduce a new option and base page frame accountiing off of it. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> [vgupta: renamed CONFIG_KERNEL_RAM_BASE_ADDRESS => CONFIG_LINUX_RAM_BASE : simplified changelog]
-rw-r--r--arch/arc/Kconfig10
-rw-r--r--arch/arc/boot/dts/axc001.dtsi2
-rw-r--r--arch/arc/boot/dts/axc003.dtsi2
-rw-r--r--arch/arc/boot/dts/axc003_idu.dtsi2
-rw-r--r--arch/arc/boot/dts/nsim_hs.dts2
-rw-r--r--arch/arc/include/asm/page.h2
-rw-r--r--arch/arc/mm/cache.c2
-rw-r--r--arch/arc/mm/init.c6
8 files changed, 18 insertions, 10 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7db85ab00c52..65b7549e17db 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -418,7 +418,7 @@ endif # ISA_ARCV2
418endmenu # "ARC CPU Configuration" 418endmenu # "ARC CPU Configuration"
419 419
420config LINUX_LINK_BASE 420config LINUX_LINK_BASE
421 hex "Linux Link Address" 421 hex "Kernel link address"
422 default "0x80000000" 422 default "0x80000000"
423 help 423 help
424 ARC700 divides the 32 bit phy address space into two equal halves 424 ARC700 divides the 32 bit phy address space into two equal halves
@@ -431,6 +431,14 @@ config LINUX_LINK_BASE
431 If you don't know what the above means, leave this setting alone. 431 If you don't know what the above means, leave this setting alone.
432 This needs to match memory start address specified in Device Tree 432 This needs to match memory start address specified in Device Tree
433 433
434config LINUX_RAM_BASE
435 hex "RAM base address"
436 default LINUX_LINK_BASE
437 help
438 By default Linux is linked at base of RAM. However in some special
439 cases (such as HSDK), Linux can't be linked at start of DDR, hence
440 this option.
441
434config HIGHMEM 442config HIGHMEM
435 bool "High Memory Support" 443 bool "High Memory Support"
436 select ARCH_DISCONTIGMEM_ENABLE 444 select ARCH_DISCONTIGMEM_ENABLE
diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi
index a380ffa1a458..fdc266504ada 100644
--- a/arch/arc/boot/dts/axc001.dtsi
+++ b/arch/arc/boot/dts/axc001.dtsi
@@ -99,7 +99,7 @@
99 99
100 memory { 100 memory {
101 device_type = "memory"; 101 device_type = "memory";
102 /* CONFIG_KERNEL_RAM_BASE_ADDRESS needs to match low mem start */ 102 /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
103 reg = <0x0 0x80000000 0x0 0x1b000000>; /* (512 - 32) MiB */ 103 reg = <0x0 0x80000000 0x0 0x1b000000>; /* (512 - 32) MiB */
104 }; 104 };
105 105
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi
index dca7e39409be..4e6e9f57e790 100644
--- a/arch/arc/boot/dts/axc003.dtsi
+++ b/arch/arc/boot/dts/axc003.dtsi
@@ -109,7 +109,7 @@
109 109
110 memory { 110 memory {
111 device_type = "memory"; 111 device_type = "memory";
112 /* CONFIG_KERNEL_RAM_BASE_ADDRESS needs to match low mem start */ 112 /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
113 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MiB low mem */ 113 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MiB low mem */
114 0x1 0xc0000000 0x0 0x40000000>; /* 1 GiB highmem */ 114 0x1 0xc0000000 0x0 0x40000000>; /* 1 GiB highmem */
115 }; 115 };
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi b/arch/arc/boot/dts/axc003_idu.dtsi
index 5b56beffc1c5..63954a8b0100 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -115,7 +115,7 @@
115 115
116 memory { 116 memory {
117 device_type = "memory"; 117 device_type = "memory";
118 /* CONFIG_KERNEL_RAM_BASE_ADDRESS needs to match low mem start */ 118 /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
119 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MiB low mem */ 119 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MiB low mem */
120 0x1 0xc0000000 0x0 0x40000000>; /* 1 GiB highmem */ 120 0x1 0xc0000000 0x0 0x40000000>; /* 1 GiB highmem */
121 }; 121 };
diff --git a/arch/arc/boot/dts/nsim_hs.dts b/arch/arc/boot/dts/nsim_hs.dts
index 3772c40c245e..8d787b251f73 100644
--- a/arch/arc/boot/dts/nsim_hs.dts
+++ b/arch/arc/boot/dts/nsim_hs.dts
@@ -18,7 +18,7 @@
18 18
19 memory { 19 memory {
20 device_type = "memory"; 20 device_type = "memory";
21 /* CONFIG_LINUX_LINK_BASE needs to match low mem start */ 21 /* CONFIG_LINUX_RAM_BASE needs to match low mem start */
22 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MB low mem */ 22 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MB low mem */
23 0x1 0x00000000 0x0 0x40000000>; /* 1 GB highmem */ 23 0x1 0x00000000 0x0 0x40000000>; /* 1 GB highmem */
24 }; 24 };
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h
index 296c3426a6ad..109baa06831c 100644
--- a/arch/arc/include/asm/page.h
+++ b/arch/arc/include/asm/page.h
@@ -85,7 +85,7 @@ typedef pte_t * pgtable_t;
85 */ 85 */
86#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 86#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
87 87
88#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_LINK_BASE) 88#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_RAM_BASE)
89 89
90#ifdef CONFIG_FLATMEM 90#ifdef CONFIG_FLATMEM
91#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr) 91#define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index d68d36c15909..eee924dfffa6 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -1173,7 +1173,7 @@ noinline void __init arc_ioc_setup(void)
1173 write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2); 1173 write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2);
1174 1174
1175 /* for now assume kernel base is start of IOC aperture */ 1175 /* for now assume kernel base is start of IOC aperture */
1176 ioc_base = CONFIG_LINUX_LINK_BASE; 1176 ioc_base = CONFIG_LINUX_RAM_BASE;
1177 1177
1178 if (ioc_base % mem_sz != 0) 1178 if (ioc_base % mem_sz != 0)
1179 panic("IOC Aperture start must be aligned to the size of the aperture"); 1179 panic("IOC Aperture start must be aligned to the size of the aperture");
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 8c9415ed6280..ba145065c579 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -26,7 +26,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __aligned(PAGE_SIZE);
26char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE); 26char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE);
27EXPORT_SYMBOL(empty_zero_page); 27EXPORT_SYMBOL(empty_zero_page);
28 28
29static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE; 29static const unsigned long low_mem_start = CONFIG_LINUX_RAM_BASE;
30static unsigned long low_mem_sz; 30static unsigned long low_mem_sz;
31 31
32#ifdef CONFIG_HIGHMEM 32#ifdef CONFIG_HIGHMEM
@@ -63,7 +63,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
63 63
64 if (!low_mem_sz) { 64 if (!low_mem_sz) {
65 if (base != low_mem_start) 65 if (base != low_mem_start)
66 panic("CONFIG_LINUX_LINK_BASE != DT memory { }"); 66 panic("CONFIG_LINUX_RAM_BASE != DT memory { }");
67 67
68 low_mem_sz = size; 68 low_mem_sz = size;
69 in_use = 1; 69 in_use = 1;
@@ -161,7 +161,7 @@ void __init setup_arch_memory(void)
161 * We can't use the helper free_area_init(zones[]) because it uses 161 * We can't use the helper free_area_init(zones[]) because it uses
162 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong 162 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
163 * when our kernel doesn't start at PAGE_OFFSET, i.e. 163 * when our kernel doesn't start at PAGE_OFFSET, i.e.
164 * PAGE_OFFSET != CONFIG_LINUX_LINK_BASE 164 * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
165 */ 165 */
166 free_area_init_node(0, /* node-id */ 166 free_area_init_node(0, /* node-id */
167 zones_size, /* num pages per zone */ 167 zones_size, /* num pages per zone */