mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxenguest: Revert domain builder interface changes for 'superpages'
parameter, and place the flag in a pad byte of 'struct xc_dom_image' instead. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This commit is contained in:
1 parent
07a34def02
commit
5301fe9943
7 files changed
+42
-47
No files matched your search
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
+20
-21
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||