x86/gart: Exclude GART aperture from vmcore
[sfrench/cifs-2.6.git] / arch / x86 / xen / suspend.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/types.h>
3 #include <linux/tick.h>
4
5 #include <xen/xen.h>
6 #include <xen/interface/xen.h>
7 #include <xen/grant_table.h>
8 #include <xen/events.h>
9
10 #include <asm/xen/hypercall.h>
11 #include <asm/xen/page.h>
12 #include <asm/fixmap.h>
13
14 #include "xen-ops.h"
15 #include "mmu.h"
16 #include "pmu.h"
17
18 void xen_arch_pre_suspend(void)
19 {
20         xen_save_time_memory_area();
21
22         if (xen_pv_domain())
23                 xen_pv_pre_suspend();
24 }
25
26 void xen_arch_post_suspend(int cancelled)
27 {
28         if (xen_pv_domain())
29                 xen_pv_post_suspend(cancelled);
30         else
31                 xen_hvm_post_suspend(cancelled);
32
33         xen_restore_time_memory_area();
34 }
35
36 static void xen_vcpu_notify_restore(void *data)
37 {
38         /* Boot processor notified via generic timekeeping_resume() */
39         if (smp_processor_id() == 0)
40                 return;
41
42         tick_resume_local();
43 }
44
45 static void xen_vcpu_notify_suspend(void *data)
46 {
47         tick_suspend_local();
48 }
49
50 void xen_arch_resume(void)
51 {
52         int cpu;
53
54         on_each_cpu(xen_vcpu_notify_restore, NULL, 1);
55
56         for_each_online_cpu(cpu)
57                 xen_pmu_init(cpu);
58 }
59
60 void xen_arch_suspend(void)
61 {
62         int cpu;
63
64         for_each_online_cpu(cpu)
65                 xen_pmu_finish(cpu);
66
67         on_each_cpu(xen_vcpu_notify_suspend, NULL, 1);
68 }