arm64: dump cpu_hwcaps at panic time
authorMark Rutland <mark.rutland@arm.com>
Wed, 21 Jun 2017 17:11:23 +0000 (18:11 +0100)
committerWill Deacon <will.deacon@arm.com>
Thu, 22 Jun 2017 14:58:20 +0000 (15:58 +0100)
commit8effeaaf2cacc8a8007d3089e253e7baaff57bb7
tree3ba3ae5c906ca03a21abd13b111ac376759c7d70
parent936eb65ca22ad856cb3a995e8cd742e982dc2dd0
arm64: dump cpu_hwcaps at panic time

When debugging a kernel panic(), it can be useful to know which CPU
features have been detected by the kernel, as some code paths can depend
on these (and may have been patched at runtime).

This patch adds a notifier to dump the detected CPU caps (as a hex
string) at panic(), when we log other information useful for debugging.
On a Juno R1 system running v4.12-rc5, this looks like:

[  615.431249] Kernel panic - not syncing: Fatal exception in interrupt
[  615.437609] SMP: stopping secondary CPUs
[  615.441872] Kernel Offset: disabled
[  615.445372] CPU features: 0x02086
[  615.448522] Memory Limit: none

A developer can decode this by looking at the corresponding
<asm/cpucaps.h> bits. For example, the above decodes as:

* bit  1: ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE
* bit  2: ARM64_WORKAROUND_845719
* bit  7: ARM64_WORKAROUND_834220
* bit 13: ARM64_HAS_32BIT_EL0

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Steve Capper <steve.capper@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