License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6/btrfs-unstable.git] / arch / x86 / xen / suspend.c
blob92bf5ecb6bafa2fe844c52a82847316403b55ef2
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/types.h>
3 #include <linux/tick.h>
5 #include <xen/xen.h>
6 #include <xen/interface/xen.h>
7 #include <xen/grant_table.h>
8 #include <xen/events.h>
10 #include <asm/xen/hypercall.h>
11 #include <asm/xen/page.h>
12 #include <asm/fixmap.h>
14 #include "xen-ops.h"
15 #include "mmu.h"
16 #include "pmu.h"
18 void xen_arch_pre_suspend(void)
20 if (xen_pv_domain())
21 xen_pv_pre_suspend();
24 void xen_arch_post_suspend(int cancelled)
26 if (xen_pv_domain())
27 xen_pv_post_suspend(cancelled);
28 else
29 xen_hvm_post_suspend(cancelled);
32 static void xen_vcpu_notify_restore(void *data)
34 /* Boot processor notified via generic timekeeping_resume() */
35 if (smp_processor_id() == 0)
36 return;
38 tick_resume_local();
41 static void xen_vcpu_notify_suspend(void *data)
43 tick_suspend_local();
46 void xen_arch_resume(void)
48 int cpu;
50 on_each_cpu(xen_vcpu_notify_restore, NULL, 1);
52 for_each_online_cpu(cpu)
53 xen_pmu_init(cpu);
56 void xen_arch_suspend(void)
58 int cpu;
60 for_each_online_cpu(cpu)
61 xen_pmu_finish(cpu);
63 on_each_cpu(xen_vcpu_notify_suspend, NULL, 1);