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 6/9] cpu-common: Have a ram_addr_t of uint64 with Xen.
Date: Wed, 27 Jul 2011 15:30:54 +0200 [thread overview]
Message-ID: <1311773457-8842-7-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>
In Xen case, memory can be bigger than the host memory. that mean a
32bits host (and QEMU) should be able to handle a RAM address of 64bits.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
cpu-common.h | 8 ++++++++
exec.c | 9 +++++----
xen-all.c | 2 +-
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/cpu-common.h b/cpu-common.h
index 44b04b3..0700101 100644
--- a/cpu-common.h
+++ b/cpu-common.h
@@ -27,7 +27,15 @@ enum device_endian {
};
/* address in the RAM (different from a physical address) */
+#if defined(CONFIG_XEN_BACKEND) && TARGET_PHYS_ADDR_BITS == 64
+typedef uint64_t ram_addr_t;
+# define RAM_ADDR_MAX UINT64_MAX
+# define RAM_ADDR_FMT "%" PRIx64
+#else
typedef unsigned long ram_addr_t;
+# define RAM_ADDR_MAX ULONG_MAX
+# define RAM_ADDR_FMT "%lx"
+#endif
/* memory API */
diff --git a/exec.c b/exec.c
index 0393d39..bfc9a43 100644
--- a/exec.c
+++ b/exec.c
@@ -2863,13 +2863,13 @@ static void *file_ram_alloc(RAMBlock *block,
static ram_addr_t find_ram_offset(ram_addr_t size)
{
RAMBlock *block, *next_block;
- ram_addr_t offset = 0, mingap = ULONG_MAX;
+ ram_addr_t offset = 0, mingap = RAM_ADDR_MAX;
if (QLIST_EMPTY(&ram_list.blocks))
return 0;
QLIST_FOREACH(block, &ram_list.blocks, next) {
- ram_addr_t end, next = ULONG_MAX;
+ ram_addr_t end, next = RAM_ADDR_MAX;
end = block->offset + block->length;
@@ -3081,7 +3081,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
#endif
}
if (area != vaddr) {
- fprintf(stderr, "Could not remap addr: %lx@%lx\n",
+ fprintf(stderr, "Could not remap addr: "
+ RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n",
length, addr);
exit(1);
}
@@ -4052,7 +4053,7 @@ void *cpu_physical_memory_map(target_phys_addr_t addr,
target_phys_addr_t page;
unsigned long pd;
PhysPageDesc *p;
- ram_addr_t raddr = ULONG_MAX;
+ ram_addr_t raddr = RAM_ADDR_MAX;
ram_addr_t rlen;
void *ret;
diff --git a/xen-all.c b/xen-all.c
index 83c5476..53296bf 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -184,7 +184,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size)
}
if (xc_domain_populate_physmap_exact(xen_xc, xen_domid, nr_pfn, 0, 0, pfn_list)) {
- hw_error("xen: failed to populate ram at %lx", ram_addr);
+ hw_error("xen: failed to populate ram at " RAM_ADDR_FMT, ram_addr);
}
qemu_free(pfn_list);
--
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 ` Alexander Graf [this message]
2011-07-27 13:30 ` [Qemu-devel] [PATCH 7/9] xen: Fix the memory registration to reflect of what is done by Xen Alexander Graf
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-7-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).