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