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

Melody Wang posted 2 patches 9 months, 3 weeks ago
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(-)
[PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable
Posted by Melody Wang 9 months, 3 weeks ago
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
Re: [PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable
Posted by Sean Christopherson 9 months, 3 weeks ago
On Tue, 25 Feb 2025 21:39:35 +0000, Melody Wang wrote:
> 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
> 
> [...]

Applied to kvm-x86 svm, with some massaging.  Thanks!

[1/2] KVM: SVM: Convert plain error code numbers to defines
      https://github.com/kvm-x86/linux/commit/ea4c2f2f5ed3
[2/2] KVM: SVM: Provide helpers to set the error code
      https://github.com/kvm-x86/linux/commit/c3392d0ab714

--
https://github.com/kvm-x86/linux/tree/next
Re: [PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable
Posted by Sean Christopherson 9 months, 3 weeks ago
On Tue, Feb 25, 2025, Melody Wang wrote:
> 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(-)

A few nits, but I'll fixup when applying.  No need for a new version.