Does kernel assume PHYS_OFFSET must be SECTION_SIZE aligned?

From: Min-Hua Chen
Date: Mon Nov 17 2014 - 09:57:36 EST


Hi,

I have a problem about kernel_x_start and kernel_x_end in map_lowmem.
If the start address of DRAM is 0x20000000 and PHYS_OFFSET is 0x20100000 (1MB)
and _start is 0xc0008000 and SECTION_SIZE is 0x200000 (2MB).
Let's say the memory between 0x20000000 and 0x20100000 is used by some H/W,
and not available for kernel.

According to current implementation:

unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);

Than we'll get kernel_x_start = round_down(__pa(0xc0008000), SECTION_SIZE)
= round_down(0x20008000, SECTION_SIZE)
= 0x20000000

In this case, 0x20000000 is not available for kernel memory.

Does kernel assume PHYS_OFFSET must be SECTION_SIZE aligned or we
should get kernel_x_start by rounding down _start first then convert
the virtual address to physical address.

phys_addr_t kernel_x_start = __pa(round_down(_stext, SECTION_SIZE));
phys_addr_t kernel_x_end = __pa(round_up(__init_end, SECTION_SIZE));

get kernel_x_start = __pa(round_down(0xc0008000, SECTION_SIZE))
= __pa(round_down(0xc0008000, SECTION_SIZE))
= __pa(0xc0000000)
= 0x20100000

thanks,
Min-Hua
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/