linux/arch/mips/kernel
Leonid Yegoshin e4aa1f153a MIPS: MSA unaligned memory access support
The MSA architecture specification allows for hardware to not implement
unaligned vector memory accesses in some or all cases. A typical example
of this is the I6400 core which does not implement unaligned vector
memory access when the memory crosses a page boundary. The architecture
also requires that such memory accesses complete successfully as far as
userland is concerned, so the kernel is required to emulate them.

This patch implements support for emulating unaligned MSA ld & st
instructions by copying between the user memory & the tasks FP context
in struct thread_struct, updating hardware registers from there as
appropriate in order to avoid saving & restoring the entire vector
context for each unaligned memory access.

Tested both using an I6400 CPU and with a QEMU build hacked to produce
AdEL exceptions for unaligned vector memory accesses.

[paul.burton@imgtec.com:
  - Remove #ifdef's
  - Move msa_op into enum major_op rather than #define
  - Replace msa_{to,from}_wd with {read,write}_msa_wr_{b,h,w,l} and the
    format-agnostic wrappers, removing the custom endian mangling for
    big endian systems.
  - Restructure the msa_op case in emulate_load_store_insn to share
    more code between the load & store cases.
  - Avoid the need for a temporary union fpureg on the stack by simply
    reusing the already suitably aligned context in struct
    thread_struct.
  - Use sizeof(*fpr) rather than hardcoding 16 as the size for user
    memory checks & copies.
  - Stop recalculating the address of the unaligned vector memory access
    and rely upon the value read from BadVAddr as we do for other
    unaligned memory access instructions.
  - Drop the now unused val8 & val16 fields in union fpureg.
  - Rewrite commit message.
  - General formatting cleanups.]

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-kernel@vger.kernel.org
Cc: Jie Chen <chenj@lemote.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Patchwork: https://patchwork.linux-mips.org/patch/10573/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2015-09-03 12:07:40 +02:00
..
.gitignore
8250-platform.c
asm-offsets.c MIPS: asm-offset.c: Patch up various comments refering to the old filename. 2015-07-14 16:05:49 +02:00
binfmt_elfn32.c MIPS: Compat: Fix cputime_to_timeval() arguments in compat binfmt_elf. 2013-06-06 16:11:26 +02:00
binfmt_elfo32.c MIPS: Remove old core dump functions 2014-08-02 00:06:37 +02:00
bmips_vec.S MIPS: BMIPS: Fix ".previous without corresponding .section" warnings 2014-11-24 07:44:05 +01:00
branch.c MIPS: Fix branch emulation for BLTC and BGEC instructions 2015-07-09 11:10:40 +02:00
cevt-bcm1480.c MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
cevt-ds1287.c
cevt-gt641xx.c
cevt-r4k.c MIPS: Remove "weak" from get_c0_compare_int() declaration 2015-09-03 12:07:38 +02:00
cevt-sb1250.c MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
cevt-txx9.c MIPS: cevt-txx9: Implement read_sched_clock 2015-04-01 17:21:30 +02:00
cps-vec.S MIPS: cps-vec: Use macros for various arithmetics and memory operations 2015-07-09 11:17:01 +02:00
cpu-bugs64.c MIPS: kernel: cpu-bugs64: Do not check R6 cores for existing 64-bit bugs 2015-02-17 15:37:24 +00:00
cpu-probe.c MIPS: Set up FTLB probability for I6400 2015-08-26 15:23:22 +02:00
crash.c mips: fix up obsolete cpu function usage. 2015-03-05 15:25:06 +10:30
crash_dump.c mips: Convert pr_warning to pr_warn 2014-11-24 07:44:51 +01:00
csrc-bcm1480.c MIPS: csrc-bcm1480: Implement read_sched_clock 2015-04-01 17:21:27 +02:00
csrc-ioasic.c MIPS: csrc-ioasic: Implement read_sched_clock 2015-04-01 17:21:28 +02:00
csrc-r4k.c MIPS: csrc-r4k: Implement read_sched_clock 2015-04-01 17:21:27 +02:00
csrc-sb1250.c MIPS: csrc-sb1250: Implement read_sched_clock 2015-04-01 17:21:33 +02:00
early_printk.c early_printk: consolidate random copies of identical code 2013-04-29 18:28:13 -07:00
early_printk_8250.c MIPS: Add 8250/16550 serial early printk driver 2013-10-29 21:24:36 +01:00
elf.c MIPS: fix FP mode selection in lieu of .MIPS.abiflags data 2015-05-12 18:54:05 +02:00
entry.S MIPS: kernel: entry.S: Set correct ISA level for mips_ihb 2015-04-10 15:41:46 +02:00
ftrace.c Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-08-07 08:47:00 -07:00
genex.S MIPS: Fix LLVM build issue. 2015-08-18 11:40:20 +02:00
gpio_txx9.c
head.S MIPS: Add support for vmlinux.bin appended dtb 2015-06-21 21:54:14 +02:00
i8253.c
i8259.c MIPS: i8259: DT support 2015-06-21 21:54:29 +02:00
idle.c MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
irq-gt641xx.c
irq-msc01.c MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region 2014-06-26 10:48:23 +01:00
irq-rm7000.c
irq.c MIPS: IRQ/IP27: Move IRQ allocation API to platform code. 2015-06-21 21:54:31 +02:00
irq_txx9.c
jump_label.c MIPS: jump_label.c: Handle the microMIPS J instruction encoding 2014-11-19 18:22:09 +01:00
kgdb.c MIPS: Get rid of 'kgdb_early_setup' cruft. 2015-06-21 21:54:10 +02:00
kprobes.c mips: Replace __get_cpu_var uses 2014-08-26 13:45:51 -04:00
linux32.c unify compat fanotify_mark(2), switch to COMPAT_SYSCALL_DEFINE 2013-05-09 13:46:38 -04:00
machine_kexec.c MIPS: kdump: Set correct value to kexec_indirection_page variable 2014-08-25 16:33:44 +02:00
Makefile MIPS/IRQCHIP: Move irq_chip from arch/mips to drivers/irqchip. 2015-06-21 21:52:50 +02:00
mcount.S MIPS: mcount: Adjust stack pointer for static trace in MIPS32 2014-09-26 11:41:17 +02:00
mips-cm.c MIPS: CM: Add support for reporting CM cache errors 2015-08-26 15:23:15 +02:00
mips-cpc.c MIPS: CPC: Remove "weak" from mips_cpc_phys_base() and make it static 2015-08-26 15:23:37 +02:00
mips-mt-fpaff.c MIPS: Fix sched_getaffinity with MT FPAFF enabled 2015-08-03 09:25:02 +02:00
mips-mt.c MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
mips-r2-to-r6-emul.c MIPS: Set `si_code' for SIGFPE signals sent from emulation too 2015-04-08 01:10:19 +02:00
mips_ksyms.c Merge branch 'mipsr6-for-3.20' of git://git.linux-mips.org/pub/scm/mchandras/linux into mips-for-linux-next 2015-02-19 16:00:34 +01:00
mips_machine.c MIPS: move mips_{set,get}_machine_name() to a more generic place 2013-05-08 01:19:07 +02:00
module-rela.c
module.c mm: vmalloc: pass additional vm_flags to __vmalloc_node_range() 2015-02-13 21:21:42 -08:00
octeon_switch.S MIPS: OCTEON: Delete unused COP2 saving code 2015-02-20 15:30:23 +01:00
perf_event.c
perf_event_mipsxx.c MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
pm-cps.c MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
pm.c MIPS: PM: Implement PM helper macros 2014-05-02 16:39:10 +01:00
proc.c MIPS: Add support for XPA. 2015-03-19 17:39:49 +01:00
process.c This is the final removal (after several years!) of the obsolete cpus_* 2015-04-20 10:19:03 -07:00
prom.c MIPS: Fix build with CONFIG_OF=y for non OF-enabled targets 2015-08-03 09:25:00 +02:00
ptrace.c MIPS: Fix a preemption issue with thread's FPU defaults 2015-05-12 23:15:49 +02:00
ptrace32.c MIPS: Remove asm/user.h 2014-08-02 00:06:37 +02:00
r4k_fpu.S MIPS: Introduce accessors for MSA vector registers 2015-09-03 12:07:40 +02:00
r4k_switch.S MIPS: Respect the ISA level in FCSR handling 2015-04-08 01:10:37 +02:00
r2300_fpu.S MIPS: Fix build with binutils 2.24.51+ 2014-11-07 15:07:36 +01:00
r2300_switch.S MIPS: Respect the ISA level in FCSR handling 2015-04-08 01:10:37 +02:00
r6000_fpu.S MIPS: Fix build with binutils 2.24.51+ 2014-11-07 15:07:36 +01:00
relocate_kernel.S MIPS: Replace add and sub instructions in relocate_kernel.S with addiu 2015-08-03 15:26:30 +02:00
reset.c MIPS: Provide fallback reboot/poweroff/halt implementations 2015-04-01 17:21:58 +02:00
rtlx-cmp.c MIPS: APRP: Fix an issue when device_create() fails. 2014-08-01 17:30:35 +02:00
rtlx-mt.c MIPS: APRP: Fix an issue when device_create() fails. 2014-08-01 17:30:35 +02:00
rtlx.c MIPS: rtlx: Remove KERN_DEBUG from pr_debug() arguments in rtlx.c 2014-11-24 07:44:04 +01:00
scall32-o32.S MIPS: O32: Do not handle require 32 bytes from the stack to be readable. 2015-07-08 05:03:30 +02:00
scall64-64.S MIPS: Fix seccomp syscall argument for MIPS64 2015-08-16 15:00:59 +02:00
scall64-n32.S MIPS: Fix seccomp syscall argument for MIPS64 2015-08-16 15:00:59 +02:00
scall64-o32.S MIPS: O32: Use compat_sys_getsockopt. 2015-07-10 11:02:22 +02:00
segment.c MIPS: Add debugfs file to print the segmentation control registers 2014-01-22 20:19:00 +01:00
setup.c MIPS: bootmem: Don't use memory holes for page bitmap 2015-07-09 11:02:59 +02:00
signal-common.h sched/preempt, MIPS: Properly lock access to the FPU 2015-05-19 08:39:18 +02:00
signal.c all arches, signal: move restart_block to struct task_struct 2015-02-12 18:54:12 -08:00
signal32.c signal: fix information leak in copy_siginfo_from_user32 2015-08-07 04:39:40 +03:00
signal_n32.c mips: Use sigsp() 2014-08-06 13:04:30 +02:00
smp-bmips.c MIPS: SMP: Don't increment irq_count multiple times for call function IPIs 2015-08-03 09:25:12 +02:00
smp-cmp.c mips: fix up obsolete cpu function usage. 2015-03-05 15:25:06 +10:30
smp-cps.c MIPS: kernel: smp-cps: Fix 64-bit compatibility errors due to pointer casting 2015-07-09 11:12:57 +02:00
smp-gic.c MIPS: Move gic.h to include/linux/irqchip/mips-gic.h 2014-11-24 07:44:59 +01:00
smp-mt.c mips: fix up obsolete cpu function usage. 2015-03-05 15:25:06 +10:30
smp-up.c MIPS: SMP: Remove plat_smp_ops cpus_done method. 2014-05-27 11:06:42 +02:00
smp.c MIPS: SMP: Don't increment irq_count multiple times for call function IPIs 2015-08-03 09:25:12 +02:00
spinlock_test.c
spram.c MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
stacktrace.c
sync-r4k.c MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
syscall.c MIPS: kernel: syscall: Set the appropriate ISA level for MIPS R6 2015-02-17 15:37:29 +00:00
sysrq.c MIPS: Add SysRq operation to dump TLBs on all CPUs 2015-06-21 21:52:27 +02:00
time.c MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
topology.c
traps.c MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
unaligned.c MIPS: MSA unaligned memory access support 2015-09-03 12:07:40 +02:00
vdso.c MIPS: Enable VDSO randomization 2014-11-24 07:45:38 +01:00
vmlinux.lds.S MIPS: Add support for vmlinux.bin appended dtb 2015-06-21 21:54:14 +02:00
vpe-cmp.c MIPS: APRP: Add VPE loader support for CMP platforms. 2014-01-22 20:19:02 +01:00
vpe-mt.c MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
vpe.c MIPS: MT: Remove "weak" from vpe_run() declaration 2015-08-26 15:23:40 +02:00
watch.c MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00