-/* $OpenBSD: vmm_machdep.c,v 1.7 2023/09/05 14:00:40 mlarkin Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.8 2023/09/06 03:35:57 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
*/
irq = vrp->vrp_irq;
+ if (vrp->vrp_intr_pending)
+ vcpu->vc_intr = 1;
+ else
+ vcpu->vc_intr = 0;
+
if (vrp->vrp_continue) {
switch (vcpu->vc_gueststate.vg_exit_reason) {
case VMX_EXIT_IO:
irq = vrp->vrp_irq;
+ if (vrp->vrp_intr_pending)
+ vcpu->vc_intr = 1;
+ else
+ vcpu->vc_intr = 0;
+
/*
* If we are returning from userspace (vmd) because we exited
* last time, fix up any needed vcpu state first. Which state
-/* $OpenBSD: vmmvar.h,v 1.93 2023/09/05 14:00:41 mlarkin Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.94 2023/09/06 03:35:57 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
uint32_t vrp_vcpu_id;
uint8_t vrp_continue; /* Continuing from an exit */
uint16_t vrp_irq; /* IRQ to inject */
+ uint8_t vrp_intr_pending; /* Additional intrs pending? */
/* Input/output parameter to VMM_IOC_RUN */
struct vm_exit *vrp_exit; /* updated exit data */
-/* $OpenBSD: vm.c,v 1.90 2023/07/13 18:31:59 dv Exp $ */
+/* $OpenBSD: vm.c,v 1.91 2023/09/06 03:35:57 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
} else
vrp->vrp_irq = 0xFFFF;
- /* Still more pending? */
- if (i8259_is_pending()) {
- /*
- * XXX can probably avoid ioctls here by providing intr
- * in vrp
- */
- if (vcpu_pic_intr(vrp->vrp_vm_id,
- vrp->vrp_vcpu_id, 1)) {
- fatal("can't set INTR");
- }
- } else {
- if (vcpu_pic_intr(vrp->vrp_vm_id,
- vrp->vrp_vcpu_id, 0)) {
- fatal("can't clear INTR");
- }
- }
+ /* Still more interrupts pending? */
+ vrp->vrp_intr_pending = i8259_is_pending();
if (ioctl(env->vmd_fd, VMM_IOC_RUN, vrp) == -1) {
/* If run ioctl failed, exit */