diff options
author | Aaron Lewis <aaronlewis@google.com> | 2023-07-28 17:36:15 -0700 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-08-02 14:41:59 -0700 |
commit | 215a681710a554b224d743e4a9cd68965889713c (patch) | |
tree | 18c93f7ce5eacb90aa0926a6cb13533a77a12356 /tools/testing/selftests/kvm/lib/ucall_common.c | |
parent | e5119382499cefc839097dcc78f27ab00131e7ad (diff) |
KVM: selftests: Add additional pages to the guest to accommodate ucall
Add additional pages to the guest to account for the number of pages
the ucall headers need. The only reason things worked before is the
ucall headers are fairly small. If they were ever to increase in
size the guest could run out of memory.
This is done in preparation for adding string formatting options to
the guest through the ucall framework which increases the size of
the ucall headers.
Fixes: 426729b2cf2e ("KVM: selftests: Add ucall pool based implementation")
Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Link: https://lore.kernel.org/r/20230729003643.1053367-7-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/ucall_common.c')
-rw-r--r-- | tools/testing/selftests/kvm/lib/ucall_common.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/ucall_common.c b/tools/testing/selftests/kvm/lib/ucall_common.c index 2f0e2ea941cc..77ada362273d 100644 --- a/tools/testing/selftests/kvm/lib/ucall_common.c +++ b/tools/testing/selftests/kvm/lib/ucall_common.c @@ -11,6 +11,11 @@ struct ucall_header { struct ucall ucalls[KVM_MAX_VCPUS]; }; +int ucall_nr_pages_required(uint64_t page_size) +{ + return align_up(sizeof(struct ucall_header), page_size) / page_size; +} + /* * ucall_pool holds per-VM values (global data is duplicated by each VM), it * must not be accessed from host code. |