public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Peter Gonda <pgonda@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Vishal Annapurve <vannapurve@google.com>,
	Ackerley Tng <ackerleytng@google.com>,
	Andrew Jones <andrew.jones@linux.dev>,
	Michael Roth <michael.roth@amd.com>
Subject: Re: [PATCH V6 2/7] KVM: selftests: add hooks for managing protected guest memory
Date: Fri, 24 Mar 2023 10:10:18 -0700	[thread overview]
Message-ID: <ZB3Zei0cxEWS997R@google.com> (raw)
In-Reply-To: <20230110175057.715453-3-pgonda@google.com>

On Tue, Jan 10, 2023, Peter Gonda wrote:
> Add kvm_vm.protected metadata. Protected VMs memory, potentially
> register and other state may not be accessible to KVM. This combined
> with a new protected_phy_pages bitmap will allow the selftests to check
> if a given pages is accessible.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Vishal Annapurve <vannapurve@google.com>
> Cc: Ackerley Tng <ackerleytng@google.com>
> cc: Andrew Jones <andrew.jones@linux.dev>
> Originally-by: Michael Roth <michael.roth@amd.com>
> Signed-off-by: Peter Gonda <pgonda@google.com>
> ---
>  .../selftests/kvm/include/kvm_util_base.h        | 14 ++++++++++++--
>  tools/testing/selftests/kvm/lib/kvm_util.c       | 16 +++++++++++++---
>  2 files changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h
> index fbc2a79369b8..015b59a0b80e 100644
> --- a/tools/testing/selftests/kvm/include/kvm_util_base.h
> +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
> @@ -45,6 +45,7 @@ typedef uint64_t vm_vaddr_t; /* Virtual Machine (Guest) virtual address */
>  struct userspace_mem_region {
>  	struct kvm_userspace_memory_region region;
>  	struct sparsebit *unused_phy_pages;
> +	struct sparsebit *protected_phy_pages;
>  	int fd;
>  	off_t offset;
>  	enum vm_mem_backing_src_type backing_src_type;
> @@ -111,6 +112,9 @@ struct kvm_vm {
>  	vm_vaddr_t handlers;
>  	uint32_t dirty_ring_size;
>  
> +	/* VM protection enabled: SEV, etc*/
> +	bool protected;
> +
>  	/* Cache of information for binary stats interface */
>  	int stats_fd;
>  	struct kvm_stats_header stats_header;
> @@ -679,10 +683,16 @@ const char *exit_reason_str(unsigned int exit_reason);
>  
>  vm_paddr_t vm_phy_page_alloc(struct kvm_vm *vm, vm_paddr_t paddr_min,
>  			     uint32_t memslot);
> -vm_paddr_t vm_phy_pages_alloc(struct kvm_vm *vm, size_t num,
> -			      vm_paddr_t paddr_min, uint32_t memslot);
> +vm_paddr_t _vm_phy_pages_alloc(struct kvm_vm *vm, size_t num,

Two underscores please.  Ignore the terrible precedent that has been set, we're
slowly purging that crud.

> +			      vm_paddr_t paddr_min, uint32_t memslot, bool protected);

Wrap, no strong justification for running long in this case since the declaration
has already wrapped, and the definition does wrap.

  reply	other threads:[~2023-03-24 17:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 17:50 [PATCH V6 0/7] KVM: selftests: Add simple SEV test Peter Gonda
2023-01-10 17:50 ` [PATCH V6 1/7] KVM: selftests: sparsebit: add const where appropriate Peter Gonda
2023-03-24 17:09   ` Sean Christopherson
2023-01-10 17:50 ` [PATCH V6 2/7] KVM: selftests: add hooks for managing protected guest memory Peter Gonda
2023-03-24 17:10   ` Sean Christopherson [this message]
2023-01-10 17:50 ` [PATCH V6 3/7] KVM: selftests: handle protected bits in page tables Peter Gonda
2023-03-24 17:24   ` Sean Christopherson
2023-01-10 17:50 ` [PATCH V6 4/7] KVM: selftests: add support for protected vm_vaddr_* allocations Peter Gonda
2023-03-24 17:30   ` Sean Christopherson
2023-01-10 17:50 ` [PATCH V6 5/7] KVM: selftests: add library for creating/interacting with SEV guests Peter Gonda
2023-03-24 18:08   ` Sean Christopherson
2023-01-10 17:50 ` [PATCH V6 6/7] KVM: selftests: Update ucall pool to allocate from shared memory Peter Gonda
2023-01-10 17:50 ` [PATCH V6 7/7] KVM: selftests: Add simple sev vm testing Peter Gonda
2023-03-24 18:23   ` Sean Christopherson
2023-01-18 20:50 ` [PATCH V6 0/7] KVM: selftests: Add simple SEV test Sean Christopherson
2023-01-20 16:43   ` Peter Gonda
2023-03-24 19:05 ` Sean Christopherson

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=ZB3Zei0cxEWS997R@google.com \
    --to=seanjc@google.com \
    --cc=ackerleytng@google.com \
    --cc=andrew.jones@linux.dev \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=vannapurve@google.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