[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZB3Zei0cxEWS997R@google.com>
Date: Fri, 24 Mar 2023 10:10:18 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Peter Gonda <pgonda@...gle.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Vishal Annapurve <vannapurve@...gle.com>,
Ackerley Tng <ackerleytng@...gle.com>,
Andrew Jones <andrew.jones@...ux.dev>,
Michael Roth <michael.roth@....com>
Subject: Re: [PATCH V6 2/7] KVM: selftests: add hooks for managing protected
guest memory
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@...hat.com>
> Cc: Sean Christopherson <seanjc@...gle.com>
> Cc: Vishal Annapurve <vannapurve@...gle.com>
> Cc: Ackerley Tng <ackerleytng@...gle.com>
> cc: Andrew Jones <andrew.jones@...ux.dev>
> Originally-by: Michael Roth <michael.roth@....com>
> Signed-off-by: Peter Gonda <pgonda@...gle.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.
Powered by blists - more mailing lists