From: Alexander Graf <agraf@suse.de>
To: QEMU-devel Developers <qemu-devel@nongnu.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH 7/9] xen: Fix the memory registration to reflect of what is done by Xen.
Date: Wed, 27 Jul 2011 15:30:55 +0200 [thread overview]
Message-ID: <1311773457-8842-8-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1311773457-8842-1-git-send-email-agraf@suse.de>
From: Anthony PERARD <anthony.perard@citrix.com>
A Xen guest memory is allocated by libxc. But this memory is not
allocated continuously, instead, it leaves the VGA IO memory space not
allocated, same for the MMIO space (at HVM_BELOW_4G_MMIO_START of size
HVM_BELOW_4G_MMIO_LENGTH).
So to reflect that, we do not register the physical memory for this two
holes. But we still keep only one RAMBlock for the all RAM as it is more
easier than have two separate blocks (1 above 4G). Also this prevent QEMU
from use the MMIO space for a ROM.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
xen-all.c | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/xen-all.c b/xen-all.c
index 53296bf..9eaeac1 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -19,6 +19,7 @@
#include <xen/hvm/ioreq.h>
#include <xen/hvm/params.h>
+#include <xen/hvm/e820.h>
//#define DEBUG_XEN
@@ -144,6 +145,12 @@ static void xen_ram_init(ram_addr_t ram_size)
new_block->host = NULL;
new_block->offset = 0;
new_block->length = ram_size;
+ if (ram_size >= HVM_BELOW_4G_RAM_END) {
+ /* Xen does not allocate the memory continuously, and keep a hole at
+ * HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH
+ */
+ new_block->length += HVM_BELOW_4G_MMIO_LENGTH;
+ }
QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next);
@@ -152,20 +159,26 @@ static void xen_ram_init(ram_addr_t ram_size)
memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS),
0xff, new_block->length >> TARGET_PAGE_BITS);
- if (ram_size >= 0xe0000000 ) {
- above_4g_mem_size = ram_size - 0xe0000000;
- below_4g_mem_size = 0xe0000000;
+ if (ram_size >= HVM_BELOW_4G_RAM_END) {
+ above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
+ below_4g_mem_size = HVM_BELOW_4G_RAM_END;
} else {
below_4g_mem_size = ram_size;
}
- cpu_register_physical_memory(0, below_4g_mem_size, new_block->offset);
-#if TARGET_PHYS_ADDR_BITS > 32
+ cpu_register_physical_memory(0, 0xa0000, 0);
+ /* Skip of the VGA IO memory space, it will be registered later by the VGA
+ * emulated device.
+ *
+ * The area between 0xc0000 and 0x100000 will be used by SeaBIOS to load
+ * the Options ROM, so it is registered here as RAM.
+ */
+ cpu_register_physical_memory(0xc0000, below_4g_mem_size - 0xc0000,
+ 0xc0000);
if (above_4g_mem_size > 0) {
cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
- new_block->offset + below_4g_mem_size);
+ 0x100000000ULL);
}
-#endif
}
void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size)
--
1.6.0.2
next prev parent reply other threads:[~2011-07-27 13:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-27 13:30 [Qemu-devel] [PULL 0/9] xen patch queue 2011-07-26 Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 1/9] xen: introduce xen_change_state_handler Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 2/9] xen: Fix xen_enabled() Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 3/9] exec.c: Use ram_addr_t in cpu_physical_memory_rw(...) Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 4/9] xen: remove CONFIG_XEN_MAPCACHE Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 5/9] xen: make xen_enabled even more clever Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 6/9] cpu-common: Have a ram_addr_t of uint64 with Xen Alexander Graf
2011-07-27 13:30 ` Alexander Graf [this message]
2011-07-27 13:30 ` [Qemu-devel] [PATCH 8/9] vl.c: Check the asked ram_size later Alexander Graf
2011-07-27 13:30 ` [Qemu-devel] [PATCH 9/9] xen: implement unplug protocol in xen_platform Alexander Graf
2011-07-29 15:47 ` [Qemu-devel] [PULL 0/9] xen patch queue 2011-07-26 Anthony Liguori
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=1311773457-8842-8-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=anthony.perard@citrix.com \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).