Skip to content

Commit c795720

Browse files
huthbonzini
authored andcommitted
KVM: selftests: Wrap vcpu_nested_state_get/set functions with x86 guard
struct kvm_nested_state is only available on x86 so far. To be able to compile the code on other architectures as well, we need to wrap the related code with #ifdefs. Signed-off-by: Thomas Huth <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 98e6834 commit c795720

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tools/testing/selftests/kvm/include/kvm_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
118118
struct kvm_vcpu_events *events);
119119
void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
120120
struct kvm_vcpu_events *events);
121+
#ifdef __x86_64__
121122
void vcpu_nested_state_get(struct kvm_vm *vm, uint32_t vcpuid,
122123
struct kvm_nested_state *state);
123124
int vcpu_nested_state_set(struct kvm_vm *vm, uint32_t vcpuid,
124125
struct kvm_nested_state *state, bool ignore_error);
126+
#endif
125127

126128
const char *exit_reason_str(unsigned int exit_reason);
127129

tools/testing/selftests/kvm/lib/kvm_util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,7 @@ void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
12481248
ret, errno);
12491249
}
12501250

1251+
#ifdef __x86_64__
12511252
void vcpu_nested_state_get(struct kvm_vm *vm, uint32_t vcpuid,
12521253
struct kvm_nested_state *state)
12531254
{
@@ -1279,6 +1280,7 @@ int vcpu_nested_state_set(struct kvm_vm *vm, uint32_t vcpuid,
12791280

12801281
return ret;
12811282
}
1283+
#endif
12821284

12831285
/*
12841286
* VM VCPU System Regs Get

0 commit comments

Comments
 (0)