summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/vm.c
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2017-06-07 14:53:29 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2017-06-07 14:53:29 +0000
commit913a48e127bc3e432236141dea89ac7852b4dde6 (patch)
treefed7c70324eefd74b23fa180da30160755262db3 /usr.sbin/vmd/vm.c
parenta10af26d84cdc2d00d374348db8477ef4833b531 (diff)
vmd: Implement simulated baudrate support in the ns8250 module. The
previous version was allowing an output rate that is "too fast", and linux guests would give up after 512 characters TXed ("too much work for irq4"). This diff calculates the approximate rate we can sustain at the current programmed baud rate and limits the output to that rate by inserting a HZ delay after a specified number of characters have been transmitted. This fixes the linux guest console issue. Note that the console now outputs at more or less the selected baud rate, instead of nearly instantaneously as before - if you selected 9600 in your guest VMs before, you might want to change that to 115200 now for a better console experience. krw@ "seems like a good idea to me"
Diffstat (limited to 'usr.sbin/vmd/vm.c')
-rw-r--r--usr.sbin/vmd/vm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c
index 2d38bc0f5e3..1c4e354422b 100644
--- a/usr.sbin/vmd/vm.c
+++ b/usr.sbin/vmd/vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm.c,v 1.19 2017/05/30 17:56:47 tedu Exp $ */
+/* $OpenBSD: vm.c,v 1.20 2017/06/07 14:53:28 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -1347,6 +1347,27 @@ vcpu_assert_pic_irq(uint32_t vm_id, uint32_t vcpu_id, int irq)
}
/*
+ * vcpu_deassert_pic_irq
+ *
+ * Clears the specified IRQ on the supplied vcpu/vm
+ *
+ * Parameters:
+ * vm_id: VM ID to clear in
+ * vcpu_id: VCPU ID to clear in
+ * irq: IRQ to clear
+ */
+void
+vcpu_deassert_pic_irq(uint32_t vm_id, uint32_t vcpu_id, int irq)
+{
+ i8259_deassert_irq(irq);
+
+ if (!i8259_is_pending()) {
+ if (vcpu_pic_intr(vm_id, vcpu_id, 0))
+ fatalx("%s: can't deassert INTR", __func__);
+ }
+}
+
+/*
* fd_hasdata
*
* Determines if data can be read from a file descriptor.