Lines Matching +full:gpa +full:- +full:0

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
149 VMMDEV_IOCTL(VM_PPTDEV_MSI, 0),
150 VMMDEV_IOCTL(VM_PPTDEV_MSIX, 0),
151 VMMDEV_IOCTL(VM_PPTDEV_DISABLE_MSIX, 0),
152 VMMDEV_IOCTL(VM_LAPIC_MSI, 0),
153 VMMDEV_IOCTL(VM_IOAPIC_ASSERT_IRQ, 0),
154 VMMDEV_IOCTL(VM_IOAPIC_DEASSERT_IRQ, 0),
155 VMMDEV_IOCTL(VM_IOAPIC_PULSE_IRQ, 0),
156 VMMDEV_IOCTL(VM_IOAPIC_PINCOUNT, 0),
157 VMMDEV_IOCTL(VM_ISA_ASSERT_IRQ, 0),
158 VMMDEV_IOCTL(VM_ISA_DEASSERT_IRQ, 0),
159 VMMDEV_IOCTL(VM_ISA_PULSE_IRQ, 0),
160 VMMDEV_IOCTL(VM_ISA_SET_IRQ_TRIGGER, 0),
161 VMMDEV_IOCTL(VM_GET_GPA_PMAP, 0),
162 VMMDEV_IOCTL(VM_GET_HPET_CAPABILITIES, 0),
163 VMMDEV_IOCTL(VM_RTC_READ, 0),
164 VMMDEV_IOCTL(VM_RTC_WRITE, 0),
165 VMMDEV_IOCTL(VM_RTC_GETTIME, 0),
166 VMMDEV_IOCTL(VM_RTC_SETTIME, 0),
204 error = 0; in vmmdev_machdep_ioctl()
213 if (error != 0) in vmmdev_machdep_ioctl()
216 error = copyout(vme, vmrun->vm_exit, sizeof(*vme)); in vmmdev_machdep_ioctl()
217 if (error != 0) in vmmdev_machdep_ioctl()
219 if (vme->exitcode == VM_EXITCODE_IPI) { in vmmdev_machdep_ioctl()
221 vmrun->cpuset, in vmmdev_machdep_ioctl()
222 min(vmrun->cpusetsize, sizeof(cpuset_t))); in vmmdev_machdep_ioctl()
223 if (error != 0) in vmmdev_machdep_ioctl()
225 if (sizeof(cpuset_t) < vmrun->cpusetsize) { in vmmdev_machdep_ioctl()
228 p = (uint8_t *)vmrun->cpuset + in vmmdev_machdep_ioctl()
230 while (p < (uint8_t *)vmrun->cpuset + in vmmdev_machdep_ioctl()
231 vmrun->cpusetsize) { in vmmdev_machdep_ioctl()
232 if (subyte(p++, 0) != 0) { in vmmdev_machdep_ioctl()
247 vme_13 = &vmrun_13->vm_exit; in vmmdev_machdep_ioctl()
251 if (error == 0) { in vmmdev_machdep_ioctl()
252 vme_13->exitcode = vme->exitcode; in vmmdev_machdep_ioctl()
253 vme_13->inst_length = vme->inst_length; in vmmdev_machdep_ioctl()
254 vme_13->rip = vme->rip; in vmmdev_machdep_ioctl()
255 memcpy(vme_13->u, &vme->u, sizeof(vme_13->u)); in vmmdev_machdep_ioctl()
256 if (vme->exitcode == VM_EXITCODE_IPI) { in vmmdev_machdep_ioctl()
262 ipi = (struct vm_exit_ipi_13 *)&vme_13->u[0]; in vmmdev_machdep_ioctl()
263 BIT_ZERO(256, &ipi->dmask); in vmmdev_machdep_ioctl()
267 BIT_SET(256, cpu, &ipi->dmask); in vmmdev_machdep_ioctl()
277 getmicrotime(&vmstats_13->tv); in vmmdev_machdep_ioctl()
278 error = vmm_stat_copy(vcpu, 0, nitems(vmstats_13->statbuf), in vmmdev_machdep_ioctl()
279 &vmstats_13->num_entries, vmstats_13->statbuf); in vmmdev_machdep_ioctl()
286 pptmsi->bus, pptmsi->slot, pptmsi->func, in vmmdev_machdep_ioctl()
287 pptmsi->addr, pptmsi->msg, in vmmdev_machdep_ioctl()
288 pptmsi->numvec); in vmmdev_machdep_ioctl()
293 pptmsix->bus, pptmsix->slot, in vmmdev_machdep_ioctl()
294 pptmsix->func, pptmsix->idx, in vmmdev_machdep_ioctl()
295 pptmsix->addr, pptmsix->msg, in vmmdev_machdep_ioctl()
296 pptmsix->vector_control); in vmmdev_machdep_ioctl()
300 error = ppt_disable_msix(vm, pptdev->bus, pptdev->slot, in vmmdev_machdep_ioctl()
301 pptdev->func); in vmmdev_machdep_ioctl()
305 error = ppt_map_mmio(vm, pptmmio->bus, pptmmio->slot, in vmmdev_machdep_ioctl()
306 pptmmio->func, pptmmio->gpa, pptmmio->len, in vmmdev_machdep_ioctl()
307 pptmmio->hpa); in vmmdev_machdep_ioctl()
311 error = ppt_unmap_mmio(vm, pptmmio->bus, pptmmio->slot, in vmmdev_machdep_ioctl()
312 pptmmio->func, pptmmio->gpa, pptmmio->len); in vmmdev_machdep_ioctl()
316 error = vm_assign_pptdev(vm, pptdev->bus, pptdev->slot, in vmmdev_machdep_ioctl()
317 pptdev->func); in vmmdev_machdep_ioctl()
321 error = vm_unassign_pptdev(vm, pptdev->bus, pptdev->slot, in vmmdev_machdep_ioctl()
322 pptdev->func); in vmmdev_machdep_ioctl()
327 vmexc->vector, vmexc->error_code_valid, vmexc->error_code, in vmmdev_machdep_ioctl()
328 vmexc->restart_instruction); in vmmdev_machdep_ioctl()
335 error = lapic_intr_edge(vcpu, vmirq->vector); in vmmdev_machdep_ioctl()
339 error = lapic_set_local_intr(vm, vcpu, vmirq->vector); in vmmdev_machdep_ioctl()
343 error = lapic_intr_msi(vm, vmmsi->addr, vmmsi->msg); in vmmdev_machdep_ioctl()
347 error = vioapic_assert_irq(vm, ioapic_irq->irq); in vmmdev_machdep_ioctl()
351 error = vioapic_deassert_irq(vm, ioapic_irq->irq); in vmmdev_machdep_ioctl()
355 error = vioapic_pulse_irq(vm, ioapic_irq->irq); in vmmdev_machdep_ioctl()
369 if (kernemu->access_width > 0) in vmmdev_machdep_ioctl()
370 size = (1u << kernemu->access_width); in vmmdev_machdep_ioctl()
374 if (kernemu->gpa >= DEFAULT_APIC_BASE && in vmmdev_machdep_ioctl()
375 kernemu->gpa < DEFAULT_APIC_BASE + PAGE_SIZE) { in vmmdev_machdep_ioctl()
378 } else if (kernemu->gpa >= VIOAPIC_BASE && in vmmdev_machdep_ioctl()
379 kernemu->gpa < VIOAPIC_BASE + VIOAPIC_SIZE) { in vmmdev_machdep_ioctl()
382 } else if (kernemu->gpa >= VHPET_BASE && in vmmdev_machdep_ioctl()
383 kernemu->gpa < VHPET_BASE + VHPET_SIZE) { in vmmdev_machdep_ioctl()
392 error = mwrite(vcpu, kernemu->gpa, in vmmdev_machdep_ioctl()
393 kernemu->value, size, &arg); in vmmdev_machdep_ioctl()
395 error = mread(vcpu, kernemu->gpa, in vmmdev_machdep_ioctl()
396 &kernemu->value, size, &arg); in vmmdev_machdep_ioctl()
401 error = vatpic_assert_irq(vm, isa_irq->atpic_irq); in vmmdev_machdep_ioctl()
402 if (error == 0 && isa_irq->ioapic_irq != -1) in vmmdev_machdep_ioctl()
403 error = vioapic_assert_irq(vm, isa_irq->ioapic_irq); in vmmdev_machdep_ioctl()
407 error = vatpic_deassert_irq(vm, isa_irq->atpic_irq); in vmmdev_machdep_ioctl()
408 if (error == 0 && isa_irq->ioapic_irq != -1) in vmmdev_machdep_ioctl()
409 error = vioapic_deassert_irq(vm, isa_irq->ioapic_irq); in vmmdev_machdep_ioctl()
413 error = vatpic_pulse_irq(vm, isa_irq->atpic_irq); in vmmdev_machdep_ioctl()
414 if (error == 0 && isa_irq->ioapic_irq != -1) in vmmdev_machdep_ioctl()
415 error = vioapic_pulse_irq(vm, isa_irq->ioapic_irq); in vmmdev_machdep_ioctl()
420 isa_irq_trigger->atpic_irq, isa_irq_trigger->trigger); in vmmdev_machdep_ioctl()
425 vmsegdesc->regnum, in vmmdev_machdep_ioctl()
426 &vmsegdesc->desc); in vmmdev_machdep_ioctl()
431 vmsegdesc->regnum, in vmmdev_machdep_ioctl()
432 &vmsegdesc->desc); in vmmdev_machdep_ioctl()
436 error = vm_set_x2apic_state(vcpu, x2apic->state); in vmmdev_machdep_ioctl()
440 error = vm_get_x2apic_state(vcpu, &x2apic->state); in vmmdev_machdep_ioctl()
445 gpapte->gpa, gpapte->pte, &gpapte->ptenum); in vmmdev_machdep_ioctl()
446 error = 0; in vmmdev_machdep_ioctl()
456 error = vm_gla2gpa(vcpu, &gg->paging, gg->gla, in vmmdev_machdep_ioctl()
457 gg->prot, &gg->gpa, &gg->fault); in vmmdev_machdep_ioctl()
458 KASSERT(error == 0 || error == EFAULT, in vmmdev_machdep_ioctl()
464 error = vm_gla2gpa_nofault(vcpu, &gg->paging, gg->gla, in vmmdev_machdep_ioctl()
465 gg->prot, &gg->gpa, &gg->fault); in vmmdev_machdep_ioctl()
466 KASSERT(error == 0 || error == EFAULT, in vmmdev_machdep_ioctl()
471 error = vm_exit_intinfo(vcpu, vmii->info1); in vmmdev_machdep_ioctl()
475 error = vm_get_intinfo(vcpu, &vmii->info1, &vmii->info2); in vmmdev_machdep_ioctl()
479 error = vrtc_nvram_write(vm, rtcdata->offset, in vmmdev_machdep_ioctl()
480 rtcdata->value); in vmmdev_machdep_ioctl()
484 error = vrtc_nvram_read(vm, rtcdata->offset, in vmmdev_machdep_ioctl()
485 &rtcdata->value); in vmmdev_machdep_ioctl()
489 error = vrtc_set_time(vm, rtctime->secs); in vmmdev_machdep_ioctl()
492 error = 0; in vmmdev_machdep_ioctl()
494 rtctime->secs = vrtc_get_time(vm); in vmmdev_machdep_ioctl()
512 (struct vm_snapshot_meta *)&snapshot_13->dev_data; in vmmdev_machdep_ioctl()