Commit 5b4f758f authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: selftests: Make set_memory_region_test common to all architectures

Make set_memory_region_test available on all architectures by wrapping
the bits that are x86-specific in ifdefs.  A future testcase
to create the maximum number of memslots will be architecture
agnostic.
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200410231707.7128-10-sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 8cc2dd63
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
/x86_64/hyperv_cpuid /x86_64/hyperv_cpuid
/x86_64/mmio_warning_test /x86_64/mmio_warning_test
/x86_64/platform_info_test /x86_64/platform_info_test
/x86_64/set_memory_region_test
/x86_64/set_sregs_test /x86_64/set_sregs_test
/x86_64/smm_test /x86_64/smm_test
/x86_64/state_test /x86_64/state_test
...@@ -21,4 +20,5 @@ ...@@ -21,4 +20,5 @@
/demand_paging_test /demand_paging_test
/dirty_log_test /dirty_log_test
/kvm_create_max_vcpus /kvm_create_max_vcpus
/set_memory_region_test
/steal_time /steal_time
...@@ -17,7 +17,6 @@ TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test ...@@ -17,7 +17,6 @@ TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test
TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid
TEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test TEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test
TEST_GEN_PROGS_x86_64 += x86_64/platform_info_test TEST_GEN_PROGS_x86_64 += x86_64/platform_info_test
TEST_GEN_PROGS_x86_64 += x86_64/set_memory_region_test
TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test
TEST_GEN_PROGS_x86_64 += x86_64/smm_test TEST_GEN_PROGS_x86_64 += x86_64/smm_test
TEST_GEN_PROGS_x86_64 += x86_64/state_test TEST_GEN_PROGS_x86_64 += x86_64/state_test
...@@ -32,12 +31,14 @@ TEST_GEN_PROGS_x86_64 += clear_dirty_log_test ...@@ -32,12 +31,14 @@ TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
TEST_GEN_PROGS_x86_64 += demand_paging_test TEST_GEN_PROGS_x86_64 += demand_paging_test
TEST_GEN_PROGS_x86_64 += dirty_log_test TEST_GEN_PROGS_x86_64 += dirty_log_test
TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus
TEST_GEN_PROGS_x86_64 += set_memory_region_test
TEST_GEN_PROGS_x86_64 += steal_time TEST_GEN_PROGS_x86_64 += steal_time
TEST_GEN_PROGS_aarch64 += clear_dirty_log_test TEST_GEN_PROGS_aarch64 += clear_dirty_log_test
TEST_GEN_PROGS_aarch64 += demand_paging_test TEST_GEN_PROGS_aarch64 += demand_paging_test
TEST_GEN_PROGS_aarch64 += dirty_log_test TEST_GEN_PROGS_aarch64 += dirty_log_test
TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus
TEST_GEN_PROGS_aarch64 += set_memory_region_test
TEST_GEN_PROGS_aarch64 += steal_time TEST_GEN_PROGS_aarch64 += steal_time
TEST_GEN_PROGS_s390x = s390x/memop TEST_GEN_PROGS_s390x = s390x/memop
...@@ -46,6 +47,7 @@ TEST_GEN_PROGS_s390x += s390x/sync_regs_test ...@@ -46,6 +47,7 @@ TEST_GEN_PROGS_s390x += s390x/sync_regs_test
TEST_GEN_PROGS_s390x += demand_paging_test TEST_GEN_PROGS_s390x += demand_paging_test
TEST_GEN_PROGS_s390x += dirty_log_test TEST_GEN_PROGS_s390x += dirty_log_test
TEST_GEN_PROGS_s390x += kvm_create_max_vcpus TEST_GEN_PROGS_s390x += kvm_create_max_vcpus
TEST_GEN_PROGS_s390x += set_memory_region_test
TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M))
LIBKVM += $(LIBKVM_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M))
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define VCPU_ID 0 #define VCPU_ID 0
#ifdef __x86_64__
/* /*
* Somewhat arbitrary location and slot, intended to not overlap anything. The * Somewhat arbitrary location and slot, intended to not overlap anything. The
* location and size are specifically 2mb sized/aligned so that the initial * location and size are specifically 2mb sized/aligned so that the initial
...@@ -301,7 +302,6 @@ static void test_zero_memory_regions(void) ...@@ -301,7 +302,6 @@ static void test_zero_memory_regions(void)
TEST_ASSERT(!ioctl(vm_get_fd(vm), KVM_SET_NR_MMU_PAGES, 64), TEST_ASSERT(!ioctl(vm_get_fd(vm), KVM_SET_NR_MMU_PAGES, 64),
"KVM_SET_NR_MMU_PAGES failed, errno = %d\n", errno); "KVM_SET_NR_MMU_PAGES failed, errno = %d\n", errno);
vcpu_run(vm, VCPU_ID); vcpu_run(vm, VCPU_ID);
run = vcpu_state(vm, VCPU_ID); run = vcpu_state(vm, VCPU_ID);
...@@ -310,14 +310,22 @@ static void test_zero_memory_regions(void) ...@@ -310,14 +310,22 @@ static void test_zero_memory_regions(void)
kvm_vm_free(vm); kvm_vm_free(vm);
} }
#endif /* __x86_64__ */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#ifdef __x86_64__
int i, loops; int i, loops;
#endif
/* Tell stdout not to buffer its content */ /* Tell stdout not to buffer its content */
setbuf(stdout, NULL); setbuf(stdout, NULL);
#ifdef __x86_64__
/*
* FIXME: the zero-memslot test fails on aarch64 and s390x because
* KVM_RUN fails with ENOEXEC or EFAULT.
*/
test_zero_memory_regions(); test_zero_memory_regions();
if (argc > 1) if (argc > 1)
...@@ -332,6 +340,7 @@ int main(int argc, char *argv[]) ...@@ -332,6 +340,7 @@ int main(int argc, char *argv[])
pr_info("Testing DELETE of in-use region, %d loops\n", loops); pr_info("Testing DELETE of in-use region, %d loops\n", loops);
for (i = 0; i < loops; i++) for (i = 0; i < loops; i++)
test_delete_memory_region(); test_delete_memory_region();
#endif
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment