android_kernel_xiaomi_sm8350/arch/powerpc/kernel
Paul Mackerras fa28237cfc [POWERPC] Provide a way to protect 4k subpages when using 64k pages
Using 64k pages on 64-bit PowerPC systems makes life difficult for
emulators that are trying to emulate an ISA, such as x86, which use a
smaller page size, since the emulator can no longer use the MMU and
the normal system calls for controlling page protections.  Of course,
the emulator can emulate the MMU by checking and possibly remapping
the address for each memory access in software, but that is pretty
slow.

This provides a facility for such programs to control the access
permissions on individual 4k sub-pages of 64k pages.  The idea is
that the emulator supplies an array of protection masks to apply to a
specified range of virtual addresses.  These masks are applied at the
level where hardware PTEs are inserted into the hardware page table
based on the Linux PTEs, so the Linux PTEs are not affected.  Note
that this new mechanism does not allow any access that would otherwise
be prohibited; it can only prohibit accesses that would otherwise be
allowed.  This new facility is only available on 64-bit PowerPC and
only when the kernel is configured for 64k pages.

The masks are supplied using a new subpage_prot system call, which
takes a starting virtual address and length, and a pointer to an array
of protection masks in memory.  The array has a 32-bit word per 64k
page to be protected; each 32-bit word consists of 16 2-bit fields,
for which 0 allows any access (that is otherwise allowed), 1 prevents
write accesses, and 2 or 3 prevent any access.

Implicit in this is that the regions of the address space that are
protected are switched to use 4k hardware pages rather than 64k
hardware pages (on machines with hardware 64k page support).  In fact
the whole process is switched to use 4k hardware pages when the
subpage_prot system call is used, but this could be improved in future
to switch only the affected segments.

The subpage protection bits are stored in a 3 level tree akin to the
page table tree.  The top level of this tree is stored in a structure
that is appended to the top level of the page table tree, i.e., the
pgd array.  Since it will often only be 32-bit addresses (below 4GB)
that are protected, the pointers to the first four bottom level pages
are also stored in this structure (each bottom level page contains the
protection bits for 1GB of address space), so the protection bits for
addresses below 4GB can be accessed with one fewer loads than those
for higher addresses.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-01-24 10:06:01 +11:00
..
vdso32 [POWERPC] vdso: Fixes for cache block sizes 2007-11-20 13:56:31 +11:00
vdso64 [POWERPC] vdso: Fixes for cache block sizes 2007-11-20 13:56:31 +11:00
align.c
asm-offsets.c [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
audit.c
binfmt_elf32.c powerpc: Use linux/elfcore-compat.h 2007-10-17 08:42:51 -07:00
btext.c [POWERPC] Use for_each macros in arch/powerpc/kernel 2008-01-17 14:56:55 +11:00
clock.c
compat_audit.c
cpu_setup_6xx.S Spelling fix: explicitly 2007-10-19 23:22:55 +02:00
cpu_setup_44x.S [POWERPC] 4xx: Fix 440grx setup function to call 440A fixup 2007-12-23 13:27:37 -06:00
cpu_setup_pa6t.S
cpu_setup_ppc970.S
cputable.c [POWERPC] Conditionally compile e200 and e500 platforms in cputable 2007-12-24 08:44:47 -06:00
crash_dump.c
crash.c
dma_64.c Update arch/ to use sg helpers 2007-10-22 21:19:59 +02:00
entry_32.S [POWERPC] Avoid unpaired stwcx. on some processors 2007-11-13 16:22:43 +11:00
entry_64.S [POWERPC] Add 1TB workaround for PA6T 2007-10-17 22:30:09 +10:00
firmware.c
fpu.S
head_8xx.S
head_32.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
head_40x.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
head_44x.S [POWERPC] Reworking machine check handling and Fix 440/440A 2007-12-23 13:11:59 -06:00
head_64.S [POWERPC] Provide a way to protect 4k subpages when using 64k pages 2008-01-24 10:06:01 +11:00
head_booke.h [POWERPC] Reworking machine check handling and Fix 440/440A 2007-12-23 13:11:59 -06:00
head_fsl_booke.S [POWERPC] Fix swapper_pg_dir size when CONFIG_PTE_64BIT=y on FSL_BOOKE 2007-12-06 13:11:04 -06:00
ibmebus.c [POWERPC] arch/powerpc/kernel: Use for_each_child_of_node 2008-01-17 14:57:20 +11:00
idle_6xx.S
idle_power4.S
idle.c [POWERPC] Fix sysctl table check failure on PowerMac 2007-11-08 14:15:30 +11:00
init_task.c
io.c
iomap.c
iommu.c [POWERPC] iommu_free_table doesn't need the device_node 2007-12-11 13:41:33 +11:00
irq.c Spelling fix: explicitly 2007-10-19 23:22:55 +02:00
isa-bridge.c [POWERPC] pci_controller->arch_data really is a struct device_node * 2007-12-11 13:42:37 +11:00
kprobes.c kprobes: support kretprobe blacklist 2007-10-16 09:43:10 -07:00
l2cr_6xx.S Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
legacy_serial.c [POWERPC] Use for_each macros in arch/powerpc/kernel 2008-01-17 14:56:55 +11:00
lparcfg.c [POWERPC] lparcfg: Remove useless buffer allocation 2007-12-11 13:41:28 +11:00
machine_kexec_32.c
machine_kexec_64.c
machine_kexec.c Use extended crashkernel command line on ppc64 2007-10-19 11:53:51 -07:00
Makefile [POWERPC] Check that the syscall table matches the syscall numbers 2008-01-17 14:57:38 +11:00
misc_32.S [POWERPC] 4xx: Add early udbg support for 40x processors 2007-12-23 13:13:03 -06:00
misc_64.S [POWERPC] kernel_execve is identical in 32 and 64 bit 2007-12-11 13:34:39 +11:00
misc.S [POWERPC] kernel_execve is identical in 32 and 64 bit 2007-12-11 13:34:39 +11:00
module_32.c [POWERPC] Optimize counting distinct entries in the relocation sections 2007-12-21 15:05:58 +11:00
module_64.c [POWERPC] Optimize counting distinct entries in the relocation sections 2007-12-21 15:05:58 +11:00
msi.c
nvram_64.c
of_device.c [POWERPC] Use <linux/of_{platform, device}.h> and not <asm/...> variants. 2008-01-17 14:58:57 +11:00
of_platform.c [POWERPC] arch/powerpc/kernel: Use for_each_child_of_node 2008-01-17 14:57:20 +11:00
paca.c
pci_32.c [POWERPC] arch/powerpc/kernel: Use for_each_child_of_node 2008-01-17 14:57:20 +11:00
pci_64.c [POWERPC] arch/powerpc/kernel: Use for_each_child_of_node 2008-01-17 14:57:20 +11:00
pci_dn.c [POWERPC] iSeries: eliminate pci_dn bussubno 2008-01-17 14:57:05 +11:00
pci-common.c Revert "[POWERPC] Disable PCI IO/Mem on a device when resources can't be allocated" 2007-12-31 10:12:45 +11:00
pmc.c
ppc32.h
ppc_ksyms.c [POWERPC] Kill non-existent symbols from ksyms and commproc.h 2007-12-13 22:44:28 -06:00
proc_ppc64.c
process.c [POWERPC] Fix hardware IRQ time accounting problem. 2007-12-06 16:08:59 +11:00
prom_init.c [POWERPC] ] Fix memset size error 2007-11-08 14:15:33 +11:00
prom_parse.c [POWERPC] Add of_translate_dma_address 2007-12-11 15:43:35 +11:00
prom.c [POWERPC] 4xx: update 440EP(x)/440GR(x) identical PVR issue workaround 2007-12-23 13:35:58 -06:00
ptrace32.c
ptrace.c Consolidate PTRACE_DETACH 2007-10-16 09:42:49 -07:00
rtas_flash.c Slab API: remove useless ctor parameter and reorder parameters 2007-10-17 08:42:45 -07:00
rtas_pci.c [POWERPC] arch/powerpc/kernel: Use for_each_child_of_node 2008-01-17 14:57:20 +11:00
rtas-proc.c
rtas-rtc.c
rtas.c Revert "[POWERPC] Fix RTAS os-term usage on kernel panic" 2007-12-03 09:39:45 +11:00
semaphore.c
setup_32.c [POWERPC] Only call ppc_md.setup_arch() if it is provided 2007-10-11 20:39:36 +10:00
setup_64.c [POWERPC] Fix cache line vs. block size confusion 2007-11-08 14:15:30 +11:00
setup-common.c [POWERPC] Cleanup SMT thread handling 2007-12-03 13:56:25 +11:00
setup.h
signal_32.c [POWERPC] arch/powerpc: Remove duplicate includes 2007-12-20 17:13:50 +11:00
signal_64.c [POWERPC] Implement logging of unhandled signals 2007-10-12 14:05:18 +10:00
signal.c [POWERPC] Implement logging of unhandled signals 2007-10-12 14:05:18 +10:00
signal.h
smp-tbsync.c
smp.c Convert cpu_sibling_map to be a per cpu variable 2007-10-16 09:42:50 -07:00
softemu8xx.c
suspend.c
swsusp_32.S [POWERPC] Make altivec code in swsusp_32.S depend on CONFIG_ALTIVEC 2007-11-08 14:15:34 +11:00
swsusp_64.c
swsusp_asm64.S
swsusp.c
sys_ppc32.c remove include/asm-*/ipc.h 2007-10-17 08:42:55 -07:00
syscalls.c remove include/asm-*/ipc.h 2007-10-17 08:42:55 -07:00
sysfs.c
systbl_chk.c [POWERPC] Check that the syscall table matches the syscall numbers 2008-01-17 14:57:38 +11:00
systbl_chk.sh [POWERPC] Check that the syscall table matches the syscall numbers 2008-01-17 14:57:38 +11:00
systbl.S
tau_6xx.c
time.c [POWERPC] Implement arch disable/enable irq hooks. 2007-12-21 22:13:35 +11:00
traps.c [POWERPC] Reworking machine check handling and Fix 440/440A 2007-12-23 13:11:59 -06:00
udbg_16550.c [POWERPC] 4xx: Add early udbg support for 40x processors 2007-12-23 13:13:03 -06:00
udbg.c [POWERPC] 4xx: Add early udbg support for 40x processors 2007-12-23 13:13:03 -06:00
vdso.c [POWERPC] vdso: Fixes for cache block sizes 2007-11-20 13:56:31 +11:00
vecemu.c
vector.S
vio.c Driver core: change add_uevent_var to use a struct 2007-10-12 14:51:01 -07:00
vmlinux.lds.S [POWERPC] Fix link errors for allyesconfig 2007-11-08 14:15:33 +11:00