aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2016-07-22 19:47:58 -0400
committerMax Filippov <jcmvbkbc@gmail.com>2016-07-23 23:33:59 -0400
commit3de00482b006daa110151ac6775adc52538a3d6a (patch)
treebd7a17e41872fdd386b5f548af88ee626fcdaba6
parenta9f2fc628e3a26a829fd79aff74eb49839d1e74b (diff)
xtensa: minimize use of PLATFORM_DEFAULT_MEM_{ADDR,SIZE}
Now that the kernel load address and KSEG physical base address have their own Kconfig symbols PLATFORM_DEFAULT_MEM seems redundant. It makes little sense to use it in MMU configurations instead of KSEG_PADDR. In noMMU configurations there's no explicit KSEG, so it's still useful for the early cache initialization and definition of ARCH_PFN_OFFSET, which affects mem_map size. - limit it to noMMU; MMU variants have XCHAL_KSEG_PADDR and XCHAL_KSEG_SIZE; - don't use it to define TASK_SIZE or MAX_LOW_PFN: first doesn't make any difference in noMMU, second is meaningless as there's no high memory; - don't add default physical memory region: memory layout should come from the DT, bootloader tags, or memmap= command line parameter. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r--arch/xtensa/Kconfig18
-rw-r--r--arch/xtensa/include/asm/page.h9
-rw-r--r--arch/xtensa/include/asm/processor.h2
-rw-r--r--arch/xtensa/kernel/setup.c13
4 files changed, 12 insertions, 30 deletions
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 9b1f8c3c8cba..7a4c77b39ce0 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -394,7 +394,7 @@ config XTENSA_PLATFORM_XT2000
394config XTENSA_PLATFORM_XTFPGA 394config XTENSA_PLATFORM_XTFPGA
395 bool "XTFPGA" 395 bool "XTFPGA"
396 select ETHOC if ETHERNET 396 select ETHOC if ETHERNET
397 select PLATFORM_WANT_DEFAULT_MEM 397 select PLATFORM_WANT_DEFAULT_MEM if !MMU
398 select SERIAL_CONSOLE 398 select SERIAL_CONSOLE
399 select XTENSA_CALIBRATE_CCOUNT 399 select XTENSA_CALIBRATE_CCOUNT
400 help 400 help
@@ -502,11 +502,9 @@ config DEFAULT_MEM_START
502 default 0x00000000 if MMU 502 default 0x00000000 if MMU
503 default 0x60000000 if !MMU 503 default 0x60000000 if !MMU
504 help 504 help
505 This is a fallback start address of the default memory area, it is 505 This is the base address of the default memory area.
506 used when no physical memory size is passed through DTB or through 506 Default memory area has platform-specific meaning, it may be used
507 boot parameter from bootloader. 507 for e.g. early cache initialization.
508
509 It's also used for TASK_SIZE calculation in noMMU configuration.
510 508
511 If unsure, leave the default value here. 509 If unsure, leave the default value here.
512 510
@@ -515,11 +513,9 @@ config DEFAULT_MEM_SIZE
515 depends on PLATFORM_WANT_DEFAULT_MEM 513 depends on PLATFORM_WANT_DEFAULT_MEM
516 default 0x04000000 514 default 0x04000000
517 help 515 help
518 This is a fallback size of the default memory area, it is used when 516 This is the size of the default memory area.
519 no physical memory size is passed through DTB or through boot 517 Default memory area has platform-specific meaning, it may be used
520 parameter from bootloader. 518 for e.g. early cache initialization.
521
522 It's also used for TASK_SIZE calculation in noMMU configuration.
523 519
524 If unsure, leave the default value here. 520 If unsure, leave the default value here.
525 521
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h
index 3b5a49dbf8b2..976b1d70edbc 100644
--- a/arch/xtensa/include/asm/page.h
+++ b/arch/xtensa/include/asm/page.h
@@ -31,10 +31,9 @@
31#define MAX_LOW_PFN (PHYS_PFN(XCHAL_KSEG_PADDR) + \ 31#define MAX_LOW_PFN (PHYS_PFN(XCHAL_KSEG_PADDR) + \
32 PHYS_PFN(XCHAL_KSEG_SIZE)) 32 PHYS_PFN(XCHAL_KSEG_SIZE))
33#else 33#else
34#define PAGE_OFFSET __XTENSA_UL_CONST(0) 34#define PAGE_OFFSET PLATFORM_DEFAULT_MEM_START
35#define PHYS_OFFSET __XTENSA_UL_CONST(0) 35#define PHYS_OFFSET PLATFORM_DEFAULT_MEM_START
36#define MAX_LOW_PFN (PHYS_PFN(PLATFORM_DEFAULT_MEM_START) + \ 36#define MAX_LOW_PFN PHYS_PFN(0xfffffffful)
37 PHYS_PFN(PLATFORM_DEFAULT_MEM_SIZE))
38#endif 37#endif
39 38
40#define PGTABLE_START 0x80000000 39#define PGTABLE_START 0x80000000
@@ -163,7 +162,7 @@ void copy_user_highpage(struct page *to, struct page *from,
163 * addresses. 162 * addresses.
164 */ 163 */
165 164
166#define ARCH_PFN_OFFSET (PLATFORM_DEFAULT_MEM_START >> PAGE_SHIFT) 165#define ARCH_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
167 166
168#define __pa(x) \ 167#define __pa(x) \
169 ((unsigned long) (x) - PAGE_OFFSET + PHYS_OFFSET) 168 ((unsigned long) (x) - PAGE_OFFSET + PHYS_OFFSET)
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index d2e40d39c615..b42d68bfe3cf 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -37,7 +37,7 @@
37#ifdef CONFIG_MMU 37#ifdef CONFIG_MMU
38#define TASK_SIZE __XTENSA_UL_CONST(0x40000000) 38#define TASK_SIZE __XTENSA_UL_CONST(0x40000000)
39#else 39#else
40#define TASK_SIZE (PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE) 40#define TASK_SIZE __XTENSA_UL_CONST(0xffffffff)
41#endif 41#endif
42 42
43#define STACK_TOP TASK_SIZE 43#define STACK_TOP TASK_SIZE
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 9735691f37f1..0e59b8900e6a 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -188,7 +188,6 @@ static int __init parse_bootparam(const bp_tag_t* tag)
188} 188}
189 189
190#ifdef CONFIG_OF 190#ifdef CONFIG_OF
191bool __initdata dt_memory_scan = false;
192 191
193#if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY 192#if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY
194unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR; 193unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR;
@@ -228,9 +227,6 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
228 227
229void __init early_init_dt_add_memory_arch(u64 base, u64 size) 228void __init early_init_dt_add_memory_arch(u64 base, u64 size)
230{ 229{
231 if (!dt_memory_scan)
232 return;
233
234 size &= PAGE_MASK; 230 size &= PAGE_MASK;
235 add_sysmem_bank(base, base + size); 231 add_sysmem_bank(base, base + size);
236} 232}
@@ -242,9 +238,6 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
242 238
243void __init early_init_devtree(void *params) 239void __init early_init_devtree(void *params)
244{ 240{
245 if (sysmem.nr_banks == 0)
246 dt_memory_scan = true;
247
248 early_init_dt_scan(params); 241 early_init_dt_scan(params);
249 of_scan_flat_dt(xtensa_dt_io_area, NULL); 242 of_scan_flat_dt(xtensa_dt_io_area, NULL);
250 243
@@ -278,12 +271,6 @@ void __init init_arch(bp_tag_t *bp_start)
278 early_init_devtree(dtb_start); 271 early_init_devtree(dtb_start);
279#endif 272#endif
280 273
281 if (sysmem.nr_banks == 0) {
282 add_sysmem_bank(PLATFORM_DEFAULT_MEM_START,
283 PLATFORM_DEFAULT_MEM_START +
284 PLATFORM_DEFAULT_MEM_SIZE);
285 }
286
287#ifdef CONFIG_CMDLINE_BOOL 274#ifdef CONFIG_CMDLINE_BOOL
288 if (!command_line[0]) 275 if (!command_line[0])
289 strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE); 276 strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);