Lines Matching refs:ghcb
2351 struct ghcb *ghcb = svm->sev_es.ghcb; in dump_ghcb() local
2360 nbits = sizeof(ghcb->save.valid_bitmap) * 8; in dump_ghcb()
2364 ghcb->save.sw_exit_code, ghcb_sw_exit_code_is_valid(ghcb)); in dump_ghcb()
2366 ghcb->save.sw_exit_info_1, ghcb_sw_exit_info_1_is_valid(ghcb)); in dump_ghcb()
2368 ghcb->save.sw_exit_info_2, ghcb_sw_exit_info_2_is_valid(ghcb)); in dump_ghcb()
2370 ghcb->save.sw_scratch, ghcb_sw_scratch_is_valid(ghcb)); in dump_ghcb()
2371 pr_err("%-20s%*pb\n", "valid_bitmap", nbits, ghcb->save.valid_bitmap); in dump_ghcb()
2377 struct ghcb *ghcb = svm->sev_es.ghcb; in sev_es_sync_to_ghcb() local
2387 ghcb_set_rax(ghcb, vcpu->arch.regs[VCPU_REGS_RAX]); in sev_es_sync_to_ghcb()
2388 ghcb_set_rbx(ghcb, vcpu->arch.regs[VCPU_REGS_RBX]); in sev_es_sync_to_ghcb()
2389 ghcb_set_rcx(ghcb, vcpu->arch.regs[VCPU_REGS_RCX]); in sev_es_sync_to_ghcb()
2390 ghcb_set_rdx(ghcb, vcpu->arch.regs[VCPU_REGS_RDX]); in sev_es_sync_to_ghcb()
2397 struct ghcb *ghcb = svm->sev_es.ghcb; in sev_es_sync_from_ghcb() local
2414 vcpu->arch.regs[VCPU_REGS_RAX] = ghcb_get_rax_if_valid(ghcb); in sev_es_sync_from_ghcb()
2415 vcpu->arch.regs[VCPU_REGS_RBX] = ghcb_get_rbx_if_valid(ghcb); in sev_es_sync_from_ghcb()
2416 vcpu->arch.regs[VCPU_REGS_RCX] = ghcb_get_rcx_if_valid(ghcb); in sev_es_sync_from_ghcb()
2417 vcpu->arch.regs[VCPU_REGS_RDX] = ghcb_get_rdx_if_valid(ghcb); in sev_es_sync_from_ghcb()
2418 vcpu->arch.regs[VCPU_REGS_RSI] = ghcb_get_rsi_if_valid(ghcb); in sev_es_sync_from_ghcb()
2420 svm->vmcb->save.cpl = ghcb_get_cpl_if_valid(ghcb); in sev_es_sync_from_ghcb()
2422 if (ghcb_xcr0_is_valid(ghcb)) { in sev_es_sync_from_ghcb()
2423 vcpu->arch.xcr0 = ghcb_get_xcr0(ghcb); in sev_es_sync_from_ghcb()
2428 exit_code = ghcb_get_sw_exit_code(ghcb); in sev_es_sync_from_ghcb()
2431 control->exit_info_1 = ghcb_get_sw_exit_info_1(ghcb); in sev_es_sync_from_ghcb()
2432 control->exit_info_2 = ghcb_get_sw_exit_info_2(ghcb); in sev_es_sync_from_ghcb()
2435 memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap)); in sev_es_sync_from_ghcb()
2441 struct ghcb *ghcb; in sev_es_validate_vmgexit() local
2445 ghcb = svm->sev_es.ghcb; in sev_es_validate_vmgexit()
2451 exit_code = ghcb_get_sw_exit_code(ghcb); in sev_es_validate_vmgexit()
2454 if (ghcb->ghcb_usage) { in sev_es_validate_vmgexit()
2461 if (!ghcb_sw_exit_code_is_valid(ghcb) || in sev_es_validate_vmgexit()
2462 !ghcb_sw_exit_info_1_is_valid(ghcb) || in sev_es_validate_vmgexit()
2463 !ghcb_sw_exit_info_2_is_valid(ghcb)) in sev_es_validate_vmgexit()
2466 switch (ghcb_get_sw_exit_code(ghcb)) { in sev_es_validate_vmgexit()
2470 if (!ghcb_rax_is_valid(ghcb)) in sev_es_validate_vmgexit()
2476 if (!ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2480 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2481 !ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2483 if (ghcb_get_rax(ghcb) == 0xd) in sev_es_validate_vmgexit()
2484 if (!ghcb_xcr0_is_valid(ghcb)) in sev_es_validate_vmgexit()
2490 if (ghcb_get_sw_exit_info_1(ghcb) & SVM_IOIO_STR_MASK) { in sev_es_validate_vmgexit()
2491 if (!ghcb_sw_scratch_is_valid(ghcb)) in sev_es_validate_vmgexit()
2494 if (!(ghcb_get_sw_exit_info_1(ghcb) & SVM_IOIO_TYPE_MASK)) in sev_es_validate_vmgexit()
2495 if (!ghcb_rax_is_valid(ghcb)) in sev_es_validate_vmgexit()
2500 if (!ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2502 if (ghcb_get_sw_exit_info_1(ghcb)) { in sev_es_validate_vmgexit()
2503 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2504 !ghcb_rdx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2509 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2510 !ghcb_cpl_is_valid(ghcb)) in sev_es_validate_vmgexit()
2518 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2519 !ghcb_rcx_is_valid(ghcb) || in sev_es_validate_vmgexit()
2520 !ghcb_rdx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2524 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2525 !ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2530 if (!ghcb_sw_scratch_is_valid(ghcb)) in sev_es_validate_vmgexit()
2550 ghcb->ghcb_usage); in sev_es_validate_vmgexit()
2561 memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap)); in sev_es_validate_vmgexit()
2563 ghcb_set_sw_exit_info_1(ghcb, 2); in sev_es_validate_vmgexit()
2564 ghcb_set_sw_exit_info_2(ghcb, reason); in sev_es_validate_vmgexit()
2572 if (!svm->sev_es.ghcb) in sev_es_unmap_ghcb()
2583 ghcb_get_sw_scratch(svm->sev_es.ghcb), in sev_es_unmap_ghcb()
2594 trace_kvm_vmgexit_exit(svm->vcpu.vcpu_id, svm->sev_es.ghcb); in sev_es_unmap_ghcb()
2599 svm->sev_es.ghcb = NULL; in sev_es_unmap_ghcb()
2629 struct ghcb *ghcb = svm->sev_es.ghcb; in setup_vmgexit_scratch() local
2634 scratch_gpa_beg = ghcb_get_sw_scratch(ghcb); in setup_vmgexit_scratch()
2650 offsetof(struct ghcb, shared_buffer); in setup_vmgexit_scratch()
2652 offsetof(struct ghcb, reserved_0xff0); in setup_vmgexit_scratch()
2665 scratch_va = (void *)svm->sev_es.ghcb; in setup_vmgexit_scratch()
2705 ghcb_set_sw_exit_info_1(ghcb, 2); in setup_vmgexit_scratch()
2706 ghcb_set_sw_exit_info_2(ghcb, GHCB_ERR_INVALID_SCRATCH_AREA); in setup_vmgexit_scratch()
2819 struct ghcb *ghcb; in sev_handle_vmgexit() local
2843 svm->sev_es.ghcb = svm->sev_es.ghcb_map.hva; in sev_handle_vmgexit()
2844 ghcb = svm->sev_es.ghcb_map.hva; in sev_handle_vmgexit()
2846 trace_kvm_vmgexit_enter(vcpu->vcpu_id, ghcb); in sev_handle_vmgexit()
2848 exit_code = ghcb_get_sw_exit_code(ghcb); in sev_handle_vmgexit()
2855 ghcb_set_sw_exit_info_1(ghcb, 0); in sev_handle_vmgexit()
2856 ghcb_set_sw_exit_info_2(ghcb, 0); in sev_handle_vmgexit()
2895 ghcb_set_sw_exit_info_2(ghcb, sev->ap_jump_table); in sev_handle_vmgexit()
2900 ghcb_set_sw_exit_info_1(ghcb, 2); in sev_handle_vmgexit()
2901 ghcb_set_sw_exit_info_2(ghcb, GHCB_ERR_INVALID_INPUT); in sev_handle_vmgexit()
3048 if (!svm->sev_es.ghcb) in sev_vcpu_deliver_sipi_vector()
3051 ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, 1); in sev_vcpu_deliver_sipi_vector()