diff mbox series

[2/5] KVM: selftests: Fix size of memslots created by Xen tests

Message ID 20210210182609.435200-3-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86/xen: Selftest fixes and a cleanup | expand

Commit Message

Sean Christopherson Feb. 10, 2021, 6:26 p.m. UTC
For better or worse, the memslot APIs take the number of pages, not the
size in bytes.  The Xen tests need 2 pages, not 8192 pages.

Fixes: 8d4e7e80838f ("KVM: x86: declare Xen HVM shared info capability and add test case")
Cc: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c | 3 +--
 tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

David Woodhouse Feb. 10, 2021, 8:53 p.m. UTC | #1
On Wed, 2021-02-10 at 10:26 -0800, Sean Christopherson wrote:
> For better or worse, the memslot APIs take the number of pages, not the
> size in bytes.  The Xen tests need 2 pages, not 8192 pages.
> 
> Fixes: 8d4e7e80838f ("KVM: x86: declare Xen HVM shared info capability and add test case")
> Cc: David Woodhouse <dwmw@amazon.co.uk>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
index bdb3feb86b5b..cb3963957b3b 100644
--- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
+++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
@@ -79,8 +79,7 @@  int main(int argc, char *argv[])
 
 	/* Map a region for the shared_info page */
 	vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
-                                    SHINFO_REGION_GPA, SHINFO_REGION_SLOT,
-				    2 * getpagesize(), 0);
+				    SHINFO_REGION_GPA, SHINFO_REGION_SLOT, 2, 0);
 	virt_map(vm, SHINFO_REGION_GPA, SHINFO_REGION_GPA, 2, 0);
 
 	struct kvm_xen_hvm_config hvmc = {
diff --git a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
index 86653361c695..8389e0bfd711 100644
--- a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
+++ b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
@@ -102,8 +102,7 @@  int main(int argc, char *argv[])
 
 	/* Map a region for the hypercall pages */
 	vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
-                                    HCALL_REGION_GPA, HCALL_REGION_SLOT,
-				    2 * getpagesize(), 0);
+				    HCALL_REGION_GPA, HCALL_REGION_SLOT, 2, 0);
 	virt_map(vm, HCALL_REGION_GPA, HCALL_REGION_GPA, 2, 0);
 
 	for (;;) {