Re: [PATCH] x86/Hyper-V: Add SEV negotiate protocol support in Isolation VM

From: Borislav Petkov
Date: Mon May 09 2022 - 18:48:49 EST


On Thu, May 05, 2022 at 09:15:02AM -0400, Tianyu Lan wrote:
> From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
>
> Hyper-V Isolation VM code uses sev_es_ghcb_hv_call() to read/write MSR
> via GHCB page. The SEV-ES guest should negotiate GHCB version before
> reading/writing MSR via GHCB page.

Why is that?

> Expose sev_es_negotiate_protocol() and sev_es_terminate() from AMD SEV
> code

Yeah, you keep wanting to expose random SEV-specific code and when we
go and change it in the future, you'll come complaining that we broke
hyperv.

I think it might be a lot better if you implement your own functions:
for example, looking at sev_es_negotiate_protocol() - it uses only
primitives which you can use because, well, VMGEXIT() is simply a
wrapper around the asm insn and sev_es_wr_ghcb_msr() is simply writing
into the MSR.

Ditto for sev_es_terminate().

And sev_es_ghcb_hv_call() too, for that matter. You can define your own.

IOW, you're much better off using those primitives and creating your own
functions than picking out random SEV-functions and then us breaking
your isolation VM stuff.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette