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

From: Dexuan Cui
Date: Thu Apr 20 2023 - 23:34:48 EST


> From: Michael Kelley (LINUX) <mikelley@xxxxxxxxxxxxx>
> Sent: Wednesday, April 12, 2023 7:05 AM
> > @@ -168,6 +170,30 @@ int hv_synic_alloc(void)
> > pr_err("Unable to allocate post msg page\n");
> > goto err;
> > }
> > +
> > +
> > + if (hv_isolation_type_tdx()) {
> > + ret = set_memory_decrypted(
> > + (unsigned long)hv_cpu->synic_message_page, 1);
> > + if (ret) {
> > + pr_err("Failed to decrypt SYNIC msg page\n");
> > + goto err;
> > + }
> > +
> > + ret = set_memory_decrypted(
> > + (unsigned long)hv_cpu->synic_event_page, 1);
> > + if (ret) {
> > + pr_err("Failed to decrypt SYNIC event page\n");
> > + goto err;
> > + }
> > +
> > + ret = set_memory_decrypted(
> > + (unsigned long)hv_cpu->post_msg_page, 1);
> > + if (ret) {
> > + pr_err("Failed to decrypt post msg page\n");
> > + goto err;
> > + }
> > + }
>
> One other comment: The memory for the synic_message_page,
> synic_event_page, and post_msg_page is obtained using get_zeroed_page().
> But after the decryption, the memory contents will be random garbage that

I'm not sure about this, as I don't see any "unknown msgtype=" message from
vmbus_on_msg_dpc() :-)

I agree it's good to add a memset(). Will do it in v5.

> isn't all zeroes. You'll need to do a memset() after the decryption to get the
> contents back to zero. Compare with Patch 6 in Tianyu's fully enlightened
> SNP patch series.
>
> Michael