hw/intc/arm_gicv3_cpuif: Tolerate spurious EOIR writes
PATCH v2 1/1 hw/intc/arm_gicv3_cpuif: Tolerate spurious EOIR writes
Commit 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic") added an assert_not_reached() if the guest writes the EOIR register while no interrupt is active.
It turns out some software does this: EDK2, in GicV3ExitBootServicesEvent(), unconditionally write EOIR for all interrupts that it manages. This now causes QEMU to abort when running UEFI on a VM with GICv3. Although it is UNPREDICTABLE behavior and EDK2 does need fixing, the punishment seems a little harsh, especially since icc_eoir_write() already tolerates writes of nonexistent interrupt numbers. Display a guest error and tolerate spurious EOIR writes.
---
v2: Added qemu_log_mask() (so I didn't keep the Reviewed-by tag)
v1: https://lore.kernel.org/qemu-devel/[email protected]/
--- hw/intc/arm_gicv3_cpuif.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/intc/arm_gicv3_cpuif.c +4 -1
@@ -14,6 +14,7 @@#include "qemu/osdep.h" #include "qemu/bitops.h" +#include "qemu/log.h" #include "qemu/main-loop.h" #include "trace.h" #include "gicv3_internal.h"
@@ -1357,7 +1358,9 @@ static void icc_eoir_write(CPUARMState *env, const ARMCPRegInfo *ri, }break ;default : -g_assert_not_reached (); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: IRQ %d isn't active\n" , __func__, irq); +return ; }icc_drop_prio (cs, grp);
Signature · 1 line
2.31.1
Quoted 14 lines · Jean-Philippe Brucker
Commit
382c7160d1cd("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic") added anassert_not_reached()if the guest writes the EOIR register while no interrupt is active.It turns out some software does this: EDK2, in
GicV3ExitBootServicesEvent(), unconditionally write EOIR for all interrupts that it manages. This now causes QEMU to abort when running UEFI on a VM with GICv3. Although it is UNPREDICTABLE behavior and EDK2 does need fixing, the punishment seems a little harsh, especially sinceicc_eoir_write()already tolerates writes of nonexistent interrupt numbers. Display a guest error and tolerate spurious EOIR writes.Fixes 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic")Signed-off-by Jean-Philippe Brucker <[email protected]>
Quoted 7 lines
---
v2: Addedqemu_log_mask()(so I didn't keep the Reviewed-by tag)
v1: https://lore.kernel.org/qemu-devel/[email protected]/--- hw/intc/arm_gicv3_cpuif.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 12 lines · Jean-Philippe Brucker
Commit
382c7160d1cd("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic") added anassert_not_reached()if the guest writes the EOIR register while no interrupt is active.It turns out some software does this: EDK2, in
GicV3ExitBootServicesEvent(), unconditionally write EOIR for all interrupts that it manages. This now causes QEMU to abort when running UEFI on a VM with GICv3. Although it is UNPREDICTABLE behavior and EDK2 does need fixing, the punishment seems a little harsh, especially sinceicc_eoir_write()already tolerates writes of nonexistent interrupt numbers. Display a guest error and tolerate spurious EOIR writes.
Quoted 2 lines
Fixes 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic")Signed-off-by Jean-Philippe Brucker <[email protected]>
Xen seems good at triggering this as well...
Signature · 1 line
Alex Bennée
Peter Maydell
AppliedQuoted 13 lines · Jean-Philippe Brucker
Commit
382c7160d1cd("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic") added anassert_not_reached()if the guest writes the EOIR register while no interrupt is active.It turns out some software does this: EDK2, in
GicV3ExitBootServicesEvent(), unconditionally write EOIR for all interrupts that it manages. This now causes QEMU to abort when running UEFI on a VM with GICv3. Although it is UNPREDICTABLE behavior and EDK2 does need fixing, the punishment seems a little harsh, especially sinceicc_eoir_write()already tolerates writes of nonexistent interrupt numbers. Display a guest error and tolerate spurious EOIR writes.
Quoted 5 lines
Fixes 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic")Signed-off-by Jean-Philippe Brucker <[email protected]>---
v2: Addedqemu_log_mask()(so I didn't keep the Reviewed-by tag)
v1: https://lore.kernel.org/qemu-devel/[email protected]/
Applied to target-arm.next, thanks.
-- PMM