All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCH kvm-unit-tests] x86: map bottom 2G 1:1 into page tables
Date: Fri, 26 Jun 2020 03:18:59 -0400	[thread overview]
Message-ID: <20200626071859.6827-1-pbonzini@redhat.com> (raw)

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>
---
 lib/x86/vm.c | 3 +--
 1 file changed, 1 insertion(+), 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
-- 
2.26.2


                 reply	other threads:[~2020-06-26  7:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200626071859.6827-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.