suspend.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include <linux/types.h>
  2. #include <linux/tick.h>
  3. #include <xen/xen.h>
  4. #include <xen/interface/xen.h>
  5. #include <xen/grant_table.h>
  6. #include <xen/events.h>
  7. #include <asm/xen/hypercall.h>
  8. #include <asm/xen/page.h>
  9. #include <asm/fixmap.h>
  10. #include "xen-ops.h"
  11. #include "mmu.h"
  12. #include "pmu.h"
  13. void xen_arch_pre_suspend(void)
  14. {
  15. if (xen_pv_domain())
  16. xen_pv_pre_suspend();
  17. }
  18. void xen_arch_post_suspend(int cancelled)
  19. {
  20. if (xen_pv_domain())
  21. xen_pv_post_suspend(cancelled);
  22. else
  23. xen_hvm_post_suspend(cancelled);
  24. }
  25. static void xen_vcpu_notify_restore(void *data)
  26. {
  27. /* Boot processor notified via generic timekeeping_resume() */
  28. if (smp_processor_id() == 0)
  29. return;
  30. tick_resume_local();
  31. }
  32. static void xen_vcpu_notify_suspend(void *data)
  33. {
  34. tick_suspend_local();
  35. }
  36. void xen_arch_resume(void)
  37. {
  38. int cpu;
  39. on_each_cpu(xen_vcpu_notify_restore, NULL, 1);
  40. for_each_online_cpu(cpu)
  41. xen_pmu_init(cpu);
  42. }
  43. void xen_arch_suspend(void)
  44. {
  45. int cpu;
  46. for_each_online_cpu(cpu)
  47. xen_pmu_finish(cpu);
  48. on_each_cpu(xen_vcpu_notify_suspend, NULL, 1);
  49. }