[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2d2a9789-083c-7e58-4628-8ebd024bee1f@redhat.com>
Date: Fri, 27 May 2022 19:38:57 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: isaku.yamahata@...el.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: 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 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?
Thanks,
Paolo
Powered by blists - more mailing lists