Skip to content

Commit a5460d1

Browse files
bibo-maochenhuacai
authored andcommitted
KVM: selftests: Add VM_MODE_P47V47_16K VM mode
On LoongArch system, 16K page is used in general and GVA width is 47 bit while GPA width is 47 bit also, here add new VM mode VM_MODE_P47V47_16K. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 05d70eb commit a5460d1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ enum vm_guest_mode {
177177
VM_MODE_P36V48_4K,
178178
VM_MODE_P36V48_16K,
179179
VM_MODE_P36V48_64K,
180+
VM_MODE_P47V47_16K,
180181
VM_MODE_P36V47_16K,
181182
NUM_VM_MODES,
182183
};

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ const char *vm_guest_mode_string(uint32_t i)
222222
[VM_MODE_P36V48_4K] = "PA-bits:36, VA-bits:48, 4K pages",
223223
[VM_MODE_P36V48_16K] = "PA-bits:36, VA-bits:48, 16K pages",
224224
[VM_MODE_P36V48_64K] = "PA-bits:36, VA-bits:48, 64K pages",
225+
[VM_MODE_P47V47_16K] = "PA-bits:47, VA-bits:47, 16K pages",
225226
[VM_MODE_P36V47_16K] = "PA-bits:36, VA-bits:47, 16K pages",
226227
};
227228
_Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
@@ -248,6 +249,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = {
248249
[VM_MODE_P36V48_4K] = { 36, 48, 0x1000, 12 },
249250
[VM_MODE_P36V48_16K] = { 36, 48, 0x4000, 14 },
250251
[VM_MODE_P36V48_64K] = { 36, 48, 0x10000, 16 },
252+
[VM_MODE_P47V47_16K] = { 47, 47, 0x4000, 14 },
251253
[VM_MODE_P36V47_16K] = { 36, 47, 0x4000, 14 },
252254
};
253255
_Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
@@ -319,6 +321,7 @@ struct kvm_vm *____vm_create(struct vm_shape shape)
319321
case VM_MODE_P36V48_16K:
320322
vm->pgtable_levels = 4;
321323
break;
324+
case VM_MODE_P47V47_16K:
322325
case VM_MODE_P36V47_16K:
323326
vm->pgtable_levels = 3;
324327
break;

0 commit comments

Comments
 (0)