Skip to content

Commit

Permalink
Revert "KVM: selftests: Test slot move/delete with slot zap quirk ena…
Browse files Browse the repository at this point in the history
…bled/disabled"

Revert set_memory_region_test's KVM_X86_QUIRK_SLOT_ZAP_ALL testcase, as
the quirk is being removed, i.e. the KVM side of things is being reverted.

This reverts commit b4ed2c6.

Signed-off-by: Sean Christopherson <seanjc@google.com>
  • Loading branch information
sean-jc committed Sep 27, 2024
1 parent dec356f commit 54415c6
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions tools/testing/selftests/kvm/set_memory_region_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void guest_code_move_memory_region(void)
GUEST_DONE();
}

static void test_move_memory_region(bool disable_slot_zap_quirk)
static void test_move_memory_region(void)
{
pthread_t vcpu_thread;
struct kvm_vcpu *vcpu;
Expand All @@ -184,9 +184,6 @@ static void test_move_memory_region(bool disable_slot_zap_quirk)

vm = spawn_vm(&vcpu, &vcpu_thread, guest_code_move_memory_region);

if (disable_slot_zap_quirk)
vm_enable_cap(vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);

hva = addr_gpa2hva(vm, MEM_REGION_GPA);

/*
Expand Down Expand Up @@ -269,7 +266,7 @@ static void guest_code_delete_memory_region(void)
GUEST_ASSERT(0);
}

static void test_delete_memory_region(bool disable_slot_zap_quirk)
static void test_delete_memory_region(void)
{
pthread_t vcpu_thread;
struct kvm_vcpu *vcpu;
Expand All @@ -279,9 +276,6 @@ static void test_delete_memory_region(bool disable_slot_zap_quirk)

vm = spawn_vm(&vcpu, &vcpu_thread, guest_code_delete_memory_region);

if (disable_slot_zap_quirk)
vm_enable_cap(vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);

/* Delete the memory region, the guest should not die. */
vm_mem_region_delete(vm, MEM_REGION_SLOT);
wait_for_vcpu();
Expand Down Expand Up @@ -559,10 +553,7 @@ int main(int argc, char *argv[])
{
#ifdef __x86_64__
int i, loops;
int j, disable_slot_zap_quirk = 0;

if (kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_SLOT_ZAP_ALL)
disable_slot_zap_quirk = 1;
/*
* FIXME: the zero-memslot test fails on aarch64 and s390x because
* KVM_RUN fails with ENOEXEC or EFAULT.
Expand All @@ -588,17 +579,13 @@ int main(int argc, char *argv[])
else
loops = 10;

for (j = 0; j <= disable_slot_zap_quirk; j++) {
pr_info("Testing MOVE of in-use region, %d loops, slot zap quirk %s\n",
loops, j ? "disabled" : "enabled");
for (i = 0; i < loops; i++)
test_move_memory_region(!!j);
pr_info("Testing MOVE of in-use region, %d loops\n", loops);
for (i = 0; i < loops; i++)
test_move_memory_region();

pr_info("Testing DELETE of in-use region, %d loops, slot zap quirk %s\n",
loops, j ? "disabled" : "enabled");
for (i = 0; i < loops; i++)
test_delete_memory_region(!!j);
}
pr_info("Testing DELETE of in-use region, %d loops\n", loops);
for (i = 0; i < loops; i++)
test_delete_memory_region();
#endif

return 0;
Expand Down

0 comments on commit 54415c6

Please sign in to comment.