void lapic_intr_accepted(struct vm *vm, int cpu, int vector) { struct vlapic *vlapic; vlapic = vm_lapic(vm, cpu); vlapic_intr_accepted(vlapic, vector); }
int lapic_pending_intr(struct vm *vm, int cpu) { struct vlapic *vlapic; vlapic = vm_lapic(vm, cpu); return (vlapic_pending_intr(vlapic)); }
void lapic_timer_tick(struct vm *vm, int cpu) { struct vlapic *vlapic; vlapic = vm_lapic(vm, cpu); vlapic_timer_tick(vlapic); }
int lapic_read(struct vm *vm, int cpu, u_int offset, uint64_t *rv) { int handled; struct vlapic *vlapic; vlapic = vm_lapic(vm, cpu); if (vlapic_op_mem_read(vlapic, offset, DWORD, rv) == 0) handled = 1; else handled = 0; return (handled); }
int lapic_write(struct vm *vm, int cpu, u_int offset, uint64_t val) { int handled; struct vlapic *vlapic; vlapic = vm_lapic(vm, cpu); if (vlapic_op_mem_write(vlapic, offset, DWORD, val) == 0) handled = 1; else handled = 0; return (handled); }
int lapic_set_intr(struct vm *vm, int cpu, int vector) { struct vlapic *vlapic; if (cpu < 0 || cpu >= VM_MAXCPU) return (EINVAL); if (vector < 32 || vector > 255) return (EINVAL); vlapic = vm_lapic(vm, cpu); vlapic_set_intr_ready(vlapic, vector); vm_interrupt_hostcpu(vm, cpu); return (0); }
/* * Reset the vlapic's trigger-mode register to reflect the ioapic pin * configuration. */ static void vioapic_update_tmr(struct vm *vm, int vcpuid, void *arg) { struct vioapic *vioapic; struct vlapic *vlapic; uint32_t low, high, dest; int delmode, pin, vector; bool level, phys; vlapic = vm_lapic(vm, vcpuid); vioapic = vm_ioapic(vm); VIOAPIC_LOCK(vioapic); /* * Reset all vectors to be edge-triggered. */ vlapic_reset_tmr(vlapic); for (pin = 0; pin < REDIR_ENTRIES; pin++) { low = vioapic->rtbl[pin].reg; high = vioapic->rtbl[pin].reg >> 32; level = low & IOART_TRGRLVL ? true : false; if (!level) continue; /* * For a level-triggered 'pin' let the vlapic figure out if * an assertion on this 'pin' would result in an interrupt * being delivered to it. If yes, then it will modify the * TMR bit associated with this vector to level-triggered. */ phys = ((low & IOART_DESTMOD) == IOART_DESTPHY); delmode = low & IOART_DELMOD; vector = low & IOART_INTVEC; dest = high >> APIC_ID_SHIFT; vlapic_set_tmr_level(vlapic, dest, phys, delmode, vector); } VIOAPIC_UNLOCK(vioapic); }