]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: selftests: Only muck with SREGS on x86 in mmu_stress_test
authorSean Christopherson <seanjc@google.com>
Thu, 28 Nov 2024 00:55:37 +0000 (16:55 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 18 Dec 2024 22:14:55 +0000 (14:14 -0800)
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>
tools/testing/selftests/kvm/mmu_stress_test.c

index 0b9678858b6d7d1a6190d1ff67fb31abd59f7167..847da23ec1b120a846722749170c0af2fa693948 100644 (file)
@@ -59,10 +59,10 @@ static void run_vcpu(struct kvm_vcpu *vcpu)
 
 static void *vcpu_worker(void *data)
 {
+       struct kvm_sregs __maybe_unused sregs;
        struct vcpu_info *info = data;
        struct kvm_vcpu *vcpu = info->vcpu;
        struct kvm_vm *vm = vcpu->vm;
-       struct kvm_sregs sregs;
 
        vcpu_args_set(vcpu, 3, info->start_gpa, info->end_gpa, vm->page_size);
 
@@ -70,12 +70,12 @@ static void *vcpu_worker(void *data)
 
        run_vcpu(vcpu);
        rendezvous_with_boss();
-       vcpu_sregs_get(vcpu, &sregs);
 #ifdef __x86_64__
+       vcpu_sregs_get(vcpu, &sregs);
        /* Toggle CR0.WP to trigger a MMU context reset. */
        sregs.cr0 ^= X86_CR0_WP;
-#endif
        vcpu_sregs_set(vcpu, &sregs);
+#endif
        rendezvous_with_boss();
 
        run_vcpu(vcpu);