x86/sev: Expose sev_es_ghcb_hv_call() for use by HyperV
authorTianyu Lan <Tianyu.Lan@microsoft.com>
Mon, 25 Oct 2021 12:21:10 +0000 (08:21 -0400)
committerBorislav Petkov <bp@suse.de>
Mon, 25 Oct 2021 16:11:42 +0000 (18:11 +0200)
commit007faec014cb5d26983c1f86fd08c6539b41392e
treeee3222dafb55504d83fb3b269c73d0d580a10832
parentce47d0c00ff5621ae5825c9d81722b23b0df395e
x86/sev: Expose sev_es_ghcb_hv_call() for use by HyperV

Hyper-V needs to issue the GHCB HV call in order to read/write MSRs in
Isolation VMs. For that, expose sev_es_ghcb_hv_call().

The Hyper-V Isolation VMs are unenlightened guests and run a paravisor
at VMPL0 for communicating. GHCB pages are being allocated and set up
by that paravisor. Linux gets the GHCB page's physical address via
MSR_AMD64_SEV_ES_GHCB from the paravisor and should not change it.

Add a @set_ghcb_msr parameter to sev_es_ghcb_hv_call() to control
whether the function should set the GHCB's address prior to the call or
not and export that function for use by HyperV.

  [ bp: - Massage commit message
        - add a struct ghcb forward declaration to fix randconfig builds. ]

Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20211025122116.264793-6-ltykernel@gmail.com
arch/x86/include/asm/sev.h
arch/x86/kernel/sev-shared.c
arch/x86/kernel/sev.c