From patchwork Thu Feb 22 11:17:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 129205 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp481403lja; Thu, 22 Feb 2018 03:19:12 -0800 (PST) X-Google-Smtp-Source: AH8x225XOgKmwaixlW/NljwTGqDvoI01TcAvaXoDPfg8tpVvCH3xhIwMRDvro9qPXAOlnVP4CIGj X-Received: by 10.98.87.68 with SMTP id l65mr6523399pfb.72.1519298352664; Thu, 22 Feb 2018 03:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519298352; cv=none; d=google.com; s=arc-20160816; b=oBh2ljUBajCdEIF4/ONAIjQM+G9+gxlQprN43cciJfUCUntkRL+tuYVAjVwWcLIgw7 6Hm8J3e7Zym61E1Buw/wiqWgodrHNJt4+s49CAJEIK0wpBMeXCYeXDCjFz6Wr8MiLHth ST+zydlO2k5Qg/vgubGl2zibB+d9bq/qCw45ACcWGyUTujfL4i7NATKCejZAt6TnMval pdWfO0h5KhDNiQ8PmCsIUK2rT+rjRbNkAr9MpoEEV/r5dXyukITFjN+mTw77HJ7T5+bF yJy9dCZx65MEGYGxWzh6tdyi7oOlJ2L2tN0aPMblpWX5S0N9rlWdBAx16bM+ZgLhX9Gd vwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=hBCJG4EDW23Kq3k1dQBmwbwyd2oPgAlLdwNxaE9ZwLs=; b=OCpC5ljDnSxoX++SmGtCdOvHM55hQjLiAfergBmmMPmG31In/i7NHHPBfeHFlzFsg9 O6VbB/V5iLpBKhMkGWH8BHjLiJ5Os/NYYPNHTTapGiJ1FvenioEJMsswBHwjGkahfDXZ RHm6df248RCzeo4ZBUnv7VGuHnNg2AS9QJWxBKlvSsIKfk0d2V3ODF0kIDKS+ECQ6Ro+ 80FzsfC3BtuGx3dTQoE7sl+ynEuKVqFBgZqcqqlBWX0Zsshh/7kcn4IUw3VaVpd/kI4v Ye4AlaaML0hJg9hd+oN2fZxvK3xIszcxuWbZwS2T0X+DQ0CIcNME8GulvYIve6pCppbm +Izw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gWoHB67g; 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 34-v6si950366plc.368.2018.02.22.03.19.12; Thu, 22 Feb 2018 03:19:12 -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=gWoHB67g; 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 S932078AbeBVLTH (ORCPT + 28 others); Thu, 22 Feb 2018 06:19:07 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44849 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753746AbeBVLTD (ORCPT ); Thu, 22 Feb 2018 06:19:03 -0500 Received: by mail-pf0-f193.google.com with SMTP id 17so1943341pfw.11 for ; Thu, 22 Feb 2018 03:19:03 -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=hBCJG4EDW23Kq3k1dQBmwbwyd2oPgAlLdwNxaE9ZwLs=; b=gWoHB67g1SU0tLXdMmIfiQAcGH0NP9/ZyP4y3JCGgtK1a5LZbLE/jan3ph/+Y/69tO MAlyf6wUCY6wlrAhNcHwHhWYSXmRshBxc4ROoqz/er95toCmBzfZPAQlif4vvwxbCuQ0 aSwV8xj8LC82ODKxLxZuQvIsRMmBoHqKu7k9c= 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=hBCJG4EDW23Kq3k1dQBmwbwyd2oPgAlLdwNxaE9ZwLs=; b=fb7fYc1NgL6XUq55FTXuXjSYRQl2ppWwKAa4uVKQzo+6ffpv9B6ubRuAw2XLdUGLuK Bs9+42op2KKgrpJXspsrAzC4CV+E9H+20wCd6YugrmubH2o2ems5jj1kEdE+m4rbUuqe ygwXqsPc6vrNRfZixkAW9Kr9rYZg1jyb+klSPmlFdxlwhgD9N28WQYYcgcPu72WJ7ec+ Zy2R1Je+Cwm69x/f91vzFsdfebRX0tGQ541t/nXwcAgVbD8Z1bbz5hmQWrbVDiord4Xz 1G7rMOBnEfnxeB/KEmErvantioBLBNK0/uTuegGHMBBXEYr7orW05fgJjUuxF1WfvKbD 4Ltw== X-Gm-Message-State: APf1xPCCu9hUsB5q+aJQP6en8mu0oc40M0cQY9vokjJGJBdXegRHIkF7 OaHo/w/qbyE2FNSGv00OFypsSQ== X-Received: by 10.98.63.147 with SMTP id z19mr6459784pfj.221.1519298343128; Thu, 22 Feb 2018 03:19:03 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id g67sm2473581pgc.60.2018.02.22.03.19.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 03:19:02 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, bauerman@linux.vnet.ibm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, mpe@ellerman.id.au, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, julien.thierry@arm.com Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v8 02/13] kexec_file: make an use of purgatory optional Date: Thu, 22 Feb 2018 20:17:21 +0900 Message-Id: <20180222111732.23051-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180222111732.23051-1-takahiro.akashi@linaro.org> References: <20180222111732.23051-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On arm64, no trampline code between old kernel and new kernel will be required in kexec_file implementation. This patch introduces a new configuration, ARCH_HAS_KEXEC_PURGATORY, and allows related code to be compiled in only if necessary. Signed-off-by: AKASHI Takahiro Cc: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- arch/powerpc/Kconfig | 3 +++ arch/x86/Kconfig | 3 +++ kernel/kexec_file.c | 6 ++++++ 3 files changed, 12 insertions(+) -- 2.16.2 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 73ce5dd07642..c32a181a7cbb 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -552,6 +552,9 @@ config KEXEC_FILE for kernel and initramfs as opposed to a list of segments as is the case for the older kexec call. +config ARCH_HAS_KEXEC_PURGATORY + def_bool KEXEC_FILE + config RELOCATABLE bool "Build a relocatable kernel" depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE)) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c1236b187824..f031c3efe47e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2019,6 +2019,9 @@ config KEXEC_FILE for kernel and initramfs as opposed to list of segments as accepted by previous system call. +config ARCH_HAS_KEXEC_PURGATORY + def_bool KEXEC_FILE + config KEXEC_VERIFY_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index e5bcd94c1efb..990adae52151 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -26,7 +26,11 @@ #include #include "kexec_internal.h" +#ifdef CONFIG_ARCH_HAS_KEXEC_PURGATORY static int kexec_calculate_store_digests(struct kimage *image); +#else +static int kexec_calculate_store_digests(struct kimage *image) { return 0; }; +#endif /* Architectures can provide this probe function */ int __weak arch_kexec_kernel_image_probe(struct kimage *image, void *buf, @@ -520,6 +524,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf) return 0; } +#ifdef CONFIG_ARCH_HAS_KEXEC_PURGATORY /* Calculate and store the digest of segments */ static int kexec_calculate_store_digests(struct kimage *image) { @@ -1022,3 +1027,4 @@ int kexec_purgatory_get_set_symbol(struct kimage *image, const char *name, return 0; } +#endif /* CONFIG_ARCH_HAS_KEXEC_PURGATORY */