From patchwork Tue Mar 6 10:22:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 130757 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3761766lja; Tue, 6 Mar 2018 02:23:11 -0800 (PST) X-Google-Smtp-Source: AG47ELsTxrsX5xe+M1efC/v2Oz6QHbmV8Souwwug/KlZKKJfdOknEc8z8yBRm1NIf1yIW2kYVgzj X-Received: by 10.98.247.9 with SMTP id h9mr18519459pfi.212.1520331791516; Tue, 06 Mar 2018 02:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520331791; cv=none; d=google.com; s=arc-20160816; b=tsYEjEFmtm0bilBoL4pI25KI1A3bIp39aBVZ8TMfdnYLI4wB8eMA+72Yvjnil+3T4G pRnK7kDuY3OimrHb+tioVUP1SUhuo/0qhAke+fkLIZsim6XsC+B8pv4QcGgE4pyrJcE4 g6ClU+tf0j1Kwxwn8h8qb2wSogcfZKhP4FYbzgA2Dl3QAF1TluY7gYTPXHQpfP/1ZPo1 QJy1K1mfzV+imG5+bJYQzqXQR3ikUo7GXUHYkPIiMuNiEV/3sBQ/jPrbkQtTC92/U4Qt w5Ygpw7NO1N0ZAjSUYs5TSBwJpEZU5Id4GZxKmOJA4QtRrSK42vEc/SDcGwcjrwQlSzk eLzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=UBZArFTSvzmVqa1ZUseBvTnaeF00LrT08rYwMJMrv40=; b=Nb+eyBZovqzHgqYLjBn6SHssncvJ8juoUfj32dZW8LDMmXH485+2jZpBpjMklPStIH rbRyGmMMhYH1JuLQZIDBKo52HYxql+aneItMTGx2mjUeGcl5ZMzPr/I6ID9vk1uuFLPn LiyiKJW2Lim7z4wEhjP3Vm8oQHSW/4Q4OrhPh/vuEjVOwXz/GUf0IdBtT483MNgxtP5i 12uiVB0P+Gt/zlOP7dT48u9UOByXxTQmn4MFvGh0M66qII5+41K4/wYcHPjGZDa7fLxZ vyWyItlcs78kw0OZWkeZm2+iVfstrAbPF/3Q8eRSFQ7fV+RovM50dZqjJzf8DEIufYZv 1j2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZCNyADVQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si9153319pgq.743.2018.03.06.02.23.11; Tue, 06 Mar 2018 02:23:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZCNyADVQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753304AbeCFKXG (ORCPT + 28 others); Tue, 6 Mar 2018 05:23:06 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:33762 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbeCFKXE (ORCPT ); Tue, 6 Mar 2018 05:23:04 -0500 Received: by mail-it0-f68.google.com with SMTP id w19so12241545ite.0 for ; Tue, 06 Mar 2018 02:23:04 -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; bh=UBZArFTSvzmVqa1ZUseBvTnaeF00LrT08rYwMJMrv40=; b=ZCNyADVQkn+bpHyzyLNb4RzJtxo7n6CrLFIyGtLGvtSZnPmE/w79UbZKDA2R1Mwcbr +JGtDY2PP8dr8Xs2Vfj/csOkcIu5+kBXOAChBr1/yjuPZbey1zy2nMooJq1GdwfvF2iV GhEz18Gm+7gn5D6OjZ8ZEFGKx5oXRl9u04nN0= 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; bh=UBZArFTSvzmVqa1ZUseBvTnaeF00LrT08rYwMJMrv40=; b=mA6Libshxs5z6APeFQPilnTNoVOceNiudo1rWvfyIcCy9jQidrQ2zRkpNwCfKxH4jI MMI3JKwKXqMKTPcf2KahdQzWPiwj4tVL2yWuQxnzrX9pnXgk3D0cDA5H4ti7C32by/Fm ksTorkenGVuKArSy4Sd84rJ4YYcvyLdFSk8BwddbOywrkfhzcWB8m2SdwyC7DXaYcykE c4WMtfdd4CGcxClhvFZO877KyzsCEGLLp+0Q4669N9X0tnTxdR/ynVc4bGlH4ss3OgKV Knc8q6toHgZJThJvOWn1BkqlvBxV296J2Xpk+clhDpVddvmWPLwl/NNKUNfcCrY6T8VG QeJQ== X-Gm-Message-State: AElRT7EltCat3+Is5tbmcWwgJTFfqhS6qgViedGmhbfUSlGz4+oANmjV d190JhtBgR82IEMdjYN7OkI69A== X-Received: by 10.36.253.7 with SMTP id m7mr18281558ith.32.1520331784077; Tue, 06 Mar 2018 02:23:04 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id n22sm9690449iob.62.2018.03.06.02.23.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 02:23:03 -0800 (PST) From: AKASHI Takahiro To: dyoung@redhat.com, vgoyal@redhat.com, bhe@redhat.com, mpe@ellerman.id.au, bauerman@linux.vnet.ibm.com, prudo@linux.vnet.ibm.com Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v2 0/7] kexec_file, x86, powerpc: refactoring for other architecutres Date: Tue, 6 Mar 2018 19:22:56 +0900 Message-Id: <20180306102303.9063-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a preparatory patch set for adding kexec_file support on arm64. It was originally included in a arm64 patch set[1], but Philipp is also working on their kexec_file support on s390[2] and some changes are now conflicting. So these common parts were extracted and put into a separate patch set for better integration. What's more, my original patch#4 was split into a few small chunks for easier review after Dave's comment. As such, the resulting code is basically identical with my original, and the only *visible* differences are: * renamings of _kexec_kernel_image_probe() and _kimage_file_post_load_cleanup() * change one of types of arguments at prepare_elf64_headers() Those, unfortunately, require a couple of trivial changes on the rest (#1, #6 to #13) of my arm64 kexec_file patch set[1]. Patch#1 allows making a use of purgatory optional, particularly useful for arm64. Patch#2 commonalizes arch_kexec_kernel_{image_probe, image_load, verify_sig}() and arch_kimage_file_post_load_cleanup() across architectures. Patch#3-#7 is also intended to generalize parse_elf64_headers(), along with exclude_mem_range(), to be made best re-use of. [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-February/561182.html [2] http://lkml.iu.edu//hypermail/linux/kernel/1802.1/02596.html Changes in v2 (Mar 6, 2018) * use IS_ENABLED() instead of #ifdef's in kexec_calculate_store_digests() * rename _kexec_kernel_*() and make them static for now except for kexec_image_probe_default() which is actually used by arch(powerpc) code (Note: kexec_image_post_load_cleanup_default() will also be exported by arm64 patches.) * change a type of kernel_map in prepare_elf64_headers() to "int" * check for a total number of system ram regions in full_up_crash_elf_data() and use vzalloc() instead of vmalloc() AKASHI Takahiro (7): kexec_file: make an use of purgatory optional kexec_file,x86,powerpc: factor out kexec_file_ops functions x86: kexec_file: purge system-ram walking from prepare_elf64_headers() x86: kexec_file: remove X86_64 dependency from prepare_elf64_headers() x86: kexec_file: lift CRASH_MAX_RANGES limit on crash_mem buffer x86: kexec_file: clean up prepare_elf64_headers() kexec_file, x86: move re-factored code to generic side arch/powerpc/Kconfig | 3 + arch/powerpc/include/asm/kexec.h | 2 +- arch/powerpc/kernel/kexec_elf_64.c | 2 +- arch/powerpc/kernel/machine_kexec_file_64.c | 39 +--- arch/x86/Kconfig | 3 + arch/x86/include/asm/kexec-bzimage64.h | 2 +- arch/x86/kernel/crash.c | 334 ++++++---------------------- arch/x86/kernel/kexec-bzimage64.c | 2 +- arch/x86/kernel/machine_kexec_64.c | 45 +--- include/linux/kexec.h | 32 ++- kernel/kexec_file.c | 240 +++++++++++++++++++- 11 files changed, 338 insertions(+), 366 deletions(-) -- 2.16.2 Acked-by: Dave Young