Lines Matching refs:ve

280 static int ve_instr_len(struct ve_info *ve)  in ve_instr_len()  argument
282 switch (ve->exit_reason) { in ve_instr_len()
289 return ve->instr_len; in ve_instr_len()
299 WARN_ONCE(1, "Unexpected #VE-type: %lld\n", ve->exit_reason); in ve_instr_len()
300 return ve->instr_len; in ve_instr_len()
327 static int handle_halt(struct ve_info *ve) in handle_halt() argument
334 return ve_instr_len(ve); in handle_halt()
348 static int read_msr(struct pt_regs *regs, struct ve_info *ve) in read_msr() argument
366 return ve_instr_len(ve); in read_msr()
369 static int write_msr(struct pt_regs *regs, struct ve_info *ve) in write_msr() argument
386 return ve_instr_len(ve); in write_msr()
389 static int handle_cpuid(struct pt_regs *regs, struct ve_info *ve) in handle_cpuid() argument
407 return ve_instr_len(ve); in handle_cpuid()
428 return ve_instr_len(ve); in handle_cpuid()
453 static int handle_mmio(struct pt_regs *regs, struct ve_info *ve) in handle_mmio() argument
482 if (!fault_in_kernel_space(ve->gla)) { in handle_mmio()
504 if (!mmio_write(size, ve->gpa, val)) in handle_mmio()
509 if (!mmio_write(size, ve->gpa, val)) in handle_mmio()
531 if (!mmio_read(size, ve->gpa, &val)) in handle_mmio()
611 static int handle_io(struct pt_regs *regs, struct ve_info *ve) in handle_io() argument
613 u32 exit_qual = ve->exit_qual; in handle_io()
632 return ve_instr_len(ve); in handle_io()
641 struct ve_info ve; in tdx_early_handle_ve() local
644 tdx_get_ve_info(&ve); in tdx_early_handle_ve()
646 if (ve.exit_reason != EXIT_REASON_IO_INSTRUCTION) in tdx_early_handle_ve()
649 insn_len = handle_io(regs, &ve); in tdx_early_handle_ve()
657 void tdx_get_ve_info(struct ve_info *ve) in tdx_get_ve_info() argument
679 ve->exit_reason = args.rcx; in tdx_get_ve_info()
680 ve->exit_qual = args.rdx; in tdx_get_ve_info()
681 ve->gla = args.r8; in tdx_get_ve_info()
682 ve->gpa = args.r9; in tdx_get_ve_info()
683 ve->instr_len = lower_32_bits(args.r10); in tdx_get_ve_info()
684 ve->instr_info = upper_32_bits(args.r10); in tdx_get_ve_info()
693 static int virt_exception_user(struct pt_regs *regs, struct ve_info *ve) in virt_exception_user() argument
695 switch (ve->exit_reason) { in virt_exception_user()
697 return handle_cpuid(regs, ve); in virt_exception_user()
699 pr_warn("Unexpected #VE: %lld\n", ve->exit_reason); in virt_exception_user()
715 static int virt_exception_kernel(struct pt_regs *regs, struct ve_info *ve) in virt_exception_kernel() argument
717 switch (ve->exit_reason) { in virt_exception_kernel()
719 return handle_halt(ve); in virt_exception_kernel()
721 return read_msr(regs, ve); in virt_exception_kernel()
723 return write_msr(regs, ve); in virt_exception_kernel()
725 return handle_cpuid(regs, ve); in virt_exception_kernel()
727 if (is_private_gpa(ve->gpa)) in virt_exception_kernel()
729 return handle_mmio(regs, ve); in virt_exception_kernel()
731 return handle_io(regs, ve); in virt_exception_kernel()
733 pr_warn("Unexpected #VE: %lld\n", ve->exit_reason); in virt_exception_kernel()
738 bool tdx_handle_virt_exception(struct pt_regs *regs, struct ve_info *ve) in tdx_handle_virt_exception() argument
743 insn_len = virt_exception_user(regs, ve); in tdx_handle_virt_exception()
745 insn_len = virt_exception_kernel(regs, ve); in tdx_handle_virt_exception()