linux/arch/powerpc/kernel
Christophe Leroy 8956c582ac powerpc/8xx: Fix kernel DTLB miss on dcbz
Following OOPS is encountered while loading test_bpf module
on powerpc 8xx:

[  218.835567] BUG: Unable to handle kernel data access on write at 0xcb000000
[  218.842473] Faulting instruction address: 0xc0017a80
[  218.847451] Oops: Kernel access of bad area, sig: 11 [#1]
[  218.852854] BE PAGE_SIZE=16K PREEMPT CMPC885
[  218.857207] SAF3000 DIE NOTIFICATION
[  218.860713] Modules linked in: test_bpf(+) test_module
[  218.865867] CPU: 0 UID: 0 PID: 527 Comm: insmod Not tainted 6.11.0-s3k-dev-09856-g3de3d71ae2e6-dirty #1280
[  218.875546] Hardware name: MIAE 8xx 0x500000 CMPC885
[  218.880521] NIP:  c0017a80 LR: beab859c CTR: 000101d4
[  218.885584] REGS: cac2bc90 TRAP: 0300   Not tainted  (6.11.0-s3k-dev-09856-g3de3d71ae2e6-dirty)
[  218.894308] MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 55005555  XER: a0007100
[  218.901290] DAR: cb000000 DSISR: c2000000
[  218.901290] GPR00: 000185d1 cac2bd50 c21b9580 caf7c030 c3883fcc 00000008 cafffffc 00000000
[  218.901290] GPR08: 00040000 18300000 20000000 00000004 99005555 100d815e ca669d08 00000369
[  218.901290] GPR16: ca730000 00000000 ca2c004c 00000000 00000000 0000035d 00000311 00000369
[  218.901290] GPR24: ca732240 00000001 00030ba3 c3800000 00000000 00185d48 caf7c000 ca2c004c
[  218.941087] NIP [c0017a80] memcpy+0x88/0xec
[  218.945277] LR [beab859c] test_bpf_init+0x22c/0x3c90 [test_bpf]
[  218.951476] Call Trace:
[  218.953916] [cac2bd50] [beab8570] test_bpf_init+0x200/0x3c90 [test_bpf] (unreliable)
[  218.962034] [cac2bde0] [c0004c04] do_one_initcall+0x4c/0x1fc
[  218.967706] [cac2be40] [c00a2ec4] do_init_module+0x68/0x360
[  218.973292] [cac2be60] [c00a5194] init_module_from_file+0x8c/0xc0
[  218.979401] [cac2bed0] [c00a5568] sys_finit_module+0x250/0x3f0
[  218.985248] [cac2bf20] [c000e390] system_call_exception+0x8c/0x15c
[  218.991444] [cac2bf30] [c00120a8] ret_from_syscall+0x0/0x28

This happens in the main loop of memcpy()

  ==>	c0017a80:	7c 0b 37 ec 	dcbz    r11,r6
	c0017a84:	80 e4 00 04 	lwz     r7,4(r4)
	c0017a88:	81 04 00 08 	lwz     r8,8(r4)
	c0017a8c:	81 24 00 0c 	lwz     r9,12(r4)
	c0017a90:	85 44 00 10 	lwzu    r10,16(r4)
	c0017a94:	90 e6 00 04 	stw     r7,4(r6)
	c0017a98:	91 06 00 08 	stw     r8,8(r6)
	c0017a9c:	91 26 00 0c 	stw     r9,12(r6)
	c0017aa0:	95 46 00 10 	stwu    r10,16(r6)
	c0017aa4:	42 00 ff dc 	bdnz    c0017a80 <memcpy+0x88>

Commit ac9f97ff8b ("powerpc/8xx: Inconditionally use task PGDIR in
DTLB misses") relies on re-reading DAR register to know if an error is
due to a missing copy of a PMD entry in task's PGDIR, allthough DAR
was already read in the exception prolog and copied into thread
struct. This is because is it done very early in the exception and
there are not enough registers available to keep a pointer to thread
struct.

However, dcbz instruction is buggy and doesn't update DAR register on
fault. That is detected and generates a call to FixupDAR workaround
which updates DAR copy in thread struct but doesn't fix DAR register.

Let's fix DAR in addition to the update of DAR copy in thread struct.

Fixes: ac9f97ff8b ("powerpc/8xx: Inconditionally use task PGDIR in DTLB misses")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/2b851399bd87e81c6ccb87ea3a7a6b32c7aa04d7.1728118396.git.christophe.leroy@csgroup.eu
2024-10-11 15:53:06 +11:00
..
ptrace powerpc: Fix typos 2024-05-08 00:21:30 +10:00
syscalls powerpc: restore some missing spu syscalls 2024-06-25 15:57:26 +02:00
trace powerpc/ftrace: Ignore ftrace locations in exit text sections 2024-02-14 14:24:06 +11:00
vdso powerpc/vdso: allow r30 in vDSO code generation of getrandom 2024-09-30 19:19:43 +10:00
.gitignore
85xx_entry_mapping.S powerpc: Remove CONFIG_FSL_BOOKE 2022-09-26 22:47:37 +10:00
align.c
asm-offsets.c powerpc/vdso: Wire up getrandom() vDSO implementation on VDSO32 2024-09-13 17:28:36 +02:00
audit_32.h powerpc: address missing-prototypes warnings 2023-08-02 22:22:19 +10:00
audit.c powerpc: address missing-prototypes warnings 2023-08-02 22:22:19 +10:00
btext.c powerpc: Use shared font data 2023-10-01 23:09:02 +11:00
cacheinfo.c powerpc: Constify struct kobj_type 2024-09-05 22:25:36 +10:00
cacheinfo.h
compat_audit.c powerpc: address missing-prototypes warnings 2023-08-02 22:22:19 +10:00
cpu_setup_6xx.S powerpc: rename SPRN_HID2 define to SPRN_HID2_750FX 2024-05-08 00:25:00 +10:00
cpu_setup_44x.S
cpu_setup_e500.S powerpc/32: Fix objtool unannotated intra-function call warnings 2022-11-18 19:00:06 +11:00
cpu_setup_pa6t.S
cpu_setup_power.c powerpc/dexcr: Add initial Dynamic Execution Control Register (DEXCR) support 2023-06-19 17:36:25 +10:00
cpu_setup_ppc970.S
cpu_specs_8xx.h powerpc/cputable: Split cpu_specs[] out of cputable.h 2022-09-26 22:47:13 +10:00
cpu_specs_44x.h powerpc/cputable: Split cpu_specs[] out of cputable.h 2022-09-26 22:47:13 +10:00
cpu_specs_47x.h powerpc/cputable: Split cpu_specs[] out of cputable.h 2022-09-26 22:47:13 +10:00
cpu_specs_85xx.h powerpc/cputable: Split cpu_specs[] for mpc85xx and e500mc 2022-09-26 23:00:05 +10:00
cpu_specs_book3s_32.h powerpc/cputable: Split cpu_specs[] out of cputable.h 2022-09-26 22:47:13 +10:00
cpu_specs_book3s_64.h powerpc: Add Power11 architected and raw mode 2024-02-21 23:11:00 +11:00
cpu_specs_e500mc.h powerpc/cputable: Add missing PPC_FEATURE_BOOKE on PPC64 Book-E 2024-02-14 14:24:06 +11:00
cpu_specs.h powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
cputable.c powerpc: Make cpu_spec __ro_after_init 2023-11-27 22:01:14 +11:00
crash_dump.c powerpc/fadump: make is_kdump_kernel() return false when fadump is active 2023-09-18 12:23:27 +10:00
dawr.c
dbell.c powerpc/64: Fix perf profiling asynchronous interrupt handlers 2023-01-30 20:07:42 +11:00
dexcr.c powerpc/dexcr: Add DEXCR prctl interface 2024-05-06 22:04:31 +10:00
dma-iommu.c change alloc_pages name in dma_map_ops to avoid name conflicts 2024-04-25 20:55:53 -07:00
dma-mask.c dma-mapping: move arch_dma_set_mask() declaration to header 2023-07-31 17:54:28 +02:00
dma-swiotlb.c
dt_cpu_ftrs.c powerpc: Add Power11 architected and raw mode 2024-02-21 23:11:00 +11:00
early_32.c
eeh_cache.c
eeh_driver.c powerpc/eeh: Permanently disable the removed device 2024-04-29 23:51:15 +10:00
eeh_event.c
eeh_pe.c powerpc/eeh: avoid possible crash when edev->pdev changes 2024-06-23 11:54:27 +10:00
eeh_sysfs.c
eeh.c powerpc/pseries/eeh: move pseries_eeh_err_inject() outside CONFIG_DEBUG_FS block 2024-09-20 19:06:25 +10:00
entry_32.S powerpc: Replace CONFIG_4xx with CONFIG_44x 2024-06-28 22:28:48 +10:00
epapr_hcalls.S powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
epapr_paravirt.c
exceptions-64e.S powerpc/64e: drop unused TLB miss handlers 2024-07-12 15:52:15 -07:00
exceptions-64s.S powerpc/64s: Remove the "fast endian switch" syscall 2024-09-05 22:30:05 +10:00
fadump.c The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
firmware.c powerpc: Export kvm_guest static key, for bcachefs six locks 2024-01-01 11:47:38 -05:00
fpu.S powerpc: Don't clobber f0/vs0 during fp|altivec register save 2023-11-28 23:04:43 +11:00
head_8xx.S powerpc/8xx: Fix kernel DTLB miss on dcbz 2024-10-11 15:53:06 +11:00
head_32.h powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
head_44x.S powerpc/44x: Introduce _PAGE_READ and remove _PAGE_USER 2023-10-19 17:12:46 +11:00
head_64.S powerpc/64s: Fix unnecessary copy to 0 when kernel is booted at address 0 2024-06-23 11:54:13 +10:00
head_85xx.S powerpc/e500: use contiguous PMD instead of hugepd 2024-07-12 15:52:18 -07:00
head_book3s_32.S powerpc/603: Inconditionally use task PGDIR in DTLB misses 2024-08-30 21:29:55 +10:00
head_booke.h powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
hw_breakpoint_constraints.c powerpc/watchpoint: Disable pagefaults when getting user instruction 2023-09-18 12:23:47 +10:00
hw_breakpoint.c powerpc/watchpoints: Annotate atomic context in more places 2023-09-18 12:23:47 +10:00
idle_6xx.S
idle_64e.S powerpc: add ISA v3.0 / v3.1 wait opcode macro 2022-09-28 19:22:10 +10:00
idle_85xx.S powerpc: Cleanup idle for e500 2022-09-26 23:00:14 +10:00
idle_book3s.S
idle.c powerpc: Remove now superfluous sentinel element from ctl_table arrays 2023-10-10 15:22:02 -07:00
ima_arch.c integrity: Always reference the blacklist keyring with appraisal 2023-08-01 08:17:25 -04:00
interrupt_64.S powerpc/64: Set task pt_regs->link to the LR value on scv entry 2024-02-05 22:43:19 +11:00
interrupt.c treewide: context_tracking: Rename CONTEXT_* into CT_STATE_* 2024-07-29 07:33:10 +05:30
io-workarounds.c
io.c powerpc: Cast away __iomem in low level IO routines 2023-10-19 17:16:20 +11:00
iomap.c
iommu.c powerpc/iommu: Reimplement the iommu_table_group_ops for pSeries 2024-06-28 17:03:40 +10:00
irq_64.c work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
irq.c powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
isa-bridge.c mm: Introduce vmap_page_range() to map pages in PCI address space 2024-03-11 16:58:10 +01:00
jump_label.c
kdebugfs.c
kgdb.c powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
kprobes-ftrace.c kprobe/ftrace: bail out if ftrace was killed 2024-05-16 07:23:30 +09:00
kprobes.c powerpc: Replace kretprobe code with rethook on powerpc 2024-09-05 22:25:36 +10:00
kvm_emul.S
kvm.c powerpc: Remove CONFIG_PPC_BOOK3E_MMU 2022-09-26 23:00:14 +10:00
l2cr_6xx.S
legacy_serial.c powerpc: Explicitly include correct DT includes 2023-08-02 22:22:19 +10:00
Makefile powerpc: Replace kretprobe code with rethook on powerpc 2024-09-05 22:25:36 +10:00
mce_power.c
mce.c powerpc/mce: log the error for all unrecoverable errors 2023-02-10 22:17:34 +11:00
misc_32.S powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
misc_64.S powerpc: Fix typos 2024-05-08 00:21:30 +10:00
misc.S powerpc: replace #include <asm/export.h> with #include <linux/export.h> 2023-08-16 23:54:48 +10:00
module_32.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
module_64.c powerpc/64: Convert patch_instruction() to patch_u32() 2024-08-21 20:15:13 +10:00
module.c powerpc updates for 6.10 2024-05-17 09:05:46 -07:00
msi.c
note.S
nvram_64.c printk: Add a short description string to kmsg_dump() 2024-07-17 12:35:24 +02:00
of_platform.c powerpc: Explicitly include correct DT includes 2023-08-02 22:22:19 +10:00
optprobes_head.S powerpc: add definition for pt_regs offset within an interrupt frame 2022-12-02 17:54:08 +11:00
optprobes.c powerpc: Replace kretprobe code with rethook on powerpc 2024-09-05 22:25:36 +10:00
paca.c docs: move powerpc under arch 2023-10-10 13:35:55 -06:00
pci_32.c powerpc/pci: Add option for using pci_to_OF_bus_map 2023-02-07 20:15:23 +11:00
pci_64.c powerpc/pci_64: Init pcibios subsys a bit later 2023-03-14 23:36:27 +11:00
pci_dn.c powerpc/pci_dn: Add missing of_node_put() 2022-09-05 17:30:25 +10:00
pci_of_scan.c
pci-common.c arch: Rename fbdev header and source files 2024-05-03 17:07:50 +02:00
pci-hotplug.c powerpc/pci: Hotplug driver bridge support 2024-07-04 23:10:40 +10:00
pmc.c powerpc/85xx: Mark some functions static and add missing includes to fix no previous prototype error 2023-08-23 15:55:21 +10:00
ppc_save_regs.S powerpc: update ppc_save_regs to save current r1 in pt_regs 2023-06-19 17:37:14 +10:00
proc_powerpc.c
process.c powerpc/32: Implement validation of emergency stack 2024-08-30 21:30:20 +10:00
prom_entry_64.S powerpc/64: Rename entry_64.S to prom_entry_64.S 2023-06-15 14:04:19 +10:00
prom_init_check.sh kasan, powerpc: don't rename memintrinsics if compiler adds prefixes 2023-03-23 17:18:33 -07:00
prom_init.c powerpc/mm: Align memory_limit value specified using mem= kernel parameter 2024-04-19 16:09:14 +10:00
prom_parse.c
prom.c powerpc/prom: Add CPU info to hardware description string later 2024-06-28 22:31:00 +10:00
reloc_32.S
reloc_64.S powerpc/64: avoid using r13 in relocate 2022-09-28 19:22:13 +10:00
rethook.c powerpc: Replace kretprobe code with rethook on powerpc 2024-09-05 22:25:36 +10:00
rtas_entry.S powerpc/rtas: Fix RTAS MSR[HV] handling for Cell 2022-08-26 08:41:54 +10:00
rtas_flash.c powerpc: add missing MODULE_DESCRIPTION() macros 2024-07-04 22:39:20 +10:00
rtas_pci.c powerpc/rtas_pci: rename and properly expose config access APIs 2023-11-28 21:49:45 +11:00
rtas-proc.c powerpc/rtas: Fix ppc_rtas_rmo_buf_show() kernel-doc 2023-11-07 13:13:45 +11:00
rtas-rtc.c powerpc/rtas: arch-wide function token lookup conversions 2023-02-13 22:35:03 +11:00
rtas.c powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas() 2024-06-28 22:28:58 +10:00
rtasd.c powerpc/rtas: arch-wide function token lookup conversions 2023-02-13 22:35:03 +11:00
secure_boot.c powerpc: Stop using of_root 2024-03-03 22:20:29 +11:00
security.c powerpc/security: Fix Speculation_Store_Bypass reporting on Power10 2023-07-10 09:47:47 +10:00
secvar-ops.c powerpc/secvar: Warn and error if multiple secvar ops are set 2023-02-12 22:12:36 +11:00
secvar-sysfs.c powerpc: Constify struct kobj_type 2024-09-05 22:25:36 +10:00
setup_32.c powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
setup_64.c powerpc/64e: drop MMU_FTR_TYPE_FSL_E checks in 64-bit code 2024-07-12 15:52:14 -07:00
setup-common.c powerpc/mm: Fix boot warning with hugepages and CONFIG_DEBUG_VIRTUAL 2024-08-12 21:50:20 +10:00
setup.h powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
signal_32.c powerpc/signal32: Force inlining of __unsafe_save_user_regs() and save_tm_user_regs_unsafe() 2023-06-09 23:29:51 +10:00
signal_64.c
signal.c powerpc: Replace GPL 2.0+ README.legal boilerplate with SPDX 2023-09-19 20:05:58 +10:00
signal.h powerpc: Replace GPL 2.0+ README.legal boilerplate with SPDX 2023-09-19 20:05:58 +10:00
smp-tbsync.c
smp.c smp: Mark smp_prepare_boot_cpu() __init 2024-09-08 16:01:10 +02:00
stacktrace.c powerpc: Replace kretprobe code with rethook on powerpc 2024-09-05 22:25:36 +10:00
static_call.c powerpc/32: Convert patch_instruction() to patch_uint() 2024-08-21 20:15:13 +10:00
suspend.c
switch.S powerpc: merge 32-bit and 64-bit _switch implementation 2023-06-15 14:03:55 +10:00
swsusp_32.S powerpc/32: Fix objtool unannotated intra-function call warnings 2022-11-18 19:00:06 +11:00
swsusp_64.c powerpc/suspend: Add prototype for do_after_copyback() 2023-11-30 13:15:49 +11:00
swsusp_85xx.S powerpc: Remove CONFIG_FSL_BOOKE 2022-09-26 22:47:37 +10:00
swsusp_asm64.S powerpc/64: asm use consistent global variable declaration and access 2022-09-28 19:22:12 +10:00
swsusp.c
sys_ppc32.c powerpc/32: fix syscall wrappers with 64-bit arguments 2022-11-01 10:24:09 +11:00
syscall.c treewide: context_tracking: Rename CONTEXT_* into CT_STATE_* 2024-07-29 07:33:10 +05:30
syscalls.c powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers 2022-09-28 19:22:08 +10:00
sysfs.c powerpc: Fix typos 2024-05-08 00:21:30 +10:00
systbl.c powerpc: Don't add __powerpc_ prefix to syscall entry points 2022-10-07 00:59:54 +11:00
tau_6xx.c powerpc, workqueue: Use alloc_ordered_workqueue() to create ordered workqueues 2023-05-08 13:52:27 -10:00
time.c powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
tm.S powerpc: replace #include <asm/export.h> with #include <linux/export.h> 2023-08-16 23:54:48 +10:00
traps.c powerpc/traps: Use backlight power constants 2024-08-07 22:48:26 +10:00
ucall.S powerpc: replace #include <asm/export.h> with #include <linux/export.h> 2023-08-16 23:54:48 +10:00
udbg_16550.c powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
udbg.c powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
uprobes.c
vdso32_wrapper.S
vdso64_wrapper.S
vdso.c powerpc/vdso: refactor error handling 2024-09-01 20:26:13 -07:00
vecemu.c
vector.S powerpc: Don't clobber f0/vs0 during fp|altivec register save 2023-11-28 23:04:43 +11:00
vmlinux.lds.S init/modpost: conditionally check section mismatch to __meminit* 2024-07-12 16:39:52 -07:00
watchdog.c nmi_backtrace: allow excluding an arbitrary CPU 2023-08-18 10:19:00 -07:00