public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Li, Xiaoyao" <xiaoyao.li@intel.com>,
	"seanjc@google.com" <seanjc@google.com>,
	"binbin.wu@linux.intel.com" <binbin.wu@linux.intel.com>,
	"Yamahata, Isaku" <isaku.yamahata@intel.com>
Subject: Re: [PATCH v3 0/7] KVM: Guest Memory Pre-Population API
Date: Thu, 18 Apr 2024 00:01:03 +0000	[thread overview]
Message-ID: <65cdc0edae65ae78856fbeef90e77f21e729cf06.camel@intel.com> (raw)
In-Reply-To: <20240417153450.3608097-1-pbonzini@redhat.com>

On Wed, 2024-04-17 at 11:34 -0400, Paolo Bonzini wrote:
> 
> Compared to Isaku's v2, I have reduced the scope as much as possible:
> 
> - no vendor-specific hooks

The TDX patches build on this, with the vendor callback looking like:

"
int tdx_pre_mmu_map_page(struct kvm_vcpu *vcpu,
			 struct kvm_map_memory *mapping,
			 u64 *error_code)
{
	struct kvm_tdx *kvm_tdx = to_kvm_tdx(vcpu->kvm);
	struct kvm *kvm = vcpu->kvm;

	if (!to_tdx(vcpu)->initialized)
		return -EINVAL;

	/* Shared-EPT case */
	if (!(kvm_is_private_gpa(kvm, mapping->base_address)))
		return 0;

	/* Once TD is finalized, the initial guest memory is fixed. */
	if (is_td_finalized(kvm_tdx))
		return -EINVAL;

	*error_code = TDX_SEPT_PFERR;
	return 0;
}
"

kvm_is_private_gpa() check is already handled in this series.

The initialized and finalized checks are nice guard rails for userspace, but
shouldn't be strictly required.

The TDX_SEPT_PFERR is (PFERR_WRITE_MASK | PFERR_PRIVATE_ACCESS). The
PFERR_WRITE_MASK doesn't seem to be required. Isaku, what was the intention?

But, I think maybe we should add a hook back in the TDX series for the guard
rails.

  parent reply	other threads:[~2024-04-18  0:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 15:34 [PATCH v3 0/7] KVM: Guest Memory Pre-Population API Paolo Bonzini
2024-04-17 15:34 ` [PATCH 1/7] KVM: Document KVM_MAP_MEMORY ioctl Paolo Bonzini
2024-04-17 20:28   ` Sean Christopherson
2024-04-17 20:37     ` Paolo Bonzini
2024-04-19 13:57       ` Xu Yilun
2024-04-17 15:34 ` [PATCH 2/7] KVM: Add KVM_MAP_MEMORY vcpu ioctl to pre-populate guest memory Paolo Bonzini
2024-04-17 19:36   ` Isaku Yamahata
2024-04-17 21:07     ` Sean Christopherson
2024-04-17 21:13       ` Paolo Bonzini
2024-04-19 13:59     ` Xu Yilun
2024-04-19 14:08       ` Sean Christopherson
2024-04-19 14:01   ` Xu Yilun
2024-04-17 15:34 ` [PATCH 3/7] KVM: x86/mmu: Extract __kvm_mmu_do_page_fault() Paolo Bonzini
2024-04-17 19:47   ` Isaku Yamahata
2024-04-17 15:34 ` [PATCH 4/7] KVM: x86/mmu: Make __kvm_mmu_do_page_fault() return mapped level Paolo Bonzini
2024-04-17 15:34 ` [PATCH 5/7] KVM: x86/mmu: Introduce kvm_tdp_map_page() to populate guest memory Paolo Bonzini
2024-04-17 21:24   ` Sean Christopherson
2024-04-17 21:31     ` Paolo Bonzini
2024-04-17 22:26       ` Sean Christopherson
2024-04-17 21:34     ` Sean Christopherson
2024-04-17 21:47       ` Paolo Bonzini
2024-04-17 15:34 ` [PATCH 6/7] KVM: x86: Implement kvm_arch_vcpu_map_memory() Paolo Bonzini
2024-04-17 19:28   ` Isaku Yamahata
2024-04-17 21:37   ` Sean Christopherson
2024-04-17 15:34 ` [PATCH 7/7] KVM: selftests: x86: Add test for KVM_MAP_MEMORY Paolo Bonzini
2024-04-18  0:01 ` Edgecombe, Rick P [this message]
2024-04-18  0:31   ` [PATCH v3 0/7] KVM: Guest Memory Pre-Population API Paolo Bonzini
2024-04-18  0:33     ` Edgecombe, Rick P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65cdc0edae65ae78856fbeef90e77f21e729cf06.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=xiaoyao.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox