diff options
-rw-r--r-- | tools/libxc/xc_dom.h | 5 | ||||
-rw-r--r-- | tools/libxc/xc_dom_boot.c | 4 | ||||
-rw-r--r-- | tools/libxc/xc_dom_compat_linux.c | 22 | ||||
-rw-r--r-- | tools/libxc/xc_dom_ia64.c | 2 | ||||
-rw-r--r-- | tools/libxc/xc_dom_x86.c | 41 | ||||
-rw-r--r-- | tools/libxc/xenguest.h | 11 | ||||
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 4 |
7 files changed, 42 insertions, 47 deletions
diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h index 3d6d9164bd..58d3f496de 100644 --- a/tools/libxc/xc_dom.h +++ b/tools/libxc/xc_dom.h @@ -96,6 +96,7 @@ struct xc_dom_image { int guest_xc; domid_t guest_domid; int8_t vhpt_size_log2; /* for IA64 */ + int8_t superpages; int shadow_enabled; int xen_version; @@ -174,7 +175,7 @@ int xc_dom_build_image(struct xc_dom_image *dom); int xc_dom_update_guest_p2m(struct xc_dom_image *dom); int xc_dom_boot_xen_init(struct xc_dom_image *dom, int xc, domid_t domid); -int xc_dom_boot_mem_init(struct xc_dom_image *dom, int superpages); +int xc_dom_boot_mem_init(struct xc_dom_image *dom); void *xc_dom_boot_domU_map(struct xc_dom_image *dom, xen_pfn_t pfn, xen_pfn_t count); int xc_dom_boot_image(struct xc_dom_image *dom); @@ -260,7 +261,7 @@ static inline xen_pfn_t xc_dom_p2m_guest(struct xc_dom_image *dom, /* --- arch bits --------------------------------------------------- */ -int arch_setup_meminit(struct xc_dom_image *dom, int superpages); +int arch_setup_meminit(struct xc_dom_image *dom); int arch_setup_bootearly(struct xc_dom_image *dom); int arch_setup_bootlate(struct xc_dom_image *dom); diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index ac192a3dac..e767e8cee1 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -129,13 +129,13 @@ int xc_dom_boot_xen_init(struct xc_dom_image *dom, int xc, domid_t domid) return 0; } -int xc_dom_boot_mem_init(struct xc_dom_image *dom, int superpages) +int xc_dom_boot_mem_init(struct xc_dom_image *dom) { long rc; xc_dom_printf("%s: called\n", __FUNCTION__); - rc = arch_setup_meminit(dom, superpages); + rc = arch_setup_meminit(dom); if ( rc != 0 ) { xc_dom_panic(XC_OUT_OF_MEMORY, diff --git a/tools/libxc/xc_dom_compat_linux.c b/tools/libxc/xc_dom_compat_linux.c index 41ee3af634..c00cd5abcd 100644 --- a/tools/libxc/xc_dom_compat_linux.c +++ b/tools/libxc/xc_dom_compat_linux.c @@ -28,8 +28,7 @@ static int xc_linux_build_internal(struct xc_dom_image *dom, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - int superpages) + unsigned long *console_mfn) { int rc; @@ -43,7 +42,7 @@ static int xc_linux_build_internal(struct xc_dom_image *dom, goto out; if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 ) goto out; - if ( (rc = xc_dom_boot_mem_init(dom, superpages)) != 0 ) + if ( (rc = xc_dom_boot_mem_init(dom)) != 0 ) goto out; if ( (rc = xc_dom_build_image(dom)) != 0 ) goto out; @@ -68,8 +67,8 @@ int xc_linux_build_mem(int xc_handle, uint32_t domid, unsigned long flags, unsigned int store_evtchn, unsigned long *store_mfn, - unsigned int console_evtchn, unsigned long *console_mfn, - int superpages) + unsigned int console_evtchn, + unsigned long *console_mfn) { struct xc_dom_image *dom; int rc; @@ -84,7 +83,7 @@ int xc_linux_build_mem(int xc_handle, uint32_t domid, rc = xc_linux_build_internal(dom, xc_handle, domid, mem_mb, flags, store_evtchn, store_mfn, - console_evtchn, console_mfn, superpages); + console_evtchn, console_mfn); out: xc_dom_release(dom); @@ -100,8 +99,8 @@ int xc_linux_build(int xc_handle, uint32_t domid, unsigned long flags, unsigned int store_evtchn, unsigned long *store_mfn, - unsigned int console_evtchn, unsigned long *console_mfn, - int superpages) + unsigned int console_evtchn, + unsigned long *console_mfn) { struct xc_dom_image *dom; int rc; @@ -117,7 +116,7 @@ int xc_linux_build(int xc_handle, uint32_t domid, rc = xc_linux_build_internal(dom, xc_handle, domid, mem_mb, flags, store_evtchn, store_mfn, - console_evtchn, console_mfn, superpages); + console_evtchn, console_mfn); out: xc_dom_release(dom); @@ -133,8 +132,7 @@ int xc_dom_linux_build(int xc_handle, unsigned long flags, unsigned int store_evtchn, unsigned long *store_mfn, - unsigned int console_evtchn, unsigned long *console_mfn, - int superpages) + unsigned int console_evtchn, unsigned long *console_mfn) { int rc; @@ -147,7 +145,7 @@ int xc_dom_linux_build(int xc_handle, return xc_linux_build_internal(dom, xc_handle, domid, mem_mb, flags, store_evtchn, store_mfn, - console_evtchn, console_mfn, superpages); + console_evtchn, console_mfn); } /* diff --git a/tools/libxc/xc_dom_ia64.c b/tools/libxc/xc_dom_ia64.c index 2d4086e41d..f5d4418077 100644 --- a/tools/libxc/xc_dom_ia64.c +++ b/tools/libxc/xc_dom_ia64.c @@ -149,7 +149,7 @@ static void __init register_arch_hooks(void) #include "xc_efi.h" -int arch_setup_meminit(struct xc_dom_image *dom, int superpages) +int arch_setup_meminit(struct xc_dom_image *dom) { xen_pfn_t pfn; int rc; diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 30f13970ac..eddb93aef5 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -694,10 +694,10 @@ static int x86_shadow(int xc, domid_t domid) return rc; } -int arch_setup_meminit(struct xc_dom_image *dom, int superpages) +int arch_setup_meminit(struct xc_dom_image *dom) { int rc; - xen_pfn_t pfn, allocsz, i; + xen_pfn_t pfn, allocsz, i, j, mfn; rc = x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type); if ( rc ) @@ -711,47 +711,46 @@ int arch_setup_meminit(struct xc_dom_image *dom, int superpages) } dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages); - if (superpages) + if ( dom->superpages ) { int count = dom->total_pages >> SUPERPAGE_PFN_SHIFT; xen_pfn_t extents[count]; xc_dom_printf("Populating memory with %d superpages\n", count); - for (pfn = 0; pfn < count; pfn++) + for ( pfn = 0; pfn < count; pfn++ ) extents[pfn] = pfn << SUPERPAGE_PFN_SHIFT; rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid, count, SUPERPAGE_PFN_SHIFT, 0, extents); - if (!rc) - { - int i, j; - xen_pfn_t mfn; + if ( rc ) + return rc; - /* Expand the returned mfn into the p2m array */ - pfn = 0; - for (i = 0; i < count; i++) - { - mfn = extents[i]; - for (j = 0; j < SUPERPAGE_NR_PFNS; j++, pfn++) - { - dom->p2m_host[pfn] = mfn + j; - } - } + /* Expand the returned mfn into the p2m array */ + pfn = 0; + for ( i = 0; i < count; i++ ) + { + mfn = extents[i]; + for ( j = 0; j < SUPERPAGE_NR_PFNS; j++, pfn++ ) + dom->p2m_host[pfn] = mfn + j; } - } else + } + else { /* setup initial p2m */ for ( pfn = 0; pfn < dom->total_pages; pfn++ ) dom->p2m_host[pfn] = pfn; /* allocate guest memory */ - for ( i = rc = allocsz = 0; (i < dom->total_pages) && !rc; i += allocsz ) + for ( i = rc = allocsz = 0; + (i < dom->total_pages) && !rc; + i += allocsz ) { allocsz = dom->total_pages - i; if ( allocsz > 1024*1024 ) allocsz = 1024*1024; rc = xc_domain_memory_populate_physmap( - dom->guest_xc, dom->guest_domid, allocsz, 0, 0, &dom->p2m_host[i]); + dom->guest_xc, dom->guest_domid, allocsz, + 0, 0, &dom->p2m_host[i]); } } diff --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h index 220db7061c..03bc38cb6a 100644 --- a/tools/libxc/xenguest.h +++ b/tools/libxc/xenguest.h @@ -63,7 +63,6 @@ int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom, * @parm store_mfn returned with the mfn of the store page * @parm console_evtchn the console event channel for this domain to use * @parm conole_mfn returned with the mfn of the console page - * @parm superpages populate memory in guest with superpages * @return 0 on success, -1 on failure */ int xc_linux_build(int xc_handle, @@ -77,8 +76,7 @@ int xc_linux_build(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - int superpages); + unsigned long *console_mfn); /** The same interface, but the dom structure is managed by the caller */ struct xc_dom_image; @@ -92,8 +90,7 @@ int xc_dom_linux_build(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - int superpages); + unsigned long *console_mfn); /** * This function will create a domain for a paravirtualized Linux @@ -112,7 +109,6 @@ int xc_dom_linux_build(int xc_handle, * @parm store_mfn returned with the mfn of the store page * @parm console_evtchn the console event channel for this domain to use * @parm conole_mfn returned with the mfn of the console page - * @parm superpages populate memory in guest with superpages * @return 0 on success, -1 on failure */ int xc_linux_build_mem(int xc_handle, @@ -128,8 +124,7 @@ int xc_linux_build_mem(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn, unsigned int console_evtchn, - unsigned long *console_mfn, - int superpages); + unsigned long *console_mfn); int xc_hvm_build(int xc_handle, uint32_t domid, diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 02505aefec..c33fcc3b9c 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -436,9 +436,11 @@ static PyObject *pyxc_linux_build(XcObject *self, /* for IA64 */ dom->vhpt_size_log2 = vhpt; + dom->superpages = superpages; + if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image, ramdisk, flags, store_evtchn, &store_mfn, - console_evtchn, &console_mfn, superpages) != 0 ) { + console_evtchn, &console_mfn) != 0 ) { goto out; } |