The ARM v8.1 architecture introduces new atomic instructions to the A64
instruction set for things like cmpxchg, so advertise their availability
to userspace using a hwcap.
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
 #define HWCAP_SHA1             (1 << 5)
 #define HWCAP_SHA2             (1 << 6)
 #define HWCAP_CRC32            (1 << 7)
+#define HWCAP_ATOMICS          (1 << 8)
 
 #endif /* _UAPI__ASM_HWCAP_H */
 
        if (block && !(block & 0x8))
                elf_hwcap |= HWCAP_CRC32;
 
+       block = (features >> 20) & 0xf;
+       if (!(block & 0x8)) {
+               switch (block) {
+               default:
+               case 2:
+                       elf_hwcap |= HWCAP_ATOMICS;
+               case 1:
+                       /* RESERVED */
+               case 0:
+                       break;
+               }
+       }
+
 #ifdef CONFIG_COMPAT
        /*
         * ID_ISAR5_EL1 carries similar information as above, but pertaining to
        "sha1",
        "sha2",
        "crc32",
+       "atomics",
        NULL
 };