From patchwork Tue Aug 1 16:17:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 796321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Znev7Cjx"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xMM4s3szkz9tWR for ; Wed, 2 Aug 2017 02:21:01 +1000 (AEST) Received: from localhost ([::1]:43597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZul-0006ji-Cj for incoming@patchwork.ozlabs.org; Tue, 01 Aug 2017 12:20:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrV-0004J3-6s for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrT-0007AH-1y for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:36 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrS-0007A0-R5 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:34 -0400 Received: by mail-wr0-x241.google.com with SMTP id y43so1805099wrd.0 for ; Tue, 01 Aug 2017 09:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RVXO7VKcCVBpWgqa+2unzBNUVdKujFIsu997c0qpmT4=; b=Znev7Cjxv1gAbAR411H+WY9Lxcp/cpJOJwdryIwRP7iEEKO8zJZCpgPlFs+WH7N3sU W0yYRP49ozo+MY/57Cy3BLPu5nytU9kwVaT8pwR/Vy5UDvcBT9UXU0JiLdfQx40RVunP iYzSx+1OXMCVZHchDuEBvaIctYTA04im1QRqgaY/Kv7TofAitcZOqEzDRa4l7Fb7aaAv FkqHFBC6V6OYsPLbsM4k2c/nuCWxsMOT2yCEjIyzMaPdo8/Tf+JY4ffcd9tKMpqnWSZI aQ+6XoffR5XW/nPe1aPMbOjd5Fdcpwj7P1SuL8y/sct4vZev7kzqd87MVNeSoNM7jfaJ O/JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=RVXO7VKcCVBpWgqa+2unzBNUVdKujFIsu997c0qpmT4=; b=htW9JdlNOQomzhhG3nd3lBi4GO0gNnBNCSn2onmU2ycEWg60pMnaJaZ805zppApJ6Z o7fvoOYsr+LfPhNCqUDzjXmwu29+2YNT4FlNkQQzG2964FI7hUwnd/STkog/D6Kil9s6 B70U9jyo3QWtZNvpr396BhaBptzrqMPIQU7xlbV+h0tywmAdTuTaCe+Jyg8zrPmH7yd6 dts9dUqEfdoZ3tHB5SKQruJTpe9JlX2FZrVfXrjJd+2V8TEa2U6nxcKEqaswnb1oHx+Z oqr82RGlu5WuJ1yUu0n/an2VsFQd7gsgdhvX62XyAR4JWjkUy883bIrmjN/7OPwkJKul o08Q== X-Gm-Message-State: AIVw111ZGTWRUY7yZehjblDdoMHhV3TN+7t6JuPHDxKcPIX8oBhwcf1o a0hDDnY5xqkAxCvQv/A= X-Received: by 10.223.183.15 with SMTP id l15mr18928736wre.260.1501604253492; Tue, 01 Aug 2017 09:17:33 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:11 +0200 Message-Id: <1501604245-33460-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 03/17] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier Only emit "XXX accelerator not found", if there are not further accelerators listed. eg accel=kvm:tcg doesn't print a "KVM accelerator not found" warning when it falls back to tcg, but a accel=kvm prints a warning, since no fallback is given. Suggested-by: Daniel P. Berrange Suggested-by: Paolo Bonzini Signed-off-by: Laurent Vivier Message-Id: <20170717144527.24534-1-lvivier@redhat.com> Signed-off-by: Paolo Bonzini --- 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" static const TypeInfo accel_type = { .name = TYPE_ACCEL, @@ -69,19 +70,20 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms) void configure_accelerator(MachineState *ms) { - const char *p; + const char *accel, *p; char buf[10]; int ret; bool accel_initialised = false; bool init_failed = false; AccelClass *acc = NULL; - p = qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (p == NULL) { + accel = qemu_opt_get(qemu_get_machine_opts(), "accel"); + if (accel == NULL) { /* Use the default "accelerator", tcg */ - p = "tcg"; + accel = "tcg"; } + p = accel; while (!accel_initialised && *p != '\0') { if (*p == ':') { p++; @@ -89,7 +91,6 @@ void configure_accelerator(MachineState *ms) p = get_opt_name(buf, sizeof(buf), p, ':'); acc = 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 = accel_init_machine(acc, ms); if (ret < 0) { init_failed = 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 = true; } @@ -110,13 +110,13 @@ void configure_accelerator(MachineState *ms) if (!accel_initialised) { if (!init_failed) { - fprintf(stderr, "No accelerator found!\n"); + error_report("-machine accel=%s: No accelerator found", accel); } exit(1); } if (init_failed) { - fprintf(stderr, "Back to %s accelerator.\n", acc->name); + error_report("Back to %s accelerator", acc->name); } }