linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Does kernel assume PHYS_OFFSET must be SECTION_SIZE aligned?
@ 2014-11-17 14:57 Min-Hua Chen
  0 siblings, 0 replies; only message in thread
From: Min-Hua Chen @ 2014-11-17 14:57 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Santosh Shilimkar; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-17 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 14:57 Does kernel assume PHYS_OFFSET must be SECTION_SIZE aligned? Min-Hua Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).