arm64: Prepare arch_nmi_enter() for recursion
authorFrederic Weisbecker <frederic@kernel.org>
Thu, 27 Feb 2020 08:51:40 +0000 (09:51 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 19 May 2020 13:51:17 +0000 (15:51 +0200)
commit28f6bf9e247fe23d177cfdbf7e709270e8cc7fa6
tree98779ac32476edcab0027f77161f7983674a7d5f
parentb0f51883f551b900a04a80f49fb0886caf7e9a12
arm64: Prepare arch_nmi_enter() for recursion

When using nmi_enter() recursively, arch_nmi_enter() must also be recursion
safe. In particular, it must be ensured that HCR_TGE is always set while in
NMI context when in HYP mode, and be restored to it's former state when
done.

The current code fails this when interleaved wrong. Notably it overwrites
the original hcr state on nesting.

Introduce a nesting counter to make sure to store the original value.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lkml.kernel.org/r/20200505134100.771491291@linutronix.de
arch/arm64/include/asm/hardirq.h