android_kernel_xiaomi_sm7250/include
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
..
acpi Pull bugzilla-8171 into release branch 2007-03-20 11:06:00 -04:00
asm-alpha [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-arm [ARM] 4298/1: fix memory barriers for DMA coherent and SMP platforms 2007-04-01 22:38:36 +01:00
asm-arm26 Storage class should be before const qualifier 2007-02-17 20:11:19 +01:00
asm-avr32 [PATCH] gpio_direction_output() needs an initial value 2007-03-16 19:25:04 -07:00
asm-cris [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-frv [PATCH] FRV: Add some missng lazy MMU hooks for NOMMU mode 2007-03-01 14:53:36 -08:00
asm-generic [PATCH] Proper fix for highmem kmap_atomic functions for VMI for 2.6.21 2007-04-08 19:47:55 -07:00
asm-h8300 [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-i386 [PATCH] Proper fix for highmem kmap_atomic functions for VMI for 2.6.21 2007-04-08 19:47:55 -07:00
asm-ia64 [IA64] SGI Altix : fix pcibr_dmamap_ate32() bug 2007-04-06 15:38:12 -07:00
asm-m32r [PATCH] m32r dma-mapping.h should simply include generic/dma-mapping-broken.h 2007-03-14 15:27:49 -07:00
asm-m68k [PATCH] m68k dma-mapping: gfp_t annotations 2007-03-14 15:27:51 -07:00
asm-m68knommu [PATCH] m68knommu: GPIO line defines for the ColdFire 5282 2007-03-06 18:08:38 -08:00
asm-mips [MIPS] SMTC: Fix recursion in instant IPI replay code. 2007-03-29 23:46:36 +01:00
asm-parisc Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6 2007-02-26 12:48:06 -08:00
asm-powerpc [POWERPC] Allow drivers to map individual 4k pages to userspace 2007-04-13 03:55:18 +10:00
asm-ppc [POWERPC] Rename get_property to of_get_property 2007-04-13 03:55:17 +10:00
asm-s390 [S390] Fix TCP/UDP pseudo header checksum computation. 2007-03-26 20:43:46 +02:00
asm-sh sh: Trivial fix for hp6xx build. 2007-03-28 19:45:59 +09:00
asm-sh64 [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-sparc [SPARC]: Add unsigned to unused bit field in a.out.h 2007-04-02 14:26:21 -07:00
asm-sparc64 [SPARC]: Add unsigned to unused bit field in a.out.h 2007-04-02 14:26:21 -07:00
asm-um [PATCH] uml: fix unreasonably long udelay 2007-04-02 10:06:08 -07:00
asm-v850 [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
asm-x86_64 [PATCH] x86_64 irq: Fix comments after changing IRQ0_VECTOR from 0x20 to 0x30 2007-03-29 08:16:23 -07:00
asm-xtensa [PATCH] consolidate line discipline number definitions 2007-02-11 10:51:26 -08:00
crypto
keys
linux Merge branch 'linux-2.6' into for-2.6.22 2007-04-13 03:50:03 +10:00
math-emu
media V4L/DVB (5441): Saa7146: Fix allocation of clipping memory 2007-03-27 08:45:56 -03:00
mtd
net [IFB]: Fix crash on input device removal 2007-03-29 11:46:52 -07:00
pcmcia serial: Add PCMCIA IDs for Quatech DSP-100 dual RS232 adapter. 2007-02-16 15:19:16 -08:00
rdma RDMA/cma: Add multicast communication support 2007-02-16 14:29:07 -08:00
rxrpc
scsi Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2007-02-19 13:32:28 -08:00
sound [ALSA] version 1.0.14rc3 2007-03-14 08:25:52 +01:00
video [PATCH] Video: fb, add true ref_count atomicity 2007-02-12 09:48:42 -08:00
Kbuild