Re: [PATCH V8 5/9] x86/sev-es: Expose sev_es_ghcb_hv_call() to call ghcb hv call out of sev code

Borislav Petkov
2021-10-21T16:22:34Z

On Thu, Oct 21, 2021 at 11:41:05AM -0400, Tianyu Lan wrote:
> diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c
> index ea9abd69237e..368ed36971e3 100644
> --- a/arch/x86/kernel/sev-shared.c
> +++ b/arch/x86/kernel/sev-shared.c
> @@ -124,10 +124,9 @@ static enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt
> return ES_VMM_ERROR;
> }
>
> -static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,
> - struct es_em_ctxt *ctxt,
> - u64 exit_code, u64 exit_info_1,
> - u64 exit_info_2)
> +enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, bool set_ghcb_msr,
> + struct es_em_ctxt *ctxt, u64 exit_code,
> + u64 exit_info_1, u64 exit_info_2)
> {
> /* Fill in protocol and format specifiers */
> ghcb->protocol_version = GHCB_PROTOCOL_MAX;
> @@ -137,7 +136,15 @@ static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,
> ghcb_set_sw_exit_info_1(ghcb, exit_info_1);
> ghcb_set_sw_exit_info_2(ghcb, exit_info_2);
>
> - sev_es_wr_ghcb_msr(__pa(ghcb));
> + /*
> + * Hyper-V unenlightened guests use a paravisor for communicating and
> + * GHCB pages are being allocated and set up by that paravisor. Linux
> + * should not change ghcb page pa in such case and so add set_ghcb_msr

"... not change the GHCB page's physical address."

Remove the "so add... " rest.

Otherwise, LGTM.

Do you want me to take it through the tip tree?

Thx.

--
Regards/Gruss,
Boris.