Skip to content

target/arm: Implement M profile floating point

Peter Maydell qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest26 patches 25 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26target/arm: Make sure M-profile FPSCR RES0 bits are not settabletarget/arm/vfp_helper.c+8 -01 reply
2/26hw/intc/armv7m_nvic: Allow reading of M-profile MVFR* registershw/intc/armv7m_nvic.c+6 -01 reply
3/26target/arm: Implement dummy versions of M-profile FP-related registershw/intc/armv7m_nvic.c target/arm/cpu.c target/arm/cpu.h +1 more+180 -01 reply
4/26target/arm: Disable most VFP sysregs for M-profiletarget/arm/translate.c+17 -21 reply
5/26target/arm: Honour M-profile FP enable bitstarget/arm/helper.c target/arm/translate.c+60 -51 reply
6/26target/arm: Decode FP instructions for M profiletarget/arm/translate.c+22 -41 reply
7/26target/arm: Clear CONTROL_S.SFPA in SG insn if FPU presenttarget/arm/helper.c+1 -01 reply
8/26target/arm: Handle SFPA and FPCA bits in reads and writes of CONTROLtarget/arm/helper.c+49 -81 reply
9/26target/arm/helper: don't return early for STKOF faults during stackingtarget/arm/helper.c+18 -51 reply
10/26target/arm: Handle floating point registers in exception entrytarget/arm/helper.c+95 -31 reply
11/26target/arm: Implement v7m_update_fpccr()hw/intc/armv7m_nvic.c target/arm/cpu.h target/arm/helper.c+114 -10 replies
12/26target/arm: Clear CONTROL.SFPA in BXNS and BLXNStarget/arm/helper.c+4 -01 reply
13/26target/arm: Clean excReturn bits when tail chainingtarget/arm/helper.c+8 -01 reply
14/26target/arm: Allow for floating point in callee stack integrity checktarget/arm/helper.c+19 -31 reply
15/26target/arm: Handle floating point registers in exception returntarget/arm/helper.c+141 -11 reply
16/26target/arm: Move NS TBFLAG from bit 19 to bit 6target/arm/cpu.h+6 -51 reply
17/26target/arm: Overlap VECSTRIDE and XSCALE_CPAR TB flagstarget/arm/cpu.c target/arm/cpu.h target/arm/helper.c +1 more+25 -71 reply
18/26target/arm: Set FPCCR.S when executing M-profile floating point insnstarget/arm/cpu.h target/arm/helper.c target/arm/translate.c +1 more+28 -01 reply
19/26target/arm: Activate M-profile floating point context when FPCCR.ASPEN is settarget/arm/cpu.h target/arm/helper.c target/arm/translate.c +1 more+45 -01 reply
20/26target/arm: New helper function arm_v7m_mmu_idx_all()target/arm/cpu.h target/arm/helper.c+18 -31 reply
21/26target/arm: New function armv7m_nvic_set_pending_lazyfp()hw/intc/armv7m_nvic.c target/arm/cpu.h+108 -01 reply
22/26target/arm: Add lazy-FP-stacking support to v7m_stack_write()target/arm/helper.c+79 -391 reply
23/26target/arm: Implement M-profile lazy FP state preservationtarget/arm/cpu.h target/arm/helper.c target/arm/helper.h +2 more+140 -01 reply
24/26target/arm: Implement VLSTM for v7M CPUs with an FPUtarget/arm/cpu.h target/arm/helper.c target/arm/helper.h +1 more+102 -11 reply
25/26target/arm: Implement VLLDM for v7M CPUs with an FPUtarget/arm/helper.c target/arm/helper.h target/arm/translate.c+56 -11 reply
26/26target/arm: Enable FPU for Cortex-M4 and Cortex-M33target/arm/cpu.c+8 -01 reply

Reviews trailers per patch

25 of 26 patches have a Reviewed-by or Acked-by.

PatchRichard Henderson
1/26R-b
2/26R-b
3/26R-b
4/26R-b
5/26R-b
6/26R-b
7/26R-b
8/26R-b
9/26R-b
10/26R-b
11/26
12/26R-b
13/26R-b
14/26R-b
15/26R-b
16/26R-b
17/26R-b
18/26R-b
19/26R-b
20/26R-b
21/26R-b
22/26R-b
23/26R-b
24/26R-b
25/26R-b
26/26R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-arm] [PATCH 00/26] target/arm: Implement M profile floating point

This patchset implements floating point support for the M-profile Arm cores and enables it for the Cortex-M4 and Cortex-M33 (both of which should really have an FPU).

The floating point instructions for M-profile are basically the same as for A-profile (with some minor differences like not having all the VFP sysregs, and definitely not having the old VFP length/stride handling). The major differences are in the exception handling:
* on exception entry and exit we may want to stack and unstack FP registers, as we do for integer registers
* M-profile supports a "lazy stacking" mode, which means that on exception entry we do not stack the FP registers that the calling convention requires us to preserve, but just reserve space for them. Then if the exception handler executes an FP instruction we spill the FP registers to the stack only at that point

There are also two M-profile-only instructions, VLLDM and VLSTM, which are for guest code to actively trigger the lazy-stacking.

Most interesting bit to review is probably whether I got the handling of the new TB flag bits right (in patches 18, 19 and 23), since they have a kind of self-clearing property that's a bit non-standard.

thanks
-- PMM

Peter Maydell (26):
target/arm: Make sure M-profile FPSCR RES0 bits are not settable hw/intc/armv7m_nvic: Allow reading of M-profile MVFR* registers target/arm: Implement dummy versions of M-profile FP-related registers target/arm: Disable most VFP sysregs for M-profile target/arm: Honour M-profile FP enable bits
target/arm: Decode FP instructions for M profile target/arm: Clear CONTROL_S.SFPA in SG insn if FPU present target/arm: Handle SFPA and FPCA bits in reads and writes of CONTROL target/arm/helper: don't return early for STKOF faults during stacking target/arm: Handle floating point registers in exception entry target/arm: Implement v7m_update_fpccr()
target/arm: Clear CONTROL.SFPA in BXNS and BLXNS target/arm: Clean excReturn bits when tail chaining target/arm: Allow for floating point in callee stack integrity check target/arm: Handle floating point registers in exception return target/arm: Move NS TBFLAG from bit 19 to bit 6 target/arm: Overlap VECSTRIDE and XSCALE_CPAR TB flags target/arm: Set FPCCR.S when executing M-profile floating point insns target/arm: Activate M-profile floating point context when FPCCR.ASPEN
is set
target/arm: New helper function arm_v7m_mmu_idx_all() target/arm: New function armv7m_nvic_set_pending_lazyfp() target/arm: Add lazy-FP-stacking support to v7m_stack_write() target/arm: Implement M-profile lazy FP state preservation target/arm: Implement VLSTM for v7M CPUs with an FPU target/arm: Implement VLLDM for v7M CPUs with an FPU target/arm: Enable FPU for Cortex-M4 and Cortex-M33

 target/arm/cpu.h        |  95 ++++-
 target/arm/helper.h     |   5 +
 target/arm/translate.h  |   3 +
 hw/intc/armv7m_nvic.c   | 261 ++++++++++++
 target/arm/cpu.c        |  20 +
 target/arm/helper.c     | 873 +++++++++++++++++++++++++++++++++++++---
 target/arm/machine.c    |  16 +
 target/arm/translate.c  | 150 ++++++-
 target/arm/vfp_helper.c |   8 +
 9 files changed, 1350 insertions(+), 81 deletions(-)
Signature · 1 line
2.20.1