Commit 1bc603af authored by Christian Borntraeger's avatar Christian Borntraeger Committed by Paolo Bonzini

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: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20210608123954.10991-1-borntraeger@de.ibm.com>
Fixes: ef4c9f4f ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarDavid Matlack <dmatlack@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent af3511ff
...@@ -43,6 +43,7 @@ enum vm_guest_mode { ...@@ -43,6 +43,7 @@ enum vm_guest_mode {
VM_MODE_P40V48_4K, VM_MODE_P40V48_4K,
VM_MODE_P40V48_64K, VM_MODE_P40V48_64K,
VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */
VM_MODE_P47V64_4K,
NUM_VM_MODES, NUM_VM_MODES,
}; };
...@@ -60,7 +61,7 @@ enum vm_guest_mode { ...@@ -60,7 +61,7 @@ enum vm_guest_mode {
#elif defined(__s390x__) #elif defined(__s390x__)
#define VM_MODE_DEFAULT VM_MODE_P52V48_4K #define VM_MODE_DEFAULT VM_MODE_P47V64_4K
#define MIN_PAGE_SHIFT 12U #define MIN_PAGE_SHIFT 12U
#define ptes_per_page(page_size) ((page_size) / 16) #define ptes_per_page(page_size) ((page_size) / 16)
......
...@@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) ...@@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i)
[VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages",
[VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages",
[VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages",
[VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages",
}; };
_Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
"Missing new mode strings?"); "Missing new mode strings?");
...@@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { ...@@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
{ 40, 48, 0x1000, 12 }, { 40, 48, 0x1000, 12 },
{ 40, 48, 0x10000, 16 }, { 40, 48, 0x10000, 16 },
{ 0, 0, 0x1000, 12 }, { 0, 0, 0x1000, 12 },
{ 47, 64, 0x1000, 12 },
}; };
_Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
"Missing new mode params?"); "Missing new mode params?");
...@@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) ...@@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm)
TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms");
#endif #endif
break; break;
case VM_MODE_P47V64_4K:
vm->pgtable_levels = 5;
break;
default: default:
TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
} }
......
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