linux/arch/powerpc/include/asm
Christophe Leroy 232ca1eeca powerpc/32s: Fix DSI and ISI exceptions for CONFIG_VMAP_STACK
hash_page() needs to read page tables from kernel memory. When entire
kernel memory is mapped by BATs, which is normally the case when
CONFIG_STRICT_KERNEL_RWX is not set, it works even if the page hosting
the page table is not referenced in the MMU hash table.

However, if the page where the page table resides is not covered by
a BAT, a DSI fault can be encountered from hash_page(), and it loops
forever. This can happen when CONFIG_STRICT_KERNEL_RWX is selected
and the alignment of the different regions is too small to allow
covering the entire memory with BATs. This also happens when
CONFIG_DEBUG_PAGEALLOC is selected or when booting with 'nobats'
flag.

Also, if the page containing the kernel stack is not present in the
MMU hash table, registers cannot be saved and a recursive DSI fault
is encountered.

To allow hash_page() to properly do its job at all time and load the
MMU hash table whenever needed, it must run with data MMU disabled.
This means it must be called before re-enabling data MMU. To allow
this, registers clobbered by hash_page() and create_hpte() have to
be saved in the thread struct together with SRR0, SSR1, DAR and DSISR.
It is also necessary to ensure that DSI prolog doesn't overwrite
regs saved by prolog of the current running exception. That means:
- DSI can only use SPRN_SPRG_SCRATCH0
- Exceptions must free SPRN_SPRG_SCRATCH0 before writing to the stack.

This also fixes the Oops reported by Erhard when create_hpte() is
called by add_hash_page().

Due to prolog size increase, a few more exceptions had to get split
in two parts.

Fixes: cd08f109e2 ("powerpc/32s: Enable CONFIG_VMAP_STACK")
Reported-by: Erhard F. <erhard_f@mailbox.org>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Erhard F. <erhard_f@mailbox.org>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206501
Link: https://lore.kernel.org/r/64a4aa44686e9fd4b01333401367029771d9b231.1581761633.git.christophe.leroy@c-s.fr
2020-02-18 21:31:11 +11:00
..
book3s powerpc updates for 5.6 2020-02-04 13:06:46 +00:00
nohash powerpc updates for 5.6 2020-02-04 13:06:46 +00:00
8xx_immap.h
Kbuild
accounting.h
agp.h
archrandom.h powerpc: Mark archrandom.h functions __must_check 2020-01-25 12:18:51 -05:00
asm-405.h
asm-compat.h
asm-const.h
asm-offsets.h
asm-prototypes.h
async_tx.h
atomic.h
backlight.h
barrier.h powerpc: Remove comment about read_barrier_depends() 2020-01-24 10:33:52 -08:00
bitops.h
bootx.h
btext.h
bug.h
bugs.h
cache.h
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
cmpxchg.h
code-patching-asm.h
code-patching.h
compat.h compat: provide compat_ptr() on all architectures 2020-01-03 09:32:51 +01:00
context_tracking.h
copro.h
cpm.h
cpm1.h
cpm2.h
cpu_has_feature.h
cpufeature.h
cpuidle.h
cputable.h powerpc/mm: Remove kvm radix prefetch workaround for Power9 DD2.2 2020-01-26 00:11:37 +11:00
cputhreads.h
cputime.h
current.h
dbdma.h
dbell.h
dcr-generic.h
dcr-mmio.h
dcr-native.h
dcr-regs.h
dcr.h
debug.h
debugfs.h
delay.h
device.h
disassemble.h
dma-direct.h
dma.h
drmem.h
dt_cpu_ftrs.h
edac.h
eeh.h
eeh_event.h
ehv_pic.h
elf.h
elfnote.h
emergency-restart.h
emulated_ops.h
epapr_hcalls.h
exception-64e.h
exception-64s.h
exec.h
extable.h
fadump-internal.h
fadump.h
fb.h
feature-fixups.h
firmware.h powerpc/pseries/iommu: Separate FW_FEATURE_MULTITCE to put/stuff features 2020-01-06 16:25:30 +11:00
fixmap.h
floppy.h
fs_pd.h
fsl_85xx_cache_sram.h
fsl_gtm.h
fsl_hcalls.h
fsl_lbc.h
fsl_pamu_stash.h
fsl_pm.h
ftrace.h
futex.h powerpc/futex: Fix incorrect user access blocking 2020-02-08 21:48:39 +11:00
grackle.h
hardirq.h
head-64.h
heathrow.h
highmem.h
hmi.h
hugetlb.h
hvcall.h KVM: PPC: Book3S HV: Implement H_SVM_INIT_ABORT hcall 2020-01-17 15:08:31 +11:00
hvconsole.h
hvcserver.h
hvsi.h
hw_breakpoint.h powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size. 2020-01-23 21:31:14 +11:00
hw_irq.h
hydra.h
i8259.h
ibmebus.h
icswx.h
ide.h
ima.h
imc-pmu.h
immap_cpm2.h
io-defs.h
io-workarounds.h
io.h remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
io_event_irq.h
iommu.h
ipic.h
irq.h
irq_work.h
irqflags.h
isa-bridge.h
jump_label.h
kasan.h powerpc/32: Add support of KASAN_VMALLOC 2020-01-27 22:37:33 +11:00
kdebug.h
kdump.h
kexec.h
keylargo.h
kgdb.h
kmap_types.h
kprobes.h
kup.h powerpc: Implement user_access_save() and user_access_restore() 2020-01-28 23:14:44 +11:00
kvm_asm.h
kvm_book3s.h
kvm_book3s_32.h
kvm_book3s_64.h
kvm_book3s_asm.h
kvm_book3s_uvmem.h KVM: PPC: Book3S HV: Implement H_SVM_INIT_ABORT hcall 2020-01-17 15:08:31 +11:00
kvm_booke.h
kvm_booke_hv_asm.h
kvm_fpu.h
kvm_host.h KVM: PPC: Book3S HV: Implement H_SVM_INIT_ABORT hcall 2020-01-17 15:08:31 +11:00
kvm_para.h
kvm_ppc.h KVM: PPC: Move kvm_vcpu_init() invocation to common code 2020-01-24 09:19:01 +01:00
libata-portmap.h
linkage.h
livepatch.h
local.h
lppaca.h
lv1call.h
machdep.h
macio.h
mc146818rtc.h
mce.h
mediabay.h
mem_encrypt.h
membarrier.h
mm-arch-hooks.h
mman.h
mmiowb.h
mmu.h
mmu_context.h mm: remove arch_bprm_mm_init() hook 2020-01-23 10:41:16 -08:00
mmzone.h
module.h
mpc5xxx.h
mpc6xx.h
mpc52xx.h
mpc52xx_psc.h
mpc85xx.h
mpc5121.h
mpc8260.h
mpic.h
mpic_msgr.h
mpic_timer.h
msi_bitmap.h
nmi.h
nvram.h
ohare.h
opal-api.h
opal.h
oprofile_impl.h
paca.h
page.h powerpc/hugetlb: Fix 8M hugepages on 8xx 2020-02-17 12:47:06 +11:00
page_32.h
page_64.h
parport.h
pasemi_dma.h
pci-bridge.h powerpc/pcidn: Make VF pci_dn management CONFIG_PCI_IOV specific 2020-01-23 21:31:19 +11:00
pci.h powerpc/pci: Remove pcibios_setup_bus_devices() 2020-01-06 16:25:29 +11:00
percpu.h
perf_event.h
perf_event_fsl_emb.h
perf_event_server.h
pgalloc.h
pgtable-be-types.h
pgtable-types.h
pgtable.h powerpc/ptdump: don't entirely rebuild kernel when selecting CONFIG_PPC_DEBUG_WX 2020-01-23 21:31:11 +11:00
pkeys.h
plpar_wrappers.h
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h
pnv-ocxl.h
pnv-pci.h powerpc/powernv/ioda: Find opencapi slot for a device node 2020-01-23 21:31:17 +11:00
powernv.h
ppc-opcode.h
ppc-pci.h
ppc4xx.h
ppc_asm.h
probes.h
processor.h powerpc/32s: Fix DSI and ISI exceptions for CONFIG_VMAP_STACK 2020-02-18 21:31:11 +11:00
prom.h
ps3.h
ps3av.h
ps3gpu.h
ps3stor.h
pte-walk.h
ptrace.h
reg.h
reg_8xx.h powerpc/hw_breakpoints: Rewrite 8xx breakpoints to allow any address range size. 2020-01-23 21:31:14 +11:00
reg_a2.h
reg_booke.h
reg_fsl_emb.h
rheap.h
rio.h
rtas.h
runlatch.h
seccomp.h
sections.h
secure_boot.h
security_features.h
secvar.h
serial.h
setjmp.h
setup.h
sfp-machine.h
shmparam.h
signal.h
slice.h
smp.h
smu.h
sparsemem.h
spinlock.h powerpc/spinlocks: Include correct header for static key 2019-12-30 21:20:41 +11:00
spinlock_types.h
spu.h
spu_csa.h
spu_info.h
spu_priv1.h
sstep.h
stackprotector.h
stacktrace.h
string.h
svm.h
swab.h
swiotlb.h
switch_to.h
synch.h
syscall.h
syscalls.h
task_size_32.h
task_size_64.h
tce.h
termios.h
thread_info.h powerpc: align stack to 2 * THREAD_SIZE with VMAP_STACK 2020-01-26 22:15:09 +11:00
time.h
timex.h
tlb.h mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush 2020-02-04 03:05:26 +00:00
tlbflush.h
tm.h
topology.h
trace.h
trace_clock.h
tsi108.h
tsi108_irq.h
tsi108_pci.h
types.h
uaccess.h powerpc: Implement user_access_save() and user_access_restore() 2020-01-28 23:14:44 +11:00
udbg.h
uic.h
ultravisor-api.h
ultravisor.h
unaligned.h
uninorth.h
unistd.h
uprobes.h
user.h
vas.h
vdso.h
vdso_datapage.h powerpc/vdso32: Don't read cache line size from the datapage on PPC32. 2020-01-23 21:31:15 +11:00
vga.h
vio.h
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00
word-at-a-time.h
xics.h
xilinx_intc.h
xilinx_pci.h
xive-regs.h powerpc/xive: Discard ESB load value when interrupt is invalid 2020-01-22 20:31:41 +11:00
xive.h powerpc/xive: Drop extern qualifiers from header function prototypes 2020-01-23 21:31:23 +11:00
xmon.h
xor.h
xor_altivec.h