Skip to content

Commit

Permalink
ARM: elf: add new hwcap for identifying atomic ldrd/strd instructions
Browse files Browse the repository at this point in the history
commit a469abd0f868c902b75532579bf87553dcf1b360 upstream.

CPUs implementing LPAE have atomic ldrd/strd instructions, meaning that
userspace software can avoid having to use the exclusive variants of
these instructions if they wish.

This patch advertises the atomicity of these instructions via the
hwcaps, so userspace can detect this CPU feature.

Reported-by: Vladimir Danushevsky <vladimir.danushevsky@oracle.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
wildea01 authored and remyoudompheng committed Apr 15, 2020
1 parent ad58bda commit ad2575c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void __init early_print(const char *str, ...)

static void __init cpuid_init_hwcaps(void)
{
unsigned int divide_instrs;
unsigned int divide_instrs, vmsa;

if (cpu_architecture() < CPU_ARCH_ARMv7)
return;
Expand All @@ -380,6 +380,11 @@ static void __init cpuid_init_hwcaps(void)
case 1:
elf_hwcap |= HWCAP_IDIVT;
}

/* LPAE implies atomic ldrd/strd instructions */
vmsa = (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xf) >> 0;
if (vmsa >= 5)
elf_hwcap |= HWCAP_LPAE;
}

static void __init feat_v6_fixup(void)
Expand Down

0 comments on commit ad2575c

Please sign in to comment.