From patchwork Thu Feb 25 03:02:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 8417331 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 449B4C0553 for ; Thu, 25 Feb 2016 03:01:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97B87201EF for ; Thu, 25 Feb 2016 03:01:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E529B20115 for ; Thu, 25 Feb 2016 03:01:45 +0000 (UTC) Received: from localhost ([::1]:39704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYmBV-0008Gr-3Q for patchwork-qemu-devel@patchwork.kernel.org; Wed, 24 Feb 2016 22:01:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYmBD-00081X-GL for qemu-devel@nongnu.org; Wed, 24 Feb 2016 22:01:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYmB9-0006Nj-KP for qemu-devel@nongnu.org; Wed, 24 Feb 2016 22:01:27 -0500 Received: from ozlabs.org ([103.22.144.67]:55376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYmB9-0006NK-3a; Wed, 24 Feb 2016 22:01:23 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 08539140C46; Thu, 25 Feb 2016 14:01:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1456369278; bh=C9uYLugfMW5GJ/+AugNhSrQUkvLEM60TB9wkBNtcLM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNr1t29yxfRQ71SGRGxQoLF3tQHpYToIZRC+OPOBKIBi3+mndk3youUDgSZuFo2iQ 2dLLAxULOM3kmW7yWik53LRwZ3f/WMpDsRzN5y/5cgpwnqP89TUzOjG5JLGzW/pWqe BqsVILbjmFJ2pZc8s+/JvtX/xobZd6XEoRwC2vfo= From: David Gibson To: peter.maydell@linaro.org, agraf@suse.de Date: Thu, 25 Feb 2016 14:02:09 +1100 Message-Id: <1456369330-7294-5-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456369330-7294-1-git-send-email-david@gibson.dropbear.id.au> References: <1456369330-7294-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Cc: Thomas Huth , aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PULL 4/5] ppc/kvm: Use error_report() instead of cpu_abort() for user-triggerable errors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 From: Thomas Huth Setting the KVM_CAP_PPC_PAPR capability can fail if either the KVM kernel module does not support it, or if the specified vCPU type is not a 64-bit Book3-S CPU type. For example, the user can trigger it easily with "-M pseries -cpu G2leLS" when using the kvm-pr kernel module. So the error should not be reported with cpu_abort() since this function is rather meant for reporting programming errors than reporting user-triggerable errors (it prints out all CPU registers and then calls abort() to kills the program - two things that the normal user does not expect here) . So let's use error_report() with exit(1) here instead. A similar problem exists in the code that sets the KVM_CAP_PPC_EPR capability, so while we're at it, fix that, too. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- target-ppc/kvm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 70ca296..762d6cf 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -23,6 +23,7 @@ #include #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" @@ -1993,7 +1994,8 @@ void kvmppc_set_papr(PowerPCCPU *cpu) ret = kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_PAPR, 0); if (ret) { - cpu_abort(cs, "This KVM version does not support PAPR\n"); + error_report("This vCPU type or KVM version does not support PAPR"); + exit(1); } /* Update the capability flag so we sync the right information @@ -2013,7 +2015,8 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) ret = kvm_vcpu_enable_cap(cs, KVM_CAP_PPC_EPR, 0, mpic_proxy); if (ret && mpic_proxy) { - cpu_abort(cs, "This KVM version does not support EPR\n"); + error_report("This KVM version does not support EPR"); + exit(1); } }