1 #include <linux/types.h> 2 #include <linux/tick.h> 3 4 #include <xen/xen.h> 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> 11 #include <asm/fixmap.h> 12 13 #include "xen-ops.h" 14 #include "mmu.h" 15 #include "pmu.h" 16 17 void xen_arch_pre_suspend(void) 18 { 19 if (xen_pv_domain()) 20 xen_pv_pre_suspend(); 21 } 22 23 void xen_arch_post_suspend(int cancelled) 24 { 25 if (xen_pv_domain()) 26 xen_pv_post_suspend(cancelled); 27 else 28 xen_hvm_post_suspend(cancelled); 29 } 30 31 static void xen_vcpu_notify_restore(void *data) 32 { 33 /* Boot processor notified via generic timekeeping_resume() */ 34 if (smp_processor_id() == 0) 35 return; 36 37 tick_resume_local(); 38 } 39 40 static void xen_vcpu_notify_suspend(void *data) 41 { 42 tick_suspend_local(); 43 } 44 45 void xen_arch_resume(void) 46 { 47 int cpu; 48 49 on_each_cpu(xen_vcpu_notify_restore, NULL, 1); 50 51 for_each_online_cpu(cpu) 52 xen_pmu_init(cpu); 53 } 54 55 void xen_arch_suspend(void) 56 { 57 int cpu; 58 59 for_each_online_cpu(cpu) 60 xen_pmu_finish(cpu); 61 62 on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); 63 } 64