History log of /netbsd-current/sys/arch/arm/vfp/vfp_init.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.78 20-Aug-2022 riastradh

fpu_kern_enter/leave: Disable IPL assertions.

These don't work because mutex_enter/exit on a spin lock may raise an
IPL but not lower it, if another spin lock was already held. For
example,

mutex_enter(some_lock_at_IPL_VM);
printf("foo\n");
fpu_kern_enter();
...
fpu_kern_leave();
mutex_exit(some_lock_at_IPL_VM);

will trigger the panic, because printf takes a lock at IPL_HIGH where
the IPL wil remain until the mutex_exit. (This was a nightmare to
track down before I remembered that detail of spin lock IPL
semantics...)


# 1.77 01-Apr-2022 riastradh

x86, arm: Allow fpu_kern_enter/leave while cold.

Normally these are forbidden above IPL_VM, so that FPU usage doesn't
block IPL_SCHED or IPL_HIGH interrupts. But while cold, e.g. during
builtin module initialization at boot, all interrupts are blocked
anyway so it's a moot point.

Also initialize x86 cpu_info_primary.ci_kfpu_spl to -1 so we don't
trip over an assertion about it while cold -- the assertion is meant
to detect reentrance into fpu_kern_enter/leave, which is prohibited.

Also initialize cpu0's ci_kfpu_spl.


# 1.76 31-Oct-2021 skrll

Rework Arm (32bit and 64bit) AP startup so that cpu_hatch doesn't sleep.

The AP initialisation code in cpu_init_secondary_processor will read and
initialise the required system registers and state for the BP to attach
and report.

Rework the interrupt handler code for this new sequence. Thankfully,
this removes a bunch of code for bcm2836mp.

The VFP detection handler on <= armv7 relies on the global undefined
handler being in place until the BP attaches vfp. That is, after the
APs have been spun up.

gicv3_its.c has a serialisation issue which is protected against in
the gicv3_its_cpu_init, which is called from cpu_hatch, with a spin
lock. The serialisation issue needs addressing more completely.

Tested on RPI3, Apple M1, QEMU, and lx2k

Fixes PR port-arm/56264:
diagnostic assertion "l->l_stat == LSONPROC" failed on RPI3


# 1.75 17-Oct-2021 skrll

Trailing whitespace


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base thorpej-i2c-spi-conf-base
# 1.74 01-Jun-2021 rin

PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


# 1.73 01-Jun-2021 rin

PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


Revision tags: cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.72 30-Oct-2020 skrll

branches: 1.72.6;
Retire arm_[di]sb in favour of the isb() and dsb(sy) macro invocations.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.77 01-Apr-2022 riastradh

x86, arm: Allow fpu_kern_enter/leave while cold.

Normally these are forbidden above IPL_VM, so that FPU usage doesn't
block IPL_SCHED or IPL_HIGH interrupts. But while cold, e.g. during
builtin module initialization at boot, all interrupts are blocked
anyway so it's a moot point.

Also initialize x86 cpu_info_primary.ci_kfpu_spl to -1 so we don't
trip over an assertion about it while cold -- the assertion is meant
to detect reentrance into fpu_kern_enter/leave, which is prohibited.

Also initialize cpu0's ci_kfpu_spl.


# 1.76 31-Oct-2021 skrll

Rework Arm (32bit and 64bit) AP startup so that cpu_hatch doesn't sleep.

The AP initialisation code in cpu_init_secondary_processor will read and
initialise the required system registers and state for the BP to attach
and report.

Rework the interrupt handler code for this new sequence. Thankfully,
this removes a bunch of code for bcm2836mp.

The VFP detection handler on <= armv7 relies on the global undefined
handler being in place until the BP attaches vfp. That is, after the
APs have been spun up.

gicv3_its.c has a serialisation issue which is protected against in
the gicv3_its_cpu_init, which is called from cpu_hatch, with a spin
lock. The serialisation issue needs addressing more completely.

Tested on RPI3, Apple M1, QEMU, and lx2k

Fixes PR port-arm/56264:
diagnostic assertion "l->l_stat == LSONPROC" failed on RPI3


# 1.75 17-Oct-2021 skrll

Trailing whitespace


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base thorpej-i2c-spi-conf-base
# 1.74 01-Jun-2021 rin

PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


# 1.73 01-Jun-2021 rin

PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


Revision tags: cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.72 30-Oct-2020 skrll

branches: 1.72.6;
Retire arm_[di]sb in favour of the isb() and dsb(sy) macro invocations.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.76 31-Oct-2021 skrll

Rework Arm (32bit and 64bit) AP startup so that cpu_hatch doesn't sleep.

The AP initialisation code in cpu_init_secondary_processor will read and
initialise the required system registers and state for the BP to attach
and report.

Rework the interrupt handler code for this new sequence. Thankfully,
this removes a bunch of code for bcm2836mp.

The VFP detection handler on <= armv7 relies on the global undefined
handler being in place until the BP attaches vfp. That is, after the
APs have been spun up.

gicv3_its.c has a serialisation issue which is protected against in
the gicv3_its_cpu_init, which is called from cpu_hatch, with a spin
lock. The serialisation issue needs addressing more completely.

Tested on RPI3, Apple M1, QEMU, and lx2k

Fixes PR port-arm/56264:
diagnostic assertion "l->l_stat == LSONPROC" failed on RPI3


# 1.75 17-Oct-2021 skrll

Trailing whitespace


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base thorpej-i2c-spi-conf-base
# 1.74 01-Jun-2021 rin

PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


# 1.73 01-Jun-2021 rin

PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


Revision tags: cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.72 30-Oct-2020 skrll

branches: 1.72.6;
Retire arm_[di]sb in favour of the isb() and dsb(sy) macro invocations.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.75 17-Oct-2021 skrll

Trailing whitespace


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base thorpej-i2c-spi-conf-base
# 1.74 01-Jun-2021 rin

PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


# 1.73 01-Jun-2021 rin

PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


Revision tags: cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 1.72 30-Oct-2020 skrll

branches: 1.72.6;
Retire arm_[di]sb in favour of the isb() and dsb(sy) macro invocations.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.74 01-Jun-2021 rin

PR port-arm/55790

Fix KASSERT failure with floating-point exception in userland.

Consider the case in which curlwp owns enabled FPU in vfp_handler().
If FPE is raised, we must skip pcu_load(9) rather than just falling
through. Otherwise, KASSERT fires in vfp_state_load(), since curlwp
already owns enabled FPU.

No regression for ATF is introduced.


# 1.73 01-Jun-2021 rin

PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


Revision tags: cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.72 30-Oct-2020 skrll

Retire arm_[di]sb in favour of the isb() and dsb(sy) macro invocations.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


Revision tags: thorpej-futex-base
# 1.72 30-Oct-2020 skrll

Retire arm_[di]sb in favour of the isb() and dsb(sy) macro invocations.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.71 01-Aug-2020 riastradh

Add kthread_fpu_enter/exit support to arm.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.70 27-Jul-2020 riastradh

Enable ChaCha NEON code on armv7 too.

The 4-blocks-at-a-time assembly helper is disabled for now; adapting
it to armv7 is going to be a little annoying with only 16 128-bit
vector registers.

(Should also do a fifth block in the integer registers for 320 bytes
at a time.)


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.69 25-Jul-2020 riastradh

Split aes_impl declarations out into aes_impl.h.

This will make it less painful to add more operations to struct
aes_impl without having to recompile everything that just uses the
block cipher directly or similar.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.68 13-Jul-2020 riastradh

Use pcu_save_all_on_cpu, not pcu_save.

We don't care what curlwp is here; we care whose state is in the fpu
registers.


# 1.67 13-Jul-2020 riastradh

Limit arm32 fpu_kern_enter/leave to IPL_VM or below.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.66 29-Jun-2020 riastradh

New permutation-based AES implementation using ARM NEON.

Also derived from Mike Hamburg's public-domain vpaes code.


# 1.65 29-Jun-2020 riastradh

Implement fpu_kern_enter/leave for arm32.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.64 29-Oct-2019 joerg

Explicitly annotate FPU requirements for LLVM MC.

When using GCC, this annotations change the global state, but there is
no push/pop functionality for .fpu to avoid this problem. The state is
local to each inline assembler block with LLVM MC.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.63 07-Sep-2019 tnn

Cortex A12 is marketed as A17 but has a distinct part number

observed on Rockchip RK3288


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

branches: 1.57.2;
Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


Revision tags: isaki-audio2-base
# 1.62 06-Apr-2019 skrll

Install the undefined instruction handlers only once, i.e. when attaching
on the BP.


# 1.61 17-Mar-2019 skrll

Trailing whitespace


# 1.60 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.59 15-Aug-2018 skrll

Sprinkle #include "opt_cputypes.h"


# 1.58 15-Aug-2018 skrll

Add __KERNEL_RCSID


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.57 08-Apr-2018 bouyer

Remove the call to vfp_fpscr_handler() from vfp_handler(). It actually never
avoids a full FPU switch, and costs a function call and a few tests.

Discussed on port-arm@ on october 2017:
http://mail-index.netbsd.org/port-arm/2017/10/16/msg004411.html


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.56 02-Mar-2018 christos

branches: 1.56.2;
Add more vfp directives for gcc-6


Revision tags: tls-maxphys-base-20171202
# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

branches: 1.53.2;
Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.55 16-Oct-2017 bouyer

We KASSERT((fregs->vfp_fpexc & VFP_FPEXC_EN) == 0) just before, so
enabled is always false. remove.


# 1.54 16-Oct-2017 bouyer

In the REENABLE case, make sur the fpexc copy in the pcb also has
VFP_FPEXC_EN set. Otherwise we could trap on every context switch even if
the CPU already has the VFP state.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.53 26-May-2017 jmcneill

Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


# 1.53 26-May-2017 jmcneill

Recognize Cortex-A57 FPU, GIC, and Generic Timer.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base
# 1.52 22-Mar-2017 chs

in vfp_state_load(), fix backwards logic for fpinst vs. fpinst2.


Revision tags: pgoyette-localcount-20170320
# 1.51 16-Mar-2017 chs

allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

branches: 1.50.2; 1.50.4;
Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.50 03-Mar-2016 skrll

Get the RPI3 working (in aarch32 mode) by recognising Cortex A53 CPUs.
While I'm here add some A57/A72 info as well.

My RPI3 works with FB console - the uart needs some help with its clocks.


Revision tags: nick-nhusb-base-20151226
# 1.49 12-Nov-2015 jmcneill

change some register dumps from aprint_verbose to aprint_debug


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.48 28-Apr-2015 jmcneill

isb after writing cpacr, from Andrew Turner


Revision tags: nick-nhusb-base-20150406
# 1.47 23-Mar-2015 matt

Fix some inverted return values. Don't return SIGILL if there is an active
FPU exception.


# 1.46 20-Mar-2015 matt

Remove extra )


# 1.45 20-Mar-2015 matt

Not only check to see if we own the VFP but that the VFP is enabled.


# 1.44 17-Mar-2015 matt

Don't try to catch undefined VFP instructions if we own the the FPU.
Let them raise SIGILL.


# 1.43 17-Mar-2015 matt

If we own the FPU, don't take anymore undefined faults. Instead generate
SIGILLs since we obviously don't understand the instruction.


# 1.42 09-Feb-2015 slp

Add VFP IDs for QEMU's emulated Cortex-A15.


Revision tags: nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.41 18-Jul-2014 matt

branches: 1.41.2; 1.41.4;
fix typo reported in PR/48948


# 1.40 15-Jun-2014 matt

Cleanup a bit of the init logic.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.39 16-May-2014 rmind

pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.


Revision tags: yamt-pagecache-base9
# 1.38 06-Apr-2014 matt

propogation -> propagation


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.37 28-Mar-2014 matt

branches: 1.37.2;
Various MP changes.


# 1.36 18-Mar-2014 matt

Enable VFP on MV88SV58XX


Revision tags: riastradh-drm2-base3
# 1.35 04-Mar-2014 matt

Add a different version vfp_fpscr_changable if FPU_VFP was not defined.
If no FPU was found, reinit vfp_fpscr_changeable/default to values appropriate
for softfloat.


# 1.34 03-Mar-2014 matt

Query the media and vfp feature registers to determine what our default
mode should be and what bits in the fpscr can be changed.
Print what features are supported:
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propogation, denormals


# 1.33 25-Jan-2014 skrll

Improve PCU/VFP handling to the point that the atf tests don't trigger
KASSERTs on the Raspberry PI and its arm1176jzf-s.

XXX Need to emulate bounce instructions to get correct exception codes,
XXX etc.


# 1.32 24-Jan-2014 skrll

Be consistent about setting fpscr for Runfast. No functional change.


# 1.31 23-Jan-2014 skrll

Fix typo in #define name


# 1.30 21-Jan-2014 skrll

Typo in comment


# 1.29 27-Dec-2013 matt

Switch to using FP instructions instead of cp10/11 instructions.


# 1.28 14-Dec-2013 matt

If we can't enable VFP/VFP2 via the CPACCESS register, bail since there
isn't a VFP.


# 1.27 18-Nov-2013 matt

Before checking for an exception, make sure we own the VFP.


# 1.26 23-Aug-2013 matt

Deal with lack of VFP.


# 1.25 23-Aug-2013 matt

Reap LWP_VFPUSED and use PCU internal tracking.
Add bool vfp_used_p(void);


# 1.24 22-Aug-2013 drochner

-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt


# 1.23 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


# 1.22 03-Aug-2013 matt

Add VFP_FPSCR_RN (even though it's 0) just to be explicit.


# 1.21 02-Aug-2013 matt

Use armreg inlines.
Add exception -> trapsignal code.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.20 20-Jun-2013 matt

branches: 1.20.2;
Add support for the Cortex-A15 Neon/VFP unit


Revision tags: agc-symver-base
# 1.19 05-Feb-2013 matt

Use the mrc form of the vmrs rX, mvfrX instruction to shut up gas.


# 1.18 31-Jan-2013 matt

Add support for machdep neon_present and id_mvfr sysctls


# 1.17 28-Jan-2013 matt

Add a machdep.fpu_present sysctl for ld.elf_so to use in ld.so.conf to load
libc_vfp.so.


# 1.16 28-Jan-2013 matt

Disable bzero_page_vfp and bcopy_page_vfp since it really isn't any faster
than memcpy.


Revision tags: yamt-pagecache-base8
# 1.15 31-Dec-2012 matt

Always re-enable the VFP when loading for a kernel LWP.


# 1.14 31-Dec-2012 matt

print the PC of the VFP kernel fault in the panic message.


# 1.13 26-Dec-2012 matt

Add support for PCU_KERNEL and vfp_kernel_acquire/vfp_kernel_release.
Add an undefined handler to catch NEON instructions.


Revision tags: yamt-pagecache-base7
# 1.12 11-Dec-2012 matt

Add code to patch pmap_{copy,zero}_page_generic to change calls to
b{copy,zero}_page to b{copy,zero}_page_vfp


# 1.11 10-Dec-2012 matt

move inlines into FPU_VFP


# 1.10 08-Dec-2012 matt

On Cortex, make sure to load/save the upper 16 64-FP registers.
When creating a mcontext_t, make sure _UC_ARM_VFP is set.


# 1.9 05-Dec-2012 matt

For armv7 (cortex), disable access to the upper 16 FP registers (restrict
the register space to 16 64-bit FP registers).


# 1.8 05-Dec-2012 matt

ARMFPE hasn't compiled since NetBSD 4. Remove it.
Complete support for FPU_VFP.
fpregs now contains vfpreg.
XXX vfpreg only has space for 16 64-bit FP registers though VFPv3 and later
have 32 64-bit FP registers.


Revision tags: yamt-pagecache-base6
# 1.7 22-Sep-2012 matt

Only use CPACR register for ARM11 and CORTEX cores.
Add VFP ids for other CORTEX CPUs.


# 1.6 22-Sep-2012 matt

Before testing for VFP, make sure CP10 is enabled. (And CP11 for Neon too).


# 1.5 16-Aug-2012 matt

branches: 1.5.2;
Add include of <arm/pcb.h>


# 1.4 12-Aug-2012 matt

Rework VFP support to use PCU.
Add emulation of instruction which save/restore the VFP FPSCR.
Add a sysarch hook to VFP FPSCR manipulation.

[The emulation will be used by libc to store/fetch exception modes and
rounding mode on a per-thread basis.]


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 rmind-uvmplock-base yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 jym-xensuspend-base
# 1.3 21-Nov-2009 rmind

branches: 1.3.12; 1.3.20;
Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.2 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base mjf-devfs2-base ad-socklock-base1 yamt-lazymbuf-base15 keiichi-mipv6-base yamt-lazymbuf-base14 matt-armv6-nbase chris-arm-intr-rework-base7 keiichi-mipv6-nbase
# 1.1 15-Mar-2008 rearnsha

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.20; 1.1.26;
VFP support.