From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932083AbbGPIsu (ORCPT ); Thu, 16 Jul 2015 04:48:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52671 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753958AbbGPIss (ORCPT ); Thu, 16 Jul 2015 04:48:48 -0400 From: Baoquan He To: linux-kernel@vger.kernel.org, ncroxon@redhat.com, dyoung@redhat.com, mhuang@redhat.com Cc: Baoquan He Subject: [RHEL6.8 Patch 18/19] s390/vmcore: implement remap_oldmem_pfn_range for s390 Date: Thu, 16 Jul 2015 16:47:16 +0800 Message-Id: <1437036437-25408-22-git-send-email-bhe@redhat.com> In-Reply-To: <1437036437-25408-1-git-send-email-bhe@redhat.com> References: <1437036437-25408-1-git-send-email-bhe@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Resolves: bz1097904 https://bugzilla.redhat.com/show_bug.cgi?id=1097904 This is back ported from upstream. commit 23df79da8eb97757e39af7625665c1c5cecc610b Author: Jan Willeke 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 Signed-off-by: Michael Holzheu Cc: HATAYAMA Daisuke Cc: Vivek Goyal Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Baoquan He --- 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