Re: [PATCH 2/4 V9] KVM: SEV: Add support for SEV-ES intra host migration

From: Tom Lendacky
Date: Fri Oct 08 2021 - 15:56:09 EST


On 10/8/21 12:26 PM, Peter Gonda wrote:
On Fri, Oct 8, 2021 at 9:38 AM Tom Lendacky <thomas.lendacky@xxxxxxx> wrote:

Would it make sense to have a pre-patch that puts these fields into a
struct? Then you can just copy the struct and zero it after. If anything
is ever added for any reason, then it could/should be added to the struct
and this code wouldn't have to change. It might be more churn than it's
worth, just a thought.


That sounds like a good idea to me. I'll add a new patch to the start
of the series which adds in something like:

struct vcpu_sev_es_state {
/* SEV-ES support */
struct vmcb_save_area *vmsa;
struct ghcb *ghcb;
struct kvm_host_map ghcb_map;
bool received_first_sipi;
/* SEV-ES scratch area support */
void *ghcb_sa;
u64 ghcb_sa_len;
bool ghcb_sa_sync;
bool ghcb_sa_free;
};

struct vcpu_svm {
...
struct vcpu_sev_es_state sev_es_state;
...
};

I think that will make this less tedious / error prone code. Names
sound OK or better suggestion?

Those names seem fine to me. If you want to shorten them, you could always drop the "_state" portion.

Thanks,
Tom