From patchwork Thu Jun 26 09:44:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 4426791 Return-Path: X-Original-To: patchwork-kvm@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 771F99F319 for ; Thu, 26 Jun 2014 09:44:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CDEA2039D for ; Thu, 26 Jun 2014 09:44:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C585C203A0 for ; Thu, 26 Jun 2014 09:44:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755965AbaFZJos (ORCPT ); Thu, 26 Jun 2014 05:44:48 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:45480 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbaFZJor (ORCPT ); Thu, 26 Jun 2014 05:44:47 -0400 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 69F4589005B57; Thu, 26 Jun 2014 10:44:42 +0100 (IST) Received: from KLMAIL02.kl.imgtec.org (10.40.10.222) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 26 Jun 2014 10:44:44 +0100 Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by klmail02.kl.imgtec.org (10.40.10.222) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 26 Jun 2014 10:44:44 +0100 Received: from jhogan-linux.le.imgtec.org (192.168.154.101) by LEMAIL01.le.imgtec.org (192.168.152.62) with Microsoft SMTP Server (TLS) id 14.3.174.1; Thu, 26 Jun 2014 10:44:43 +0100 From: James Hogan To: CC: , Aurelien Jarno , "Paolo Bonzini" , James Hogan Subject: [PATCH 4/4] mips_malta: Catch kernels linked at wrong address Date: Thu, 26 Jun 2014 10:44:25 +0100 Message-ID: <1403775865-25219-5-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403775865-25219-1-git-send-email-james.hogan@imgtec.com> References: <1403775865-25219-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.101] Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 error reporting if the wrong type of kernel is provided for the current mode of acceleration. Currently a KVM kernel linked at 0x40000000 can't be used with TCG, and a normal kernel linked at 0x80000000 can't be used with KVM. Signed-off-by: James Hogan Cc: Aurelien Jarno Cc: Paolo Bonzini Reviewed-by: Aurelien Jarno --- hw/mips/mips_malta.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 76cf5f2c48f4..95df42e6a4d5 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -792,9 +792,23 @@ static int64_t load_kernel (void) loaderparams.kernel_filename); exit(1); } + + /* Sanity check where the kernel has been linked */ if (kvm_enabled()) { + if (kernel_entry & 0x80000000ll) { + error_report("KVM guest kernels must be linked in useg. " + "Did you forget to enable CONFIG_KVM_GUEST?"); + exit(1); + } + xlate_to_kseg0 = cpu_mips_kvm_um_phys_to_kseg0; } else { + if (!(kernel_entry & 0x80000000ll)) { + error_report("KVM guest kernels aren't supported with TCG. " + "Did you unintentionally enable CONFIG_KVM_GUEST?"); + exit(1); + } + xlate_to_kseg0 = cpu_mips_phys_to_kseg0; }