suspend_pv.c 1.1 KB

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