| /freebsd/sys/arm64/vmm/ |
| H A D | vmm_hyp.c | 39 struct hypctx; 41 uint64_t VMM_HYP_FUNC(do_call_guest)(struct hypctx *); 44 vmm_hyp_reg_store_pmu_debug(struct hypctx *hypctx, bool guest) in vmm_hyp_reg_store_pmu_debug() argument 47 hypctx_write_sys_reg(hypctx, DBGCLAIMSET_EL1, in vmm_hyp_reg_store_pmu_debug() 54 hypctx_write_sys_reg(hypctx, DBGBCR_EL1(x), \ in vmm_hyp_reg_store_pmu_debug() 56 hypctx_write_sys_reg(hypctx, DBGBVR_EL1(x), \ in vmm_hyp_reg_store_pmu_debug() 81 hypctx_write_sys_reg(hypctx, DBGWCR_EL1(x), \ in vmm_hyp_reg_store_pmu_debug() 83 hypctx_write_sys_reg(hypctx, DBGWVR_EL1(x), \ in vmm_hyp_reg_store_pmu_debug() 106 hypctx_write_sys_reg(hypctx, PMCR_EL in vmm_hyp_reg_store_pmu_debug() 175 vmm_hyp_reg_store_vgic(struct hypctx * hypctx,bool guest) vmm_hyp_reg_store_vgic() argument 235 vmm_hyp_reg_store_timer(struct hypctx * hypctx,struct hyp * hyp,bool guest) vmm_hyp_reg_store_timer() argument 273 vmm_hyp_reg_store_special(struct hypctx * hypctx,struct hyp * hyp,bool guest) vmm_hyp_reg_store_special() argument 353 vmm_hyp_reg_restore_special(struct hypctx * hypctx,struct hyp * hyp,bool guest) vmm_hyp_reg_restore_special() argument 455 vmm_hyp_reg_restore_pmu_debug(struct hypctx * hypctx) vmm_hyp_reg_restore_pmu_debug() argument 588 vmm_hyp_reg_restore_timer(struct hypctx * hypctx,struct hyp * hyp,bool guest) vmm_hyp_reg_restore_timer() argument 633 vmm_hyp_reg_restore_vgic(struct hypctx * hypctx,bool guest) vmm_hyp_reg_restore_vgic() argument 686 vmm_hyp_reg_store(struct hypctx * hypctx,struct hyp * hyp,bool guest) vmm_hyp_reg_store() argument 695 vmm_hyp_reg_restore(struct hypctx * hypctx,struct hyp * hyp,bool guest) vmm_hyp_reg_restore() argument 704 vmm_hyp_handle_guest_exit(struct hypctx * hypctx,uint64_t * ret) vmm_hyp_handle_guest_exit() argument 762 __vmm_hyp_call_guest(struct hypctx * hypctx,struct hypctx * host_hypctx) __vmm_hyp_call_guest() argument 777 vmm_hyp_call_guest(struct hyp * hyp,struct hypctx * hypctx) vmm_hyp_call_guest() argument [all...] |
| H A D | vmm_arm64.c | 107 DPCPU_DEFINE_STATIC(struct hypctx *, vcpu); 110 arm64_set_active_vcpu(struct hypctx *hypctx) in arm64_set_active_vcpu() argument 112 DPCPU_SET(vcpu, hypctx); in arm64_set_active_vcpu() 115 struct hypctx * 487 sizeof(struct hypctx *) * vm_get_maxcpus(vm))); in el2_hyp_size() 494 return (round_page(sizeof(struct hypctx) + 2 * VNCR_PAGE_SIZE)); in el2_hypctx_size() 559 struct hypctx *hypctx; in vmmops_vcpu_init() local 569 hypctx = malloc_aligned(size, PAGE_SIZE, M_HYP, M_WAITOK | M_ZERO); in vmmops_vcpu_init() 570 _Static_assert(sizeof(struct hypctx) < VNCR_PAGE_SIZE, in vmmops_vcpu_init() 572 hypctx->vncr_regs = (void *)((char *)hypctx + VNCR_PAGE_SIZE); in vmmops_vcpu_init() [all …]
|
| H A D | arm64.h | 267 struct hypctx { struct 308 #define __hypctx_vncr_sysreg(hypctx, reg) \ argument 309 ((uint64_t *)((char *)hypctx->vncr_regs + REG_VNCR_OFFSET(reg))) 313 #define __hypctx_va_sysreg(hypctx, reg) \ argument 314 (&hypctx->va_regs[reg - VA_REGS_START - 1]) 320 hypctx_sys_reg(struct hypctx *hypctx, int reg /* enum hypctx_sysreg */) in hypctx_sys_reg() argument 324 return (__hypctx_va_sysreg(hypctx, reg)); in hypctx_sys_reg() 326 return (__hypctx_vncr_sysreg(hypctx, reg)); in hypctx_sys_reg() 327 return (&hypctx->sys_regs[reg]); in hypctx_sys_reg() 331 hypctx_write_sys_reg(struct hypctx *hypctx, enum hypctx_sysreg reg, in hypctx_write_sys_reg() argument [all …]
|
| H A D | vmm_handlers.c | 52 vmm_nvhe_enter_guest(struct hyp *hyp, struct hypctx *hypctx) in vmm_nvhe_enter_guest() argument 54 return (vmm_call_hyp(HYP_ENTER_GUEST, hyp->el2_addr, hypctx->el2_addr)); in vmm_nvhe_enter_guest() 58 (struct hyp *hyp, struct hypctx *hypctx))
|
| H A D | vmm_handlers.h | 34 struct hypctx; 37 uint64_t vmm_enter_guest(struct hyp *, struct hypctx *); 43 uint64_t vmm_vhe_enter_guest(struct hyp *, struct hypctx *);
|
| H A D | vmm.c | 431 struct hypctx *hypctx; in vmm_write_oslar_el1() local 433 hypctx = vcpu_get_cookie(vcpu); in vmm_write_oslar_el1() 436 hypctx->dbg_oslock = (wval & OSLAR_OSLK) == OSLAR_OSLK; in vmm_write_oslar_el1() 443 struct hypctx *hypctx; in vmm_read_oslsr_el1() local 446 hypctx = vcpu_get_cookie(vcpu); in vmm_read_oslsr_el1() 448 if (hypctx->dbg_oslock) in vmm_read_oslsr_el1() 860 struct hypctx *hypctx; in vm_handle_smccc_call() local 863 hypctx = vcpu_get_cookie(vcpu); in vm_handle_smccc_call() 865 if ((hypctx_read_sys_reg(hypctx, HOST_ESR_EL2) & ESR_ELx_ISS_MASK) != 0) in vm_handle_smccc_call() 869 vme->u.smccc_call.func_id = hypctx_read_sys_reg(hypctx, GPR_X(0)); in vm_handle_smccc_call() [all …]
|
| H A D | vmm_nvhe.c | 39 #define __hypctx_vncr_sysreg(hypctx, reg) \ argument 40 ((uint64_t*)(hypctx->el2_vncr_addr + REG_VNCR_OFFSET(reg))) 99 (struct hypctx *)x2)); in vmm_hyp_enter()
|
| H A D | hyp_genassym.c | 34 ASSYM(HYPCTX_GPR_LR, offsetof(struct hypctx, va_regs) + (GPR_LR - VA_REGS_START - 1) * sizeof(uint6… 35 ASSYM(HYPCTX_GPR_X0, offsetof(struct hypctx, va_regs) + (GPR_X0 - VA_REGS_START - 1) * sizeof(uint6…
|
| H A D | vmm_reset.c | 52 struct hypctx *el2ctx; in reset_vm_el01_regs() 75 struct hypctx *el2ctx; in reset_vm_el2_regs()
|
| /freebsd/sys/arm64/vmm/io/ |
| H A D | vtimer.c | 72 static void vtimer_schedule_irq(struct hypctx *hypctx, bool phys); 77 struct hypctx *hypctx; in vtimer_virtual_timer_intr() local 81 hypctx = arm64_get_active_vcpu(); in vtimer_virtual_timer_intr() 84 if (!hypctx) { in vtimer_virtual_timer_intr() 100 hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); in vtimer_virtual_timer_intr() 101 if (hypctx->vtimer_cpu.virt_timer.cntx_cval_el0 < cntpct_el0) in vtimer_virtual_timer_intr() 102 vgic_inject_irq(hypctx->hyp, vcpu_vcpuid(hypctx->vcpu), in vtimer_virtual_timer_intr() 105 cntv_ctl = hypctx->vtimer_cpu.virt_timer.cntx_ctl_el0; in vtimer_virtual_timer_intr() 136 vtimer_cpuinit(struct hypctx *hypctx) in vtimer_cpuinit() argument 141 vtimer_cpu = &hypctx->vtimer_cpu; in vtimer_cpuinit() [all …]
|
| H A D | vgic_v3.c | 338 struct hypctx *hypctx; in mpidr_to_vcpu() local 342 hypctx = hyp->ctx[i]; in mpidr_to_vcpu() 343 if (hypctx != NULL && (hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2) & GICD_AFF) == mpidr) in mpidr_to_vcpu() 374 vgic_v3_cpuinit(device_t dev, struct hypctx *hypctx) in vgic_v3_cpuinit() argument 380 hypctx->vgic_cpu = malloc(sizeof(*hypctx->vgic_cpu), in vgic_v3_cpuinit() 382 vgic_cpu = hypctx->vgic_cpu; in vgic_v3_cpuinit() 396 irq->mpidr = hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2) & GICD_AFF; in vgic_v3_cpuinit() 397 irq->target_vcpu = vcpu_vcpuid(hypctx->vcpu); in vgic_v3_cpuinit() 418 hypctx_write_sys_reg(hypctx, HOST_ICH_HCR_EL2, ICH_HCR_EL2_En); in vgic_v3_cpuinit() 433 hypctx_write_sys_reg(hypctx, HOST_ICH_VMCR_EL2, in vgic_v3_cpuinit() [all …]
|
| H A D | vgic.c | 41 vgic_zero_read(struct hypctx *hypctx, u_int reg, uint64_t *rval, in vgic_zero_read() argument 48 vgic_ignore_write(struct hypctx *hypctx, u_int reg, u_int offset, u_int size, in vgic_ignore_write() argument 55 vgic_register_read(struct hypctx *hypctx, struct vgic_register *reg_list, in vgic_register_read() argument 65 reg_list[i].read(hypctx, reg, rval, NULL); in vgic_register_read() 90 vgic_register_write(struct hypctx *hypctx, struct vgic_register *reg_list, in vgic_register_write() argument 100 reg_list[i].write(hypctx, reg, offset, in vgic_register_write() 146 vgic_cpuinit(struct hypctx *hypctx) in vgic_cpuinit() argument 148 VGIC_CPUINIT(vgic_dev, hypctx); in vgic_cpuinit() 152 vgic_cpucleanup(struct hypctx *hypctx) in vgic_cpucleanup() argument 154 VGIC_CPUCLEANUP(vgic_dev, hypctx); in vgic_cpucleanup() [all …]
|
| H A D | vtimer.h | 38 struct hypctx; 65 void vtimer_cpuinit(struct hypctx *); 66 void vtimer_cpucleanup(struct hypctx *); 69 void vtimer_sync_hwstate(struct hypctx *hypctx);
|
| H A D | vgic_internal.h | 83 typedef void (register_read)(struct hypctx *, u_int, uint64_t *, void *); 84 typedef void (register_write)(struct hypctx *, u_int, u_int, u_int, 127 bool vgic_register_read(struct hypctx *, struct vgic_register *, u_int, u_int, 129 bool vgic_register_write(struct hypctx *, struct vgic_register *, u_int, u_int,
|
| /freebsd/sys/riscv/vmm/ |
| H A D | vmm_riscv.c | 78 DPCPU_DEFINE_STATIC(struct hypctx *, vcpu); 91 riscv_set_active_vcpu(struct hypctx *hypctx) in riscv_set_active_vcpu() argument 94 DPCPU_SET(vcpu, hypctx); in riscv_set_active_vcpu() 97 struct hypctx * 130 sizeof(struct hypctx *) * vm_get_maxcpus(vm)); in vmmops_init() 162 vmmops_vcpu_restore_csrs(struct hypctx *hypctx) in vmmops_vcpu_restore_csrs() argument 166 csrs = &hypctx->guest_csrs; in vmmops_vcpu_restore_csrs() 180 vmmops_vcpu_save_csrs(struct hypctx *hypctx) in vmmops_vcpu_save_csrs() argument 184 csrs = &hypctx->guest_csrs; in vmmops_vcpu_save_csrs() 200 struct hypctx *hypctx; in vmmops_vcpu_init() local [all …]
|
| H A D | vmm_sbi.c | 45 vmm_sbi_handle_rfnc(struct vcpu *vcpu, struct hypctx *hypctx) in vmm_sbi_handle_rfnc() argument 57 func_id = hypctx->guest_regs.hyp_a[6]; in vmm_sbi_handle_rfnc() 58 hart_mask = hypctx->guest_regs.hyp_a[0]; in vmm_sbi_handle_rfnc() 59 hart_mask_base = hypctx->guest_regs.hyp_a[1]; in vmm_sbi_handle_rfnc() 63 fence.start = hypctx->guest_regs.hyp_a[2]; in vmm_sbi_handle_rfnc() 64 fence.size = hypctx->guest_regs.hyp_a[3]; in vmm_sbi_handle_rfnc() 65 fence.asid = hypctx->guest_regs.hyp_a[4]; in vmm_sbi_handle_rfnc() 83 hyp = hypctx->hyp; in vmm_sbi_handle_rfnc() 114 vmm_sbi_handle_time(struct vcpu *vcpu, struct hypctx *hypctx) in vmm_sbi_handle_time() argument 119 func_id = hypctx->guest_regs.hyp_a[6]; in vmm_sbi_handle_time() [all …]
|
| H A D | vmm_fence.c | 50 vmm_fence_dequeue(struct hypctx *hypctx, struct vmm_fence *new_fence) in vmm_fence_dequeue() argument 55 mtx_lock_spin(&hypctx->fence_queue_mtx); in vmm_fence_dequeue() 56 queue = hypctx->fence_queue; in vmm_fence_dequeue() 57 fence = &queue[hypctx->fence_queue_head]; in vmm_fence_dequeue() 61 hypctx->fence_queue_head = in vmm_fence_dequeue() 62 (hypctx->fence_queue_head + 1) % VMM_FENCE_QUEUE_SIZE; in vmm_fence_dequeue() 64 mtx_unlock_spin(&hypctx->fence_queue_mtx); in vmm_fence_dequeue() 67 mtx_unlock_spin(&hypctx->fence_queue_mtx); in vmm_fence_dequeue() 73 vmm_fence_enqueue(struct hypctx *hypctx, struct vmm_fence *new_fence) in vmm_fence_enqueue() argument 78 mtx_lock_spin(&hypctx->fence_queue_mtx); in vmm_fence_enqueue() [all …]
|
| H A D | vmm_vtimer.c | 68 vtimer_cpuinit(struct hypctx *hypctx) in vtimer_cpuinit() argument 74 vtimer = &hypctx->vtimer; in vtimer_cpuinit() 88 struct hypctx *hypctx; in vtimer_inject_irq_callout() local 91 hypctx = arg; in vtimer_inject_irq_callout() 92 hyp = hypctx->hyp; in vtimer_inject_irq_callout() 94 atomic_set_32(&hypctx->interrupts_pending, HVIP_VSTIP); in vtimer_inject_irq_callout() 95 vcpu_notify_event(vm_vcpu(hyp->vm, hypctx->cpu_id)); in vtimer_inject_irq_callout() 99 vtimer_set_timer(struct hypctx *hypctx, uint64_t next_val) in vtimer_set_timer() argument 106 vtimer = &hypctx->vtimer; in vtimer_set_timer() 112 atomic_clear_32(&hypctx->interrupts_pending, HVIP_VSTIP); in vtimer_set_timer() [all …]
|
| H A D | vmm_aplic.h | 37 struct hypctx; 46 int aplic_check_pending(struct hypctx *hypctx); 48 void aplic_cpuinit(struct hypctx *hypctx); 49 void aplic_cpucleanup(struct hypctx *hypctx); 50 void aplic_flush_hwstate(struct hypctx *hypctx); 51 void aplic_sync_hwstate(struct hypctx *hypctx);
|
| H A D | riscv.h | 84 struct hypctx { struct 114 struct hypctx *ctx[]; argument 127 struct hypctx *riscv_get_active_vcpu(void); 128 void vmm_switch(struct hypctx *); 133 int riscv_check_ipi(struct hypctx *hypctx, bool clear); 134 bool riscv_check_interrupts_pending(struct hypctx *hypctx);
|
| H A D | vmm_aplic.c | 330 struct hypctx *hypctx; in mem_read() local 337 hypctx = vcpu_get_cookie(vcpu); in mem_read() 338 hyp = hypctx->hyp; in mem_read() 359 struct hypctx *hypctx; in mem_write() local 366 hypctx = vcpu_get_cookie(vcpu); in mem_write() 367 hyp = hypctx->hyp; in mem_write() 450 aplic_check_pending(struct hypctx *hypctx) in aplic_check_pending() argument 457 hyp = hypctx->hyp; in aplic_check_pending() 468 if (irq->target_hart != hypctx->cpu_id) in aplic_check_pending() 560 aplic_cpuinit(struct hypctx *hypctx) in aplic_cpuinit() argument [all …]
|
| H A D | vmm_vtimer.h | 36 struct hypctx; 44 void vtimer_cpuinit(struct hypctx *hypctx); 45 int vtimer_set_timer(struct hypctx *hypctx, uint64_t next_val);
|
| H A D | vmm_fence.h | 36 struct hypctx; 40 void vmm_fence_process(struct hypctx *hypctx);
|
| /freebsd/sys/riscv/riscv/ |
| H A D | genassym.c | 102 ASSYM(HYP_H_RA, offsetof(struct hypctx, host_regs.hyp_ra)); 103 ASSYM(HYP_H_SP, offsetof(struct hypctx, host_regs.hyp_sp)); 104 ASSYM(HYP_H_GP, offsetof(struct hypctx, host_regs.hyp_gp)); 105 ASSYM(HYP_H_TP, offsetof(struct hypctx, host_regs.hyp_tp)); 106 ASSYM(HYP_H_T, offsetof(struct hypctx, host_regs.hyp_t)); 107 ASSYM(HYP_H_S, offsetof(struct hypctx, host_regs.hyp_s)); 108 ASSYM(HYP_H_A, offsetof(struct hypctx, host_regs.hyp_a)); 109 ASSYM(HYP_H_SEPC, offsetof(struct hypctx, host_regs.hyp_sepc)); 110 ASSYM(HYP_H_SSTATUS, offsetof(struct hypctx, host_regs.hyp_sstatus)); 111 ASSYM(HYP_H_HSTATUS, offsetof(struct hypctx, host_regs.hyp_hstatus)); [all …]
|