From: Alexander Graf <agraf@csgraf.de>
To: Cameron Esfahani <dirty@apple.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Roman Bolshakov <r.bolshakov@yadro.com>,
qemu-devel@nongnu.org
Subject: [PATCH] hvf: Avoid mapping regions < PAGE_SIZE as ram
Date: Mon, 25 Oct 2021 10:25:58 +0200 [thread overview]
Message-ID: <20211025082558.96864-1-agraf@csgraf.de> (raw)
HVF has generic memory listener code that adds all RAM regions as HVF RAM
regions. However, HVF can only handle page aligned, page granule regions.
So let's ignore regions that are not page aligned and sized. They will be
trapped as MMIO instead.
Signed-off-by: Alexander Graf <agraf@csgraf.de>
---
accel/hvf/hvf-accel-ops.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index 6bf319d34c..090155853a 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -135,6 +135,12 @@ static void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
}
}
+ if (int128_get64(section->size) & (qemu_real_host_page_size - 1) ||
+ section->offset_within_address_space & (qemu_real_host_page_size - 1)) {
+ /* Not page aligned, so we can not map as RAM */
+ add = false;
+ }
+
mem = hvf_find_overlap_slot(
section->offset_within_address_space,
int128_get64(section->size));
--
2.30.1 (Apple Git-130)
next reply other threads:[~2021-10-25 8:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 8:25 Alexander Graf [this message]
2021-10-25 10:56 ` [PATCH] hvf: Avoid mapping regions < PAGE_SIZE as ram Philippe Mathieu-Daudé
2021-10-25 17:11 ` Paolo Bonzini
2021-10-25 19:10 ` Alexander Graf
2021-10-26 16:34 ` Paolo Bonzini
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=20211025082558.96864-1-agraf@csgraf.de \
--to=agraf@csgraf.de \
--cc=dirty@apple.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
/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.