Resolves: bz1097904
https://bugzilla.redhat.com/show_bug.cgi?id=1097904

This is back ported from upstream.

commit 23df79da8eb97757e39af7625665c1c5cecc610b
Author: Jan Willeke <[email protected]>
Date:   Wed Sep 11 14:24:52 2013 -0700

    s390/vmcore: implement remap_oldmem_pfn_range for s390

    Introduce the s390 specific way to map pages from oldmem.  The memory area
    below OLDMEM_SIZE is mapped with offset OLDMEM_BASE.  The other old memory
    is mapped directly.

    Signed-off-by: Jan Willeke <[email protected]>
    Signed-off-by: Michael Holzheu <[email protected]>
    Cc: HATAYAMA Daisuke <[email protected]>
    Cc: Vivek Goyal <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>

Signed-off-by: Baoquan He <[email protected]>
---
 arch/s390/kernel/crash_dump.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 0f70217..1f38051 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -127,6 +127,32 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 }
 
 /*
+ * Remap "oldmem"
+ *
+ * For the kdump reserved memory this functions performs a swap operation:
+ * [0 - OLDMEM_SIZE] is mapped to [OLDMEM_BASE - OLDMEM_BASE + OLDMEM_SIZE]
+ */
+int remap_oldmem_pfn_range(struct vm_area_struct *vma, unsigned long from,
+                          unsigned long pfn, unsigned long size, pgprot_t prot)
+{
+       unsigned long size_old;
+       int rc;
+
+       if (pfn < OLDMEM_SIZE >> PAGE_SHIFT) {
+               size_old = min(size, OLDMEM_SIZE - (pfn << PAGE_SHIFT));
+               rc = remap_pfn_range(vma, from,
+                                    pfn + (OLDMEM_BASE >> PAGE_SHIFT),
+                                    size_old, prot);
+               if (rc || size == size_old)
+                       return rc;
+               size -= size_old;
+               from += size_old;
+               pfn += size_old >> PAGE_SHIFT;
+       }
+       return remap_pfn_range(vma, from, pfn, size, prot);
+}
+
+/*
  * Copy memory from old kernel
  */
 static int copy_from_oldmem(void *dest, void *src, size_t count)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to