aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-06-26 03:18:46 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-26 03:18:46 -0400
commit6b9334e77ab0ad367ab0e8995d5d8d329ea125a3 (patch)
treec8fd0211a9231f096df732fede9c0b7d5342848d
parentded410576a6ee8ca021575cd7d9309b2a819878a (diff)
downloadkvm-unit-tests-6b9334e77ab0ad367ab0e8995d5d8d329ea125a3.tar.gz
x86: map bottom 2G 1:1 into page tables
Right now only addresses up to the highest RAM memory address are are mapped 1:1 into the 32-bit page tables, but this also excludes ACPI-reserved areas that are higher than the highest RAM memory address. Depending on the memory layout, this may prevent the tests from accessing the ACPI tables after setup_vm. Unconditionally including the bottom 2G of memory fixes that. We do rely on the ACPI tables being in the first 2GB of memory, which is not necessarily true on bare metal; fixing that requires adding calls to something like Linux's kmap/kunmap. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--lib/x86/vm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index edbbe82..2bc2a39 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -154,8 +154,7 @@ void *setup_mmu(phys_addr_t end_of_memory)
if (end_of_memory > (1ul << 31))
end_of_memory = (1ul << 31);
- /* 0 - 2G memory, 2G-3G valloc area, 3G-4G mmio */
- setup_mmu_range(cr3, 0, end_of_memory);
+ setup_mmu_range(cr3, 0, (2ul << 30));
setup_mmu_range(cr3, 3ul << 30, (1ul << 30));
init_alloc_vpage((void*)(3ul << 30));
#endif