[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [PATCH v4 16/16] Save/Restore Support: Implement code for arch suspend/resume
Before suspending the domain the shared_info_page is unmapped and for PVs the pagetables should be canonicalized. After resume the shared_info_page should be mapped again. Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx> Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> --- Changed since v2: * Fixed parameter passed to 'unmap_shared_info' in after_suspend Changed since v1: * Fixed comment --- arch/x86/setup.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/arch/x86/setup.c b/arch/x86/setup.c index 60e12c0..4fd8e39 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -32,6 +32,7 @@ #include <xen/xen.h> #include <xen/arch-x86/cpuid.h> #include <xen/arch-x86/hvm/start_info.h> +#include <xen/hvm/params.h> #ifdef CONFIG_PARAVIRT /* @@ -42,6 +43,11 @@ union start_info_union start_info_union; #endif /* + * This pointer holds a reference to the copy of the start_info struct. + */ +static start_info_t *start_info_ptr; + +/* * Shared page for communicating with the hypervisor. * Events flags go here, for example. */ @@ -213,18 +219,63 @@ arch_init(void *par) #ifdef CONFIG_PARAVIRT memcpy(&start_info, par, sizeof(start_info)); #endif + start_info_ptr = (start_info_t *)par; start_kernel((start_info_t *)par); } void arch_pre_suspend(void) { +#ifdef CONFIG_PARAVIRT + /* Replace xenstore and console mfns with the correspondent pfns */ + start_info_ptr->store_mfn = + virt_to_pfn(mfn_to_virt(start_info_ptr->store_mfn)); + start_info_ptr->console.domU.mfn = + virt_to_pfn(mfn_to_virt(start_info_ptr->console.domU.mfn)); +#else + uint64_t store_v; + uint64_t console_v; + + if( hvm_get_parameter(HVM_PARAM_STORE_PFN, &store_v) ) + BUG(); + start_info_ptr->store_mfn = store_v; + + if( hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &console_v) ) + BUG(); + start_info_ptr->console.domU.mfn = console_v; +#endif + unmap_shared_info(); + arch_mm_pre_suspend(); } void arch_post_suspend(int canceled) { +#if CONFIG_PARAVIRT + if (canceled) { + start_info_ptr->store_mfn = pfn_to_mfn(start_info_ptr->store_mfn); + start_info_ptr->console.domU.mfn = pfn_to_mfn(start_info_ptr->console.domU.mfn); + } else { + memcpy(&start_info, start_info_ptr, sizeof(start_info_t)); + } +#else + uint64_t store_v; + uint64_t console_v; + + if (hvm_get_parameter(HVM_PARAM_STORE_PFN, &store_v)) + BUG(); + start_info_ptr->store_mfn = pfn_to_mfn(store_v); + if (hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &console_v)) + BUG(); + start_info_ptr->console.domU.mfn = pfn_to_mfn(console_v); +#endif + + HYPERVISOR_shared_info = map_shared_info((void*) start_info_ptr); +#ifndef CONFIG_PARAVIRT + xen_callback_vector(); +#endif + arch_mm_post_suspend(canceled); } void -- 2.3.2 (Apple Git-55) _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |