[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220601204917.GA3778155@ls.amr.corp.intel.com>
Date: Wed, 1 Jun 2022 13:49:17 -0700
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: isaku.yamahata@...el.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
erdemaktas@...gle.com, Sean Christopherson <seanjc@...gle.com>,
Sagi Shahar <sagis@...gle.com>
Subject: Re: [RFC PATCH v6 047/104] KVM: x86/tdp_mmu: Support TDX private
mapping for TDP MMU
On Fri, May 27, 2022 at 07:38:57PM +0200,
Paolo Bonzini <pbonzini@...hat.com> wrote:
> On 5/5/22 20:14, isaku.yamahata@...el.com wrote:
> > +/*
> > + * Private page can't be release on mmu_notifier without losing page contents.
> > + * The help, callback, from backing store is needed to allow page migration.
> > + * For now, pin the page.
> > + */
> > +static bool kvm_faultin_pfn_private(struct kvm_vcpu *vcpu,
> > + struct kvm_page_fault *fault, int *r)
> > +{
> > + hva_t hva = gfn_to_hva_memslot(fault->slot, fault->gfn);
> > + struct page *page[1];
> > + unsigned int flags;
> > + int npages;
> > +
> > + fault->map_writable = false;
> > + fault->pfn = KVM_PFN_ERR_FAULT;
> > + *r = -1;
> > + if (hva == KVM_HVA_ERR_RO_BAD || hva == KVM_HVA_ERR_BAD)
> > + return true;
> > +
> > + /* TDX allows only RWX. Read-only isn't supported. */
> > + WARN_ON_ONCE(!fault->write);
> > + flags = FOLL_WRITE | FOLL_LONGTERM;
> > +
> > + npages = pin_user_pages_fast(hva, 1, flags, page);
> > + if (npages != 1)
> > + return true;
> > +
> > + fault->map_writable = true;
> > + fault->pfn = page_to_pfn(page[0]);
> > + return false;
> > +}
> > +
>
> This function is present also in the memfd notifier series. For the next
> postings, can you remove all the KVM bits from the series and include it
> yourself?
Sure.
For next post, do you want to KVM patch series based on memfd notifier series?
--
Isaku Yamahata <isaku.yamahata@...il.com>
Powered by blists - more mailing lists