]> git.baikalelectronics.ru Git - kernel.git/commit
[ARM] Fix virtual to physical translation macro corner cases
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 12 Mar 2009 17:03:48 +0000 (17:03 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 Mar 2009 23:09:09 +0000 (23:09 +0000)
commit881cf5ba145f1c661c3cb0caeb02448d35211146
tree77444039536e70b3e9fbb38f686104cb5054aba3
parentb348eee09d56f5ea032e7d9c1a020468b42e25ca
[ARM] Fix virtual to physical translation macro corner cases

The current use of these macros works well when the conversion is
entirely linear.  In this case, we can be assured that the following
holds true:

__va(p + s) - s = __va(p)

However, this is not always the case, especially when there is a
non-linear conversion (eg, when there is a 3.5GB hole in memory.)
In this case, if 's' is the size of the region (eg, PAGE_SIZE) and
'p' is the final page, the above is most definitely not true.

So, we must ensure that __va() and __pa() are only used with valid
kernel direct mapped RAM addresses.  This patch tweaks the code
to achieve this.

Tested-by: Charles Moschel <fred99@carolina.rr.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/dma-mapping.c
arch/arm/mm/init.c
arch/arm/mm/mmap.c