[PATCH] arm64: Add basic JSON register parser

Marc Zyngier maz at kernel.org
Fri Dec 27 09:47:37 PST 2024


On Wed, 25 Dec 2024 18:57:11 +0000,
Marc Zyngier <maz at kernel.org> wrote:
> 
> We currently populate the sysreg file by hand from the ARM ARM,
> resulting in a bunch of errors being introduced on a regular basis.
> While there is an XML dump of the architecture produced on a quarterly
> basis, the license that comes attached to it excludes any sort of
> open-source usage.
> 
> However, ARM has recently made available a JSON dump[1] that contains
> a reduced set of information under a BSD license. This has enough
> data to extract what is relevant to the sysreg file.
> 
> This is achieved using a JQ script that I cobbled together over
> the holiday, and while it has a number of limitations, it already
> works well enough to extract useful data.
> 
> As an example, here's what the script returns for TCR_EL1:
> 
> $ jq -r --arg REG TCR_EL1 -f arch/arm64/tools/dumpreg.jq ~/Work/XML/2024-12/AARCHMRS_BSD_A_profile/Registers.json
> TCR_EL1	[3,0,0,2,2]	MRS
> TCR_EL1	[3,0,0,2,2]	MSRregister
> TCR_EL12	[3,5,0,2,2]	MRS
> TCR_EL12	[3,5,0,2,2]	MSRregister
> TCRALIAS_EL1	[3,0,7,2,6]	MRS
> TCRALIAS_EL1	[3,0,7,2,6]	MSRregister

The eagle-eyed reviewers will have certainly noticed that the
encodings have a couple of fields swapped. I've since fixed this
locally, together with a bunch of other issues. I'll post v2 in the
new year.

For those interested in the current of affairs, I've pushed out a
branch at [1].

	M.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=arm64/dumpreg.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list