From patchwork Sat Jul 11 03:55:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 11657663 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 057ED618 for ; Sat, 11 Jul 2020 04:01:17 +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 D38402075F 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="0A89Viy7"; 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="tQOPOFgt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D38402075F 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=9mNticA2oDkdgCo6QZTRdScyN+n8T6VocXLf9p5BOfs=; b=0A89Viy7qfiMBCSQw7L6THg9t 3mS/fhP9xXaVMqQSuYXZ5c/s9reF3Zujoz+yLlSw0j2l44G9WMNMPE3wqMjdCRUEJDk/qmkoxPdbS bMW3J9Qiay/pUxM68ErKmm36Jj4xpHIZLsBNJqd3AXdmIv3HCjG0qQferfpjHDA3CEpThKxLwtd7D Ze7UToe6jvSOCjTpbWl0MPWi+t06VOEpk3azeIdVs0+TEDn2F6zQvKq2ETlF+8s8xLNcGyOgxidqU typ26ZcyUnCzCtZSHyh0rv4TqwfqPwRJHAm1Sw+oMZd9XZJ5fVQ5hSHSnJ2xqyQBbyec20Ot7yaOt xenR1Gzhw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ju6fo-0001bK-JV; Sat, 11 Jul 2020 03:59:36 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ju6fd-0001XG-2O for linux-arm-kernel@lists.infradead.org; Sat, 11 Jul 2020 03:59:31 +0000 Received: by mail-pg1-x541.google.com with SMTP id l63so3375539pge.12 for ; Fri, 10 Jul 2020 20:59:24 -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=Wf2KClM6Tk5kmhkj4X2FnIK/p9JJMcXyJrf5eWEAU70=; b=tQOPOFgtewhe4q5nXYz43DV8Ob8tcit3pVPeQ5TjI8XCSGeWy0QqpfT1poT6OTp9qZ YjFz2pfaGqF7Im0Xa0etUyPumohyomrxVS6dAiZjGplSskgBqcJ0W4i3tH4EqmgTAuLI ray0SmDHhfL0JbGHQmiGEkARHu/0ZLfEjKmfczdYDEi+Tcg619FSyL6RkdvSs0W+Wimc egdq14P+9oRqZeBP0QFzd73I+cTpaCrwB0w8T86McEFZgKrVKr43mtk2lMzhnGnCOlot mGekL5N/WGkfxCgmTsZV1BlX/R4q2iZ1fZuZTMXA02bsAG5A6A+6o11l/VbpxUFuQpn8 OU5Q== 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=Wf2KClM6Tk5kmhkj4X2FnIK/p9JJMcXyJrf5eWEAU70=; b=BKmsJfIBVS167docqNOl8BGrVIeM9efZsHbAzolKOViqAeEWH+blu1n0zejpv52A4b uhM/2I8Uzi1oMg4Mjfm+J1toE/dB+5kXxzmqBSXyfEAKmikoDRhTb0pqYJ2emnXE5t1t TpAp4M0GRIu6vWI9FQo9n+LiVla3CSvhr/o28lkzj9Ferta0O1Qj/Ibs3MdbbQ4rd39u ccqfoSJusYr4UMrL0FHaStHbYnUHp02SdPJ+E0W/JX/y1eybpMuuOvLubx8rKlgKPQJA OW6LNojcCpJI1Thf+hZbUc6wPemkhk8Hgsr9L3YSYCDaSf1VU6ZAOrZ0fwdvWHQmvlhn ZWdQ== X-Gm-Message-State: AOAM531yXbleHTS5SnbdE/SzpbJPKqy4R35873gDxA2SmAcA2Nl4oFEM RgnC7h0nZjbZfUOvFXTG0qHYlw== X-Google-Smtp-Source: ABdhPJzMofsLQD9Z2uTdicmms83eUcQQbTxAg1eUW9k4rQlfm5rNXPzgR+F3lg7A+gscikb7UdwrtQ== X-Received: by 2002:aa7:9ec5:: with SMTP id r5mr17529907pfq.86.1594439963157; Fri, 10 Jul 2020 20:59:23 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id j17sm6811709pgn.87.2020.07.10.20.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 20:59:22 -0700 (PDT) Subject: [PATCH 3/3] arm64: Use the new generic copy_oldmem_page() Date: Fri, 10 Jul 2020 20:55:44 -0700 Message-Id: <20200711035544.2832154-4-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_235925_201456_265A18B1 X-CRM114-Status: GOOD ( 18.52 ) 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:541 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. Signed-off-by: Palmer Dabbelt Acked-by: Catalin Marinas --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/crash_dump.c | 39 ---------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 66dc41fd49f2..55b27d56b163 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1109,6 +1109,7 @@ comment "Support for PE file signature verification disabled" config CRASH_DUMP bool "Build kdump crash kernel" + 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/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c index e6e284265f19..197b92c249ba 100644 --- a/arch/arm64/kernel/crash_dump.c +++ b/arch/arm64/kernel/crash_dump.c @@ -13,45 +13,6 @@ #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 in a 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 = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB); - if (!vaddr) - return -ENOMEM; - - if (userbuf) { - if (copy_to_user((char __user *)buf, vaddr + offset, csize)) { - memunmap(vaddr); - return -EFAULT; - } - } else { - memcpy(buf, vaddr + offset, csize); - } - - memunmap(vaddr); - - return csize; -} - /** * elfcorehdr_read - read from ELF core header * @buf: buffer where the data is placed