Commit fe85ec86 authored by Thomas Huth's avatar Thomas Huth Committed by Christian Borntraeger

KVM: selftests: Introduce a VM_MODE_DEFAULT macro for the default bits

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: default avatarAndrew Jones <drjones@redhat.com>
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Message-Id: <20190523164309.13345-5-thuth@redhat.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent a9c788f0
...@@ -43,6 +43,12 @@ enum vm_guest_mode { ...@@ -43,6 +43,12 @@ enum vm_guest_mode {
NUM_VM_MODES, 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] #define vm_guest_mode_string(m) vm_guest_mode_string[m]
extern const char * const vm_guest_mode_string[]; extern const char * const vm_guest_mode_string[];
......
...@@ -227,7 +227,7 @@ struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages, ...@@ -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; uint64_t extra_pg_pages = (extra_mem_pages / ptrs_per_4k_pte) * 2;
struct kvm_vm *vm; 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); kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
vm_vcpu_add_default(vm, vcpuid, guest_code); vm_vcpu_add_default(vm, vcpuid, guest_code);
......
...@@ -821,7 +821,7 @@ struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages, ...@@ -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; uint64_t extra_pg_pages = extra_mem_pages / 512 * 2;
/* Create VM */ /* Create VM */
vm = vm_create(VM_MODE_P52V48_4K, vm = vm_create(VM_MODE_DEFAULT,
DEFAULT_GUEST_PHY_PAGES + extra_pg_pages, DEFAULT_GUEST_PHY_PAGES + extra_pg_pages,
O_RDWR); O_RDWR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment