android_kernel_xiaomi_sdm845/include/asm-powerpc
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
..
iseries
8xx_immap.h
8253pit.h
a.out.h
abs_addr.h
agp.h
asm-compat.h powerpc: Add a #define for aligning to a long-sized boundary 2008-07-22 10:39:34 +10:00
atomic.h
auxvec.h
backlight.h
bitops.h
bootx.h
btext.h
bug.h
bugs.h
byteorder.h
cache.h powerpc/booke: Add support for new e500mc core 2008-06-18 16:17:56 -05:00
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
clk_interface.h
code-patching.h powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
compat.h
cpm1.h powerpc/cpm: Remove !CONFIG_PPC_CPM_NEW_BINDING code 2008-06-26 01:49:06 -05:00
cpm2.h powerpc/cpm: Remove !CONFIG_PPC_CPM_NEW_BINDING code 2008-06-26 01:49:06 -05:00
cpm.h powerpc/QE: switch to the cpm_muram implementation 2008-06-10 11:11:21 -05:00
cputable.h powerpc: Add PPC_FEATURE_PSERIES_PERFMON_COMPAT 2008-07-15 12:24:57 +10:00
cputhreads.h
cputime.h
current.h
dbdma.h
dcr-generic.h [POWERPC] Refactor DCR code 2008-05-29 07:06:56 -05:00
dcr-mmio.h [POWERPC] Refactor DCR code 2008-05-29 07:06:56 -05:00
dcr-native.h [POWERPC] Refactor DCR code 2008-05-29 07:06:56 -05:00
dcr-regs.h
dcr.h [POWERPC] Refactor DCR code 2008-05-29 07:06:56 -05:00
delay.h
device.h
div64.h
dma-mapping.h powerpc: move device_to_mask() to dma-mapping.h 2008-07-09 16:30:44 +10:00
dma.h
edac.h
eeh_event.h
eeh.h
elf.h powerpc: Remove old dump_task_* functions 2008-07-03 16:58:13 +10:00
emergency-restart.h
errno.h
exception.h
fb.h
fcntl.h
feature-fixups.h powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
firmware.h powerpc: Consolidate CPU and firmware feature fixup macros 2008-07-01 11:28:25 +10:00
fixmap.h
floppy.h
fs_pd.h
fsl_gtm.h powerpc/sysdev: implement FSL GTM support 2008-06-10 10:38:50 -05:00
fsl_lbc.h
ftrace.h ftrace: store mcount address in rec->ip 2008-06-23 22:10:56 +02:00
futex.h
gpio.h
grackle.h
hardirq.h
heathrow.h
highmem.h
hugetlb.h powerpc: support multiple hugepage sizes 2008-07-24 10:47:19 -07:00
hvcall.h
hvconsole.h
hvcserver.h
hw_irq.h ftrace, POWERPC: add irqs_disabled_flags to ppc 2008-05-23 22:37:23 +02:00
hydra.h
i8259.h
ibmebus.h
ide.h
immap_86xx.h
immap_cpm2.h
immap_qe.h
io-defs.h
io.h powerpc ioremap_prot 2008-07-24 10:47:15 -07:00
ioctl.h [POWERPC] Get most of ioctl.h content from <asm-generic/ioctl.h> 2008-05-16 23:22:28 +10:00
ioctls.h
iommu.h powerpc/dma: implement new dma_*map*_attrs() interfaces 2008-07-09 16:30:43 +10:00
ipcbuf.h
ipic.h
irq_regs.h
irq.h [POWERPC] Move to runtime allocated exception stacks 2008-06-02 14:54:42 -05:00
irqflags.h
Kbuild powerpc: mman.h export fixups 2008-07-15 12:24:53 +10:00
kdebug.h
kdump.h
kexec.h powerpc: Provide dummy crash_shutdown_register 2008-06-30 22:30:55 +10:00
keylargo.h
kgdb.h kgdb, powerpc: arch specific powerpc kgdb support 2008-07-23 11:30:15 -05:00
kmap_types.h
kprobes.h
kvm_asm.h
kvm_host.h KVM: Add coalesced MMIO support (powerpc part) 2008-07-20 12:42:31 +03:00
kvm_para.h
kvm_ppc.h KVM: ppc: Remove duplicate function 2008-06-06 21:22:09 +03:00
kvm.h
libata-portmap.h
linkage.h
lmb.h
local.h
lppaca.h
lv1call.h
machdep.h powerpc/dma: Use the struct dma_attrs in iommu code 2008-07-22 10:39:32 +10:00
macio.h
mc146818rtc.h
mediabay.h [POWERPC] Build fix for drivers/macintosh/mediabay.c 2008-06-16 15:00:47 +10:00
mman.h powerpc: mman.h export fixups 2008-07-15 12:24:53 +10:00
mmu_context.h
mmu-8xx.h
mmu-40x.h
mmu-44x.h
mmu-fsl-booke.h
mmu-hash32.h powerpc: Get rid of bitfields in ppc_bat struct 2008-06-30 22:31:05 +10:00
mmu-hash64.h powerpc: support multiple hugepage sizes 2008-07-24 10:47:19 -07:00
mmu.h
mmzone.h
module.h
mpc6xx.h [POWERPC] Add 6xx-style HID0_SLEEP support. 2008-05-16 23:22:28 +10:00
mpc8xx.h
mpc52xx_psc.h
mpc52xx.h
mpc86xx.h
mpc512x.h
mpc8260.h
mpic.h Merge branch 'merge' into powerpc-next 2008-05-23 16:53:23 +10:00
msgbuf.h
mutex.h
namei.h
nvram.h
of_device.h [POWERPC] Move of_device_get_modalias to drivers/of 2008-05-16 23:22:28 +10:00
of_platform.h
ohare.h
oprofile_impl.h
paca.h
page_32.h
page_64.h powerpc: support multiple hugepage sizes 2008-07-24 10:47:19 -07:00
page.h PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
param.h
parport.h
pasemi_dma.h
pci-bridge.h powerpc/4xx: Workaround for PPC440EPx/GRx PCI_28 Errata 2008-06-17 19:01:38 -04:00
pci.h
percpu.h
pgalloc-32.h
pgalloc-64.h powerpc: support multiple hugepage sizes 2008-07-24 10:47:19 -07:00
pgalloc.h
pgtable-4k.h powerpc ioremap_prot 2008-07-24 10:47:15 -07:00
pgtable-64k.h powerpc: define support for 16G hugepages 2008-07-24 10:47:19 -07:00
pgtable-ppc32.h powerpc ioremap_prot 2008-07-24 10:47:15 -07:00
pgtable-ppc64.h powerpc ioremap_prot 2008-07-24 10:47:15 -07:00
pgtable.h
phyp_dump.h
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h powerpc/cell: Add support for power button of future IBM cell blades 2008-07-22 10:39:32 +10:00
poll.h
posix_types.h
ppc4xx.h
ppc_asm.h powerpc: Add VSX assembler code macros 2008-07-01 11:28:48 +10:00
ppc-pci.h
processor.h powerpc: Implement task_pt_regs() accessor 2008-07-09 16:30:44 +10:00
prom.h powerpc: Implement OF PCI address accessors stubs for CONFIG_PCI=n 2008-06-30 22:30:51 +10:00
ps3.h powerpc/ps3: Add a sub-match id to ps3_system_bus 2008-07-22 10:39:33 +10:00
ps3av.h
ps3fb.h
ps3stor.h
pSeries_reconfig.h powerpc/pseries: Update the device tree correctly for drconf memory add/remove 2008-07-03 16:58:16 +10:00
ptrace.h powerpc: Add VSX context save/restore, ptrace and signal support 2008-07-01 11:28:50 +10:00
qe_ic.h
qe.h powerpc/QE: use arch_initcall to probe QUICC Engine GPIOs 2008-06-26 01:49:09 -05:00
reg_8xx.h
reg_booke.h powerpc/e500mc: flush L2 on NAP for e500mc 2008-06-26 01:49:03 -05:00
reg_fsl_emb.h
reg.h powerpc/mpc83xx: Power Management support 2008-07-16 17:57:30 -05:00
resource.h
rheap.h
rio.h
rtas.h
rtc.h
rwsem.h
scatterlist.h
seccomp.h
sections.h
semaphore.h
sembuf.h
serial.h
setjmp.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h powerpc: Add VSX context save/restore, ptrace and signal support 2008-07-01 11:28:50 +10:00
siginfo.h
signal.h
smp.h Merge commit 'origin/master' 2008-07-16 11:07:59 +10:00
smu.h
socket.h
sockios.h
sparsemem.h powerpc: Fix building of arch/powerpc/mm/mem.o when MEMORY_HOTPLUG=y and SPARSEMEM=n 2008-07-03 16:58:07 +10:00
spinlock_types.h
spinlock.h powerpc: Make sure that include/asm-powerpc/spinlock.h does not trigger compilation warnings 2008-07-01 11:29:00 +10:00
spu_csa.h powerpc/spufs: remove class_0_dsisr from spu exception handling 2008-06-16 14:35:00 +10:00
spu_info.h
spu_priv1.h
spu.h powerpc/spufs: add atomic busy_spus counter to struct cbe_spu_info 2008-07-09 16:30:42 +10:00
sstep.h
stat.h
statfs.h
string.h
suspend.h
synch.h powerpc: Fixup lwsync at runtime 2008-07-03 16:58:10 +10:00
syscalls.h
systbl.h
system.h powerpc: fix giveup_vsx to save registers correctly 2008-07-15 12:29:23 +10:00
tce.h
termbits.h
termios.h
thread_info.h [POWERPC] Defer processing of interrupts when the CPU wakes from sleep mode 2008-05-16 23:22:28 +10:00
time.h [POWERPC] Fix sparse warnings in arch/powerpc/kernel 2008-05-14 22:31:59 +10:00
timex.h powerpc: Introduce infrastructure for feature sections with alternatives 2008-07-01 11:28:28 +10:00
tlb.h
tlbflush.h
topology.h
tsi108_irq.h
tsi108_pci.h
tsi108.h
types.h
uaccess.h powerpc: Use PPC_LONG_ALIGN in uaccess.h 2008-07-22 10:39:35 +10:00
ucc_fast.h powerpc: Fix a bunch of sparse warnings in the qe_lib 2008-07-16 17:57:45 -05:00
ucc_slow.h
ucc.h
ucontext.h
udbg.h
uic.h
unaligned.h
uninorth.h
unistd.h
user.h
vdso_datapage.h
vdso.h
vga.h
vio.h
xilinx_intc.h
xmon.h [POWERPC] Make cpus_in_xmon static and remove extern mess from hvc_console.c 2008-05-14 22:31:57 +10:00
xor.h