target/arm: Fix ISR_EL1 tracking when executing at EL2
commit7cf95aed53c8770a338617ef40d5f37d2c197853
authorMarc Zyngier <maz@kernel.org>
Tue, 26 Nov 2019 13:55:36 +0000 (26 13:55 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 26 Nov 2019 13:55:36 +0000 (26 13:55 +0000)
treeb746b3639c25316c75d370d1842829d9832cba97
parentf0138990ce1e8166ef1488e3b77b2d21ce71ede3
target/arm: Fix ISR_EL1 tracking when executing at EL2

The ARMv8 ARM states when executing at EL2, EL3 or Secure EL1,
ISR_EL1 shows the pending status of the physical IRQ, FIQ, or
SError interrupts.

Unfortunately, QEMU's implementation only considers the HCR_EL2
bits, and ignores the current exception level. This means a hypervisor
trying to look at its own interrupt state actually sees the guest
state, which is unexpected and breaks KVM as of Linux 5.3.

Instead, check for the running EL and return the physical bits
if not running in a virtualized context.

Fixes: 636540e9c40b
Cc: qemu-stable@nongnu.org
Reported-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Message-id: 20191122135833.28953-1-maz@kernel.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/helper.c