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: 10235219 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 B0EE460224 for ; Thu, 22 Feb 2018 11:21:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B355028B95 for ; Thu, 22 Feb 2018 11:21:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A823728B9D; Thu, 22 Feb 2018 11:21:02 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 4D75D28B97 for ; Thu, 22 Feb 2018 11:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=AgYP/X/hRDsbDHHnC0oftGX6lui6K/pNSVCQHObEOTc=; b=nLbnpQBEuA9AqRQerIWvRn7mZX 5NwPFRk/n9E4nnhh9Yp7wIYKIIHcMFJJVA2UJAKHKKNjE8rciK3C7b3Z8Nav0k76PDGevrviIQNLA MV2IQAXym0q8iB0CXdVyKDTC99Lbn1bom0bC16qsQaooNc0CchhDQPWQ3QCbOnD/CgepiWTEYCn9c 8PiN4PtwSNRvlAQ6oGNLOwUdNbxqZdqTqXp5u26W07iHuRiECCa4X/F6d0o0bTJilY92BVgkIMn+u CdRogORtYJ+7Z/OlNLoceoGKq3iusi63zk4WPgLQD6vpRGZ1krwNDixr3chcQE8EVX+NvfijJyA/9 mv71VKGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eoovf-0004V8-7R; Thu, 22 Feb 2018 11:20:47 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eoouA-0002UI-Db for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2018 11:19:23 +0000 Received: by mail-pf0-x244.google.com with SMTP id c143so1952711pfb.6 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=r042P1RDT5e5tTLRwevy560043gLT8d/WGJRDUDdw8zaQW/rjhsQWcnfl/5rT3TQV/ x/kzJn+zG995Ow5zKb9TvgpgBqxhgsrIw6srRvoHQL0JmcVlH6Wlkyp8NPaciBIocT0R eWLK+RzR2qAQPGzTqpXH8uo3LjTdveaVjz2x/J650p0cOJe8bCswwq00mODjfXCu+xoR t+ddGxlJhttohkAiEs755gMXo14s59wuljqJB2QLEc34tytGuvgUsBmkydl/Jhm3FDpp Vf0Wvva+KoVBjzU3W/T/GEpjYFhB8coFq7y1GZUbMwX/dO/JOcdkp+izesB/XJYnZBLo 2CSw== X-Gm-Message-State: APf1xPDVFA8tSYnrBzhie0CweoxA39qtz2omRmjE1Vvy5zuiDfP39dUB 1rEPJJSnrmbgwVqW6zeew1jnVg== X-Google-Smtp-Source: AH8x227aXT63o6J5JQ0qHH7Rf9XtPXrrXcn9glvHwWov2RE3jKUKLtOij9VY9rde5y9oUaf0glslPg== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180222_031914_547585_E2108803 X-CRM114-Status: GOOD ( 12.71 ) 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: AKASHI Takahiro , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, 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 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(+) 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 */