From patchwork Tue Feb 7 08:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 9559351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E56D160216 for ; Tue, 7 Feb 2017 08:09:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D88E9204C2 for ; Tue, 7 Feb 2017 08:09:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB6F32819A; Tue, 7 Feb 2017 08:09:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 522A8204C2 for ; Tue, 7 Feb 2017 08:09:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cb0qK-0005UQ-Rc; Tue, 07 Feb 2017 08:09:40 +0000 Received: from mail-pg0-f51.google.com ([74.125.83.51]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cb0ps-0004bT-7D for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2017 08:09:20 +0000 Received: by mail-pg0-f51.google.com with SMTP id 194so36723615pgd.2 for ; Tue, 07 Feb 2017 00:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ntd90kS1Xdrph8XsWlwBaxh4vaiV/hn//e7D2DjJKPs=; b=NvJHWrfz7sNuH2wgQOvUptkrlC0ghfjs4mBcvg4SKoBYhY6qG6FJ4ked3sWZ6zsWss NcC4PoqsxdtYvXYKQU2y4vb+pMKGn+u4bVq31g0wnrt1U7T9LRetbuuw0tl7wOfiYLVO zVuDUPsE3EMNM/p+XayQe/KxwQnTAP/c8Sjkc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ntd90kS1Xdrph8XsWlwBaxh4vaiV/hn//e7D2DjJKPs=; b=bypIA/l9QD5cV9nk8ps2G/ocsKvw0ILaL7Tsc4+1lK5EbXqD0AL7O/r2hwnwPBo2y/ l2qhe7msIk9FB7969IDd4IYreYTLZqzVCI+4RB8rBctNWqFJVgGHNWT2UYQ2JkSsj4gS CizEARpxnE+jRKw9wicMmyR7ZiB3CilEeTQydDvUkIv5EL3UznHiaic+/UqHr21c3+SC TwDpwZTVSAIvd9lYFUEhUIIk87lM/3e/g1vIvXkdTQe+6vseGfd009Of1vLL1hCn6CZE Cwa/fPUMr1odQqTqQcYx91SxHZ5eLbAjAeGkZdXIalWyNf8+oxniPd81RTdeSFom9dfa SUNw== X-Gm-Message-State: AIkVDXKbnjLnIUgHZjRIMx9kJBQ4d+DcSvuD7+jeUDXx9+pTAP1Wo0G0M2xWHvVwTxZlL96V X-Received: by 10.84.224.70 with SMTP id a6mr8565059plt.28.1486454871527; Tue, 07 Feb 2017 00:07:51 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 18sm8562846pgf.28.2017.02.07.00.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2017 00:07:51 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH v32 07/13] arm64: hibernate: preserve kdump image around hibernation Date: Tue, 7 Feb 2017 17:08:59 +0900 Message-Id: <20170207080904.5974-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170207080601.5816-1-takahiro.akashi@linaro.org> References: <20170207080601.5816-1-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170207_000912_315552_5C5849FE X-CRM114-Status: GOOD ( 10.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, geoff@infradead.org, kexec@lists.infradead.org, AKASHI Takahiro , james.morse@arm.com, bauerman@linux.vnet.ibm.com, dyoung@redhat.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since arch_kexec_protect_crashkres() removes a mapping for crash dump kernel memory, the loaded contents won't be preserved around hibernation. In this patch, arch_kexec_(un)protect_crashkres() are additionally called before/after hibernation so that the relevant region will be mapped again and restored just as the other memory regions are. Signed-off-by: AKASHI Takahiro Reviewed-by: James Morse --- arch/arm64/kernel/hibernate.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index fe301cbcb442..111a849333ee 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -16,6 +16,7 @@ */ #define pr_fmt(x) "hibernate: " x #include +#include #include #include #include @@ -289,6 +290,12 @@ int swsusp_arch_suspend(void) local_dbg_save(flags); if (__cpu_suspend_enter(&state)) { +#ifdef CONFIG_KEXEC_CORE + /* make the crash dump kernel region mapped */ + if (kexec_crash_image) + arch_kexec_unprotect_crashkres(); +#endif + sleep_cpu = smp_processor_id(); ret = swsusp_save(); } else { @@ -300,6 +307,12 @@ int swsusp_arch_suspend(void) if (el2_reset_needed()) dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); +#ifdef CONFIG_KEXEC_CORE + /* make the crash dump kernel region unmapped */ + if (kexec_crash_image) + arch_kexec_protect_crashkres(); +#endif + /* * Tell the hibernation core that we've just restored * the memory