From: Sean Christopherson <seanjc@google.com>
To: Melody Wang <huibo.wang@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, KVM <kvm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Tom Lendacky <thomas.lendacky@amd.com>,
Paluri PavanKumar <pavankumar.paluri@amd.com>,
Pavan Kumar Paluri <papaluri@amd.com>
Subject: Re: [PATCH v5 1/2] KVM: SVM: Convert plain error code numbers to defines
Date: Tue, 25 Feb 2025 14:28:46 -0800 [thread overview]
Message-ID: <Z75EHspU4ZPcqw0U@google.com> (raw)
In-Reply-To: <20250225213937.2471419-2-huibo.wang@amd.com>
On Tue, Feb 25, 2025, Melody Wang wrote:
> Convert VMGEXIT SW_EXITINFO1 codes from plain numbers to proper defines.
>
> No functionality changed.
>
> Signed-off-by: Melody Wang <huibo.wang@amd.com>
> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
> Reviewed-by: Pavan Kumar Paluri <papaluri@amd.com>
> ---
> arch/x86/include/asm/sev-common.h | 8 ++++++++
> arch/x86/kvm/svm/sev.c | 12 ++++++------
> arch/x86/kvm/svm/svm.c | 2 +-
> 3 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h
> index dcbccdb280f9..3aca97d22cdc 100644
> --- a/arch/x86/include/asm/sev-common.h
> +++ b/arch/x86/include/asm/sev-common.h
> @@ -211,6 +211,14 @@ struct snp_psc_desc {
>
> #define GHCB_RESP_CODE(v) ((v) & GHCB_MSR_INFO_MASK)
>
> +/*
> + * Error codes of the GHCB SW_EXITINFO1 related to GHCB input that can be
The use of "Error codes" is confusing due to a psuedo-conflict with the below
comment for the "Error codes" for malformed input.
On that topic, the comment for _those_ error codes is a bad example, and shouldn't
be used as the basis for copy+paste. Most notably, it doesn't explicitly state
that the values are *defined* by the GHCB.
> + * communicated back to the guest
> + */
> +#define GHCB_HV_RESP_NO_ACTION 0
> +#define GHCB_HV_RESP_ISSUE_EXCEPTION 1
> +#define GHCB_HV_RESP_MALFORMED_INPUT 2
> +
> /*
> * Error codes related to GHCB input that can be communicated back to the guest
> * by setting the lower 32-bits of the GHCB SW_EXITINFO1 field to 2.
Now that GHCB_HV_RESP_MALFORMED_INPUT is properly defined, this comment can refer
to "malformed input (see above)" instead of open coding '2'.
next prev parent reply other threads:[~2025-02-25 22:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 21:39 [PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable Melody Wang
2025-02-25 21:39 ` [PATCH v5 1/2] KVM: SVM: Convert plain error code numbers to defines Melody Wang
2025-02-25 22:28 ` Sean Christopherson [this message]
2025-02-25 21:39 ` [PATCH v5 2/2] KVM: SVM: Provide helpers to set the error code Melody Wang
2025-02-25 22:32 ` Sean Christopherson
2025-02-25 22:39 ` [PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable Sean Christopherson
2025-02-28 17:06 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z75EHspU4ZPcqw0U@google.com \
--to=seanjc@google.com \
--cc=huibo.wang@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=papaluri@amd.com \
--cc=pavankumar.paluri@amd.com \
--cc=pbonzini@redhat.com \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox