RE: [PATCH v2 6/6] Drivers: hv: vmbus: Support TDX guests

From: Dexuan Cui
Date: Mon Dec 12 2022 - 14:19:02 EST


> From: Michael Kelley (LINUX) <mikelley@xxxxxxxxxxxxx>
> Sent: Monday, December 12, 2022 9:02 AM
> > [...]
> > @@ -225,6 +275,10 @@ void hv_synic_enable_regs(unsigned int cpu)
> > } else {
> > simp.base_simp_gpa = virt_to_phys(hv_cpu->synic_message_page)
> > >> HV_HYP_PAGE_SHIFT;
> > +
> > + if (hv_isolation_type_tdx())
> > + simp.base_simp_gpa |= ms_hyperv.shared_gpa_boundary
> > + >> HV_HYP_PAGE_SHIFT;
>
> Since we're using cc_mkdec() in hv_do_hypercall() to set the SHARED bit,
> perhaps the same could be done here to simplify the code and avoid the
> explicit call to hv_isolation_type_tdx():

Good idea! Will do.

> simp.base_simp_gpa =
> cc_mkdec(virt_to_phys(hv_cpu->synic_message))
> >> HV_HYP_PAGE_SHIFT;
>
> cc_mkdec() does nothing in a normal VM, and vTOM VMs are already
> special-cased.

This should work for C-bit SNP as well (clearing cc_mask from the GPA
doesn't really change the GPA since the GPA doesn't have the bit in the
first place).

> > hv_set_register(HV_REGISTER_SIMP, simp.as_uint64);
> > @@ -243,6 +297,10 @@ void hv_synic_enable_regs(unsigned int cpu)
> > } else {
> > siefp.base_siefp_gpa = virt_to_phys(hv_cpu->synic_event_page)
> > >> HV_HYP_PAGE_SHIFT;
> > +
> > + if (hv_isolation_type_tdx())
> > + siefp.base_siefp_gpa |= ms_hyperv.shared_gpa_boundary
> > + >> HV_HYP_PAGE_SHIFT;
>
> Same here.

Will do.