On 5/10/2022 6:48 AM, Borislav Petkov wrote:
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.
OK. I got it. Thanks for your suggestion.