Lines Matching refs:ghcb
2350 struct ghcb *ghcb = svm->sev_es.ghcb; in dump_ghcb() local
2359 nbits = sizeof(ghcb->save.valid_bitmap) * 8; in dump_ghcb()
2363 ghcb->save.sw_exit_code, ghcb_sw_exit_code_is_valid(ghcb)); in dump_ghcb()
2365 ghcb->save.sw_exit_info_1, ghcb_sw_exit_info_1_is_valid(ghcb)); in dump_ghcb()
2367 ghcb->save.sw_exit_info_2, ghcb_sw_exit_info_2_is_valid(ghcb)); in dump_ghcb()
2369 ghcb->save.sw_scratch, ghcb_sw_scratch_is_valid(ghcb)); in dump_ghcb()
2370 pr_err("%-20s%*pb\n", "valid_bitmap", nbits, ghcb->save.valid_bitmap); in dump_ghcb()
2376 struct ghcb *ghcb = svm->sev_es.ghcb; in sev_es_sync_to_ghcb() local
2386 ghcb_set_rax(ghcb, vcpu->arch.regs[VCPU_REGS_RAX]); in sev_es_sync_to_ghcb()
2387 ghcb_set_rbx(ghcb, vcpu->arch.regs[VCPU_REGS_RBX]); in sev_es_sync_to_ghcb()
2388 ghcb_set_rcx(ghcb, vcpu->arch.regs[VCPU_REGS_RCX]); in sev_es_sync_to_ghcb()
2389 ghcb_set_rdx(ghcb, vcpu->arch.regs[VCPU_REGS_RDX]); in sev_es_sync_to_ghcb()
2396 struct ghcb *ghcb = svm->sev_es.ghcb; in sev_es_sync_from_ghcb() local
2413 vcpu->arch.regs[VCPU_REGS_RAX] = ghcb_get_rax_if_valid(ghcb); in sev_es_sync_from_ghcb()
2414 vcpu->arch.regs[VCPU_REGS_RBX] = ghcb_get_rbx_if_valid(ghcb); in sev_es_sync_from_ghcb()
2415 vcpu->arch.regs[VCPU_REGS_RCX] = ghcb_get_rcx_if_valid(ghcb); in sev_es_sync_from_ghcb()
2416 vcpu->arch.regs[VCPU_REGS_RDX] = ghcb_get_rdx_if_valid(ghcb); in sev_es_sync_from_ghcb()
2417 vcpu->arch.regs[VCPU_REGS_RSI] = ghcb_get_rsi_if_valid(ghcb); in sev_es_sync_from_ghcb()
2419 svm->vmcb->save.cpl = ghcb_get_cpl_if_valid(ghcb); in sev_es_sync_from_ghcb()
2421 if (ghcb_xcr0_is_valid(ghcb)) { in sev_es_sync_from_ghcb()
2422 vcpu->arch.xcr0 = ghcb_get_xcr0(ghcb); in sev_es_sync_from_ghcb()
2427 exit_code = ghcb_get_sw_exit_code(ghcb); in sev_es_sync_from_ghcb()
2430 control->exit_info_1 = ghcb_get_sw_exit_info_1(ghcb); in sev_es_sync_from_ghcb()
2431 control->exit_info_2 = ghcb_get_sw_exit_info_2(ghcb); in sev_es_sync_from_ghcb()
2434 memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap)); in sev_es_sync_from_ghcb()
2440 struct ghcb *ghcb; in sev_es_validate_vmgexit() local
2444 ghcb = svm->sev_es.ghcb; in sev_es_validate_vmgexit()
2450 exit_code = ghcb_get_sw_exit_code(ghcb); in sev_es_validate_vmgexit()
2453 if (ghcb->ghcb_usage) { in sev_es_validate_vmgexit()
2460 if (!ghcb_sw_exit_code_is_valid(ghcb) || in sev_es_validate_vmgexit()
2461 !ghcb_sw_exit_info_1_is_valid(ghcb) || in sev_es_validate_vmgexit()
2462 !ghcb_sw_exit_info_2_is_valid(ghcb)) in sev_es_validate_vmgexit()
2465 switch (ghcb_get_sw_exit_code(ghcb)) { in sev_es_validate_vmgexit()
2469 if (!ghcb_rax_is_valid(ghcb)) in sev_es_validate_vmgexit()
2475 if (!ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2479 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2480 !ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2482 if (ghcb_get_rax(ghcb) == 0xd) in sev_es_validate_vmgexit()
2483 if (!ghcb_xcr0_is_valid(ghcb)) in sev_es_validate_vmgexit()
2489 if (ghcb_get_sw_exit_info_1(ghcb) & SVM_IOIO_STR_MASK) { in sev_es_validate_vmgexit()
2490 if (!ghcb_sw_scratch_is_valid(ghcb)) in sev_es_validate_vmgexit()
2493 if (!(ghcb_get_sw_exit_info_1(ghcb) & SVM_IOIO_TYPE_MASK)) in sev_es_validate_vmgexit()
2494 if (!ghcb_rax_is_valid(ghcb)) in sev_es_validate_vmgexit()
2499 if (!ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2501 if (ghcb_get_sw_exit_info_1(ghcb)) { in sev_es_validate_vmgexit()
2502 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2503 !ghcb_rdx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2508 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2509 !ghcb_cpl_is_valid(ghcb)) in sev_es_validate_vmgexit()
2517 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2518 !ghcb_rcx_is_valid(ghcb) || in sev_es_validate_vmgexit()
2519 !ghcb_rdx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2523 if (!ghcb_rax_is_valid(ghcb) || in sev_es_validate_vmgexit()
2524 !ghcb_rcx_is_valid(ghcb)) in sev_es_validate_vmgexit()
2529 if (!ghcb_sw_scratch_is_valid(ghcb)) in sev_es_validate_vmgexit()
2549 ghcb->ghcb_usage); in sev_es_validate_vmgexit()
2560 memset(ghcb->save.valid_bitmap, 0, sizeof(ghcb->save.valid_bitmap)); in sev_es_validate_vmgexit()
2562 ghcb_set_sw_exit_info_1(ghcb, 2); in sev_es_validate_vmgexit()
2563 ghcb_set_sw_exit_info_2(ghcb, reason); in sev_es_validate_vmgexit()
2571 if (!svm->sev_es.ghcb) in sev_es_unmap_ghcb()
2582 ghcb_get_sw_scratch(svm->sev_es.ghcb), in sev_es_unmap_ghcb()
2593 trace_kvm_vmgexit_exit(svm->vcpu.vcpu_id, svm->sev_es.ghcb); in sev_es_unmap_ghcb()
2598 svm->sev_es.ghcb = NULL; in sev_es_unmap_ghcb()
2628 struct ghcb *ghcb = svm->sev_es.ghcb; in setup_vmgexit_scratch() local
2633 scratch_gpa_beg = ghcb_get_sw_scratch(ghcb); in setup_vmgexit_scratch()
2649 offsetof(struct ghcb, shared_buffer); in setup_vmgexit_scratch()
2651 offsetof(struct ghcb, reserved_1); in setup_vmgexit_scratch()
2664 scratch_va = (void *)svm->sev_es.ghcb; in setup_vmgexit_scratch()
2704 ghcb_set_sw_exit_info_1(ghcb, 2); in setup_vmgexit_scratch()
2705 ghcb_set_sw_exit_info_2(ghcb, GHCB_ERR_INVALID_SCRATCH_AREA); in setup_vmgexit_scratch()
2818 struct ghcb *ghcb; in sev_handle_vmgexit() local
2842 svm->sev_es.ghcb = svm->sev_es.ghcb_map.hva; in sev_handle_vmgexit()
2843 ghcb = svm->sev_es.ghcb_map.hva; in sev_handle_vmgexit()
2845 trace_kvm_vmgexit_enter(vcpu->vcpu_id, ghcb); in sev_handle_vmgexit()
2847 exit_code = ghcb_get_sw_exit_code(ghcb); in sev_handle_vmgexit()
2854 ghcb_set_sw_exit_info_1(ghcb, 0); in sev_handle_vmgexit()
2855 ghcb_set_sw_exit_info_2(ghcb, 0); in sev_handle_vmgexit()
2894 ghcb_set_sw_exit_info_2(ghcb, sev->ap_jump_table); in sev_handle_vmgexit()
2899 ghcb_set_sw_exit_info_1(ghcb, 2); in sev_handle_vmgexit()
2900 ghcb_set_sw_exit_info_2(ghcb, GHCB_ERR_INVALID_INPUT); in sev_handle_vmgexit()
3047 if (!svm->sev_es.ghcb) in sev_vcpu_deliver_sipi_vector()
3050 ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, 1); in sev_vcpu_deliver_sipi_vector()