From patchwork Thu Jan 9 02:17:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182796 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp3211661ile; Sun, 12 Jan 2020 09:55:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzxX3xZYMf0+TzYlxYuGH9RrxWAUEiUzZd9GyFMD7C0AXJ7KtzS60sz8cYCI5DyKQpLUAAQ X-Received: by 2002:a17:907:375:: with SMTP id rs21mr9387622ejb.351.1578845041977; Sun, 12 Jan 2020 08:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578845041; cv=none; d=google.com; s=arc-20160816; b=XORGcM/9qkjnHmkWsLjq15zuYUdGsxhjErLKuByPfRSSda54QIhcre1iHGMELWhKF+ foEsXL2w5USKqhcawBH11TkGVaAq9fHkA463O2PR7F2FvGoLldtbAbwIDkMOUCW5eK+i pw2m1M1H5l2WKD+6HA/SBERf9pHOwNfliOAj0UVJxncgiIyhuUKYQKLZj3yYiXaFkfkV dCZF8HM2VLAmR7Oo2e/9XHLb5k/9JLNcy6bnYIDe8yDc/QxzDI9oKDlVakRkDZ4Pqe6Z NRPD1EhxV6NAJiGvAAf2tzZbFUmxfpwcNUhZEo+nGz3r2x2vzPdxAwzeCyjf/WQNWtHH vWrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=71biz+iT3vb9rCukTO9Hbb/aNJiPW+OOTq+eiVqnO3Q=; b=H9OuvO7+035kcLgykyCiOuZt8ScgH+wx705gqWYqMZwwwPMJtZ5aTBM8rpOsBC0YlN tx+cCjPu/APLGYubCHlQBBsSH7Gg3F8fNeMHsNJfnneABqCELWh4dN6eXcxGXcLFbU3Y S5ticjmfXfJ20fz0ZmepIFQZi8/k2WN4DL6tTs+FTf+uRlTwNFNUI355dWIXiOzPO8cb bm64FB8yhCSCtJu6/gni3NyhWjsP1CUmdEErUzHVRtFsX2xzGxuh4+VBgdPSxTUx14Ls 8WRgmozU73tYox5jg/XX0GuQMINyVeslHO4kXNuIFCkY4UetAeGRdR1Dk2cd/PaeTikC Mmbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XNxmweGO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c93si5591726edd.127.2020.01.12.08.04.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Jan 2020 08:04:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XNxmweGO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNRL-0003AI-Ac for patch@linaro.org; Wed, 08 Jan 2020 21:20:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35191) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNO5-0007Ij-Bs for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:17:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNO2-0008Cy-KJ for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:17:29 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:51936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNO2-0008Bg-DO for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:17:26 -0500 Received: by mail-pj1-x1044.google.com with SMTP id j11so444618pjs.1 for ; Wed, 08 Jan 2020 18:17:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=71biz+iT3vb9rCukTO9Hbb/aNJiPW+OOTq+eiVqnO3Q=; b=XNxmweGOHA/RLA6fhSbtVVdLqgWBVA9GRqD6bNfy8sb4NmE+CwRq5dXkN3tMXXXmk2 ZR530tOfnnEHNMn0oU4kH5RrsyLmvfUtAgS+Bf8PcAqKF5yk6XdRqFcJjQncbLGPVe4o xYoKByrsHfWChuRk1XH8hXYLJcp1iqmuKwpM265kOpqqaU3VwprSq2xt13V9/tnv83CH REeYtVwAttLzKSJ8IsDWMfS+U1y2raz8iWySkCzcp24KN3sSfmtCg8hT1EucL5mo62Fo hMN+G14fEEx6DVYFb0F6xMTyT5jOMgRskKy/qPPNySZAt9mUjpLROmmS+DOeU2trw8Or QNfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=71biz+iT3vb9rCukTO9Hbb/aNJiPW+OOTq+eiVqnO3Q=; b=NpXwwCzfODsj9bwblxM89Gd7TCEu2KQ3HPeLlrwyz+UqZgzy76y8BMoad0oPJs/t5o YaKRK/3HmOwWgFQCbQ+avz/Oo5CXlyhJj4pSYXZ/umO4IGuwZknFxSjv8wWEaoWzmXnn khCgU0ouk9EMj0IlvOMKOmuTQsQVqjZii4NaL6gzSDaNq4RVU/ggWkmefOMbIgk5Zh5H K3wusw3DaSES9IUssYh+kYbB1dRjv3nGEtH8/Tr9DVh7Z+Trl6aEVS54hP6tNHQHOf8L ARXJRJBByRqfH5HJuVT00m6KR7NweSHpwVRS0s/232W8zPiOU4HxUU/qAuPSblb4JCw5 jRtQ== X-Gm-Message-State: APjAAAWfSjkqjqatbPdT4vzjYlxSvSxb96HFYAdldXA4rClbga5x4XI+ 14uBZAqKutYTJGmSWu6utijwpXe02rt4/w== X-Received: by 2002:a17:902:6906:: with SMTP id j6mr9065005plk.321.1578536245112; Wed, 08 Jan 2020 18:17:25 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id n26sm5166715pgd.46.2020.01.08.18.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:17:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/4] vl: Only choose enabled accelerators in configure_accelerators Date: Thu, 9 Jan 2020 13:17:10 +1100 Message-Id: <20200109021710.1219-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109021710.1219-1-richard.henderson@linaro.org> References: <20200109021710.1219-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1044 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" By choosing "tcg:kvm" when kvm is not enabled, we generate an incorrect warning: "invalid accelerator kvm". Presumably the inverse is also true with --disable-tcg. Fixes: 28a0961757fc Signed-off-by: Richard Henderson --- vl.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/vl.c b/vl.c index 887dbfbb5d..9b7651c80d 100644 --- a/vl.c +++ b/vl.c @@ -2759,11 +2759,10 @@ static void configure_accelerators(const char *progname) if (accel == NULL) { /* Select the default accelerator */ - if (!accel_find("tcg") && !accel_find("kvm")) { - error_report("No accelerator selected and" - " no default accelerator available"); - exit(1); - } else { + bool have_tcg = accel_find("tcg"); + bool have_kvm = accel_find("kvm"); + + if (have_tcg && have_kvm) { int pnlen = strlen(progname); if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) { /* If the program name ends with "kvm", we prefer KVM */ @@ -2771,9 +2770,16 @@ static void configure_accelerators(const char *progname) } else { accel = "tcg:kvm"; } + } else if (have_kvm) { + accel = "kvm"; + } else if (have_tcg) { + accel = "tcg"; + } else { + error_report("No accelerator selected and" + " no default accelerator available"); + exit(1); } } - accel_list = g_strsplit(accel, ":", 0); for (tmp = accel_list; *tmp; tmp++) {