From patchwork Thu Feb 18 21:01:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 8354671 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 98EDF9F38B for ; Thu, 18 Feb 2016 21:02:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09274203A0 for ; Thu, 18 Feb 2016 21:02:06 +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 6D37920306 for ; Thu, 18 Feb 2016 21:02:00 +0000 (UTC) Received: from localhost ([::1]:45532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWVi3-0007W1-Ij for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Feb 2016 16:01:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWVhs-0007VH-7h for qemu-devel@nongnu.org; Thu, 18 Feb 2016 16:01:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWVhm-0002JA-IU for qemu-devel@nongnu.org; Thu, 18 Feb 2016 16:01:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWVhm-0002IL-CR; Thu, 18 Feb 2016 16:01:42 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 404E08E234; Thu, 18 Feb 2016 21:01:41 +0000 (UTC) Received: from thh440s.fritz.box (vpn1-5-205.ams2.redhat.com [10.36.5.205]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1IL1cSh019122; Thu, 18 Feb 2016 16:01:39 -0500 From: Thomas Huth To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Thu, 18 Feb 2016 22:01:38 +0100 Message-Id: <1455829298-15331-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, agraf@suse.de Subject: [Qemu-devel] [PATCH] 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 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 --- 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); } }