@@ -24,6 +24,12 @@
#include "kvm_util.h"
#include "processor.h"
+/*
+ * Put slot 0 past the first 4G of guest physical address to avoid collision
+ * with KVM-internal memslots.
+ */
+#define SLOT_0_GPA (4UL << 30)
+
/* The memory slot index demand page */
#define TEST_MEM_SLOT_INDEX 1
@@ -171,7 +177,7 @@ static struct kvm_vm *create_vm(enum vm_guest_mode mode, int vcpus,
pages += (2 * pages) / PTES_PER_PT;
pages += ((2 * vcpus * vcpu_wss) >> PAGE_SHIFT_4K) / PTES_PER_PT;
- vm = vm_create(mode, pages, O_RDWR);
+ vm = _vm_create(mode, SLOT_0_GPA, pages, O_RDWR);
kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
#ifdef __x86_64__
vm_create_irqchip(vm);
Move memslot 0 past 4 GiB to support the large page tables required to map several TiB of memory. Signed-off-by: Ben Gardon <bgardon@google.com> --- tools/testing/selftests/kvm/demand_paging_test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)