Lines Matching refs:ctxt

206 static enum es_result vc_init_em_ctxt(struct es_em_ctxt *ctxt,  in vc_init_em_ctxt()  argument
212 memset(ctxt, 0, sizeof(*ctxt)); in vc_init_em_ctxt()
213 ctxt->regs = regs; in vc_init_em_ctxt()
216 ret = vc_decode_insn(ctxt); in vc_init_em_ctxt()
221 static void vc_finish_insn(struct es_em_ctxt *ctxt) in vc_finish_insn() argument
223 ctxt->regs->ip += ctxt->insn.length; in vc_finish_insn()
226 static enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt *ctxt) in verify_exception_info() argument
242 ctxt->fi.vector = v; in verify_exception_info()
245 ctxt->fi.error_code = info >> 32; in verify_exception_info()
338 struct es_em_ctxt ctxt; in svsm_perform_ghcb_protocol() local
361 switch (verify_exception_info(ghcb, &ctxt)) { in svsm_perform_ghcb_protocol()
365 vc_forward_exception(&ctxt); in svsm_perform_ghcb_protocol()
375 struct es_em_ctxt *ctxt, in sev_es_ghcb_hv_call() argument
390 return verify_exception_info(ghcb, ctxt); in sev_es_ghcb_hv_call()
431 static int __sev_cpuid_hv_ghcb(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) in __sev_cpuid_hv_ghcb() argument
446 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0); in __sev_cpuid_hv_ghcb()
464 static int sev_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) in sev_cpuid_hv() argument
466 return ghcb ? __sev_cpuid_hv_ghcb(ghcb, ctxt, leaf) in sev_cpuid_hv()
573 static void snp_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) in snp_cpuid_hv() argument
575 if (sev_cpuid_hv(ghcb, ctxt, leaf)) in snp_cpuid_hv()
579 static int snp_cpuid_postprocess(struct ghcb *ghcb, struct es_em_ctxt *ctxt, in snp_cpuid_postprocess() argument
586 snp_cpuid_hv(ghcb, ctxt, &leaf_hv); in snp_cpuid_postprocess()
605 snp_cpuid_hv(ghcb, ctxt, &leaf_hv); in snp_cpuid_postprocess()
653 snp_cpuid_hv(ghcb, ctxt, &leaf_hv); in snp_cpuid_postprocess()
675 snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) in snp_cpuid() argument
709 return snp_cpuid_postprocess(ghcb, ctxt, leaf); in snp_cpuid()
784 static enum es_result vc_insn_string_check(struct es_em_ctxt *ctxt, in vc_insn_string_check() argument
788 if (user_mode(ctxt->regs) && fault_in_kernel_space(address)) { in vc_insn_string_check()
789 ctxt->fi.vector = X86_TRAP_PF; in vc_insn_string_check()
790 ctxt->fi.error_code = X86_PF_USER; in vc_insn_string_check()
791 ctxt->fi.cr2 = address; in vc_insn_string_check()
793 ctxt->fi.error_code |= X86_PF_WRITE; in vc_insn_string_check()
801 static enum es_result vc_insn_string_read(struct es_em_ctxt *ctxt, in vc_insn_string_read() argument
811 ret = vc_insn_string_check(ctxt, address, false); in vc_insn_string_read()
819 ret = vc_read_mem(ctxt, s, d, data_size); in vc_insn_string_read()
827 static enum es_result vc_insn_string_write(struct es_em_ctxt *ctxt, in vc_insn_string_write() argument
837 ret = vc_insn_string_check(ctxt, address, true); in vc_insn_string_write()
845 ret = vc_write_mem(ctxt, d, b, data_size); in vc_insn_string_write()
872 static enum es_result vc_ioio_exitinfo(struct es_em_ctxt *ctxt, u64 *exitinfo) in vc_ioio_exitinfo() argument
874 struct insn *insn = &ctxt->insn; in vc_ioio_exitinfo()
886 port = ctxt->regs->dx & 0xffff; in vc_ioio_exitinfo()
894 port = ctxt->regs->dx & 0xffff; in vc_ioio_exitinfo()
915 port = ctxt->regs->dx & 0xffff; in vc_ioio_exitinfo()
922 port = ctxt->regs->dx & 0xffff; in vc_ioio_exitinfo()
964 return vc_ioio_check(ctxt, (u16)port, size); in vc_ioio_exitinfo()
967 static enum es_result vc_handle_ioio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) in vc_handle_ioio() argument
969 struct pt_regs *regs = ctxt->regs; in vc_handle_ioio()
973 ret = vc_ioio_exitinfo(ctxt, &exit_info_1); in vc_handle_ioio()
1000 es_base = insn_get_seg_base(ctxt->regs, INAT_SEG_REG_ES); in vc_handle_ioio()
1004 ret = vc_insn_string_read(ctxt, in vc_handle_ioio()
1019 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO, in vc_handle_ioio()
1026 ret = vc_insn_string_write(ctxt, in vc_handle_ioio()
1061 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO, exit_info_1, 0); in vc_handle_ioio()
1075 static int vc_handle_cpuid_snp(struct ghcb *ghcb, struct es_em_ctxt *ctxt) in vc_handle_cpuid_snp() argument
1077 struct pt_regs *regs = ctxt->regs; in vc_handle_cpuid_snp()
1083 ret = snp_cpuid(ghcb, ctxt, &leaf); in vc_handle_cpuid_snp()
1095 struct es_em_ctxt *ctxt) in vc_handle_cpuid() argument
1097 struct pt_regs *regs = ctxt->regs; in vc_handle_cpuid()
1102 snp_cpuid_ret = vc_handle_cpuid_snp(ghcb, ctxt); in vc_handle_cpuid()
1118 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0); in vc_handle_cpuid()
1137 struct es_em_ctxt *ctxt, in vc_handle_rdtsc() argument
1143 ret = sev_es_ghcb_hv_call(ghcb, ctxt, exit_code, 0, 0); in vc_handle_rdtsc()
1151 ctxt->regs->ax = ghcb->save.rax; in vc_handle_rdtsc()
1152 ctxt->regs->dx = ghcb->save.rdx; in vc_handle_rdtsc()
1154 ctxt->regs->cx = ghcb->save.rcx; in vc_handle_rdtsc()
1492 struct es_em_ctxt ctxt; in vmgexit_psc() local
1519 ret = sev_es_ghcb_hv_call(ghcb, &ctxt, SVM_VMGEXIT_PSC, 0, 0); in vmgexit_psc()
1554 static enum es_result vc_check_opcode_bytes(struct es_em_ctxt *ctxt, in vc_check_opcode_bytes() argument
1557 unsigned int opcode = (unsigned int)ctxt->insn.opcode.value; in vc_check_opcode_bytes()
1558 u8 modrm = ctxt->insn.modrm.value; in vc_check_opcode_bytes()
1614 X86_MODRM_REG(ctxt->insn.modrm.value) == 7) in vc_check_opcode_bytes()
1626 X86_MODRM_REG(ctxt->insn.modrm.value) == 7) in vc_check_opcode_bytes()
1640 opcode, exit_code, ctxt->regs->ip); in vc_check_opcode_bytes()