android_kernel_xiaomi_sm8350/arch/arm/plat-omap
Andrea Righi 27ac792ca0 PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures
On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

	u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT      12
#define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK       (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:21 -07:00
..
clock.c ARM: OMAP: CLKFW: Initial debugfs support for omap clock framework 2008-07-03 12:24:41 +03:00
common.c ARM: OMAP: Introduce omap_globals and prcm access functions for multi-omap 2008-07-03 12:24:44 +03:00
cpu-omap.c
debug-devices.c
debug-leds.c
devices.c ARM: OMAP: McBSP: Prepare for splitting into omap1 and omap2 code 2008-07-03 12:24:39 +03:00
dma.c ARM: OMAP: DMA: Clean-up code 2008-07-03 12:24:37 +03:00
dmtimer.c ARM: OMAP: DMTimer: Optimize by adding load and start 2008-07-03 12:24:30 +03:00
fb.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
gpio.c
i2c.c
Kconfig
mailbox.c arm: bus_id -> dev_name() and dev_set_name() conversions 2008-07-21 21:55:03 -07:00
mailbox.h
Makefile ARM: OMAP: SRAM: Move sram-fn.S from plat-omap to mach-omap1 2008-07-03 12:24:38 +03:00
mcbsp.c ARM: OMAP: McBSP: Prepare for splitting into omap1 and omap2 code 2008-07-03 12:24:39 +03:00
mux.c ARM: OMAP2: Clean-up mux code 2008-04-14 09:57:13 -07:00
ocpi.c
sram.c ARM: OMAP: SRAM: Split sram24xx.S into sram242x.S and sram243x.S 2008-07-03 12:24:38 +03:00
usb.c ARM: OMAP: USB: Change omap USB code to use omap_read/write instead of __REG 2008-07-03 12:24:43 +03:00