Lines Matching +full:gpa +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0
51 struct memstress_vcpu_args *vcpu_args = &args->vcpu_args[vcpu_idx]; in memstress_guest_code()
59 rand_state = new_guest_random_state(args->random_seed + vcpu_idx); in memstress_guest_code()
61 gva = vcpu_args->gva; in memstress_guest_code()
62 pages = vcpu_args->pages; in memstress_guest_code()
65 GUEST_ASSERT(vcpu_args->vcpu_idx == vcpu_idx); in memstress_guest_code()
68 for (i = 0; i < sizeof(memstress_args); i += args->guest_page_size) in memstress_guest_code()
72 if (args->random_access) in memstress_guest_code()
77 addr = gva + (page * args->guest_page_size); in memstress_guest_code()
79 if (guest_random_u32(&rand_state) % 100 < args->write_percent) in memstress_guest_code()
85 GUEST_SYNC(1); in memstress_guest_code()
99 vcpu_args = &args->vcpu_args[i]; in memstress_setup_vcpus()
101 vcpu_args->vcpu = vcpus[i]; in memstress_setup_vcpus()
102 vcpu_args->vcpu_idx = i; in memstress_setup_vcpus()
105 vcpu_args->gva = guest_test_virt_mem + in memstress_setup_vcpus()
107 vcpu_args->pages = vcpu_memory_bytes / in memstress_setup_vcpus()
108 args->guest_page_size; in memstress_setup_vcpus()
109 vcpu_args->gpa = args->gpa + (i * vcpu_memory_bytes); in memstress_setup_vcpus()
111 vcpu_args->gva = guest_test_virt_mem; in memstress_setup_vcpus()
112 vcpu_args->pages = (nr_vcpus * vcpu_memory_bytes) / in memstress_setup_vcpus()
113 args->guest_page_size; in memstress_setup_vcpus()
114 vcpu_args->gpa = args->gpa; in memstress_setup_vcpus()
117 vcpu_args_set(vcpus[i], 1, i); in memstress_setup_vcpus()
119 pr_debug("Added VCPU %d with test mem gpa [%lx, %lx)\n", in memstress_setup_vcpus()
120 i, vcpu_args->gpa, vcpu_args->gpa + in memstress_setup_vcpus()
121 (vcpu_args->pages * args->guest_page_size)); in memstress_setup_vcpus()
140 args->write_percent = 100; in memstress_create_vm()
143 * Snapshot the non-huge page size. This is used by the guest code to in memstress_create_vm()
146 args->guest_page_size = vm_guest_mode_params[mode].page_size; in memstress_create_vm()
149 (nr_vcpus * vcpu_memory_bytes) / args->guest_page_size); in memstress_create_vm()
153 TEST_ASSERT(vcpu_memory_bytes % args->guest_page_size == 0, in memstress_create_vm()
161 * in-memory data structures. in memstress_create_vm()
163 if (args->nested) in memstress_create_vm()
174 args->vm = vm; in memstress_create_vm()
177 region_end_gfn = vm->max_gfn + 1; in memstress_create_vm()
182 * avoid needing 5-level page tables to identity map L2. in memstress_create_vm()
184 if (args->nested) in memstress_create_vm()
185 region_end_gfn = min(region_end_gfn, (1UL << 48) / args->guest_page_size); in memstress_create_vm()
195 guest_num_pages, region_end_gfn - 1, nr_vcpus, vcpu_memory_bytes); in memstress_create_vm()
197 args->gpa = (region_end_gfn - guest_num_pages - 1) * args->guest_page_size; in memstress_create_vm()
198 args->gpa = align_down(args->gpa, backing_src_pagesz); in memstress_create_vm()
200 /* Align to 1M (segment size) */ in memstress_create_vm()
201 args->gpa = align_down(args->gpa, 1 << 20); in memstress_create_vm()
203 args->size = guest_num_pages * args->guest_page_size; in memstress_create_vm()
205 args->gpa, args->gpa + args->size); in memstress_create_vm()
210 vm_paddr_t region_start = args->gpa + region_pages * args->guest_page_size * i; in memstress_create_vm()
218 virt_map(vm, guest_test_virt_mem, args->gpa, guest_num_pages); in memstress_create_vm()
223 if (args->nested) { in memstress_create_vm()
271 int vcpu_idx = vcpu->vcpu_idx; in vcpu_thread_main()
276 WRITE_ONCE(vcpu->running, true); in vcpu_thread_main()
279 * Wait for all vCPU threads to be up and running before calling the test- in vcpu_thread_main()
304 vcpu->vcpu_idx = i; in memstress_start_vcpu_threads()
305 WRITE_ONCE(vcpu->running, false); in memstress_start_vcpu_threads()
307 pthread_create(&vcpu->thread, NULL, vcpu_thread_main, vcpu); in memstress_start_vcpu_threads()