aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_core_x86.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-03-19 16:48:24 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-03-19 16:48:24 +0000
commit28f7888d7fc4aa75135ac1c566566eda1704db65 (patch)
tree7497496dd0c56c7c264f3b371d69b95abe50f06b /tools/libxc/xc_core_x86.c
parentb81cb0e6ae47ee9885ac2bfc006c6e5162d76cae (diff)
downloadxen-28f7888d7fc4aa75135ac1c566566eda1704db65.tar.gz
xen-28f7888d7fc4aa75135ac1c566566eda1704db65.tar.bz2
xen-28f7888d7fc4aa75135ac1c566566eda1704db65.zip
hvm: Do not save/restore shared_info gpfn location.
Instead of kludging a max_gpfn estimate in shared_info, add a new XENMEM command to discover the actual maximum gpfn value as known by the shadow code. This needs to be more robust when we support HVM ballooning in future anyway. One interesting point is that max_gpfn may be close to 4GB even for small-memory HVM guests since for example SVGA LFB is mapped into the I/O hole. We may need to special case the I/O hole somehow, or provide some finer-grained way to find out which parts of the GPFN space are actually used (e.g., get Xen to fill in a bitmap with 1 bit per 1024 pages, or similar). Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_core_x86.c')
-rw-r--r--tools/libxc/xc_core_x86.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c
index 6ea775aef6..bd82110713 100644
--- a/tools/libxc/xc_core_x86.c
+++ b/tools/libxc/xc_core_x86.c
@@ -21,12 +21,15 @@
#include "xg_private.h"
#include "xc_core.h"
+static int max_gpfn(int xc_handle, domid_t domid)
+{
+ return xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &domid);
+}
+
int
xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
{
- if ( info->hvm )
- return 1;
- return 0;
+ return info->hvm;
}
int
@@ -35,14 +38,14 @@ xc_core_arch_memory_map_get(int xc_handle, xc_dominfo_t *info,
xc_core_memory_map_t **mapp,
unsigned int *nr_entries)
{
- unsigned long max_pfn = live_shinfo->arch.max_pfn;
- xc_core_memory_map_t *map = NULL;
+ unsigned long max_pfn = max_gpfn(xc_handle, info->domid);
+ xc_core_memory_map_t *map;
map = malloc(sizeof(*map));
- if ( !map )
+ if ( map == NULL )
{
PERROR("Could not allocate memory");
- goto out;
+ return -1;
}
map->addr = 0;
@@ -51,11 +54,6 @@ xc_core_arch_memory_map_get(int xc_handle, xc_dominfo_t *info,
*mapp = map;
*nr_entries = 1;
return 0;
-
-out:
- if ( map )
- free(map);
- return -1;
}
int
@@ -67,7 +65,7 @@ xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info,
xen_pfn_t *live_p2m_frame_list_list = NULL;
xen_pfn_t *live_p2m_frame_list = NULL;
uint32_t dom = info->domid;
- unsigned long max_pfn = live_shinfo->arch.max_pfn;
+ unsigned long max_pfn = max_gpfn(xc_handle, info->domid);
int ret = -1;
int err;