[PATCH v2 0/8] ARM: vfp: Reimplement dispatch and support logic in C

Ard Biesheuvel ardb at kernel.org
Wed May 17 14:28:00 PDT 2023


This is a follow-up to [0] 'ARM: vfp: Switch to C API to en/disable
softirqs', which fixed some issues introduced by a prior series of mine
that relaxed the requirement for kernel mode NEON to only run in task
context [1].

As it turns out, the VFP dispatch logic in the entry code as well as
the VFP support code that triages the exceptions are good candidates for
receiving the same treatment: we now have the undef_hook API for
matching PSR values and opcodes, and the exceptions are all ultimately
routed to C code anyway, now that we return via __local_bh_enable_ip()
back to the caller. So most of this logic can be moved to C.

So let's clean this up: reimplement the VFP handling in C code, so that
we can get rid of most of the asm code that deals with this.

Changes since v1:
- rebase onto v6.4-rc2
- add Arnd's ack to #2
- fix issue in #7 regarding access to struct pt_regs to update the user
  PC
- move residual FPE-only undef dispatch asm code to nwfpe/entry.S (#8)

This v2 can be found at [2]. KernelCI test results for this version of
the series can be found at [3].

Changes since [0]:
- drop bogus patch 'fixing' the iWMMXT dispatch logic
- add some acks from Nico and Linus
- rip out even more asm code in patch #6 - there is no need to load the
  opcode from user space at all when entering in Thumb mode

[0] https://lore.kernel.org/all/20230320131845.3138015-1-ardb@kernel.org/
[1] https://lore.kernel.org/all/20221207103936.2198407-1-ardb@kernel.org/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=arm-vfp-softirq-fixes
[3] https://linux.kernelci.org/test/job/ardb/branch/for-kernelci/kernel/arm-vfp-refactor-for-rmk/

Cc: Linus Walleij <linus.walleij at linaro.org>
Cc: Arnd Bergmann <arnd at arndb.de>
Cc: Russell King <linux at armlinux.org.uk>
Cc: Nicolas Pitre <nico at fluxnic.net>

Ard Biesheuvel (8):
  ARM: vfp: Record VFP bounces as perf emulation faults
  ARM: vfp: Remove workaround for Feroceon CPUs
  ARM: vfp: Reimplement VFP exception entry in C code
  ARM: kernel: Get rid of thread_info::used_cp[] array
  ARM: vfp: Use undef hook for handling VFP exceptions
  ARM: entry: Disregard Thumb undef exception in coproc dispatch
  ARM: iwmmxt: Use undef hook to enable coprocessor for task
  ARM: entry: Make asm coproc dispatch code NWFPE only

 arch/arm/include/asm/thread_info.h |  17 +-
 arch/arm/kernel/asm-offsets.c      |   1 -
 arch/arm/kernel/entry-armv.S       | 254 +-------------------
 arch/arm/kernel/iwmmxt.S           |  18 +-
 arch/arm/kernel/pj4-cp0.c          |   1 +
 arch/arm/kernel/process.c          |   1 -
 arch/arm/kernel/ptrace.c           |   2 -
 arch/arm/kernel/xscale-cp0.c       |   1 +
 arch/arm/mm/proc-feroceon.S        |   4 +
 arch/arm/nwfpe/entry.S             |  77 ++++++
 arch/arm/vfp/Makefile              |   2 +-
 arch/arm/vfp/entry.S               |  31 ---
 arch/arm/vfp/vfp.h                 |   1 +
 arch/arm/vfp/vfphw.S               | 208 ++--------------
 arch/arm/vfp/vfpmodule.c           | 208 +++++++++++-----
 15 files changed, 286 insertions(+), 540 deletions(-)
 delete mode 100644 arch/arm/vfp/entry.S

-- 
2.39.2




More information about the linux-arm-kernel mailing list