linux/include/asm-powerpc
Paul Mackerras 721151d004 [POWERPC] Allow drivers to map individual 4k pages to userspace
Some drivers have resources that they want to be able to map into
userspace that are 4k in size.  On a kernel configured with 64k pages
we currently end up mapping the 4k we want plus another 60k of
physical address space, which could contain anything.  This can
introduce security problems, for example in the case of an infiniband
adaptor where the other 60k could contain registers that some other
program is using for its communications.

This patch adds a new function, remap_4k_pfn, which drivers can use to
map a single 4k page to userspace regardless of whether the kernel is
using a 4k or a 64k page size.  Like remap_pfn_range, it would
typically be called in a driver's mmap function.  It only maps a
single 4k page, which on a 64k page kernel appears replicated 16 times
throughout a 64k page.  On a 4k page kernel it reduces to a call to
remap_pfn_range.

The way this works on a 64k kernel is that a new bit, _PAGE_4K_PFN,
gets set on the linux PTE.  This alters the way that __hash_page_4K
computes the real address to put in the HPTE.  The RPN field of the
linux PTE becomes the 4k RPN directly rather than being interpreted as
a 64k RPN.  Since the RPN field is 32 bits, this means that physical
addresses being mapped with remap_4k_pfn have to be below 2^44,
i.e. 0x100000000000.

The patch also factors out the code in arch/powerpc/mm/hash_utils_64.c
that deals with demoting a process to use 4k pages into one function
that gets called in the various different places where we need to do
that.  There were some discrepancies between exactly what was done in
the various places, such as a call to spu_flush_all_slbs in one case
but not in others.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-04-13 03:55:18 +10:00
..
iseries [POWERPC] Refactor 64 bits DMA operations 2006-12-04 20:38:40 +11:00
8253pit.h
a.out.h [PATCH] powerpc: Merge include/asm-ppc*/a.out.h into include/asm-powerpc 2005-09-21 19:21:08 +10:00
abs_addr.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
agp.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
asm-compat.h [POWERPC] Use mtocrf instruction in asm when CONFIG_POWER4_ONLY=y 2007-04-13 03:55:13 +10:00
atomic.h [POWERPC] atomic.h: Add atomic64 cmpxchg, xchg and add_unless to powerpc 2007-02-16 14:00:20 +11:00
auxvec.h [PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel 2005-11-11 22:25:39 +11:00
backlight.h [PATCH] powermac: More powermac backlight fixes 2006-07-31 13:28:45 -07:00
bitops.h [PATCH] LOG2: Make powerpc's __ilog2_u64() take a 64-bit argument 2006-12-11 12:29:27 -08:00
bootx.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
btext.h [PATCH] powerpc: Unify udbg (#2) 2006-01-09 14:49:54 +11:00
bug.h [POWERPC] Fix manual assembly WARN_ON() in enter_rtas(). 2007-01-09 17:03:02 +11:00
bugs.h
byteorder.h [PATCH] powerpc: merge byteorder.h 2005-09-28 15:42:53 +10:00
cache.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cacheflush.h [PATCH] Optimize D-cache alias handling on fork 2006-12-13 09:27:08 -08:00
cell-pmu.h [POWERPC] cell: PPU Oprofile cleanup patch 2007-02-13 22:03:06 +01:00
checksum.h [NET]: POWERPC checksum annotations and cleanups. 2006-12-02 21:23:20 -08:00
compat.h [PATCH] powerpc signal __user annotations 2006-02-08 01:03:46 -05:00
cputable.h [POWERPC] Add PMC type to cputable 2007-02-07 14:03:19 +11:00
cputime.h [PATCH] powerpc: implement missing jiffies64_to_cputime64() 2006-07-05 09:39:54 -07:00
current.h [POWERPC] Include stddef.h in asm-powerpc/current.h to get offsetof 2007-03-09 15:03:24 +11:00
dbdma.h [POWERPC] Xserve cpu-meter driver 2006-12-04 20:39:30 +11:00
dcr-mmio.h [POWERPC] Generic DCR infrastructure 2006-12-04 16:08:25 +11:00
dcr-native.h [POWERPC] More DCR native fixups 2007-02-16 14:00:19 +11:00
dcr.h [POWERPC] Compile fixes for arch/powerpc dcr code 2007-02-07 14:03:23 +11:00
delay.h [POWERPC] Fix mdelay badness on shared processor partitions 2006-06-21 15:01:33 +10:00
device.h [POWERPC] Refactor 64 bits DMA operations 2006-12-04 20:38:40 +11:00
div64.h
dma-mapping.h [PATCH] dma-mapping.h stubs fix 2007-01-30 08:39:21 -08:00
dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
edac.h [POWERPC] EDAC ECC software scrubber 2007-03-09 15:03:25 +11:00
eeh_event.h [POWERPC] EEH: rm un-needed data 2007-03-22 22:52:55 +11:00
eeh.h [POWERPC] Merge 32 and 64 bits asm-powerpc/io.h 2006-12-04 20:39:05 +11:00
elf.h [POWERPC] Move ELF_ET_DYN_BASE up to 512MB point 2007-01-24 21:13:56 +11:00
emergency-restart.h
errno.h
fcntl.h
firmware.h [POWERPC] Only use H_BULK_REMOVE if the firmware supports it 2007-02-08 15:02:35 +11:00
floppy.h [PATCH] ANSIfy powerpc floppy.h 2007-03-14 15:27:50 -07:00
fs_pd.h [POWERPC] Fix kernel build errors for mpc8272ads and mpc8560ads 2007-02-07 14:03:20 +11:00
futex.h [PATCH] mm: pagefault_{disable,enable}() 2006-12-07 08:39:21 -08:00
grackle.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
hardirq.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
heathrow.h powerpc: Fix some #ifndef __KERNEL__ that should be #ifdef 2006-01-09 15:14:05 +11:00
hvcall.h [POWERPC] Avoid hypervisor statistics calculation in real mode 2007-03-22 15:01:43 +11:00
hvconsole.h [PATCH] powerpc: hvc_console updates 2006-03-28 16:45:26 +11:00
hvcserver.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
hw_irq.h [POWERPC] Delete unused irq functions on powerpc 2006-12-08 17:10:18 +11:00
i8259.h [POWERPC] Fix CHRP platforms with only 8259 2006-10-25 13:49:22 +10:00
ibmebus.h [POWERPC] ibmebus: dynamic addition/removal of adapters, some code cleanup 2007-03-16 16:38:19 +11:00
ide.h [POWERPC] Merge 32 and 64 bits asm-powerpc/io.h 2006-12-04 20:39:05 +11:00
immap_86xx.h [POWERPC] 86xx/85xx: Unify Freescale PCI Express memory map registers structure 2007-03-26 17:03:49 -05:00
immap_qe.h [POWERPC] qe: ucc_slow.guemr is in the wrong place 2007-03-29 14:33:56 -05:00
io-defs.h [POWERPC] Merge 32 and 64 bits asm-powerpc/io.h 2006-12-04 20:39:05 +11:00
io.h [POWERPC] Fix kernel build errors for mpc8272ads and mpc8560ads 2007-02-07 14:03:20 +11:00
ioctl.h
ioctls.h powerpc: remove duplicate ioctl definitions 2005-11-01 14:36:30 +11:00
iommu.h [POWERPC] pasemi: iommu support 2007-02-07 14:03:22 +11:00
ipc.h
ipcbuf.h [PATCH] powerpc: Keep fixing merged ipcbuf.h 2005-11-03 16:58:17 +11:00
ipic.h [POWERPC] 83xx: Return a point to the struct ipic from ipic_init() 2007-01-26 01:45:32 -06:00
irq_regs.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
irq.h [POWERPC] Add IRQ remapping hook 2007-01-24 21:13:59 +11:00
irqflags.h [PATCH] lockdep: irqtrace subsystem, core 2006-07-03 15:27:03 -07:00
Kbuild [PATCH] ps3: Virtual Frame Buffer Driver 2007-02-12 09:48:44 -08:00
kdebug.h [PATCH] Notify page fault call chain for powerpc 2006-06-26 09:58:22 -07:00
kdump.h [POWERPC] kdump: Support kernels having 64k page size. 2006-09-13 18:30:04 +10:00
kexec.h [POWERPC] Make crash.c work on 32-bit and 64-bit 2006-08-17 16:41:10 +10:00
keylargo.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
kmap_types.h [PATCH] powerpc: Merge kmap_types.h 2005-09-19 09:38:49 +10:00
kprobes.h [POWERPC] Added kprobes support to ppc32 2007-02-06 22:55:19 -06:00
libata-portmap.h Fix Maple PATA IRQ assignment. 2007-01-26 17:27:40 -05:00
linkage.h
lmb.h [PATCH] powerpc: Remove calculation of io hole 2006-03-22 15:04:30 +11:00
local.h
lppaca.h [POWERPC] Update lppaca offset comments 2006-08-08 17:08:58 +10:00
lv1call.h [POWERPC] ps3: add lv1 hvcalls 2006-12-04 20:40:44 +11:00
machdep.h [POWERPC] Merge 32 and 64 bits asm-powerpc/io.h 2006-12-04 20:39:05 +11:00
macio.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
mc146818rtc.h
mediabay.h powerpc: Merge various powermac-related header files. 2005-10-20 20:53:39 +10:00
mman.h [PATCH] add asm-generic/mman.h 2006-02-15 15:32:22 -08:00
mmu_context.h [POWERPC] Correct the MAX_CONTEXT definition 2006-06-29 16:16:15 +10:00
mmu.h [POWERPC] Celleb: htab routines 2007-02-07 14:03:21 +11:00
mmzone.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
module.h [POWERPC] Generic BUG for powerpc 2006-12-11 16:35:07 +11:00
mpc8xx.h [POWERPC] Add mpc866ads board-specific bits to arch/powerpc 2007-02-07 14:03:17 +11:00
mpc52xx.h [POWERPC] Add mpc52xx/lite5200 PCI support 2007-02-08 15:29:22 +11:00
mpc85xx.h [PATCH] ppc: Fix io.h for config with CONFIG_PCI not set 2006-11-13 14:49:25 +11:00
mpc86xx.h [POWERPC] Use mpc8641hpcn PIC base address from dev tree. 2006-08-25 14:32:13 +10:00
mpc8260.h [POWERPC] cpm2: CPM2 interrupt controller fix 2007-02-07 14:03:20 +11:00
mpic.h [POWERPC] MPIC: support more than 256 sources 2007-02-07 14:03:19 +11:00
msgbuf.h
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
namei.h
nvram.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
of_device.h [POWERPC] Add a unified uevent handler for bus based on of_device 2007-04-13 03:55:13 +10:00
of_platform.h [POWERPC] Souped-up of_platform_device support 2006-12-04 16:08:52 +11:00
ohare.h powerpc: Fix some #ifndef __KERNEL__ that should be #ifdef 2006-01-09 15:14:05 +11:00
oprofile_impl.h [POWERPC] Oprofile cleanup 2007-02-07 14:03:19 +11:00
paca.h [POWERPC] Minor paca optimisation 2007-03-21 22:35:51 +11:00
page_32.h [PATCH] LOG2: Provide ilog2() fallbacks for powerpc 2006-12-08 08:28:51 -08:00
page_64.h [PATCH] powerpc: Fix pagetable bloat for hugepages 2006-04-28 15:02:51 +10:00
page.h [POWERPC] Remove DISCONTIGMEM cruft from page.h 2006-09-22 15:19:58 +10:00
param.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
parport.h [PATCH] powerpc: parallel port init fix 2006-01-11 14:49:24 +11:00
pci-bridge.h [POWERPC] Add a field for each specific bus to struct pci_controller 2007-01-24 21:13:59 +11:00
pci.h [POWERPC] Create and use get_pci_dma_ops() 2007-03-09 15:03:25 +11:00
percpu.h [PATCH] lockdep: add per_cpu_offset() 2006-07-03 15:27:00 -07:00
pgalloc.h [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
pgtable-4k.h [POWERPC] Allow drivers to map individual 4k pages to userspace 2007-04-13 03:55:18 +10:00
pgtable-64k.h [POWERPC] Allow drivers to map individual 4k pages to userspace 2007-04-13 03:55:18 +10:00
pgtable.h [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
pmac_feature.h [PATCH] powerpc: Kill _machine and hard-coded platform numbers 2006-03-28 23:15:54 +11:00
pmac_low_i2c.h [PATCH] 3/5 powerpc: Add platform functions interpreter 2006-01-09 15:47:18 +11:00
pmac_pfunc.h typo fixes: mecanism -> mechanism 2006-06-30 18:20:44 +02:00
pmc.h [POWERPC] Fix oprofile support for e500 in arch/powerpc 2006-11-01 14:52:48 +11:00
pmi.h [POWERPC] Add PMI driver for cell blade 2007-02-16 14:00:19 +11:00
poll.h [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
posix_types.h [PATCH] FD_ZERO build fix 2007-01-11 18:18:22 -08:00
ppc_asm.h [POWERPC] Cell timebase bug workaround 2006-10-25 11:54:18 +10:00
ppc-pci.h [POWERPC] EEH: wait for slot status 2007-03-22 22:52:54 +11:00
processor.h [POWERPC] Remove last_syscall 2007-03-22 22:52:58 +11:00
prom.h [POWERPC] Make struct property's value a void * 2007-04-13 03:55:18 +10:00
ps3.h [POWERPC] PS3: System manager support 2007-02-16 14:00:19 +11:00
ps3av.h [PATCH] ps3: AV Settings Driver 2007-02-12 09:48:44 -08:00
ps3fb.h [PATCH] ps3: cleanup ps3fb before clearing HPTE 2007-02-12 09:48:44 -08:00
pSeries_reconfig.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
ptrace.h [PATCH] Add regs_return_value() helper 2006-10-02 07:57:16 -07:00
qe_ic.h [POWERPC] Add QUICC Engine (QE) infrastructure 2006-10-04 15:24:27 +10:00
qe.h [POWERPC] Add QUICC Engine (QE) infrastructure 2006-10-04 15:24:27 +10:00
reg_8xx.h [PATCH] powerpc: Merge cacheflush.h and cache.h 2005-11-10 13:09:22 +11:00
reg.h [POWERPC] pasemi: SMP timebase sync 2007-02-07 14:03:22 +11:00
resource.h
rtas.h [POWERPC] Add rtas_service_present() helper 2006-12-08 17:10:22 +11:00
rtc.h powerpc: Make set_rtc_time() return error code from lower-level function 2005-10-22 15:57:55 +10:00
rwsem.h [PATCH] lockdep: remove RWSEM_DEBUG remnants 2006-07-03 15:27:01 -07:00
scatterlist.h [PATCH] powerpc: merge scatterlist.h 2005-10-27 16:45:52 +10:00
seccomp.h powerpc: Fix some #ifndef __KERNEL__ that should be #ifdef 2006-01-09 15:14:05 +11:00
sections.h [PATCH] powerpc: sanitize header files for user space includes 2006-01-09 15:13:08 +11:00
semaphore.h Merge ../linux-2.6 by hand 2005-10-31 13:37:12 +11:00
sembuf.h
serial.h powerpc: Introduce a new config symbol to control 16550 early debug code 2006-01-10 16:19:05 +11:00
setup.h [PATCH] cleanup asm/setup.h userspace visibility 2006-12-07 08:39:46 -08:00
shmbuf.h
shmparam.h
sigcontext.h powerpc: merge sigcontext.h 2005-11-03 16:24:25 +11:00
siginfo.h
signal.h [PATCH] irq-flags: POWERPC: Use the new IRQF_ constants 2006-07-02 13:58:47 -07:00
smp.h [POWERPC] Celleb: basic support 2007-02-07 14:03:21 +11:00
smu.h [POWERPC] powermac: Constify & voidify get_property() 2006-07-31 15:55:05 +10:00
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h
sparsemem.h [POWERPC] ps3: add lpar addressing 2006-12-04 20:40:52 +11:00
spinlock_types.h [PATCH] powerpc: merge include/asm-ppc*/spinlock_types.h into include/asm-powerpc/spinlock_types.h 2005-09-21 19:21:09 +10:00
spinlock.h [PATCH] Directed yield: direct yield of spinlocks for powerpc 2006-10-01 00:39:22 -07:00
spu_csa.h [POWERPC] Fix spu SLB invalidations 2007-03-10 00:07:50 +01:00
spu_info.h [POWERPC] spufs: Add /lslr, /dma_info and /proxydma files 2006-12-04 20:39:45 +11:00
spu_priv1.h [POWERPC] Celleb: consolidate spu management ops 2007-02-07 14:03:21 +11:00
spu.h [POWERPC] Fix spu SLB invalidations 2007-03-10 00:07:50 +01:00
sstep.h [POWERPC] Added kprobes support to ppc32 2007-02-06 22:55:19 -06:00
stat.h powerpc: merge stat.h 2005-11-03 16:02:23 +11:00
statfs.h [PATCH] powerpc: merge include/asm-ppc*/statfs.h into include/asm-powerpc/statfs.h 2005-09-21 19:21:10 +10:00
string.h powerpc: fix strncasecmp prototype 2006-03-25 09:41:40 -08:00
synch.h [PATCH] powerpc: newline for ISYNC_ON_SMP 2006-02-24 14:06:00 +11:00
syscalls.h [PATCH] powerpc: declare arch syscalls in <asm/syscalls.h> 2006-03-27 14:48:22 +11:00
systbl.h [POWERPC] sys_move_pages should be callable from an SPU 2007-03-12 15:48:35 +11:00
system.h [POWERPC] Fix rmb() for e500-based machines it 2006-11-01 14:52:48 +11:00
tce.h [POWERPC] Use 4kB iommu pages even on 64kB-page systems 2006-11-01 14:52:48 +11:00
termbits.h [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
termios.h [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
thread_info.h [PATCH] PM: Fix SMP races in the freezer 2006-12-13 09:05:49 -08:00
time.h [POWERPC] 8xx: powerpc port of core CPM PIC 2007-02-07 14:03:17 +11:00
timex.h [POWERPC] Cell timebase bug workaround 2006-10-25 11:54:18 +10:00
tlb.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
tlbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
topology.h [PATCH] sched: remove SMT nice 2007-03-05 07:57:51 -08:00
tsi108_irq.h [POWERPC] Update mpc7448hpc2 board irq support using device tree 2006-08-23 15:51:18 +10:00
tsi108.h [POWERPC] include/asm-powerpc/: "extern inline" -> "static inline" 2006-12-04 20:41:26 +11:00
types.h [PATCH] Centralise definitions of sector_t and blkcnt_t 2006-12-04 19:41:15 -08:00
uaccess.h [POWERPC] include/asm-powerpc/: "extern inline" -> "static inline" 2006-12-04 20:41:26 +11:00
ucc_fast.h [POWERPC] Add QUICC Engine (QE) infrastructure 2006-10-04 15:24:27 +10:00
ucc_slow.h [POWERPC] QE: clean up ucc_slow.c and ucc_fast.c 2007-02-17 16:12:54 -06:00
ucc.h [POWERPC] Add QUICC Engine (QE) infrastructure 2006-10-04 15:24:27 +10:00
ucontext.h powerpc: merge ucontext.h 2005-11-03 16:59:17 +11:00
udbg.h [POWERPC] Use udbg_early_init() on ppc32 2007-02-14 11:55:16 +11:00
unaligned.h
uninorth.h powerpc: Merge various powermac-related header files. 2005-10-20 20:53:39 +10:00
unistd.h [POWERPC] Wire up sys_epoll_pwait 2007-03-12 15:48:35 +11:00
user.h
vdso_datapage.h [PATCH] powerpc: Kill _machine and hard-coded platform numbers 2006-03-28 23:15:54 +11:00
vdso.h [POWERPC] Fix vDSO page count calculation 2007-02-13 15:35:52 +11:00
vga.h [PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use 2006-06-22 15:05:58 -07:00
vio.h [POWERPC] Refactor 64 bits DMA operations 2006-12-04 20:38:40 +11:00
xmon.h [POWERPC] add support for stopping spus from xmon 2006-10-25 14:20:22 +10:00
xor.h