[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z75EHspU4ZPcqw0U@google.com>
Date: Tue, 25 Feb 2025 14:28:46 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Melody Wang <huibo.wang@....com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, KVM <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Tom Lendacky <thomas.lendacky@....com>,
Paluri PavanKumar <pavankumar.paluri@....com>, Pavan Kumar Paluri <papaluri@....com>
Subject: Re: [PATCH v5 1/2] KVM: SVM: Convert plain error code numbers to defines
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@....com>
> Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
> Reviewed-by: Pavan Kumar Paluri <papaluri@....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'.
Powered by blists - more mailing lists