From nobody Sat Feb 7 09:29:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150162383257677.02392088339582; Tue, 1 Aug 2017 14:43:52 -0700 (PDT) Received: from localhost ([::1]:44583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcexD-00061P-4g for importer@patchew.org; Tue, 01 Aug 2017 17:43:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcerR-00019x-Ro for qemu-devel@nongnu.org; Tue, 01 Aug 2017 17:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcerQ-0004mF-Vl for qemu-devel@nongnu.org; Tue, 01 Aug 2017 17:37:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcerQ-0004lr-ML for qemu-devel@nongnu.org; Tue, 01 Aug 2017 17:37:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87A1AC07643C; Tue, 1 Aug 2017 21:37:51 +0000 (UTC) Received: from redhat.com (dhcp-17-221.bos.redhat.com [10.18.17.221]) by smtp.corp.redhat.com (Postfix) with SMTP id BCA2663772; Tue, 1 Aug 2017 21:37:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 87A1AC07643C Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mst@redhat.com Date: Wed, 2 Aug 2017 00:37:47 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1501623438-31419-7-git-send-email-mst@redhat.com> References: <1501623438-31419-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1501623438-31419-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 01 Aug 2017 21:37:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/10] accel: cleanup error output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Yang Zhong , Peter Xu , Anand J , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Only emit "XXX accelerator not found", if there are not further accelerators listed. eg accel=3Dkvm:tcg doesn't print a "KVM accelerator not found" warning when it falls back to tcg, but a accel=3Dkvm prints a warning, since no fallback is given. Suggested-by: Daniel P. Berrange Suggested-by: Paolo Bonzini Signed-off-by: Laurent Vivier Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Eric Blake Tested-by: Thomas Huth --- accel/accel.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index fa85844..8ae40e1 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -33,6 +33,7 @@ #include "sysemu/qtest.h" #include "hw/xen/xen.h" #include "qom/object.h" +#include "qemu/error-report.h" =20 static const TypeInfo accel_type =3D { .name =3D TYPE_ACCEL, @@ -69,19 +70,20 @@ static int accel_init_machine(AccelClass *acc, MachineS= tate *ms) =20 void configure_accelerator(MachineState *ms) { - const char *p; + const char *accel, *p; char buf[10]; int ret; bool accel_initialised =3D false; bool init_failed =3D false; AccelClass *acc =3D NULL; =20 - p =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (p =3D=3D NULL) { + accel =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); + if (accel =3D=3D NULL) { /* Use the default "accelerator", tcg */ - p =3D "tcg"; + accel =3D "tcg"; } =20 + p =3D accel; while (!accel_initialised && *p !=3D '\0') { if (*p =3D=3D ':') { p++; @@ -89,7 +91,6 @@ void configure_accelerator(MachineState *ms) p =3D get_opt_name(buf, sizeof(buf), p, ':'); acc =3D accel_find(buf); if (!acc) { - fprintf(stderr, "\"%s\" accelerator not found.\n", buf); continue; } if (acc->available && !acc->available()) { @@ -100,9 +101,8 @@ void configure_accelerator(MachineState *ms) ret =3D accel_init_machine(acc, ms); if (ret < 0) { init_failed =3D true; - fprintf(stderr, "failed to initialize %s: %s\n", - acc->name, - strerror(-ret)); + error_report("failed to initialize %s: %s", + acc->name, strerror(-ret)); } else { accel_initialised =3D true; } @@ -110,13 +110,13 @@ void configure_accelerator(MachineState *ms) =20 if (!accel_initialised) { if (!init_failed) { - fprintf(stderr, "No accelerator found!\n"); + error_report("-machine accel=3D%s: No accelerator found", acce= l); } exit(1); } =20 if (init_failed) { - fprintf(stderr, "Back to %s accelerator.\n", acc->name); + error_report("Back to %s accelerator", acc->name); } } =20 --=20 MST