[PATCH 2/3] arm64: insn: Add tests for aarch64_insn_gen_logical_immediate()

Will Deacon will at kernel.org
Tue Feb 15 07:55:26 PST 2022


On Thu, Jan 27, 2022 at 04:21:26PM +0000, James Morse wrote:
> Aarch64 has instructions to generate reasonably complicated 32 or 64
> bit masks from only 13 bits of information.
> aarch64_insn_gen_logical_immediate() has to created the immediate
> encoding by spotting the patterns in the 32 or 64 bit immediate.
> 
> Despite attempts to validate or model this code, or use it as-is outside
> the kernel tree, bugs still exist.
> 
> Add a self test module that tests this code in place against a golden
> set of values.
> 
> Signed-off-by: James Morse <james.morse at arm.com>
> ---
>  arch/arm64/Kconfig.debug                   |  3 +
>  arch/arm64/Makefile                        |  2 +
>  arch/arm64/lib/Makefile                    |  2 +
>  arch/arm64/lib/insn.c                      |  3 +
>  arch/arm64/lib/test_insn.c                 | 90 ++++++++++++++++++++++

Can we put the new tests under tools/testing/selftests/arm64 as well,
please? It looks like there's precedence for having modules in there (e.g.
bpf_testmod.c).

In the meantime, I'll pick up patch 3.

Cheers,

Will



More information about the linux-arm-kernel mailing list