Re: [PATCH V8 5/9] x86/sev-es: Expose sev_es_ghcb_hv_call() to call ghcb hv call out of sev code
From: Wei Liu
Date: Mon Oct 25 2021 - 07:21:48 EST
On Fri, Oct 22, 2021 at 09:39:48PM +0800, Tianyu Lan wrote:
> On 10/22/2021 12:22 AM, Borislav Petkov wrote:
> > 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?
>
> Yes, please and this patch is based on the your clean up patch which is
> already in the tip sev branch.
Borislav, please take the whole series via the tip tree if possible.
That's perhaps the easiest thing for both of us because the rest of the
series depends on this patch. Or else I will have to base hyperv-next on
the tip tree once you merge this patch.
Let me know what you think.
Thanks,
Wei.