Re: [PATCH v7 09/45] x86/sev: Save the negotiated GHCB version

From: Brijesh Singh
Date: Tue Dec 07 2021 - 11:58:44 EST




On 12/7/21 7:17 AM, Borislav Petkov wrote:
On Tue, Dec 07, 2021 at 08:51:53PM +0800, Tianyu Lan wrote:
Hi Brijesh:

Do me a favor please and learn not to top-post on a public mailing list.
Also, take the time to read Documentation/process/ before you send
upstream patches and how to work with the community in general.

We find this patch breaks AMD SEV support in the Hyper-V Isolation
VM. Hyper-V code also uses sev_es_ghcb_hv_call() to read or write msr
value. The sev_es_check_cpu_features() isn't called in the Hyper-V
code and so the ghcb_version is always 0.

If hyperv is going to expose hypervisor features, then it better report
GHCB v2. If not, then I guess < 2 or 1 or so, depending on how this is
defined.

Could you add a new parameter ghcb_version for sev_es_ghcb_hv_call()
and then caller may input ghcb_version?

No, your hypervisor needs to adhere to the spec and report proper ghcb
version. We won't be doing any accomodate-hyperv hacks.



Agreed, the HyperV support need to negotiate the GHCB version before making those HC. In the current patch, the sev_es_negotiate_protocol() will save the ghcb_version in global variable and the saved value is used during the HC. Just make sure that initial HyperV support is adhering to the specification.

thanks