MIPS: Add crc instruction support flag to elf_hwcap
authorMarcin Nowakowski <marcin.nowakowski@mips.com>
Fri, 9 Feb 2018 22:11:05 +0000 (22:11 +0000)
committerJames Hogan <jhogan@kernel.org>
Mon, 19 Feb 2018 20:50:35 +0000 (20:50 +0000)
Indicate that CRC32 and CRC32C instuctions are supported by the CPU
through elf_hwcap flags.

This will be used by a follow-up commit that introduces crc32(c) crypto
acceleration modules and is required by GENERIC_CPU_AUTOPROBE feature.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@mips.com>
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/18600/

arch/mips/include/asm/mipsregs.h
arch/mips/include/uapi/asm/hwcap.h
arch/mips/kernel/cpu-probe.c

index 858752dac3373475234063ba8940013bc5f97cae..f65859784a4c1f41b70050b2d35a07bafade6535 100644 (file)
 #define MIPS_CONF5_FRE         (_ULCAST_(1) << 8)
 #define MIPS_CONF5_UFE         (_ULCAST_(1) << 9)
 #define MIPS_CONF5_CA2         (_ULCAST_(1) << 14)
+#define MIPS_CONF5_CRCP                (_ULCAST_(1) << 18)
 #define MIPS_CONF5_MSAEN       (_ULCAST_(1) << 27)
 #define MIPS_CONF5_EVA         (_ULCAST_(1) << 28)
 #define MIPS_CONF5_CV          (_ULCAST_(1) << 29)
index 600ad8fd683565c5b756c4654cb1eba4ed346af8..a2aba4b059e63ff535ac3f46d35efa67ef258bf0 100644 (file)
@@ -5,5 +5,6 @@
 /* HWCAP flags */
 #define HWCAP_MIPS_R6          (1 << 0)
 #define HWCAP_MIPS_MSA         (1 << 1)
+#define HWCAP_MIPS_CRC32       (1 << 2)
 
 #endif /* _UAPI_ASM_HWCAP_H */
index cf3fd549e16d05a6e666ee8d96e4bde06878c650..6b07b739f914d06ebb6fc8777e4b3fb2be914547 100644 (file)
@@ -848,6 +848,9 @@ static inline unsigned int decode_config5(struct cpuinfo_mips *c)
        if (config5 & MIPS_CONF5_CA2)
                c->ases |= MIPS_ASE_MIPS16E2;
 
+       if (config5 & MIPS_CONF5_CRCP)
+               elf_hwcap |= HWCAP_MIPS_CRC32;
+
        return config5 & MIPS_CONF_M;
 }