Lines Matching defs:vcpu
23 unsigned long _kvm_emu_read_csr(struct kvm_vcpu *vcpu, int csrid)
25 struct loongarch_csrs *csr = vcpu->arch.csr;
49 csrid, vcpu->arch.pc);
62 void _kvm_emu_write_csr(struct kvm_vcpu *vcpu, int csrid,
65 struct loongarch_csrs *csr = vcpu->arch.csr;
75 CASE_WRITE_HW_PMU(vcpu, csr, csrid, KVM_CSR_PERFCTRL0, val);
76 CASE_WRITE_HW_PMU(vcpu, csr, csrid, KVM_CSR_PERFCTRL1, val);
77 CASE_WRITE_HW_PMU(vcpu, csr, csrid, KVM_CSR_PERFCTRL2, val);
78 CASE_WRITE_HW_PMU(vcpu, csr, csrid, KVM_CSR_PERFCTRL3, val);
90 csrid, vcpu->arch.pc);
101 void _kvm_emu_xchg_csr(struct kvm_vcpu *vcpu, int csrid,
104 struct loongarch_csrs *csr = vcpu->arch.csr;
123 csrid, vcpu->arch.pc);
126 int _kvm_getcsr(struct kvm_vcpu *vcpu, unsigned int id, u64 *v, int force)
128 struct loongarch_csrs *csr = vcpu->arch.csr;
206 int _kvm_setcsr(struct kvm_vcpu *vcpu, unsigned int id, u64 *v, int force)
208 struct loongarch_csrs *csr = vcpu->arch.csr;
300 int (*get) (struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr, u64 *res);
301 int (*set) (struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr, u64 val);
316 static int kvm_iocsr_common_get(struct kvm_run *run, struct kvm_vcpu *vcpu,
322 spin_lock(&vcpu->kvm->arch.iocsr_lock);
323 entry = _kvm_find_iocsr(vcpu->kvm, addr);
328 spin_unlock(&vcpu->kvm->arch.iocsr_lock);
332 static int kvm_iocsr_common_set(struct kvm_run *run, struct kvm_vcpu *vcpu,
338 spin_lock(&vcpu->kvm->arch.iocsr_lock);
339 entry = _kvm_find_iocsr(vcpu->kvm, addr);
344 spin_unlock(&vcpu->kvm->arch.iocsr_lock);
348 static int kvm_misc_set(struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr,
351 return kvm_iocsr_common_set(run, vcpu, addr, val);
354 static int kvm_ipi_get(struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr,
359 ++vcpu->stat.rdcsr_ipi_access_exits;
360 run->mmio.phys_addr = KVM_IPI_REG_ADDRESS(vcpu->vcpu_id, (addr & 0xff));
361 ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, run->mmio.phys_addr,
365 vcpu->mmio_needed = 1;
366 vcpu->mmio_is_write = 0;
372 static int kvm_extioi_isr_get(struct kvm_run *run, struct kvm_vcpu *vcpu,
377 run->mmio.phys_addr = EXTIOI_PERCORE_ADDR(vcpu->vcpu_id, (addr & 0xff));
378 ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, run->mmio.phys_addr,
382 vcpu->mmio_needed = 1;
383 vcpu->mmio_is_write = 0;
390 static int kvm_ipi_set(struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr,
395 run->mmio.phys_addr = KVM_IPI_REG_ADDRESS(vcpu->vcpu_id, (addr & 0xff));
396 ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, run->mmio.phys_addr,
400 vcpu->mmio_needed = 1;
401 vcpu->mmio_is_write = 1;
408 static int kvm_extioi_set(struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr,
414 run->mmio.phys_addr = EXTIOI_PERCORE_ADDR(vcpu->vcpu_id, (addr & 0xff));
419 ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, run->mmio.phys_addr,
424 vcpu->mmio_needed = 1;
425 vcpu->mmio_is_write = 1;
432 static int kvm_nop_set(struct kvm_run *run, struct kvm_vcpu *vcpu, u32 addr,
469 static int _kvm_emu_iocsr_read(struct kvm_run *run, struct kvm_vcpu *vcpu,
476 if (!irqchip_in_kernel(vcpu->kvm)) {
486 er = iocsr->get(run, vcpu, addr, res);
496 static int _kvm_emu_iocsr_write(struct kvm_run *run, struct kvm_vcpu *vcpu,
503 if (!irqchip_in_kernel(vcpu->kvm)) {
514 er = iocsr->set(run, vcpu, addr, val);
525 struct kvm_run *run, struct kvm_vcpu *vcpu)
538 val = vcpu->arch.gprs[rj];
539 res = vcpu->arch.gprs[rd];
544 ret = _kvm_emu_iocsr_read(run, vcpu, val, &res);
545 vcpu->arch.gprs[rd] = (u8) res;
549 ret = _kvm_emu_iocsr_read(run, vcpu, val, &res);
550 vcpu->arch.gprs[rd] = (u16) res;
554 ret = _kvm_emu_iocsr_read(run, vcpu, val, &res);
555 vcpu->arch.gprs[rd] = (u32) res;
559 ret = _kvm_emu_iocsr_read(run, vcpu, val, &res);
560 vcpu->arch.gprs[rd] = res;
564 ret = _kvm_emu_iocsr_write(run, vcpu, val, (u8)res);
568 ret = _kvm_emu_iocsr_write(run, vcpu, val, (u16)res);
572 ret = _kvm_emu_iocsr_write(run, vcpu, val, (u32)res);
576 ret = _kvm_emu_iocsr_write(run, vcpu, val, res);
584 vcpu->arch.io_gpr = rd;
590 int _kvm_complete_iocsr_read(struct kvm_vcpu *vcpu, struct kvm_run *run)
592 unsigned long *gpr = &vcpu->arch.gprs[vcpu->arch.io_gpr];
610 run->iocsr_io.len, vcpu->arch.badv);