Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3de00482 authored by Max Filippov's avatar Max Filippov
Browse files

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: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent a9f2fc62
Loading
Loading
Loading
Loading
+7 −11
Original line number Original line Diff line number Diff line
@@ -394,7 +394,7 @@ config XTENSA_PLATFORM_XT2000
config XTENSA_PLATFORM_XTFPGA
config XTENSA_PLATFORM_XTFPGA
	bool "XTFPGA"
	bool "XTFPGA"
	select ETHOC if ETHERNET
	select ETHOC if ETHERNET
	select PLATFORM_WANT_DEFAULT_MEM
	select PLATFORM_WANT_DEFAULT_MEM if !MMU
	select SERIAL_CONSOLE
	select SERIAL_CONSOLE
	select XTENSA_CALIBRATE_CCOUNT
	select XTENSA_CALIBRATE_CCOUNT
	help
	help
@@ -502,11 +502,9 @@ config DEFAULT_MEM_START
	default 0x00000000 if MMU
	default 0x00000000 if MMU
	default 0x60000000 if !MMU
	default 0x60000000 if !MMU
	help
	help
	  This is a fallback start address of the default memory area, it is
	  This is the base address of the default memory area.
	  used when no physical memory size is passed through DTB or through
	  Default memory area has platform-specific meaning, it may be used
	  boot parameter from bootloader.
	  for e.g. early cache initialization.

	  It's also used for TASK_SIZE calculation in noMMU configuration.


	  If unsure, leave the default value here.
	  If unsure, leave the default value here.


@@ -515,11 +513,9 @@ config DEFAULT_MEM_SIZE
	depends on PLATFORM_WANT_DEFAULT_MEM
	depends on PLATFORM_WANT_DEFAULT_MEM
	default 0x04000000
	default 0x04000000
	help
	help
	  This is a fallback size of the default memory area, it is used when
	  This is the size of the default memory area.
	  no physical memory size is passed through DTB or through boot
	  Default memory area has platform-specific meaning, it may be used
	  parameter from bootloader.
	  for e.g. early cache initialization.

	  It's also used for TASK_SIZE calculation in noMMU configuration.


	  If unsure, leave the default value here.
	  If unsure, leave the default value here.


+4 −5
Original line number Original line Diff line number Diff line
@@ -31,10 +31,9 @@
#define MAX_LOW_PFN	(PHYS_PFN(XCHAL_KSEG_PADDR) + \
#define MAX_LOW_PFN	(PHYS_PFN(XCHAL_KSEG_PADDR) + \
			 PHYS_PFN(XCHAL_KSEG_SIZE))
			 PHYS_PFN(XCHAL_KSEG_SIZE))
#else
#else
#define PAGE_OFFSET	__XTENSA_UL_CONST(0)
#define PAGE_OFFSET	PLATFORM_DEFAULT_MEM_START
#define PHYS_OFFSET	__XTENSA_UL_CONST(0)
#define PHYS_OFFSET	PLATFORM_DEFAULT_MEM_START
#define MAX_LOW_PFN	(PHYS_PFN(PLATFORM_DEFAULT_MEM_START) + \
#define MAX_LOW_PFN	PHYS_PFN(0xfffffffful)
			 PHYS_PFN(PLATFORM_DEFAULT_MEM_SIZE))
#endif
#endif


#define PGTABLE_START	0x80000000
#define PGTABLE_START	0x80000000
@@ -163,7 +162,7 @@ void copy_user_highpage(struct page *to, struct page *from,
 * addresses.
 * addresses.
 */
 */


#define ARCH_PFN_OFFSET		(PLATFORM_DEFAULT_MEM_START >> PAGE_SHIFT)
#define ARCH_PFN_OFFSET		(PHYS_OFFSET >> PAGE_SHIFT)


#define __pa(x)	\
#define __pa(x)	\
	((unsigned long) (x) - PAGE_OFFSET + PHYS_OFFSET)
	((unsigned long) (x) - PAGE_OFFSET + PHYS_OFFSET)
+1 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@
#ifdef CONFIG_MMU
#ifdef CONFIG_MMU
#define TASK_SIZE	__XTENSA_UL_CONST(0x40000000)
#define TASK_SIZE	__XTENSA_UL_CONST(0x40000000)
#else
#else
#define TASK_SIZE	(PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE)
#define TASK_SIZE	__XTENSA_UL_CONST(0xffffffff)
#endif
#endif


#define STACK_TOP	TASK_SIZE
#define STACK_TOP	TASK_SIZE
+0 −13
Original line number Original line Diff line number Diff line
@@ -188,7 +188,6 @@ static int __init parse_bootparam(const bp_tag_t* tag)
}
}


#ifdef CONFIG_OF
#ifdef CONFIG_OF
bool __initdata dt_memory_scan = false;


#if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY
#if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY
unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR;
unsigned 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,


void __init early_init_dt_add_memory_arch(u64 base, u64 size)
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
{
	if (!dt_memory_scan)
		return;

	size &= PAGE_MASK;
	size &= PAGE_MASK;
	add_sysmem_bank(base, base + size);
	add_sysmem_bank(base, base + size);
}
}
@@ -242,9 +238,6 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)


void __init early_init_devtree(void *params)
void __init early_init_devtree(void *params)
{
{
	if (sysmem.nr_banks == 0)
		dt_memory_scan = true;

	early_init_dt_scan(params);
	early_init_dt_scan(params);
	of_scan_flat_dt(xtensa_dt_io_area, NULL);
	of_scan_flat_dt(xtensa_dt_io_area, NULL);


@@ -278,12 +271,6 @@ void __init init_arch(bp_tag_t *bp_start)
	early_init_devtree(dtb_start);
	early_init_devtree(dtb_start);
#endif
#endif


	if (sysmem.nr_banks == 0) {
		add_sysmem_bank(PLATFORM_DEFAULT_MEM_START,
				PLATFORM_DEFAULT_MEM_START +
				PLATFORM_DEFAULT_MEM_SIZE);
	}

#ifdef CONFIG_CMDLINE_BOOL
#ifdef CONFIG_CMDLINE_BOOL
	if (!command_line[0])
	if (!command_line[0])
		strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
		strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);