suspend_pv.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. xen_setup_shared_info();
  23. if (suspend_cancelled) {
  24. xen_start_info->store_mfn =
  25. pfn_to_mfn(xen_start_info->store_mfn);
  26. xen_start_info->console.domU.mfn =
  27. pfn_to_mfn(xen_start_info->console.domU.mfn);
  28. } else {
  29. #ifdef CONFIG_SMP
  30. BUG_ON(xen_cpu_initialized_map == NULL);
  31. cpumask_copy(xen_cpu_initialized_map, cpu_online_mask);
  32. #endif
  33. xen_vcpu_restore();
  34. }
  35. xen_mm_unpin_all();
  36. }