Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2024 09:20:43 +0100
From:      Andrew Turner <andrew@fubar.geek.nz>
To:        Paul Floyd <pjfloyd@wanadoo.fr>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: arm64 mrs and system registers
Message-ID:  <609598D9-93C1-4E62-88F1-4CA33DDDF7AB@fubar.geek.nz>
In-Reply-To: <25700410-7722-4EC4-82EC-3D87E1937EEA@wanadoo.fr>
References:  <e7aa2897-e05a-4a91-a1a0-f6c0a03156ae@wanadoo.fr> <CANCZdfpQBTWK-8DTR0TwE8LzPe81EQ7LzwZpw54iQeAs9d7Fvw@mail.gmail.com> <25700410-7722-4EC4-82EC-3D87E1937EEA@wanadoo.fr>

next in thread | previous in thread | raw e-mail | index | archive | help


> On 8 Apr 2024, at 22:03, Paul Floyd <pjfloyd@wanadoo.fr> wrote:
>=20
>=20
>=20
>> On 8 Apr 2024, at 22:31, Warner Losh <imp@bsdimp.com> wrote:
>>=20
>>=20
>>=20
>> On Mon, Apr 8, 2024 at 9:03=E2=80=AFPM Paul Floyd =
<pjfloyd@wanadoo.fr> wrote:
>> Hi
>>=20
>> I've been looking at this bugzilla item
>>=20
>> https://bugs.kde.org/show_bug.cgi?id=3D392146
>>=20
>> Is there any difference between Linux and FreeBSD when it comes to =
what=20
>> registers and fields are exposed by the kernel (see comment 17 in the=20=

>> link above).
>>=20
>> I don't think so. We've not seen issues with other drivers on aarch64 =
except
>> when they were written on x86 and didn't have the synchronization =
needed
>> for the weaker memory models in aarch64 systems.
>>  I did have a poke around the kernel code but it's a bit hard to tell=20=

>> exactly which of the access macros are being used, without =
exhaustively=20
>> grepping for them one by one.
>>=20
>> Yea, I think that there's missing atomics on the state transitions =
and/or
>> some missing locking that "magically" provides barriers that make it =
work
>> on x86.
>>=20
>=20
> Hi
>=20
> There aren=E2=80=99t any memory issues.
>=20
> The problem is that the opcodes aren=E2=80=99t fully covered. There =
are 3 aspects to that
> 1. What the kernel exposes
> 2. What Valgrind implements (usually a subset of point 1 but it should =
claim things that the kernel doesn=E2=80=99t support).
> 3. Actually handling the opcode.
>=20
> If Linux and FreeBSD expose the same things then I can go ahead with =
looking at a common solution.

The list of registers FreeBSD handles are in user_mrs_handler [1]. They =
are midr_el1, mpidr_el1, revid_el1, and anything that looks like it =
should be an id_aa64 register. See the comment there for the exact list.

When adding support I wrote a tool to read the Arm special registers =
[2]. It should run on both FreeBSD and Linux, although the register =
order may not be identical.

Andrew

[1] =
https://cgit.freebsd.org/src/tree/sys/arm64/arm64/identcpu.c?id=3Dda2b7322=
88c72b347b128e1fa9a169c7bba3beb8#n1907
[2] https://github.com/zxombie/arm64id=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?609598D9-93C1-4E62-88F1-4CA33DDDF7AB>