summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd
diff options
context:
space:
mode:
authorpd <pd@openbsd.org>2020-06-16 08:46:03 +0000
committerpd <pd@openbsd.org>2020-06-16 08:46:03 +0000
commitd1d2907d1e7543dfd882675c2ffeefe9de69d5cf (patch)
treeab9231b397e27ed1807ee976468b1490065eb031 /usr.sbin/vmd
parentd and D keys to reset to default in customize mode. (diff)
downloadwireguard-openbsd-d1d2907d1e7543dfd882675c2ffeefe9de69d5cf.tar.xz
wireguard-openbsd-d1d2907d1e7543dfd882675c2ffeefe9de69d5cf.zip
vmd(8): backout previous commit to ns8250.c as it reintroduced the bug where the
vm would get stuck if disconnected from console and get unstuck once console is attached. Spotted by tb@
Diffstat (limited to 'usr.sbin/vmd')
-rw-r--r--usr.sbin/vmd/ns8250.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/usr.sbin/vmd/ns8250.c b/usr.sbin/vmd/ns8250.c
index 44b7e20c5d1..b21ccf7adfd 100644
--- a/usr.sbin/vmd/ns8250.c
+++ b/usr.sbin/vmd/ns8250.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ns8250.c,v 1.26 2020/06/16 06:23:51 pd Exp $ */
+/* $OpenBSD: ns8250.c,v 1.27 2020/06/16 08:46:03 pd Exp $ */
/*
* Copyright (c) 2016 Mike Larkin <mlarkin@openbsd.org>
*
@@ -55,13 +55,10 @@ static void
ratelimit(int fd, short type, void *arg)
{
/* Set TXRDY and clear "no pending interrupt" */
- mutex_lock(&com1_dev.mutex);
com1_dev.regs.iir |= IIR_TXRDY;
com1_dev.regs.iir &= ~IIR_NOPEND;
-
vcpu_assert_pic_irq(com1_dev.vmid, 0, com1_dev.irq);
vcpu_deassert_pic_irq(com1_dev.vmid, 0, com1_dev.irq);
- mutex_unlock(&com1_dev.mutex);
}
void
@@ -133,26 +130,21 @@ com_rcv_event(int fd, short kind, void *arg)
* has become available now will be moved to the com port later.
*/
if (com1_dev.rcv_pending) {
- goto end;
+ mutex_unlock(&com1_dev.mutex);
+ return;
}
if (com1_dev.regs.lsr & LSR_RXRDY)
com1_dev.rcv_pending = 1;
else {
com_rcv(&com1_dev, (uintptr_t)arg, 0);
- }
-
-end:
- if (com1_dev.regs.ier & IER_ERXRDY) {
- com1_dev.regs.iir |= IIR_RXRDY;
- com1_dev.regs.iir &= ~IIR_NOPEND;
- }
- /* If pending interrupt, inject */
- if ((com1_dev.regs.iir & IIR_NOPEND) == 0) {
- /* XXX: vcpu_id */
- vcpu_assert_pic_irq((uintptr_t)arg, 0, com1_dev.irq);
- vcpu_deassert_pic_irq((uintptr_t)arg, 0, com1_dev.irq);
+ /* If pending interrupt, inject */
+ if ((com1_dev.regs.iir & IIR_NOPEND) == 0) {
+ /* XXX: vcpu_id */
+ vcpu_assert_pic_irq((uintptr_t)arg, 0, com1_dev.irq);
+ vcpu_deassert_pic_irq((uintptr_t)arg, 0, com1_dev.irq);
+ }
}
mutex_unlock(&com1_dev.mutex);