diff options
| author | Sean Christopherson <seanjc@google.com> | 2021-06-22 13:05:24 -0700 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-24 11:47:49 -0400 |
| commit | cce0c23dd944068d7f07a03938d5b3cbcdaf4148 (patch) | |
| tree | 359900099640eac2cdd4c75f7a78d0af2d09f0c3 /tools/testing/selftests/kvm/lib/kvm_util.c | |
| parent | KVM: selftests: Unconditionally allocate EPT tables in memslot 0 (diff) | |
| download | linux-cce0c23dd944068d7f07a03938d5b3cbcdaf4148.tar.gz linux-cce0c23dd944068d7f07a03938d5b3cbcdaf4148.zip | |
KVM: selftests: Add wrapper to allocate page table page
Add a helper to allocate a page for use in constructing the guest's page
tables. All architectures have identical address and memslot
requirements (which appear to be arbitrary anyways).
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622200529.3650424-15-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/kvm_util.c')
| -rw-r--r-- | tools/testing/selftests/kvm/lib/kvm_util.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 06b8fa60840c..7a2b84e81292 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -2209,6 +2209,14 @@ vm_paddr_t vm_phy_page_alloc(struct kvm_vm *vm, vm_paddr_t paddr_min, return vm_phy_pages_alloc(vm, 1, paddr_min, memslot); } +/* Arbitrary minimum physical address used for virtual translation tables. */ +#define KVM_GUEST_PAGE_TABLE_MIN_PADDR 0x180000 + +vm_paddr_t vm_alloc_page_table(struct kvm_vm *vm) +{ + return vm_phy_page_alloc(vm, KVM_GUEST_PAGE_TABLE_MIN_PADDR, 0); +} + /* * Address Guest Virtual to Host Virtual * |
