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 if (xen_pv_domain()) 21 xen_pv_pre_suspend(); 22 } 23 24 void xen_arch_post_suspend(int cancelled) 25 { 26 if (xen_pv_domain()) 27 xen_pv_post_suspend(cancelled); 28 else 29 xen_hvm_post_suspend(cancelled); 30 } 31 32 static void xen_vcpu_notify_restore(void *data) 33 { 34 /* Boot processor notified via generic timekeeping_resume() */ 35 if (smp_processor_id() == 0) 36 return; 37 38 tick_resume_local(); 39 } 40 41 static void xen_vcpu_notify_suspend(void *data) 42 { 43 tick_suspend_local(); 44 } 45 46 void xen_arch_resume(void) 47 { 48 int cpu; 49 50 on_each_cpu(xen_vcpu_notify_restore, NULL, 1); 51 52 for_each_online_cpu(cpu) 53 xen_pmu_init(cpu); 54 } 55 56 void xen_arch_suspend(void) 57 { 58 int cpu; 59 60 for_each_online_cpu(cpu) 61 xen_pmu_finish(cpu); 62 63 on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); 64 } 65