mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 19:45:06 +08:00
7b25b9cb0d
In every hypervisor except for xen pv time ops are initialized in init_hypervisor_platform(). Xen PV domains initialize time ops in x86_init.paging.pagetable_init(), by calling xen_setup_shared_info() which is a poor design, as time is needed prior to memory allocator. xen_setup_shared_info() is called from two places: during boot, and after suspend. Split the content of xen_setup_shared_info() into three places: 1. add the clock relavent data into new xen pv init_platform vector, and set clock ops in there. 2. move xen_setup_vcpu_info_placement() to new xen_pv_guest_late_init() call. 3. Re-initializing parts of shared info copy to xen_pv_post_suspend() to be symmetric to xen_pv_pre_suspend Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: steven.sistare@oracle.com Cc: daniel.m.jordan@oracle.com Cc: linux@armlinux.org.uk Cc: schwidefsky@de.ibm.com Cc: heiko.carstens@de.ibm.com Cc: john.stultz@linaro.org Cc: sboyd@codeaurora.org Cc: hpa@zytor.com Cc: douly.fnst@cn.fujitsu.com Cc: peterz@infradead.org Cc: prarit@redhat.com Cc: feng.tang@intel.com Cc: pmladek@suse.com Cc: gnomes@lxorguk.ukuu.org.uk Cc: linux-s390@vger.kernel.org Cc: boris.ostrovsky@oracle.com Cc: jgross@suse.com Cc: pbonzini@redhat.com Link: https://lkml.kernel.org/r/20180719205545.16512-13-pasha.tatashin@oracle.com
49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/types.h>
|
|
|
|
#include <asm/fixmap.h>
|
|
|
|
#include <asm/xen/hypercall.h>
|
|
#include <asm/xen/page.h>
|
|
|
|
#include "xen-ops.h"
|
|
|
|
void xen_pv_pre_suspend(void)
|
|
{
|
|
xen_mm_pin_all();
|
|
|
|
xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
|
|
xen_start_info->console.domU.mfn =
|
|
mfn_to_pfn(xen_start_info->console.domU.mfn);
|
|
|
|
BUG_ON(!irqs_disabled());
|
|
|
|
HYPERVISOR_shared_info = &xen_dummy_shared_info;
|
|
if (HYPERVISOR_update_va_mapping(fix_to_virt(FIX_PARAVIRT_BOOTMAP),
|
|
__pte_ma(0), 0))
|
|
BUG();
|
|
}
|
|
|
|
void xen_pv_post_suspend(int suspend_cancelled)
|
|
{
|
|
xen_build_mfn_list_list();
|
|
set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_start_info->shared_info);
|
|
HYPERVISOR_shared_info = (void *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);
|
|
xen_setup_mfn_list_list();
|
|
|
|
if (suspend_cancelled) {
|
|
xen_start_info->store_mfn =
|
|
pfn_to_mfn(xen_start_info->store_mfn);
|
|
xen_start_info->console.domU.mfn =
|
|
pfn_to_mfn(xen_start_info->console.domU.mfn);
|
|
} else {
|
|
#ifdef CONFIG_SMP
|
|
BUG_ON(xen_cpu_initialized_map == NULL);
|
|
cpumask_copy(xen_cpu_initialized_map, cpu_online_mask);
|
|
#endif
|
|
xen_vcpu_restore();
|
|
}
|
|
|
|
xen_mm_unpin_all();
|
|
}
|