Re: git: 6926e2699ae5 - main - arm: Add support for using VFP in kernel

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 06 Feb 2023 18:35:10 UTC
On 2/4/23 11:22 AM, Kornel Dulęba wrote:
> The branch main has been updated by kd:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=6926e2699ae55080f860488895a2a9aa6e6d9b4d
> 
> commit 6926e2699ae55080f860488895a2a9aa6e6d9b4d
> Author:     Kornel Dulęba <kd@FreeBSD.org>
> AuthorDate: 2023-02-04 12:59:30 +0000
> Commit:     Kornel Dulęba <kd@FreeBSD.org>
> CommitDate: 2023-02-04 19:21:43 +0000
> 
>      arm: Add support for using VFP in kernel
>      
>      Add missing logic to allow in-kernel VFP usage for ARMv7 NEON.
>      The implementation is strongly based on arm64 code.
>      It introduces a family of fpu_kern_* functions to enable the usage
>      of VFP instructions in kernel.
>      Apart from that the existing armv7 VFP logic was modified,
>      taking into account that the state of the VFP registers can now
>      be modified in the kernel.
>      
>      Co-developed by: Wojciech Macek <wma@FreeBSD.org>
>      Sponsored by:   Stormshield
>      Obtained from:  Semihalf
>      Reviewed by:    andrew
>      Differential Revision: https://reviews.freebsd.org/D37419

Note that changing the layout of 'struct fpreg' and what fill_fpregs
and set_fpregs do does change the layout of the .reg2 coredump note
and what happens for PT_[GS]ETFPREGS for ptrace(2).  That said, GDB
at least ignores all that since it is known to be useless.  I haven't
checked LLDB, but it likely doesn't care about the old interfaces
either.  Maybe at least a RELNOTES entry and __FreeBSD_version bump
in case it is problematic in the future?

> ---
>   lib/libthread_db/arch/arm/libpthread_md.c |  21 ++--
>   sys/arm/arm/exec_machdep.c                |  49 ++++----
>   sys/arm/arm/machdep.c                     |   1 +
>   sys/arm/arm/machdep_kdb.c                 |  31 ++++-
>   sys/arm/arm/swtch-v6.S                    |   8 +-
>   sys/arm/arm/swtch.S                       |   8 +-
>   sys/arm/arm/vfp.c                         | 182 +++++++++++++++++++++++++++++-
>   sys/arm/arm/vm_machdep.c                  |   6 +-
>   sys/arm/include/fpu.h                     |   7 ++
>   sys/arm/include/pcb.h                     |   5 +
>   sys/arm/include/reg.h                     |  12 +-
>   sys/arm/include/vfp.h                     |  17 +++
>   12 files changed, 293 insertions(+), 54 deletions(-)
> 
> diff --git a/sys/arm/arm/exec_machdep.c b/sys/arm/arm/exec_machdep.c
> index 2bf3efff7fe4..c14bd51146ef 100644
> --- a/sys/arm/arm/exec_machdep.c
> +++ b/sys/arm/arm/exec_machdep.c
> @@ -100,16 +100,18 @@ get_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
>   	memcpy(vfp->mcv_reg, pcb->pcb_vfpstate.reg,
> -	    sizeof(vfp->mcv_reg));
> +		sizeof(vfp->mcv_reg));

FYI, this was a style regression here and elsewhere in the commit.

-- 
John Baldwin