]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: selftests: Capture per-vCPU GPA in perf_test_vcpu_args
authorSean Christopherson <seanjc@google.com>
Thu, 11 Nov 2021 00:03:04 +0000 (00:03 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Nov 2021 12:43:26 +0000 (07:43 -0500)
Capture the per-vCPU GPA in perf_test_vcpu_args so that tests can get
the GPA without having to calculate the GPA on their own.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20211111000310.1435032-7-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/perf_test_util.h
tools/testing/selftests/kvm/lib/perf_test_util.c

index df9f1a3a3ffb9a5922ddff89e8557d6e039b3fcb..20aec72fe7b8957b79381f919362cd0e50857bc6 100644 (file)
@@ -18,6 +18,7 @@
 #define PERF_TEST_MEM_SLOT_INDEX       1
 
 struct perf_test_vcpu_args {
+       uint64_t gpa;
        uint64_t gva;
        uint64_t pages;
 
index ccdc950c829e5cf64824139418e328a1006981ba..d9c6bcb7964d81b4e4cb97f841e6a169a271e197 100644 (file)
@@ -136,7 +136,6 @@ void perf_test_setup_vcpus(struct kvm_vm *vm, int vcpus,
                           bool partition_vcpu_memory_access)
 {
        struct perf_test_args *pta = &perf_test_args;
-       vm_paddr_t vcpu_gpa;
        struct perf_test_vcpu_args *vcpu_args;
        int vcpu_id;
 
@@ -149,19 +148,19 @@ void perf_test_setup_vcpus(struct kvm_vm *vm, int vcpus,
                                         (vcpu_id * vcpu_memory_bytes);
                        vcpu_args->pages = vcpu_memory_bytes /
                                           pta->guest_page_size;
-                       vcpu_gpa = guest_test_phys_mem +
-                                  (vcpu_id * vcpu_memory_bytes);
+                       vcpu_args->gpa = guest_test_phys_mem +
+                                        (vcpu_id * vcpu_memory_bytes);
                } else {
                        vcpu_args->gva = guest_test_virt_mem;
                        vcpu_args->pages = (vcpus * vcpu_memory_bytes) /
                                           pta->guest_page_size;
-                       vcpu_gpa = guest_test_phys_mem;
+                       vcpu_args->gpa = guest_test_phys_mem;
                }
 
                vcpu_args_set(vm, vcpu_id, 1, vcpu_id);
 
                pr_debug("Added VCPU %d with test mem gpa [%lx, %lx)\n",
-                        vcpu_id, vcpu_gpa, vcpu_gpa +
+                        vcpu_id, vcpu_args->gpa, vcpu_args->gpa +
                         (vcpu_args->pages * pta->guest_page_size));
        }
 }