mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[LIBXC] Allocate memory and populate p2m in arch-specific code.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
This commit is contained in:
1 parent
06aaae8408
commit
ba5aedc193
4 files changed
+30
-15
No files matched your search
@@ -133,13 +133,7 @@ int xc_dom_boot_mem_init(struct xc_dom_image *dom)
|
||||
|
||||
xc_dom_printf("%s: called\n", __FUNCTION__);
|
||||
|
||||
if ( (rc = arch_setup_meminit(dom)) != 0 )
|
||||
return rc;
|
||||
|
||||
/* allocate guest memory */
|
||||
rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
|
||||
dom->total_pages, 0, 0,
|
||||
dom->p2m_host);
|
||||
rc = arch_setup_meminit(dom);
|
||||
if ( rc != 0 )
|
||||
{
|
||||
xc_dom_panic(XC_OUT_OF_MEMORY,
|
||||
|
||||
@@ -639,7 +639,7 @@ int xc_dom_parse_image(struct xc_dom_image *dom)
|
||||
int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
|
||||
{
|
||||
unsigned int page_shift;
|
||||
xen_pfn_t nr_pages, pfn;
|
||||
xen_pfn_t nr_pages;
|
||||
|
||||
dom->arch_hooks = xc_dom_find_arch_hooks(dom->guest_type);
|
||||
if ( dom->arch_hooks == NULL )
|
||||
@@ -659,10 +659,6 @@ int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
|
||||
xc_dom_printf("%s: 0x%" PRIpfn " pages\n",
|
||||
__FUNCTION__, dom->total_pages);
|
||||
|
||||
/* setup initial p2m */
|
||||
dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
|
||||
for ( pfn = 0; pfn < dom->total_pages; pfn++ )
|
||||
dom->p2m_host[pfn] = pfn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "xg_private.h"
|
||||
#include "xc_dom.h"
|
||||
#include "xenctrl.h"
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
@@ -130,8 +131,19 @@ static void __init register_arch_hooks(void)
|
||||
|
||||
int arch_setup_meminit(struct xc_dom_image *dom)
|
||||
{
|
||||
xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
|
||||
return 0;
|
||||
xen_pfn_t pfn;
|
||||
int rc;
|
||||
|
||||
/* setup initial p2m */
|
||||
dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
|
||||
for ( pfn = 0; pfn < dom->total_pages; pfn++ )
|
||||
dom->p2m_host[pfn] = pfn;
|
||||
|
||||
/* allocate guest memory */
|
||||
rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
|
||||
dom->total_pages, 0, 0,
|
||||
dom->p2m_host);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int arch_setup_bootearly(struct xc_dom_image *dom)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "xg_private.h"
|
||||
#include "xc_dom.h"
|
||||
#include "xenctrl.h"
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
@@ -626,14 +627,26 @@ static int x86_shadow(int xc, domid_t domid)
|
||||
|
||||
int arch_setup_meminit(struct xc_dom_image *dom)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc;
|
||||
|
||||
x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
|
||||
if ( xc_dom_feature_translated(dom) )
|
||||
{
|
||||
dom->shadow_enabled = 1;
|
||||
rc = x86_shadow(dom->guest_xc, dom->guest_domid);
|
||||
if ( rc )
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* setup initial p2m */
|
||||
dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
|
||||
for ( pfn = 0; pfn < dom->total_pages; pfn++ )
|
||||
dom->p2m_host[pfn] = pfn;
|
||||
|
||||
/* allocate guest memory */
|
||||
rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
|
||||
dom->total_pages, 0, 0,
|
||||
dom->p2m_host);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||