From patchwork Fri Nov 14 01:22:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 5302301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 416CA9F2ED for ; Fri, 14 Nov 2014 01:25:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75347201ED for ; Fri, 14 Nov 2014 01:25:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5DB6201C8 for ; Fri, 14 Nov 2014 01:25:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xp5bq-0003wv-9G; Fri, 14 Nov 2014 01:23:34 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xp5ac-0003Dh-S1; Fri, 14 Nov 2014 01:22:18 +0000 Received: from geoff by merlin.infradead.org with local (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xp5aa-0006yo-DO; Fri, 14 Nov 2014 01:22:16 +0000 Message-Id: In-Reply-To: References: From: Geoff Levand Patch-Date: Thu, 13 Nov 2014 16:52:16 -0800 Subject: [PATCH 7/8] arm64/kexec: Add checks for KVM and EFI To: Catalin Marinas , Will Deacon Date: Fri, 14 Nov 2014 01:22:16 +0000 Cc: marc.zyngier@arm.com, Grant Likely , kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add runtime checks that fail the arm64 kexec syscall for situations that would result in system instability do to problems in the KVM and EFI kernel support. These checks should be removed when the KVM and EFI problems are fixed. Signed-off-by: Geoff Levand --- arch/arm64/kernel/machine_kexec.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 775bcc3..5b62bd1f 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -16,6 +16,12 @@ #include #include +/* TODO: Remove this include when KVM can support a kexc reboot. */ +#include + +/* TODO: Remove this include when EFI can support a kexc reboot. */ +#include + /* Global variables for the relocate_kernel routine. */ extern const unsigned char relocate_new_kernel[]; extern const unsigned long relocate_new_kernel_size; @@ -101,6 +107,22 @@ int machine_kexec_prepare(struct kimage *image) kexec_image_info(image); + /* TODO: Remove this message when KVM can support a kexc reboot. */ + if (IS_ENABLED(CONFIG_KVM) && is_hyp_mode_available()) { + pr_err("%s: Your kernel is configued with KVM support " + "(CONFIG_KVM=y) which currently does not allow for " + "kexec re-boot.\n", __func__); + return -ENOSYS; + } + + /* TODO: Remove this message when EFI can support a kexc reboot. */ + if (efi_enabled(EFI_BOOT)) { + pr_err("%s: Your kernel is using the Extensible Firmware " + "Interface (EFI) which currently does not allow for " + "kexec re-boot.\n", __func__); + return -ENOSYS; + } + return 0; }