1 // SPDX-License-Identifier: GPL-2.0
3 * Memory preserving reboot related code.
5 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
6 * Copyright (C) IBM Corporation, 2004. All rights reserved
9 #include <linux/slab.h>
10 #include <linux/errno.h>
11 #include <linux/highmem.h>
12 #include <linux/crash_dump.h>
13 #include <linux/uio.h>
15 static inline bool is_crashed_pfn_valid(unsigned long pfn)
17 #ifndef CONFIG_X86_PAE
19 * non-PAE kdump kernel executed from a PAE one will crop high pte
20 * bits and poke unwanted space counting again from address 0, we
21 * don't want that. pte must fit into unsigned long. In fact the
22 * test checks high 12 bits for being zero (pfn will be shifted left
25 return pte_pfn(pfn_pte(pfn, __pgprot(0))) == pfn;
31 ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, size_t csize,
39 if (!is_crashed_pfn_valid(pfn))
42 vaddr = kmap_local_pfn(pfn);
43 csize = copy_to_iter(vaddr + offset, csize, iter);