mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
tools/dombuilder: Remove PV-only, mandatory hooks
Currently, the setup_pgtable() hook is optional, but alloc_pgtable() hook is not. Both are specific to x86 PV guests, and stubbed in various ways by the dombuilders for translated guests (x86 HVM, ARM). Make alloc_pgtables() optional, and drop all the stubs for translated guest types. No change in the constructed guests. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Wei Liu <wl@xen.org> Acked-by: Julien Grall <julien@xen.org>
This commit is contained in:
1 parent
ee21f10d70
commit
f8218e4792
5 files changed
+7
-33
No files matched your search
@@ -253,8 +253,9 @@ void xc_dom_register_loader(struct xc_dom_loader *loader);
|
||||
/* --- arch specific hooks ----------------------------------------- */
|
||||
|
||||
struct xc_dom_arch {
|
||||
/* pagetable setup */
|
||||
int (*alloc_magic_pages) (struct xc_dom_image * dom);
|
||||
|
||||
/* pagetable setup - x86 PV only */
|
||||
int (*alloc_pgtables) (struct xc_dom_image * dom);
|
||||
int (*alloc_p2m_list) (struct xc_dom_image * dom);
|
||||
int (*setup_pgtables) (struct xc_dom_image * dom);
|
||||
|
||||
@@ -46,23 +46,6 @@ const char *xc_domain_get_native_protocol(xc_interface *xch,
|
||||
return XEN_IO_PROTO_ABI_ARM;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/*
|
||||
* arm guests are hybrid and start off with paging disabled, therefore no
|
||||
* pagetables and nothing to do here.
|
||||
*/
|
||||
static int alloc_pgtables_arm(struct xc_dom_image *dom)
|
||||
{
|
||||
DOMPRINTF_CALLED(dom->xch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setup_pgtables_arm(struct xc_dom_image *dom)
|
||||
{
|
||||
DOMPRINTF_CALLED(dom->xch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static int alloc_magic_pages(struct xc_dom_image *dom)
|
||||
@@ -539,8 +522,6 @@ static struct xc_dom_arch xc_dom_32 = {
|
||||
.page_shift = PAGE_SHIFT_ARM,
|
||||
.sizeof_pfn = 8,
|
||||
.alloc_magic_pages = alloc_magic_pages,
|
||||
.alloc_pgtables = alloc_pgtables_arm,
|
||||
.setup_pgtables = setup_pgtables_arm,
|
||||
.start_info = start_info_arm,
|
||||
.shared_info = shared_info_arm,
|
||||
.vcpu = vcpu_arm32,
|
||||
@@ -555,8 +536,6 @@ static struct xc_dom_arch xc_dom_64 = {
|
||||
.page_shift = PAGE_SHIFT_ARM,
|
||||
.sizeof_pfn = 8,
|
||||
.alloc_magic_pages = alloc_magic_pages,
|
||||
.alloc_pgtables = alloc_pgtables_arm,
|
||||
.setup_pgtables = setup_pgtables_arm,
|
||||
.start_info = start_info_arm,
|
||||
.shared_info = shared_info_arm,
|
||||
.vcpu = vcpu_arm64,
|
||||
|
||||
@@ -199,9 +199,9 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
|
||||
/* initial mm setup */
|
||||
if ( (rc = xc_dom_update_guest_p2m(dom)) != 0 )
|
||||
return rc;
|
||||
if ( dom->arch_hooks->setup_pgtables )
|
||||
if ( (rc = dom->arch_hooks->setup_pgtables(dom)) != 0 )
|
||||
return rc;
|
||||
if ( dom->arch_hooks->setup_pgtables &&
|
||||
(rc = dom->arch_hooks->setup_pgtables(dom)) != 0 )
|
||||
return rc;
|
||||
|
||||
/* start info page */
|
||||
if ( dom->arch_hooks->start_info )
|
||||
|
||||
@@ -1248,7 +1248,8 @@ int xc_dom_build_image(struct xc_dom_image *dom)
|
||||
goto err;
|
||||
if ( dom->arch_hooks->alloc_magic_pages(dom) != 0 )
|
||||
goto err;
|
||||
if ( dom->arch_hooks->alloc_pgtables(dom) != 0 )
|
||||
if ( dom->arch_hooks->alloc_pgtables &&
|
||||
dom->arch_hooks->alloc_pgtables(dom) != 0 )
|
||||
goto err;
|
||||
if ( dom->alloc_bootstack )
|
||||
{
|
||||
|
||||
@@ -1690,12 +1690,6 @@ static int bootlate_pv(struct xc_dom_image *dom)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int alloc_pgtables_hvm(struct xc_dom_image *dom)
|
||||
{
|
||||
DOMPRINTF("%s: doing nothing", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The memory layout of the start_info page and the modules, and where the
|
||||
* addresses are stored:
|
||||
@@ -1906,7 +1900,6 @@ static struct xc_dom_arch xc_hvm_32 = {
|
||||
.page_shift = PAGE_SHIFT_X86,
|
||||
.sizeof_pfn = 4,
|
||||
.alloc_magic_pages = alloc_magic_pages_hvm,
|
||||
.alloc_pgtables = alloc_pgtables_hvm,
|
||||
.vcpu = vcpu_hvm,
|
||||
.meminit = meminit_hvm,
|
||||
.bootearly = bootearly,
|
||||
|
||||