Skip to content

Commit

Permalink
KVM: selftests: Introduce a VM_MODE_DEFAULT macro for the default bits
Browse files Browse the repository at this point in the history
This will be required later for tests like the kvm_create_max_vcpus
test that do not use the vm_create_default() function.

Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190523164309.13345-5-thuth@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
  • Loading branch information
huth authored and borntraeger committed Jun 4, 2019
1 parent a9c788f commit fe85ec8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions tools/testing/selftests/kvm/include/kvm_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ enum vm_guest_mode {
NUM_VM_MODES,
};

#ifdef __aarch64__
#define VM_MODE_DEFAULT VM_MODE_P40V48_4K
#else
#define VM_MODE_DEFAULT VM_MODE_P52V48_4K
#endif

#define vm_guest_mode_string(m) vm_guest_mode_string[m]
extern const char * const vm_guest_mode_string[];

Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/kvm/lib/aarch64/processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages,
uint64_t extra_pg_pages = (extra_mem_pages / ptrs_per_4k_pte) * 2;
struct kvm_vm *vm;

vm = vm_create(VM_MODE_P40V48_4K, DEFAULT_GUEST_PHY_PAGES + extra_pg_pages, O_RDWR);
vm = vm_create(VM_MODE_DEFAULT, DEFAULT_GUEST_PHY_PAGES + extra_pg_pages, O_RDWR);

kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
vm_vcpu_add_default(vm, vcpuid, guest_code);
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/kvm/lib/x86_64/processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages,
uint64_t extra_pg_pages = extra_mem_pages / 512 * 2;

/* Create VM */
vm = vm_create(VM_MODE_P52V48_4K,
vm = vm_create(VM_MODE_DEFAULT,
DEFAULT_GUEST_PHY_PAGES + extra_pg_pages,
O_RDWR);

Expand Down

0 comments on commit fe85ec8

Please sign in to comment.