arm64: ensure __raw_read_system_reg() is self-consistent
authorMark Rutland <mark.rutland@arm.com>
Thu, 2 Feb 2017 17:32:15 +0000 (17:32 +0000)
committerWill Deacon <will.deacon@arm.com>
Thu, 2 Feb 2017 18:34:38 +0000 (18:34 +0000)
commit965861d66fad6ce07bd5c5ecbe6514bc50b8fc11
tree5ef91fe1935cb720a522f61c16c6cd34f5f53a05
parent7d0928f18bf890d2853281f59aba0dd5a46b34f9
arm64: ensure __raw_read_system_reg() is self-consistent

We recently discovered that __raw_read_system_reg() erroneously mapped
sysreg IDs to the wrong registers.

To ensure that we don't get hit by a similar issue in future, this patch
makes __raw_read_system_reg() use a macro for each case statement,
ensuring that each case reads the correct register.

To ensure that this patch hasn't introduced an issue, I've binary-diffed
the object files before and after this patch. No code or data sections
differ (though some debug section differ due to line numbering
changing).

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/cpufeature.c