Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: isaku.yamahata@intel.com
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	erdemaktas@google.com, Sean Christopherson <seanjc@google.com>,
	Sagi Shahar <sagis@google.com>,
	David Matlack <dmatlack@google.com>,
	Kai Huang <kai.huang@intel.com>,
	Zhi Wang <zhi.wang.linux@gmail.com>,
	chen.bo@intel.com, linux-coco@lists.linux.dev,
	Chao Peng <chao.p.peng@linux.intel.com>,
	Ackerley Tng <ackerleytng@google.com>,
	Vishal Annapurve <vannapurve@google.com>,
	Michael Roth <michael.roth@amd.com>
Subject: [RFC PATCH v2 0/6] KVM: guest memory: Misc enhacnement
Date: Thu, 22 Jun 2023 16:16:24 -0700	[thread overview]
Message-ID: <cover.1687474039.git.isaku.yamahata@intel.com> (raw)

From: Isaku Yamahata <isaku.yamahata@intel.com>

Hello. I've updated the patch series following Michael suggestion.
Here are the discussion points.

- 4/6 KVM: x86: Introduce fault type to indicate kvm page fault is private
  The moot point is where to put the logic to determine the fault is private.
  - The caller site of kvm_mmu_do_page_fault() (or kvm_mmu_page_fault()).
    The v1 patch approach.
    - npf_interception()
    - handle_ept_violation(), handle_ept_misconfig() and TDX counter part.
  - Open code in kvm_get_fault_type()
  
- 5/6 KVM: Add flags to struct kvm_gfn_range
  I think this patch doesn't interfere the SNP case because it passes more
  info to the callback.

- 6/6 KVM: x86: Add is_vm_type_supported callback
  Let's introduce KVM_X86_TDX_VM for TDX.  And revise KVM_X86_PROTECTED_VM.
  I won't address the name in this patch series.

Thanks,


Hello. This is an RFC patch series based on KVM gmem [1] and [2] 
for the common use of TDX and SEV-SNP.  I'd like to discuss three items.

* Flags for kvm_gfn_range:
Roth, By adding flags to kvm_gfn_range, kvm_arch_gmem_invalidate() won't be
needed.  Maybe x86 gmem_invalidate callback is still needed, though.

* Page fault error code or how to figure out the private page fault
There is an issue to set kvm_page_fault.is_private. I came up with two new
error codes.  Is this a way or any other way?

* VM type: Now we have KVM_X86_PROTECTED_VM. How do we proceed?
  - Keep KVM_X86_PROTECTED_VM for its use. Introduce KVM_X86_TDX_VM
  - Use KVM_X86_PROTECTED_VM for TDX. (If necessary, introduce another type in
    the future)
  - any other way?

[1] KVM gmem patches
https://github.com/sean-jc/linux/tree/x86/kvm_gmem_solo

[2] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support
https://lore.kernel.org/lkml/20230612042559.375660-1-michael.roth@amd.com/

Isaku Yamahata (6):
  KVM: selftests: Fix test_add_overlapping_private_memory_regions()
  KVM: selftests: Fix guest_memfd()
  KVM: x86/mmu: Pass round full 64-bit error code for the KVM page fault
  KVM: x86: Introduce fault type to indicate kvm page fault is private
  KVM: Add flags to struct kvm_gfn_range
  KVM: x86: Add is_vm_type_supported callback

 arch/x86/include/asm/kvm-x86-ops.h            |  1 +
 arch/x86/include/asm/kvm_host.h               |  7 ++++
 arch/x86/include/uapi/asm/kvm.h               |  1 +
 arch/x86/kvm/mmu/mmu.c                        | 31 +++++++++++-----
 arch/x86/kvm/mmu/mmu_internal.h               | 37 +++++++++++++++++--
 arch/x86/kvm/mmu/mmutrace.h                   |  2 +-
 arch/x86/kvm/mmu/paging_tmpl.h                |  4 +-
 arch/x86/kvm/svm/svm.c                        |  7 ++++
 arch/x86/kvm/vmx/vmx.c                        |  6 +++
 arch/x86/kvm/x86.c                            | 10 ++++-
 arch/x86/kvm/x86.h                            |  2 +
 include/linux/kvm_host.h                      | 10 ++++-
 .../testing/selftests/kvm/guest_memfd_test.c  |  4 +-
 .../selftests/kvm/set_memory_region_test.c    | 16 +++++++-
 virt/kvm/guest_mem.c                          |  9 +++--
 virt/kvm/kvm_main.c                           |  4 +-
 16 files changed, 125 insertions(+), 26 deletions(-)


base-commit: be8abcec83c87d4e15ae04816b685fe260c4bcfd
-- 
2.25.1


             reply	other threads:[~2023-06-22 23:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 23:16 isaku.yamahata [this message]
2023-06-22 23:16 ` [RFC PATCH v2 1/6] KVM: selftests: Fix test_add_overlapping_private_memory_regions() isaku.yamahata
2023-06-22 23:16 ` [RFC PATCH v2 2/6] KVM: selftests: Fix guest_memfd() isaku.yamahata
2023-06-22 23:16 ` [RFC PATCH v2 3/6] KVM: x86/mmu: Pass round full 64-bit error code for the KVM page fault isaku.yamahata
2023-06-22 23:28   ` Huang, Kai
2023-06-23  2:54     ` Isaku Yamahata
2023-06-23 17:18       ` Sean Christopherson
2023-06-24  4:15         ` Huang, Kai
2023-06-26 21:48           ` Sean Christopherson
2023-06-22 23:16 ` [RFC PATCH v2 4/6] KVM: x86: Introduce fault type to indicate kvm page fault is private isaku.yamahata
2023-06-23 20:04   ` Sean Christopherson
2023-06-26  1:07     ` Michael Roth
2023-06-26 18:21       ` Sean Christopherson
2023-06-27 23:58         ` Michael Roth
2023-06-28 16:53           ` Sean Christopherson
2023-06-22 23:16 ` [RFC PATCH v2 5/6] KVM: Add flags to struct kvm_gfn_range isaku.yamahata
2023-06-28  6:41   ` Yuan Yao
2023-06-28 17:03     ` Isaku Yamahata
2023-06-28 15:21   ` Michael Roth
2023-06-28 17:05     ` Isaku Yamahata
2023-06-22 23:16 ` [RFC PATCH v2 6/6] KVM: x86: Add is_vm_type_supported callback isaku.yamahata

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=cover.1687474039.git.isaku.yamahata@intel.com \
    --to=isaku.yamahata@intel.com \
    --cc=ackerleytng@google.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=chen.bo@intel.com \
    --cc=dmatlack@google.com \
    --cc=erdemaktas@google.com \
    --cc=isaku.yamahata@gmail.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=sagis@google.com \
    --cc=seanjc@google.com \
    --cc=vannapurve@google.com \
    --cc=zhi.wang.linux@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).