Skip to content

Commit 1bc603a

Browse files
borntraegerbonzini
authored andcommitted
KVM: selftests: introduce P47V64 for s390x
s390x can have up to 47bits of physical guest and 64bits of virtual address bits. Add a new address mode to avoid errors of testcases going beyond 47bits. Signed-off-by: Christian Borntraeger <[email protected]> Message-Id: <[email protected]> Fixes: ef4c9f4 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()") Cc: [email protected] Reviewed-by: David Matlack <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent af3511f commit 1bc603a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tools/testing/selftests/kvm/include/kvm_util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ enum vm_guest_mode {
4343
VM_MODE_P40V48_4K,
4444
VM_MODE_P40V48_64K,
4545
VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */
46+
VM_MODE_P47V64_4K,
4647
NUM_VM_MODES,
4748
};
4849

@@ -60,7 +61,7 @@ enum vm_guest_mode {
6061

6162
#elif defined(__s390x__)
6263

63-
#define VM_MODE_DEFAULT VM_MODE_P52V48_4K
64+
#define VM_MODE_DEFAULT VM_MODE_P47V64_4K
6465
#define MIN_PAGE_SHIFT 12U
6566
#define ptes_per_page(page_size) ((page_size) / 16)
6667

tools/testing/selftests/kvm/lib/kvm_util.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i)
175175
[VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages",
176176
[VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages",
177177
[VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages",
178+
[VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages",
178179
};
179180
_Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
180181
"Missing new mode strings?");
@@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
192193
{ 40, 48, 0x1000, 12 },
193194
{ 40, 48, 0x10000, 16 },
194195
{ 0, 0, 0x1000, 12 },
196+
{ 47, 64, 0x1000, 12 },
195197
};
196198
_Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
197199
"Missing new mode params?");
@@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
277279
TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms");
278280
#endif
279281
break;
282+
case VM_MODE_P47V64_4K:
283+
vm->pgtable_levels = 5;
284+
break;
280285
default:
281286
TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
282287
}

0 commit comments

Comments
 (0)