--- zzzz-none-000/linux-3.10.107/arch/x86/xen/suspend.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/arch/x86/xen/suspend.c 2021-02-04 17:41:59.000000000 +0000 @@ -1,6 +1,7 @@ #include -#include +#include +#include #include #include #include @@ -11,9 +12,12 @@ #include "xen-ops.h" #include "mmu.h" +#include "pmu.h" -void xen_arch_pre_suspend(void) +static void xen_pv_pre_suspend(void) { + xen_mm_pin_all(); + xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); xen_start_info->console.domU.mfn = mfn_to_pfn(xen_start_info->console.domU.mfn); @@ -26,7 +30,7 @@ BUG(); } -void xen_arch_hvm_post_suspend(int suspend_cancelled) +static void xen_hvm_post_suspend(int suspend_cancelled) { #ifdef CONFIG_XEN_PVHVM int cpu; @@ -42,7 +46,7 @@ #endif } -void xen_arch_post_suspend(int suspend_cancelled) +static void xen_pv_post_suspend(int suspend_cancelled) { xen_build_mfn_list_list(); @@ -61,21 +65,53 @@ xen_vcpu_restore(); } + xen_mm_unpin_all(); } -static void xen_vcpu_notify_restore(void *data) +void xen_arch_pre_suspend(void) { - unsigned long reason = (unsigned long)data; + if (xen_pv_domain()) + xen_pv_pre_suspend(); +} +void xen_arch_post_suspend(int cancelled) +{ + if (xen_pv_domain()) + xen_pv_post_suspend(cancelled); + else + xen_hvm_post_suspend(cancelled); +} + +static void xen_vcpu_notify_restore(void *data) +{ /* Boot processor notified via generic timekeeping_resume() */ - if ( smp_processor_id() == 0) + if (smp_processor_id() == 0) return; - clockevents_notify(reason, NULL); + tick_resume_local(); +} + +static void xen_vcpu_notify_suspend(void *data) +{ + tick_suspend_local(); } void xen_arch_resume(void) { - on_each_cpu(xen_vcpu_notify_restore, - (void *)CLOCK_EVT_NOTIFY_RESUME, 1); + int cpu; + + on_each_cpu(xen_vcpu_notify_restore, NULL, 1); + + for_each_online_cpu(cpu) + xen_pmu_init(cpu); +} + +void xen_arch_suspend(void) +{ + int cpu; + + for_each_online_cpu(cpu) + xen_pmu_finish(cpu); + + on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); }