summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2020-10-10 17:05:55 +0000
committerkettenis <kettenis@openbsd.org>2020-10-10 17:05:55 +0000
commit0c5cb0211f56ff89b49a36b427cead5c6460aff9 (patch)
tree7b2c01f9e064903a85a94a35da969037266c1f59
parentAdd OPAL_PCI_MAP_PE_DMA_WINDOW. (diff)
downloadwireguard-openbsd-0c5cb0211f56ff89b49a36b427cead5c6460aff9.tar.xz
wireguard-openbsd-0c5cb0211f56ff89b49a36b427cead5c6460aff9.zip
Handle spurious interrupts.
ok patrick@, deraadt@
-rw-r--r--sys/arch/powerpc64/dev/xive.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/arch/powerpc64/dev/xive.c b/sys/arch/powerpc64/dev/xive.c
index 57ad233f737..5953b66b3aa 100644
--- a/sys/arch/powerpc64/dev/xive.c
+++ b/sys/arch/powerpc64/dev/xive.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xive.c,v 1.14 2020/09/26 17:56:54 kettenis Exp $ */
+/* $OpenBSD: xive.c,v 1.15 2020/10/10 17:05:55 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
*
@@ -395,8 +395,17 @@ xive_hvi(struct trapframe *frame)
/* Synchronize software state to hardware state. */
cppr = ack;
new = xive_ipl(cppr);
+ if (new <= old) {
+ /*
+ * QEMU generates spurious interrupts. It is
+ * unclear whether this can happen on real
+ * hardware as well. We just ignore the
+ * interrupt, but we need to reset the CPPR
+ * register since we did accept the interrupt.
+ */
+ goto spurious;
+ }
ci->ci_cpl = new;
- KASSERT(new > old);
KASSERT(cppr < XIVE_NUM_PRIORITIES);
eq = &sc->sc_eq[ci->ci_cpuid][cppr];
@@ -436,6 +445,7 @@ xive_hvi(struct trapframe *frame)
}
ci->ci_cpl = old;
+ spurious:
xive_write_1(sc, XIVE_TM_CPPR_HV, xive_prio(old));
eieio();
}