RE: [PATCH 2/9] x86/hyperv: Support hypercalls for fully enlightened TDX guests
From: Dexuan Cui
Date: Wed Aug 23 2023 - 13:40:22 EST
> From: Tianyu Lan <ltykernel@xxxxxxxxx>
> Sent: Wednesday, August 23, 2023 12:06 AM
> To: Dexuan Cui <decui@xxxxxxxxxxxxx>; ak@xxxxxxxxxxxxxxx;
> [...]
> On 8/12/2023 6:18 AM, Dexuan Cui wrote:
> > A fully enlightened TDX guest on Hyper-V (i.e. without the paravisor) only
> > uses the GHCI call rather than hv_hypercall_pg.
> >
> > In hv_do_hypercall(), Hyper-V requires that the input/output addresses
> > must have the cc_mask.
I'll remove the above sentence, since this is no longer true on
generally available Hyper-V: cc_mask still works, but it's not required.
> > [...]
> Reviewed-by: Tianyu Lan <tiala@xxxxxxxxxxxxx>
Thanks!
> > --- a/arch/x86/hyperv/hv_init.c
> > +++ b/arch/x86/hyperv/hv_init.c
> > @@ -481,6 +481,10 @@ void __init hyperv_init(void)
> > /* Hyper-V requires to write guest os id via ghcb in SNP IVM. */
> > hv_ghcb_msr_write(HV_X64_MSR_GUEST_OS_ID, guest_id);
> >
> > + /* A TDX guest uses the GHCI call rather than hv_hypercall_pg. */
> > + if (hv_isolation_type_tdx())
> > + goto skip_hypercall_pg_init;
> > +
>
> Nitpick:
> Put hypercal page initialization code into a sepearate function and
> skip the function in the tdx guest instead of adding the label.
This is doable. The intention here is to minimize the changes.
In the future, we'll introduce a hypercall function structure. We can
do code refactoring at that time.