[PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable

Melody Wang
2025-02-25T21:39:53Z

This patchset includes two patches to make VMGEXIT GHCB exit codes returned by the
hypervisor more readable. One patch coverts plain error code numbers to defines, the
other one adds helpers to set the error code.

No functionality changed.

Thanks,
Melody

Changelog:

Changes since v4:
* Add explanation comment about svm_vmgexit_no_action() is corresponding to SW_EXITINFO1.
* Add explanation comment about svm_vmgexit_no_action() when the request failed due to a firmware error.

Changes since v3:
* Document the weirdness with PSC's SW_EXITINFO1.
* Add svm_vmgexit_no_action() helper along with svm_vmgexit_success() to clarify meaning.
* Change GHCB_HV_RESP_SUCCESS to GHCB_HV_RESP_NO_ACTION to avoid the confusion.

Changes since v2:
* Add one patch for providing helpers to set the error code when converting VMGEXIT SW_EXITINFO1 and
SW_EXITINFO2 codes from plain numbers to proper defines.
* Add comments for better code readability.

Changes since v1: Rebase with the latest KVM next.

Melody Wang (2):
KVM: SVM: Convert plain error code numbers to defines
KVM: SVM: Provide helpers to set the error code

arch/x86/include/asm/sev-common.h | 8 +++++++
arch/x86/kvm/svm/sev.c | 39 +++++++++++++++++--------------
arch/x86/kvm/svm/svm.c | 6 +----
arch/x86/kvm/svm/svm.h | 29 +++++++++++++++++++++++
4 files changed, 59 insertions(+), 23 deletions(-)

--
2.34.1