Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2016 13:41:38 +0200
From:      Konrad Witaszczyk <def@FreeBSD.org>
To:        Andrew Turner <andrew@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r307321 - in head/sys/arm64: arm64 include
Message-ID:  <eac3148a-4696-a5bf-f531-fcf40630b3c1@FreeBSD.org>
In-Reply-To: <201610141553.u9EFrmT7062155@repo.freebsd.org>
References:  <201610141553.u9EFrmT7062155@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--LrR0ev3DmqnFePiuhcL61Fu1ljARN0KKN
Content-Type: multipart/mixed; boundary="naRKO9CPQCK5o11CPCjgv7mm4qx6HpxMf";
 protected-headers="v1"
From: Konrad Witaszczyk <def@FreeBSD.org>
To: Andrew Turner <andrew@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Message-ID: <eac3148a-4696-a5bf-f531-fcf40630b3c1@FreeBSD.org>
Subject: Re: svn commit: r307321 - in head/sys/arm64: arm64 include
References: <201610141553.u9EFrmT7062155@repo.freebsd.org>
In-Reply-To: <201610141553.u9EFrmT7062155@repo.freebsd.org>

--naRKO9CPQCK5o11CPCjgv7mm4qx6HpxMf
Content-Type: multipart/mixed;
 boundary="------------0F29FCD2389F98BF52E7E1FC"

This is a multi-part message in MIME format.
--------------0F29FCD2389F98BF52E7E1FC
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi Andrew,

On 10/14/2016 17:53, Andrew Turner wrote:
> Author: andrew
> Date: Fri Oct 14 15:53:48 2016
> New Revision: 307321
> URL: https://svnweb.freebsd.org/changeset/base/307321
>=20
> Log:
>   Rework how we store the VFP registers in the pcb. This will be used w=
hen
>   creating a floating-point context within the kernel without having to=
 move
>   the stored values in memory.
>  =20
>   Sponsored by:	The FreeBSD Foundation
>=20
> Modified:
>   head/sys/arm64/arm64/machdep.c
>   head/sys/arm64/arm64/vfp.c
>   head/sys/arm64/arm64/vm_machdep.c
>   head/sys/arm64/include/pcb.h
>   head/sys/arm64/include/vfp.h

[...]

> Modified: head/sys/arm64/include/pcb.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/arm64/include/pcb.h	Fri Oct 14 15:16:44 2016	(r307320)
> +++ head/sys/arm64/include/pcb.h	Fri Oct 14 15:53:48 2016	(r307321)
> @@ -31,6 +31,8 @@
> =20
>  #ifndef LOCORE
> =20
> +#include <machine/vfp.h>
> +
>  struct trapframe;
> =20
>  #define	PCB_LR		30
> @@ -49,13 +51,17 @@ struct pcb {
>  #define	PCB_SINGLE_STEP_SHIFT	0
>  #define	PCB_SINGLE_STEP		(1 << PCB_SINGLE_STEP_SHIFT)
> =20
> -	/* Place last to simplify the asm to access the rest if the struct */=

> -	__uint128_t	pcb_vfp[32];
> -	uint32_t	pcb_fpcr;
> -	uint32_t	pcb_fpsr;
> +	struct vfpstate	*pcb_fpusaved;
>  	int		pcb_fpflags;
>  #define	PCB_FP_STARTED	0x01
>  	u_int		pcb_vfpcpu;	/* Last cpu this thread ran VFP code */
> +
> +	/*
> +	 * The userspace VFP state. The pcb_fpusaved pointer will point to
> +	 * this unless the kernel has allocated a VFP context.
> +	 * Place last to simplify the asm to access the rest if the struct.
> +	 */
> +	struct vfpstate	pcb_fpustate;
>  };
> =20
>  #ifdef _KERNEL
>=20
> Modified: head/sys/arm64/include/vfp.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/arm64/include/vfp.h	Fri Oct 14 15:16:44 2016	(r307320)
> +++ head/sys/arm64/include/vfp.h	Fri Oct 14 15:53:48 2016	(r307321)
> @@ -35,6 +35,12 @@
>  #ifdef _KERNEL
> =20
>  #ifndef LOCORE
> +struct vfpstate {
> +	__uint128_t	vfp_regs[32];
> +	uint32_t	vfp_fpcr;
> +	uint32_t	vfp_fpsr;
> +};
> +
>  void	vfp_init(void);
>  void	vfp_discard(struct thread *);
>  void	vfp_restore_state(void);

These changes break buildworld for arm64:
In file included from /usr/home/def/FreeBSD/ekcd/repo/lib/libutil/kinfo_g=
etfile.c:5:
In file included from
/usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/sys=
/user.h:38:
/usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/mac=
hine/pcb.h:64:18:
error: field has incomplete type 'struct vfpstate'
        struct vfpstate pcb_fpustate;
                        ^
/usr/obj/arm64.aarch64/usr/home/def/FreeBSD/ekcd/repo/tmp/usr/include/mac=
hine/pcb.h:54:9:
note: forward declaration of 'struct vfpstate'
        struct vfpstate *pcb_fpusaved;
               ^
1 error generated.
--- kinfo_getfile.o ---
*** [kinfo_getfile.o] Error code 1

You might want to consider making vfpstate available for userland as in a=
rm
case. If so I'm attaching a patch for it.


Konrad

--------------0F29FCD2389F98BF52E7E1FC
Content-Type: text/x-patch;
 name="vfpstate.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="vfpstate.patch"

diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h
index de99118..9429247 100644
--- a/sys/arm64/include/vfp.h
+++ b/sys/arm64/include/vfp.h
@@ -32,15 +32,15 @@
 #ifndef _MACHINE_VFP_H_
 #define	_MACHINE_VFP_H_
=20
-#ifdef _KERNEL
-
 #ifndef LOCORE
+
 struct vfpstate {
 	__uint128_t	vfp_regs[32];
 	uint32_t	vfp_fpcr;
 	uint32_t	vfp_fpsr;
 };
=20
+#ifdef _KERNEL
 void	vfp_init(void);
 void	vfp_discard(struct thread *);
 void	vfp_restore_state(void);

--------------0F29FCD2389F98BF52E7E1FC--

--naRKO9CPQCK5o11CPCjgv7mm4qx6HpxMf--

--LrR0ev3DmqnFePiuhcL61Fu1ljARN0KKN
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQJ8BAEBCgBmBQJYAhX1XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGREI1MzAxNjZGNTBCM0NCRUQ5QjZGNzdF
MUMxMjI1QjBCMjZBNEYwAAoJEOHBIlsLJqTwJPAQAJIuw61OdSgvS2Rr4WCa3MQf
6z2U1hYtSboIl8KLtFbkGSoqA6t6ef9pWmIUkZTIDTxXqawymL+5uqFuNI/H6aDZ
gQNte91zrM0MYYEPEX/5nhWUbHbk8xfVaVa0zXhXP7dXZuWP3YGOjyjaNswjqA6o
yDKPKLgDK5HAwfhsc0m5K12DhQ4vnJfMO9AziQlVTJJ8nfmbeC5EbvMd3L1v34se
cLkHh2ElUTVK63MrkrAZbdOhgDy9tibO2CSA4twJO5g+LBIA4cNC0t7ZBwBRC/bn
s4JKWpO0dHAj1PyyJ7A348yRFOWcg+z4jhGXnPsXKo3nK5Zedi810k75rNErBhz+
p9YjWdCWwmtX+sj4gKVoY3h8uEUXNvYIovec1Em51UtufaWIbBQfrWleDNnM7W8X
/FD0+E379AgxOrAXsEvch6QKWo4CjGI6PALyawPXnfx6rJrNVKslRFhX+Yi2iph+
0T+b01WRNFwdvqZythzM4tdG+IFwhFtcNRfZGTYekZ+g01YO/SUvhy0Rm2PExKyl
ifxgnaGvjv0EauFVtG2zm0vsyqEsynSgxs79TnTk1ftBDIMTkO1Aemhj/1/7Lm/i
dd4rcpXaznAuly15kQB3jfUJ3gXaBH14IryA/TCM+wO/xpLa9wYZG1fGjALp7iap
ato1jTzqojr7J+usqVLi
=7uVE
-----END PGP SIGNATURE-----

--LrR0ev3DmqnFePiuhcL61Fu1ljARN0KKN--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?eac3148a-4696-a5bf-f531-fcf40630b3c1>