From nobody Fri Dec 19 17:36:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1681749659; cv=none; d=zohomail.com; s=zohoarc; b=USwcWyy3PoPoV7p5sVg39oYVRJ+kqWSlMBVq04MYJpa3ANSyjlZUjyDfLx4sLfvYNh5EnfLIuQ5t4H8S1YgjLNvajBuiL8630xo4fOgODIDhS5b9xbs4m+KLSugBIyoIfqg3jBLwSEaQ78xdy5pXdLk9w43jhFQINNTmUiTUfT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681749659; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=exlqhHtpNYfOagC4ag8CmHQpsGR3QrEyzrEn9wP3FGw=; b=S1BbjTaRg8ek27j6MTO3oU9oX3r4Ave5ji5iXYTFKqbCEYlH0bZDN9ES4jeChnyaTNesrvopekFJAeNyKeUCeEIFHgQbnTyjzZTU7p7BSm2A9IQ+JhlcOSAtXuw+MxyQNgdZD3H+RkGK9+fOQtzNbdL7fKtOm9BJ3r6x1Stl87A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1681749659125247.43732907221442; Mon, 17 Apr 2023 09:40:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-185-4Lp8O4pDP8aG-CRdO0B1dQ-1; Mon, 17 Apr 2023 12:40:51 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 105BE381497B; Mon, 17 Apr 2023 16:40:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8964492B0C; Mon, 17 Apr 2023 16:40:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E0F9A19465BD; Mon, 17 Apr 2023 16:40:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 327D1194658C for ; Mon, 17 Apr 2023 16:40:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 257202166B29; Mon, 17 Apr 2023 16:40:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DF332166B26 for ; Mon, 17 Apr 2023 16:40:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F1B66101A531 for ; Mon, 17 Apr 2023 16:40:46 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-373-g22Vk6QJNy-AJhJW5BWyaw-1; Mon, 17 Apr 2023 12:40:45 -0400 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-2f917585b26so1288225f8f.0 for ; Mon, 17 Apr 2023 09:40:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q17-20020a5d61d1000000b002faaa9a1721sm2595103wrv.58.2023.04.17.09.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 09:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681749657; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=exlqhHtpNYfOagC4ag8CmHQpsGR3QrEyzrEn9wP3FGw=; b=N6fHxE75v3RCDks4DKw0luROw866gX933DHcW/9IMfpcYEMgNqjinZ2lv66MtAJ6tOrNfO ZJVNyOD8OdbBiW3aaZuCa4Dty3yRuBX3xlWhhGJOsNV2Tg7tASjF1e+LohvWCFoH1LmhR4 ax8iltrxCGEv8FP3LOICeypOivcXXDQ= X-MC-Unique: 4Lp8O4pDP8aG-CRdO0B1dQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: g22Vk6QJNy-AJhJW5BWyaw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681749644; x=1684341644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=exlqhHtpNYfOagC4ag8CmHQpsGR3QrEyzrEn9wP3FGw=; b=iuv277Zm6ttbdoAgKihmncZEAdDudNRINdiVhx3suQPoZbEzNRFo4e1KucInXNfkuD iT4/60zL9OeEne6GXv03V2YeuP5n4VRsHtD5Yk0fFBnFaEJ2AdYqc+ytviGKpRSQgHse fD1eGN2P1HPL8DFnROUOZnlT7HdcUxAxnSY3/ZKKBt8G/hVc5DjYGO4MpvWNyx2rBYUM CEIyddAThPZWj5YRkgW1pNZVi3Q5czCarL8TUtETeG1SFfJuOZk7vo6MfvP5FhDWnmCZ S+4b8GMrtoz82I7+/JPPvW7Xo4NTcEdXDOCAqONwpXGwPCGWJBlFR1oyppqJjQl5yM7p eplw== X-Gm-Message-State: AAQBX9dm/VIIMPJV8fMKlyg/QUFTWGWjskYsKCuMsfT8H7YLmXNdVajc 1/EfNLI3TYshMnTvfxbz5R8vgA== X-Google-Smtp-Source: AKy350bsaF1f+Lcqqll5M2lnR/askrplOHaIXPQhftt/Ll3P0i89Jz1ABcxAOo+KCtdROyNHQM/SbA== X-Received: by 2002:a5d:4cc6:0:b0:2f8:a7c0:5ce7 with SMTP id c6-20020a5d4cc6000000b002f8a7c05ce7mr5685549wrt.8.1681749644100; Mon, 17 Apr 2023 09:40:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v3 02/10] softmmu: Don't use 'singlestep' global in QMP and HMP commands Date: Mon, 17 Apr 2023 17:40:33 +0100 Message-Id: <20230417164041.684562-3-peter.maydell@linaro.org> In-Reply-To: <20230417164041.684562-1-peter.maydell@linaro.org> References: <20230417164041.684562-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libvir-list@redhat.com, Kyle Evans , Richard Henderson , Markus Armbruster , Laurent Vivier , Eric Blake , Warner Losh Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linaro.org Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681749661409100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The HMP 'singlestep' command, the QMP 'query-status' command and the HMP 'info status' command (which is just wrapping the QMP command implementation) look at the 'singlestep' global variable. Make them access the new TCG accelerator 'one-insn-per-tb' property instead. This leaves the HMP and QMP command/field names and output strings unchanged; we will clean that up later. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- softmmu/runstate-hmp-cmds.c | 18 ++++++++++++++++-- softmmu/runstate.c | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c index d55a7d4db89..127521a483a 100644 --- a/softmmu/runstate-hmp-cmds.c +++ b/softmmu/runstate-hmp-cmds.c @@ -20,6 +20,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qmp/qdict.h" +#include "qemu/accel.h" =20 void hmp_info_status(Monitor *mon, const QDict *qdict) { @@ -43,13 +44,26 @@ void hmp_info_status(Monitor *mon, const QDict *qdict) void hmp_singlestep(Monitor *mon, const QDict *qdict) { const char *option =3D qdict_get_try_str(qdict, "option"); + AccelState *accel =3D current_accel(); + bool newval; + + if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) { + monitor_printf(mon, + "This accelerator does not support setting one-insn= -per-tb\n"); + return; + } + if (!option || !strcmp(option, "on")) { - singlestep =3D 1; + newval =3D true; } else if (!strcmp(option, "off")) { - singlestep =3D 0; + newval =3D false; } else { monitor_printf(mon, "unexpected option %s\n", option); + return; } + /* If the property exists then setting it can never fail */ + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", + newval, &error_abort); } =20 void hmp_watchdog_action(Monitor *mon, const QDict *qdict) diff --git a/softmmu/runstate.c b/softmmu/runstate.c index d1e04586dbc..2f2396c819e 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -40,6 +40,7 @@ #include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-events-run-state.h" +#include "qemu/accel.h" #include "qemu/error-report.h" #include "qemu/job.h" #include "qemu/log.h" @@ -234,9 +235,16 @@ bool runstate_needs_reset(void) StatusInfo *qmp_query_status(Error **errp) { StatusInfo *info =3D g_malloc0(sizeof(*info)); + AccelState *accel =3D current_accel(); =20 + /* + * We ignore errors, which will happen if the accelerator + * is not TCG. "singlestep" is meaningless for other accelerators, + * so we will set the StatusInfo field to false for those. + */ + info->singlestep =3D object_property_get_bool(OBJECT(accel), + "one-insn-per-tb", NULL); info->running =3D runstate_is_running(); - info->singlestep =3D singlestep; info->status =3D current_run_state; =20 return info; --=20 2.34.1