1 #include <linux/types.h>
2 #include <linux/crash_dump.h>
4 #include <xen/interface/xen.h>
9 #ifdef CONFIG_PROC_VMCORE
11 * This function is used in two contexts:
12 * - the kdump kernel has to check whether a pfn of the crashed kernel
13 * was a ballooned page. vmcore is using this function to decide
14 * whether to access a pfn of the crashed kernel.
15 * - the kexec kernel has to check whether a pfn was ballooned by the
16 * previous kernel. If the pfn is ballooned, handle it properly.
17 * Returns 0 if the pfn is not backed by a RAM page, the caller may
18 * handle the pfn special in this case.
20 static int xen_oldmem_pfn_is_ram(unsigned long pfn
)
22 struct xen_hvm_get_mem_type a
= {
28 if (HYPERVISOR_hvm_op(HVMOP_get_mem_type
, &a
))
46 static void xen_hvm_exit_mmap(struct mm_struct
*mm
)
48 struct xen_hvm_pagetable_dying a
;
52 a
.gpa
= __pa(mm
->pgd
);
53 rc
= HYPERVISOR_hvm_op(HVMOP_pagetable_dying
, &a
);
57 static int is_pagetable_dying_supported(void)
59 struct xen_hvm_pagetable_dying a
;
64 rc
= HYPERVISOR_hvm_op(HVMOP_pagetable_dying
, &a
);
66 printk(KERN_DEBUG
"HVMOP_pagetable_dying not supported\n");
72 void __init
xen_hvm_init_mmu_ops(void)
74 if (is_pagetable_dying_supported())
75 pv_mmu_ops
.exit_mmap
= xen_hvm_exit_mmap
;
76 #ifdef CONFIG_PROC_VMCORE
77 register_oldmem_pfn_is_ram(&xen_oldmem_pfn_is_ram
);