suspend_pv.c 993 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <linux/types.h>
  2. #include <asm/fixmap.h>
  3. #include <asm/xen/hypercall.h>
  4. #include <asm/xen/page.h>
  5. #include "xen-ops.h"
  6. void xen_pv_pre_suspend(void)
  7. {
  8. xen_mm_pin_all();
  9. xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
  10. xen_start_info->console.domU.mfn =
  11. mfn_to_pfn(xen_start_info->console.domU.mfn);
  12. BUG_ON(!irqs_disabled());
  13. HYPERVISOR_shared_info = &xen_dummy_shared_info;
  14. if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP),
  15. __pte_ma(0), 0))
  16. BUG();
  17. }
  18. void xen_pv_post_suspend(int suspend_cancelled)
  19. {
  20. xen_build_mfn_list_list();
  21. xen_setup_shared_info();
  22. if (suspend_cancelled) {
  23. xen_start_info->store_mfn =
  24. pfn_to_mfn(xen_start_info->store_mfn);
  25. xen_start_info->console.domU.mfn =
  26. pfn_to_mfn(xen_start_info->console.domU.mfn);
  27. } else {
  28. #ifdef CONFIG_SMP
  29. BUG_ON(xen_cpu_initialized_map == NULL);
  30. cpumask_copy(xen_cpu_initialized_map, cpu_online_mask);
  31. #endif
  32. xen_vcpu_restore();
  33. }
  34. xen_mm_unpin_all();
  35. }