Re: [PATCH v2 2/4] mm: x86: Invoke hypercall when page encryption status is changed

From: Andy Lutomirski
Date: Wed May 19 2021 - 19:30:06 EST


On Wed, May 12, 2021, at 6:15 AM, Borislav Petkov wrote:
> On Fri, Apr 23, 2021 at 03:58:43PM +0000, Ashish Kalra wrote:
> > +static inline void notify_page_enc_status_changed(unsigned long pfn,
> > + int npages, bool enc)
> > +{
> > + PVOP_VCALL3(mmu.notify_page_enc_status_changed, pfn, npages, enc);
> > +}
>
> Now the question is whether something like that is needed for TDX, and,
> if so, could it be shared by both.

The TDX MapGPA call can fail, and presumably it will fail if the page is not sufficiently quiescent from the host's perspective. It seems like a mistake to me to have a KVM-specific hypercall for this that cannot cleanly fail.