From patchwork Sat Jul 11 03:55:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 11657661 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C29613B1 for ; Sat, 11 Jul 2020 04:01:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74CB42075F for ; Sat, 11 Jul 2020 04:01:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WVAFkfsS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=dabbelt-com.20150623.gappssmtp.com header.i=@dabbelt-com.20150623.gappssmtp.com header.b="Dzt/iMd0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74CB42075F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=96T74Dl/nfpz1SFOctNgylfj4H8B1FwARe0TiAGmkyI=; b=WVAFkfsSMssK7pU55uuJVstEk 08TnBFQVpwO8UatRJ88BIuzADzr0q/+/c3PtC8kqSFx79/mCpKoC7wz0VjJ/DRL8ocSKav4EKDv7+ rlp6D7Bf2QDLmGUKkGHhPmoMM8XIYk013hL73ogw3ezl5tREENKtqCEN4zJBskTrbW9UbfRinfEXX LudyEoUPDgOQ2keo0Diw3Mj63BqSYtqeityiSVytHDKlgC+8DF7nD0+TWWUreLzuAU2c0HC9zxt4T +COU9hEO+KALkGkhGQIxsOnkklAvAtSvCmdVaiZj85yAlqRsboErAzXtqTer/8aCwPIR9kEqQueMi AjQxf/swg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ju6fm-0001b2-Pz; Sat, 11 Jul 2020 03:59:34 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ju6fb-0001Um-KA for linux-arm-kernel@lists.infradead.org; Sat, 11 Jul 2020 03:59:28 +0000 Received: by mail-pj1-x1044.google.com with SMTP id b92so3432637pjc.4 for ; Fri, 10 Jul 2020 20:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=wantLvKFQ7sTWJpeW6b72Xahd71W/Sz84V8SEQBvlmI=; b=Dzt/iMd0Hum1aoS+SHRvQmVGrLKShehT79ai0Ryv1Ow+zSH+jbU0jjwYtZpVk67aiV 1HiQkGeRmLeAWouzpK1njvMU2hi9+aOIhncWTl6oQ+CiXqBFME3Tc+7U9VAWwS72ayBO i4/YP6ES0V92NTI30DjTMpG9aSkH+3JhVVkmxvDnnaNIIPtpvjyArJAnu4W+RkJ4veM8 PIn/5mchWUuc/cp8woLUw2vYx4IlJ21mUQrd3f74UNhii/G8w9nQ90zOGCgF8ZZJLRaW 116tQlsVrG9tfuLFIQGA+Kt9aGH+2nCXkDBm44G01dcOxh5CZ4GyVHQ6fAxIVPBEg+qo Icug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=wantLvKFQ7sTWJpeW6b72Xahd71W/Sz84V8SEQBvlmI=; b=bcqMFjXDA1g92cd4r+gbOCrgi1ElTzeEPGGIipxMGek/1GwaTevfdxgkvNCXVgxEsp vm9czKaCq8OQh2XmVkLLY+FL13STUr9oo/ltZ0YQ0LmT41tHmMIHEZDmnUjxcdqPB8F5 5hf1WWuQS8cOw0rlnaQlr7fa2edQYLGbGWG/+Dg0UcqH0OKNKUm6lPymptdJa7A58vLu /9IKQzP9harCV8lTLGVXCRF4iRXbT596yKmpkG5+cOsXxaiMpfaJGz6hYgFnDfTJWDUk HMj3wt3qrIzPQoRwKpY/dBuD06uW0fF9Iv+Xuzwnj+F9x6axzUx/XlXUCagpoWTWJ34M JlXA== X-Gm-Message-State: AOAM530AFgD8ZRcRXa8gTA0Tn1laFSpddhU0IGjDB2ZNFFZhF3f5qU/l B4fI2XsKu/mVmfuUjmoar7gN+Q== X-Google-Smtp-Source: ABdhPJx/QGm0euUPP1vS4ZGSr12gxaH7Z/02J8eMRGjwMOHJlhMMz4ZQIbxP9ubJpQt+MkD/3WtArg== X-Received: by 2002:a17:902:bb96:: with SMTP id m22mr5383732pls.6.1594439961667; Fri, 10 Jul 2020 20:59:21 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id q24sm7718285pfg.34.2020.07.10.20.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 20:59:21 -0700 (PDT) Subject: [PATCH 2/3] arm: Use the new generic copy_oldmem_page() Date: Fri, 10 Jul 2020 20:55:43 -0700 Message-Id: <20200711035544.2832154-3-palmer@dabbelt.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog In-Reply-To: <20200711035544.2832154-1-palmer@dabbelt.com> References: <20200711035544.2832154-1-palmer@dabbelt.com> MIME-Version: 1.0 From: Palmer Dabbelt To: mick@ics.forth.gr X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_235923_738333_7E748135 X-CRM114-Status: GOOD ( 19.85 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, gregory.0xf0@gmail.com, peterz@infradead.org, catalin.marinas@arm.com, linus.walleij@linaro.org, Palmer Dabbelt , brendanhiggins@google.com, elver@google.com, glider@google.com, krzk@kernel.org, mchehab+samsung@kernel.org, will@kernel.org, mingo@kernel.org, uwe@kleine-koenig.org, takahiro.akashi@linaro.org, paulmck@kernel.org, masahiroy@kernel.org, linux@armlinux.org.uk, willy@infradead.org, rppt@linux.ibm.com, bgolaszewski@baylibre.com, kernel-team@android.com, pmladek@suse.com, zaslonko@linux.ibm.com, keescook@chromium.org, Arnd Bergmann , broonie@kernel.org, matti.vaittinen@fi.rohmeurope.com, ben-linux@fluff.org, dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org, davidgow@google.com, rdunlap@infradead.org, Nick Desaulniers , linux-kernel@vger.kernel.org, mhiramat@kernel.org, ardb@kernel.org, akpm@linux-foundation.org, davem@davemloft.net Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Palmer Dabbelt This is exactly the same as the arm64 code, which I just into lib/ to avoid copying it into the RISC-V port. This builds with defconfig and with CRASH_DUMP=y. Signed-off-by: Palmer Dabbelt Reviewed-by: Linus Walleij --- arch/arm/Kconfig | 1 + arch/arm/kernel/Makefile | 1 - arch/arm/kernel/crash_dump.c | 54 ------------------------------------ 3 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 arch/arm/kernel/crash_dump.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 2ac74904a3ce..dfbeb14e9673 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1933,6 +1933,7 @@ config ATAGS_PROC config CRASH_DUMP bool "Build kdump crash kernel (EXPERIMENTAL)" + select GENERIC_LIB_COPY_OLDMEM_PAGE help Generate crash dump after being started by kexec. This should be normally only set in special crash dump kernels which are diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 89e5d864e923..b5310a90dfe4 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -65,7 +65,6 @@ obj-$(CONFIG_KGDB) += kgdb.o patch.o obj-$(CONFIG_ARM_UNWIND) += unwind.o obj-$(CONFIG_HAVE_TCM) += tcm.o obj-$(CONFIG_OF) += devtree.o -obj-$(CONFIG_CRASH_DUMP) += crash_dump.o obj-$(CONFIG_SWP_EMULATE) += swp_emulate.o CFLAGS_swp_emulate.o := -Wa,-march=armv7-a obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c deleted file mode 100644 index 53cb92435392..000000000000 --- a/arch/arm/kernel/crash_dump.c +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * arch/arm/kernel/crash_dump.c - * - * Copyright (C) 2010 Nokia Corporation. - * Author: Mika Westerberg - * - * This code is taken from arch/x86/kernel/crash_dump_64.c - * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) - * Copyright (C) IBM Corporation, 2004. All rights reserved - */ - -#include -#include -#include -#include - -/** - * copy_oldmem_page() - copy one page from old kernel memory - * @pfn: page frame number to be copied - * @buf: buffer where the copied page is placed - * @csize: number of bytes to copy - * @offset: offset in bytes into the page - * @userbuf: if set, @buf is int he user address space - * - * This function copies one page from old kernel memory into buffer pointed by - * @buf. If @buf is in userspace, set @userbuf to %1. Returns number of bytes - * copied or negative error in case of failure. - */ -ssize_t copy_oldmem_page(unsigned long pfn, char *buf, - size_t csize, unsigned long offset, - int userbuf) -{ - void *vaddr; - - if (!csize) - return 0; - - vaddr = ioremap(__pfn_to_phys(pfn), PAGE_SIZE); - if (!vaddr) - return -ENOMEM; - - if (userbuf) { - if (copy_to_user(buf, vaddr + offset, csize)) { - iounmap(vaddr); - return -EFAULT; - } - } else { - memcpy(buf, vaddr + offset, csize); - } - - iounmap(vaddr); - return csize; -}