Re: [PATCH v2 1/4] KVM: SVM: Get rid of *ghcb_msr_bits() functions

From: Joerg Roedel
Date: Thu Sep 09 2021 - 09:32:32 EST

Hi Sean,

On Wed, Sep 01, 2021 at 09:31:52PM +0000, Sean Christopherson wrote:
> On Wed, Sep 01, 2021, Sean Christopherson wrote:
> > control->ghcb_gpa = MAKE_GHCB_MSR_RESP(cpuid_reg, cpuid_value);

Made that change, but kept the set_ghcb_msr_cpuid_resp() and renamed it
to ghcb_msr_cpuid_resp(). It now returns the MSR value for the CPUID

I like the keep the more complicated response setters as functions and
not macros for readability.

> control->ghcb_gpa = GHCB_MSR_SEV_INFO(GHCB_VERSION_MAX,
> sev_enc_bit));
> break;
> and drop set_ghcb_msr() altogether.

Makes sense, I replaced the set_ghcb_msr() calls with the above.

> Side topic, what about renaming control->ghcb_gpa => control->ghcb_msr so that
> the code for the MSR protocol is a bit more self-documenting? The APM defines
> the field as "Guest physical address of GHCB", so it's not exactly prescribing a
> specific name.

No strong opinion here, I let this up to the AMD engineers to decide. If
we change the name I can add a separate patch for this.