[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 3/4] libxc: fixes for the ARM platform
Make xc_dom_feature_translated an arch-dependent function. alloc_magic_pages: save console and xenstore pfn's in xc_dom_image. alloc_magic_pages: set HVM_PARAM_CONSOLE_EVTCHN and HVM_PARAM_STORE_EVTCHN hvm_params using the event channels allocated by the toolstack. Call xc_dom_gnttab_hvm_seed instead of xc_dom_gnttab_seed in xc_dom_gnttab_init for autotranslated guests. Changes in v3: - rebased on b61ed421d2c85b5b106c63f2c14f8aa162b282f0; - implement xc_dom_feature_translated in xc_dom_{arm/x86}.c. Changes on v2: - add xc_dom_gnttab_init changes. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxc/xc_dom.h | 6 +----- tools/libxc/xc_dom_arm.c | 24 +++++++++++++++++------- tools/libxc/xc_dom_boot.c | 23 ++++++++++------------- tools/libxc/xc_dom_x86.c | 5 +++++ 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h index eccc516..7583d8c 100644 --- a/tools/libxc/xc_dom.h +++ b/tools/libxc/xc_dom.h @@ -250,6 +250,7 @@ int xc_dom_gnttab_seed(xc_interface *xch, domid_t domid, xen_pfn_t xenstore_gmfn, domid_t console_domid, domid_t xenstore_domid); +int xc_dom_feature_translated(struct xc_dom_image *dom); /* --- debugging bits ---------------------------------------------- */ @@ -312,11 +313,6 @@ static inline void *xc_dom_vaddr_to_ptr(struct xc_dom_image *dom, return (ptr ? (ptr + offset) : NULL); } -static inline int xc_dom_feature_translated(struct xc_dom_image *dom) -{ - return elf_xen_feature_get(XENFEAT_auto_translated_physmap, dom->f_active); -} - static inline xen_pfn_t xc_dom_p2m_host(struct xc_dom_image *dom, xen_pfn_t pfn) { if (dom->shadow_enabled) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index b743a6c..62bd3cf 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -51,7 +51,7 @@ static int setup_pgtables_arm(struct xc_dom_image *dom) static int alloc_magic_pages(struct xc_dom_image *dom) { int rc, i; - xen_pfn_t store_pfn, console_pfn, p2m[NR_MAGIC_PAGES]; + xen_pfn_t p2m[NR_MAGIC_PAGES]; DOMPRINTF_CALLED(dom->xch); @@ -64,15 +64,20 @@ static int alloc_magic_pages(struct xc_dom_image *dom) if ( rc < 0 ) return rc; - console_pfn = dom->rambase_pfn + dom->total_pages + CONSOLE_PFN_OFFSET; - store_pfn = dom->rambase_pfn + dom->total_pages + XENSTORE_PFN_OFFSET; + dom->console_pfn = dom->rambase_pfn + dom->total_pages + CONSOLE_PFN_OFFSET; + dom->xenstore_pfn = dom->rambase_pfn + dom->total_pages + XENSTORE_PFN_OFFSET; - xc_clear_domain_page(dom->xch, dom->guest_domid, console_pfn); - xc_clear_domain_page(dom->xch, dom->guest_domid, store_pfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); + xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN, - console_pfn); + dom->console_pfn); xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN, - store_pfn); + dom->xenstore_pfn); + /* allocated by toolstack */ + xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN, + dom->console_evtchn); + xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_EVTCHN, + dom->xenstore_evtchn); return 0; } @@ -196,6 +201,11 @@ int arch_setup_bootlate(struct xc_dom_image *dom) return 0; } +int xc_dom_feature_translated(struct xc_dom_image *dom) +{ + return 1; +} + /* * Local variables: * mode: C diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index f83aa12..c7f04a8 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -416,19 +416,16 @@ int xc_dom_gnttab_hvm_seed(xc_interface *xch, domid_t domid, int xc_dom_gnttab_init(struct xc_dom_image *dom) { - xen_pfn_t console_gmfn; - xen_pfn_t xenstore_gmfn; - int autotranslated; - - autotranslated = xc_dom_feature_translated(dom); - console_gmfn = autotranslated ? - dom->console_pfn : xc_dom_p2m_host(dom, dom->console_pfn); - xenstore_gmfn = autotranslated ? - dom->xenstore_pfn : xc_dom_p2m_host(dom, dom->xenstore_pfn); - - return xc_dom_gnttab_seed(dom->xch, dom->guest_domid, - console_gmfn, xenstore_gmfn, - dom->console_domid, dom->xenstore_domid); + if ( xc_dom_feature_translated(dom) ) { + return xc_dom_gnttab_hvm_seed(dom->xch, dom->guest_domid, + dom->console_pfn, dom->xenstore_pfn, + dom->console_domid, dom->xenstore_domid); + } else { + return xc_dom_gnttab_seed(dom->xch, dom->guest_domid, + xc_dom_p2m_host(dom, dom->console_pfn), + xc_dom_p2m_host(dom, dom->xenstore_pfn), + dom->console_domid, dom->xenstore_domid); + } } /* diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index be2ad66..9cbdd62 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -822,6 +822,11 @@ int arch_setup_bootlate(struct xc_dom_image *dom) return 0; } +int xc_dom_feature_translated(struct xc_dom_image *dom) +{ + return elf_xen_feature_get(XENFEAT_auto_translated_physmap, dom->f_active); +} + /* * Local variables: * mode: C -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |