This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Re: [PATCH 4/5] xen: Fix the memory registration to reflect

To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Date: Fri, 15 Jul 2011 16:55:16 +0200
Cc: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, QEMU-devel <qemu-devel@xxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>, Alexander Graf <agraf@xxxxxxx>
Delivery-date: Fri, 15 Jul 2011 07:57:38 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:newsgroups:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=W+8GRJqOPJ1gslGDHASQqe5Zo0i3aWQFCz/g0V5pAVQ=; b=RIhzyHfPXkTRVBDJOxzZo9DheEJPrWal4PWKLLgLitahRQrvk2+6tpfaKAwtuTT6ST c4d2tFLWcQacpB9/xoPqgZtNdHtPFmizg0I65QvwQxhRMy5mHhjGAKvFJmUXF74cOA3g f3D7PXmtk2HG6eRuQtMizrIljWa/TNvIjDn0E=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1310740376-13323-5-git-send-email-anthony.perard@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Newsgroups: gmane.comp.emulators.xen.devel, gmane.comp.emulators.qemu
References: <1310740376-13323-1-git-send-email-anthony.perard@xxxxxxxxxx> <1310740376-13323-5-git-send-email-anthony.perard@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110428 Fedora/3.1.10-1.fc15 Mnenhy/0.8.3 Thunderbird/3.1.10
On 07/15/2011 04:32 PM, Anthony PERARD wrote:
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

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@xxxxxxxxxx>
  xen-all.c |   21 ++++++++++++++-------
  1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 2c0a62d..76d5c5c 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -144,6 +144,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
+         */
+        new_block->length += HVM_BELOW_4G_MMIO_LENGTH;
+    }

      QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next);

@@ -152,20 +158,21 @@ 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);
+    cpu_register_physical_memory(0, 0xa0000, 0);
+    /* Skip of the VGA IO memory space */
+    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);

  void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size)

Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>


Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>