Skip to content

Commit 76f972c

Browse files
brooniebonzini
authored andcommitted
KVM: selftests: Fix build on architectures other than x86_64
The recent addition of support for testing with the x86 specific quirk KVM_X86_QUIRK_SLOT_ZAP_ALL disabled in the generic memslot tests broke the build of the KVM selftests for all other architectures: In file included from include/kvm_util.h:8, from include/memstress.h:13, from memslot_modification_stress_test.c:21: memslot_modification_stress_test.c: In function ‘main’: memslot_modification_stress_test.c:176:38: error: ‘KVM_X86_QUIRK_SLOT_ZAP_ALL’ undeclared (first use in this function) 176 | KVM_X86_QUIRK_SLOT_ZAP_ALL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Add __x86_64__ guard defines to avoid building the relevant code on other architectures. Fixes: 61de4c3 ("KVM: selftests: Test memslot move in memslot_perf_test with quirk disabled") Fixes: 218f641 ("KVM: selftests: Allow slot modification stress test with quirk disabled") Reported-by: Aishwarya TCV <[email protected]> Signed-off-by: Mark Brown <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent efbc6bd commit 76f972c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tools/testing/selftests/kvm/memslot_modification_stress_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,14 @@ int main(int argc, char *argv[])
169169
case 'i':
170170
p.nr_iterations = atoi_positive("Number of iterations", optarg);
171171
break;
172+
#ifdef __x86_64__
172173
case 'q':
173174
p.disable_slot_zap_quirk = true;
174175

175176
TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
176177
KVM_X86_QUIRK_SLOT_ZAP_ALL);
177178
break;
179+
#endif
178180
case 'h':
179181
default:
180182
help(argv[0]);

tools/testing/selftests/kvm/memslot_perf_test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ static_assert(ATOMIC_BOOL_LOCK_FREE == 2, "atomic bool is not lockless");
113113
static sem_t vcpu_ready;
114114

115115
static bool map_unmap_verify;
116+
#ifdef __x86_64__
116117
static bool disable_slot_zap_quirk;
118+
#endif
117119

118120
static bool verbose;
119121
#define pr_info_v(...) \
@@ -579,8 +581,10 @@ static bool test_memslot_move_prepare(struct vm_data *data,
579581
uint32_t guest_page_size = data->vm->page_size;
580582
uint64_t movesrcgpa, movetestgpa;
581583

584+
#ifdef __x86_64__
582585
if (disable_slot_zap_quirk)
583586
vm_enable_cap(data->vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);
587+
#endif
584588

585589
movesrcgpa = vm_slot2gpa(data, data->nslots - 1);
586590

@@ -971,11 +975,13 @@ static bool parse_args(int argc, char *argv[],
971975
case 'd':
972976
map_unmap_verify = true;
973977
break;
978+
#ifdef __x86_64__
974979
case 'q':
975980
disable_slot_zap_quirk = true;
976981
TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
977982
KVM_X86_QUIRK_SLOT_ZAP_ALL);
978983
break;
984+
#endif
979985
case 's':
980986
targs->nslots = atoi_paranoid(optarg);
981987
if (targs->nslots <= 1 && targs->nslots != -1) {

0 commit comments

Comments
 (0)