(Please keep the list CC'ed) Hi Marcello,
On Mon, 2025-05-19 at 18:51 +0200, Marcelo Bezerra wrote: > I wonder if the code in > https://github.com/torvalds/linux/blob/a5806cd506af5a7c19bcd596e4708b5c464bfd21/arch/sparc/lib/crc32_glue.c#L62 > should be returning non 0 when it lacks HWCAP_SPARC_CRYPTO or fails > the CFR_CRC32C checks. > > static int __init crc32_sparc_init(void) > { > unsigned long cfr; > > if (!(sparc64_elf_hwcap & HWCAP_SPARC_CRYPTO)) > return 0; <=== here > > __asm__ __volatile__("rd %%asr26, %0" : "=r" (cfr)); > if (!(cfr & CFR_CRC32C)) > return 0; <=== and here > > static_branch_enable(&have_crc32c_opcode); > pr_info("Using sparc64 crc32c opcode optimized CRC32C implementation\n"); > return 0; > } > arch_initcall(crc32_sparc_init); This is actually correct as the conditional checks only determine whether static_branch_enable() is called or not and as you can see from the code above, that only happens when both the flags HWCAP_SPARC_CRYPTO and CFR_CRC32C are present. The code is similar to the one on powerpc which also returns zero even when no hardware support for crc32 instructions was found [1]. Adrian > [1] > https://elixir.bootlin.com/linux/v6.14.7/source/arch/powerpc/lib/crc32-glue.c#L73 -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

