From patchwork Fri Nov 14 18:28:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 5308851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87C65C11AC for ; Fri, 14 Nov 2014 18:31:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A29E7201ED for ; Fri, 14 Nov 2014 18:31:35 +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 C5E8E201E4 for ; Fri, 14 Nov 2014 18:31:34 +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 1XpLc6-0000zc-It; Fri, 14 Nov 2014 18:28:54 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpLc3-0000yw-El; Fri, 14 Nov 2014 18:28:51 +0000 Received: from 107-1-141-74-ip-static.hfc.comcastbusiness.net ([107.1.141.74] helo=[192.168.252.189]) by casper.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpLc0-0006kf-Ic; Fri, 14 Nov 2014 18:28:49 +0000 Message-ID: <1415989719.15847.121.camel@smoke> Subject: [PATCH v2 7/8] arm64/kexec: Add checks for KVM and EFI From: Geoff Levand To: Sergei Shtylyov Date: Fri, 14 Nov 2014 10:28:39 -0800 In-Reply-To: <546614D7.8080401@cogentembedded.com> References: <546614D7.8080401@cogentembedded.com> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Cc: marc.zyngier@arm.com, Catalin Marinas , Will Deacon , christoffer.dall@linaro.org, Grant Likely , kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 --- v2: Typo fixes. 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..faeb4f1 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 kexec reboot. */ +#include + +/* TODO: Remove this include when EFI can support a kexec 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 kexec reboot. */ + if (IS_ENABLED(CONFIG_KVM) && is_hyp_mode_available()) { + pr_err("%s: Your kernel is configured 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 kexec 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; }