From patchwork Wed Feb 1 12:46:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 9549627 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 B43E760415 for ; Wed, 1 Feb 2017 12:46:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F2642041F for ; Wed, 1 Feb 2017 12:46:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93CAA27E3E; Wed, 1 Feb 2017 12:46:31 +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 2BA582041F for ; Wed, 1 Feb 2017 12:46:31 +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 1cYuIw-0003CL-AT; Wed, 01 Feb 2017 12:46:30 +0000 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cYuIX-0002V7-3x for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2017 12:46:11 +0000 Received: by mail-pf0-x22d.google.com with SMTP id e4so117965705pfg.1 for ; Wed, 01 Feb 2017 04:45:44 -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=XHVsXrKL2Eq0fW1dx11UQXAdia1vK96e5SEubHfwovI=; b=d7Mtt0jTDL8JVyYbPG73+TfwhFJX9kwwctNCcMXZZmgcvGZd4px/LRLdSd2kFSjKr7 IpNISveFx4uiALaG8GacDY4lpTVKghyvacUBJcJRK3IgYaGjra+ZD8l709Hv9oDX5Hij +ZGPiLHLuYVKNKPYGnXo+96QnygBAT1DW00Ro= 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=XHVsXrKL2Eq0fW1dx11UQXAdia1vK96e5SEubHfwovI=; b=URNz+m7yW5l8Ssd+/t3oOFE123KSZP3ZrfCTo8zjSCxcYSgaaUXR3ltRoMILw6/0oU Lwus3TERyhuIav9PFTv1GZe3GvtEVcOwxTgH2tGnU/TLN8kPxPRnQwGbdZkSNNZftlZV Hl1CCJy5TOaadPJgg4dh8IZbgMDItr7UvcGqDhimrtJIavyTjWliN+mAz3929tgt2mYq dawozqPgY9NLdTkLx29C/u9Uwn6PhoxIjk1QAZ8Zm+sdTSZcRD/UpVmzOhW12+c3mPGA LAEX2oD0+J3rrPCwRYYpJUo7q4uOxMZOBSGYbgzjtyfo1oyd6kQMz8mgFOq4w0F82FX1 /yoA== X-Gm-Message-State: AIkVDXLYVCHXe0gLJYvZJ3Iwrqll2/8g9NwDt2yPglhGCKHSaAa3gZPYGzuIwpEnmhT/yxDI X-Received: by 10.84.143.195 with SMTP id 61mr4262872plz.46.1485953144292; Wed, 01 Feb 2017 04:45:44 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id c11sm49471466pfe.68.2017.02.01.04.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 04:45:43 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH v31 06/12] arm64: hibernate: preserve kdump image around hibernation Date: Wed, 1 Feb 2017 21:46:25 +0900 Message-Id: <20170201124630.6016-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170201124218.5823-1-takahiro.akashi@linaro.org> References: <20170201124218.5823-1-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170201_044605_516473_76077CA9 X-CRM114-Status: GOOD ( 11.06 ) 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 --- 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