From patchwork Mon Jun 27 10:22:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585272 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2944185mab; Mon, 27 Jun 2022 03:24:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sr1u0rRvYoCUguhpbioprLYIr/znhYCe60ItmC5n7Xv/3JT8BvLpseNVRydYxf4koh1cF/ X-Received: by 2002:ac8:5ac4:0:b0:305:87e:3636 with SMTP id d4-20020ac85ac4000000b00305087e3636mr8436225qtd.454.1656325442289; Mon, 27 Jun 2022 03:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656325442; cv=none; d=google.com; s=arc-20160816; b=UUbYMGaXC3/FxjzgqtcxHHQkGv01edHcRPiO1M7Kby+vdO6jzap8kgWEmTeZprH7kG NQnScXFP7F4l/KWDXl7+UnIuVc+lSjBdVx1C4sFPdNRurzpFMD9vATUp2+eYPN0cl8fJ 4bHGECTkPhftFO4tNaChAQ5P66EaaArNIfk/okw+TUaiyTDDHNXUBplp+I1zLd3egQpR CJKqx114zt95GSx/6dep3NTBtZu+NpDmt7BCzVxvOB8uoBqNVog4WuIm47JxJ6dQIqNq gbsJ4CnnJXjoaBOskx8XVxQg0OjL82Sxla12EPXUTooBgaz6M1wqqmX5j3EfNrJjd2sr PsJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=EOVXgkGRtIpIGzJkFF4/6zpJoNS3CC73Hky3UMqCS5s=; b=0vkzoRelQddFfJLyYQesbsU+lGs7WRi3lXmpjPcYt/HCxGwRVc+k9netkLfWka8kP9 eNKLp8DenUkNmNRxbtAJJpjmW968lBnEZdLygJbzxMLS3fjS8p6OVhBydXQGCHoWebCo fJ7Tr7mLtttsQa18lYqVDmgpqamYo/ztz+EXyJMrVLAvxlCpq//wYZPz8Cq9v7upPm0v CR0qcSUw/HpDLoZ7wjlEtmJTWkyIl5HO4KqQD9F9OH2koHV9I3mpZZRsW/3DXkBmz/ev HAIhvgZtpdqDW2o5A+1V6UNXiButArRwJwIjIeR5F1pFCZx5t5VpYsuvPL0tQfFiKYu4 NezA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FwVFcRrX; 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 t2-20020a05620a450200b006af245d98a9si1357146qkp.404.2022.06.27.03.24.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:24:02 -0700 (PDT) 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=FwVFcRrX; 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]:53308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5luT-0002XA-Ri for patch@linaro.org; Mon, 27 Jun 2022 06:24:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltF-0002Fo-Cp for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:45 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltB-0004rd-Qj for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:44 -0400 Received: by mail-wr1-x42c.google.com with SMTP id v14so12340152wra.5 for ; Mon, 27 Jun 2022 03:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EOVXgkGRtIpIGzJkFF4/6zpJoNS3CC73Hky3UMqCS5s=; b=FwVFcRrXy3p4zKvB6Ev4hnglI3w6Ldi4RJaKtatZ83oXHyJakWfOaLu96jqIZc4LJH t+b8v+bhSuVtE61XWN3g1VCdXDCj+0/IpZKEE40/m/DKyTMFygJCRqtacbd1CZgCbE/2 8w6FWqoodA7m7cx3+a4jaXN7Tcefv2oxXm2BcA7+Dl33MELo8X1bSEu4FIYYZ3RFsr5V XbD2HyQ4wK72cLHh14WykL0sM2lxeYLW9NLsDDOC+E0XZa/4qK9NR3362hpSH3XORKIj usaxkfJGrz5vMyqmUbEcGfYstYNbFSf8UDRB2i9K1liRQ46Kk0iCWmyZV0QCYEb7OcTZ GNCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EOVXgkGRtIpIGzJkFF4/6zpJoNS3CC73Hky3UMqCS5s=; b=jPrqmxpKC8J8WwtxfNMel/LDiN5zLTgxxMP/1XZtr+21UkahfuleBrYogpQp5g2NPS 1jNRugGxYTL3v7BrxX2uXnMtsOvZ1yZCjqTPaPvrV5GPfNujqX455X0mzQTU4lp4oLaO Zitdu6G/BQa60uyi+/1OEnmXlxmtdR46q7yamUt+sRbNMau08T4LTfubLBPf0OToOeAI XxckWkRlR2Q+N7V0JRLSVMynB3njxqPJ4LrC+Npu/Z/DT7n8CfzkGnsWUcvPdzsVhtrZ pzXq84cr4fqAnfU9cXjWcNn4kpEM+teaSq5KVIW+HGt+PepwD4itq9KdocTIKFvgkM2J CvHg== X-Gm-Message-State: AJIora9XhNVQB+tc/jtUretd8NQhc0h/8FHU5T/agvsdUmPXB6/evkX4 7gDSV1i/pT1iNKBnRIMNUp+y3X2PnahvNQ== X-Received: by 2002:a5d:584d:0:b0:21b:a3a2:d67c with SMTP id i13-20020a5d584d000000b0021ba3a2d67cmr10861641wrf.149.1656325360030; Mon, 27 Jun 2022 03:22:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/25] accel: Introduce current_accel_name() Date: Mon, 27 Jun 2022 11:22:13 +0100 Message-Id: <20220627102236.3097629-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alexander Graf We need to fetch the name of the current accelerator in flexible error messages more going forward. Let's create a helper that gives it to us without casting in the target code. Signed-off-by: Alexander Graf Reviewed-by: Richard Henderson Message-id: 20220620192242.70573-1-agraf@csgraf.de Signed-off-by: Peter Maydell --- include/qemu/accel.h | 1 + accel/accel-common.c | 8 ++++++++ softmmu/vl.c | 3 +-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 4f4c283f6fc..be56da1b999 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -68,6 +68,7 @@ typedef struct AccelClass { AccelClass *accel_find(const char *opt_name); AccelState *current_accel(void); +const char *current_accel_name(void); void accel_init_interfaces(AccelClass *ac); diff --git a/accel/accel-common.c b/accel/accel-common.c index 7b8ec7e0f72..50035bda55d 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -49,6 +49,14 @@ AccelClass *accel_find(const char *opt_name) return ac; } +/* Return the name of the current accelerator */ +const char *current_accel_name(void) +{ + AccelClass *ac = ACCEL_GET_CLASS(current_accel()); + + return ac->name; +} + static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque) { CPUClass *cc = CPU_CLASS(klass); diff --git a/softmmu/vl.c b/softmmu/vl.c index 54e920ada1a..3dca5936c76 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2271,8 +2271,7 @@ static void configure_accelerators(const char *progname) } if (init_failed && !qtest_chrdev) { - AccelClass *ac = ACCEL_GET_CLASS(current_accel()); - error_report("falling back to %s", ac->name); + error_report("falling back to %s", current_accel_name()); } if (icount_enabled() && !tcg_enabled()) {