Skip to content

Commit 55e164d

Browse files
committed
KVM: selftests: Only muck with SREGS on x86 in mmu_stress_test
Try to get/set SREGS in mmu_stress_test only when running on x86, as the ioctls are supported only by x86 and PPC, and the latter doesn't yet support KVM selftests. Reviewed-by: James Houghton <jthoughton@google.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20241128005547.4077116-7-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent b123914 commit 55e164d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/kvm/mmu_stress_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,23 @@ static void run_vcpu(struct kvm_vcpu *vcpu)
5959

6060
static void *vcpu_worker(void *data)
6161
{
62+
struct kvm_sregs __maybe_unused sregs;
6263
struct vcpu_info *info = data;
6364
struct kvm_vcpu *vcpu = info->vcpu;
6465
struct kvm_vm *vm = vcpu->vm;
65-
struct kvm_sregs sregs;
6666

6767
vcpu_args_set(vcpu, 3, info->start_gpa, info->end_gpa, vm->page_size);
6868

6969
rendezvous_with_boss();
7070

7171
run_vcpu(vcpu);
7272
rendezvous_with_boss();
73-
vcpu_sregs_get(vcpu, &sregs);
7473
#ifdef __x86_64__
74+
vcpu_sregs_get(vcpu, &sregs);
7575
/* Toggle CR0.WP to trigger a MMU context reset. */
7676
sregs.cr0 ^= X86_CR0_WP;
77-
#endif
7877
vcpu_sregs_set(vcpu, &sregs);
78+
#endif
7979
rendezvous_with_boss();
8080

8181
run_vcpu(vcpu);

0 commit comments

Comments
 (0)