[PATCH v3 33/38] arm64: Avoid cpus_have_const_cap() for ARM64_WORKAROUND_1742098

Mark Rutland mark.rutland at arm.com
Fri Oct 13 03:53:53 PDT 2023


On Tue, Oct 10, 2023 at 11:31:34AM +0100, Mark Rutland wrote:
>  static void elf_hwcap_fixup(void)
>  {
> -#ifdef CONFIG_ARM64_ERRATUM_1742098
> -	if (cpus_have_const_cap(ARM64_WORKAROUND_1742098))
> +	if (cpus_have_cap(ARM64_WORKAROUND_1742098))
>  		compat_elf_hwcap2 &= ~COMPAT_HWCAP2_AES;
> -#endif /* ARM64_ERRATUM_1742098 */
>  }

The kbuild test robot pointed out that this is broken for CONFIG_COMPAT=n,
since compat_elf_hwcap2 is only defined when CONFIG_COMPAT=y. As
CONFIG_ARM64_ERRATUM_1742098 depends on CONFIG_COMPAT, this worked prior to this patch.

I've changed that locally to:

| static void elf_hwcap_fixup(void)
| {
| #ifdef CONFIG_COMPAT
| 	if (cpus_have_cap(ARM64_WORKAROUND_1742098))
| 		compat_elf_hwcap2 &= ~COMPAT_HWCAP2_AES;
| #endif /* CONFIG_COMPAT */
| }

... since the ifdeffery is protecting the use of 'compat_elf_hwcap2', and the
cpucap is now elided by virtue of cpucap_is_possible().

Catalin, aside from the minor fixup above, are you happy to pick this for v6.7?

I can post a v4 with that change (and the commit message updated accordingly).

Mark.



More information about the linux-arm-kernel mailing list