Re: [PATCH v2] KVM: SVM: Convert plain error code numbers to defines
From: Melody (Huibo) Wang
Date: Tue Dec 03 2024 - 16:46:57 EST
Hi Sean,
On 12/2/2024 4:11 PM, Sean Christopherson wrote:
>
> E.g. something like this? Definitely feel free to suggest better names.
>
> static inline void svm_vmgexit_set_return_code(struct vcpu_svm *svm,
> u64 response, u64 data)
> {
> ghcb_set_sw_exit_info_1(svm->sev_es.ghcb, response);
> ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, data);
> }
>
If I make this function more generic where the exit info is set for both KVM and the guest, then maybe I can write something like this:
void ghcb_set_exit_info(struct ghcb *ghcb,
u64 info1, u64 info2)
{
ghcb_set_sw_exit_info_1(ghcb, info1);
ghcb_set_sw_exit_info_2(ghcb, info2);
}
This way we can address every possible case that sets the exit info - not only KVM.
And I am not sure about the wrappers for each specific case because we will have too many, too specific small functions, but if you want them I can add them.
Thanks,
Melody