Jeremy Fitzhardinge | 0e91398 | 2008-05-26 23:31:27 +0100 | [diff] [blame] | 1 | #include <linux/types.h> |
Thomas Gleixner | 4ffee52 | 2015-03-25 13:09:16 +0100 | [diff] [blame] | 2 | #include <linux/tick.h> |
Jeremy Fitzhardinge | 0e91398 | 2008-05-26 23:31:27 +0100 | [diff] [blame] | 3 | |
Andrew Morton | facca61 | 2015-12-29 14:54:13 -0800 | [diff] [blame] | 4 | #include <xen/xen.h> |
Jeremy Fitzhardinge | 0e91398 | 2008-05-26 23:31:27 +0100 | [diff] [blame] | 5 | #include <xen/interface/xen.h> |
6 | #include <xen/grant_table.h> | ||||
7 | #include <xen/events.h> | ||||
8 | |||||
9 | #include <asm/xen/hypercall.h> | ||||
10 | #include <asm/xen/page.h> | ||||
Ingo Molnar | 99d0000 | 2009-01-23 11:09:15 +0100 | [diff] [blame] | 11 | #include <asm/fixmap.h> |
Jeremy Fitzhardinge | 0e91398 | 2008-05-26 23:31:27 +0100 | [diff] [blame] | 12 | |
13 | #include "xen-ops.h" | ||||
14 | #include "mmu.h" | ||||
Boris Ostrovsky | 65d0cf0 | 2015-08-10 16:34:34 -0400 | [diff] [blame] | 15 | #include "pmu.h" |
Jeremy Fitzhardinge | 0e91398 | 2008-05-26 23:31:27 +0100 | [diff] [blame] | 16 | |
David Vrabel | aa8532c | 2014-05-08 11:09:23 +0100 | [diff] [blame] | 17 | void xen_arch_pre_suspend(void) |
18 | { | ||||
Boris Ostrovsky | 65d0cf0 | 2015-08-10 16:34:34 -0400 | [diff] [blame] | 19 | if (xen_pv_domain()) |
20 | xen_pv_pre_suspend(); | ||||
David Vrabel | aa8532c | 2014-05-08 11:09:23 +0100 | [diff] [blame] | 21 | } |
22 | |||||
23 | void xen_arch_post_suspend(int cancelled) | ||||
24 | { | ||||
Boris Ostrovsky | 65d0cf0 | 2015-08-10 16:34:34 -0400 | [diff] [blame] | 25 | if (xen_pv_domain()) |
26 | xen_pv_post_suspend(cancelled); | ||||
27 | else | ||||
28 | xen_hvm_post_suspend(cancelled); | ||||
Jeremy Fitzhardinge | 0e91398 | 2008-05-26 23:31:27 +0100 | [diff] [blame] | 29 | } |
30 | |||||
Ian Campbell | f6eafe3 | 2009-11-25 14:12:08 +0000 | [diff] [blame] | 31 | static void xen_vcpu_notify_restore(void *data) |
32 | { | ||||
Ian Campbell | f6eafe3 | 2009-11-25 14:12:08 +0000 | [diff] [blame] | 33 | /* Boot processor notified via generic timekeeping_resume() */ |
Thomas Gleixner | 4ffee52 | 2015-03-25 13:09:16 +0100 | [diff] [blame] | 34 | if (smp_processor_id() == 0) |
Ian Campbell | f6eafe3 | 2009-11-25 14:12:08 +0000 | [diff] [blame] | 35 | return; |
36 | |||||
Thomas Gleixner | f46481d | 2015-03-25 13:11:04 +0100 | [diff] [blame] | 37 | tick_resume_local(); |
Ian Campbell | f6eafe3 | 2009-11-25 14:12:08 +0000 | [diff] [blame] | 38 | } |
39 | |||||
Boris Ostrovsky | 2b953a5 | 2015-04-28 18:46:20 -0400 | [diff] [blame] | 40 | static void xen_vcpu_notify_suspend(void *data) |
41 | { | ||||
42 | tick_suspend_local(); | ||||
43 | } | ||||
44 | |||||
Isaku Yamahata | ad55db9 | 2008-07-08 15:06:32 -0700 | [diff] [blame] | 45 | void xen_arch_resume(void) |
46 | { | ||||
Boris Ostrovsky | de0afc9 | 2015-12-02 12:10:48 -0500 | [diff] [blame] | 47 | int cpu; |
48 | |||||
Thomas Gleixner | 4ffee52 | 2015-03-25 13:09:16 +0100 | [diff] [blame] | 49 | on_each_cpu(xen_vcpu_notify_restore, NULL, 1); |
Boris Ostrovsky | de0afc9 | 2015-12-02 12:10:48 -0500 | [diff] [blame] | 50 | |
51 | for_each_online_cpu(cpu) | ||||
52 | xen_pmu_init(cpu); | ||||
Isaku Yamahata | ad55db9 | 2008-07-08 15:06:32 -0700 | [diff] [blame] | 53 | } |
Boris Ostrovsky | 2b953a5 | 2015-04-28 18:46:20 -0400 | [diff] [blame] | 54 | |
55 | void xen_arch_suspend(void) | ||||
56 | { | ||||
Boris Ostrovsky | de0afc9 | 2015-12-02 12:10:48 -0500 | [diff] [blame] | 57 | int cpu; |
58 | |||||
59 | for_each_online_cpu(cpu) | ||||
60 | xen_pmu_finish(cpu); | ||||
61 | |||||
Boris Ostrovsky | 2b953a5 | 2015-04-28 18:46:20 -0400 | [diff] [blame] | 62 | on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); |
63 | } |