From patchwork Mon Apr 17 16:40:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 673834 Delivered-To: patch@linaro.org Received: by 2002:adf:fcce:0:0:0:0:0 with SMTP id f14csp1604318wrs; Mon, 17 Apr 2023 09:40:56 -0700 (PDT) X-Google-Smtp-Source: AKy350aBKtznhPml1Q6xQquHoppHq//3pRRL0nJ/ouPkH1UKE5rVAdmX/tE0hxtsyYxlVpSHBY15 X-Received: by 2002:a05:6214:da2:b0:5ef:6718:f8c7 with SMTP id h2-20020a0562140da200b005ef6718f8c7mr12955384qvh.38.1681749656334; Mon, 17 Apr 2023 09:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681749656; cv=none; d=google.com; s=arc-20160816; b=QZEqP7ptJcFxxUa/uJ2o0KSbIZAY8tXtUcZufjKsvYiylJuy9Xa2cTAL8fOC7G1Wnd 4pzOu+N/6IHUSEoLiw3LN1hx81L8QIiC/zmdnw81px68p5ZzG1XrXopY+2vwfR87pD6g gd73TFloOtK6W68F1RnLLSWZsNbKiQyvi2GSEmI+oLUBxDQKYHIWUFCCd+RVX43EF1Bn 8Lt3esci4OjUX7jpVojIaiHhNeFHojxF56GLf4b+/uq6TKQOHN+ZUmKlOs0OpEPP6d2r WL8oLNwrWiwQcVE0o/3pBBTD9AtDuH+IbA7LQ0pxeWguU/oI58z13I5/IKGoF4QGLLS9 WPCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=exlqhHtpNYfOagC4ag8CmHQpsGR3QrEyzrEn9wP3FGw=; b=UZ8nN4SG3BSAx/qtfxduwuqAvdJjPEh4LptpYKpu3dZEwPuugd6BXi5v0VeV5gKgHK tZUbVRkWo9qE0p7mKRXLJaAlH/LCuANKkSHwLXUe/khhYqp+O9YXk9vvo3IeOV43xoX5 himq6r/bRdxRLLigekkt7+j2RNxVY0jcRYZzQq26DYMXWlBVR4IDMS1/FIKJngxq3WL8 Ow3AEXHzmprXafvKXmWu9FANLEgiD4jSm1iUNtoW4FgygcMtuPBxJXpkYcE0HTfCGU0S lQaMEcgjqUdUoeN2ddkHBGdCvrRsUtvMHUeIwzImosvIUL0uPDwZfvHNjuMWmJpx2lbT BXVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HvnZgaIV; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.129.124]) by mx.google.com with ESMTPS id az11-20020a05620a170b00b0074ac1063ab6si5902266qkb.133.2023.04.17.09.40.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 09:40:56 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HvnZgaIV; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681749655; 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=HvnZgaIVomETx748k9cMhkwiy3L1AJyY5ylBI+62S+AhTgG27sMEBDc00yeA7USmuHZ+Xp UT1K3pH/6jxzNcQSsTnqFEJ+Mu21cHXLQhMqW9yE4f3SgbAZTTqorvWs51InfGMWzfxSQB Xj9dET+1peeFQoEdD1JEseizOwmC3Ws= 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 X-MC-Unique: 4Lp8O4pDP8aG-CRdO0B1dQ-1 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) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com 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) Delivered-To: libvir-list@redhat.com 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 X-MC-Unique: g22Vk6QJNy-AJhJW5BWyaw-1 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-2f917585b26so1288225f8f.0 for ; Mon, 17 Apr 2023 09:40:45 -0700 (PDT) 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-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) 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) 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 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é --- 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" 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 = qdict_get_try_str(qdict, "option"); + AccelState *accel = 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 = 1; + newval = true; } else if (!strcmp(option, "off")) { - singlestep = 0; + newval = 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); } 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 = g_malloc0(sizeof(*info)); + AccelState *accel = current_accel(); + /* + * 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 = object_property_get_bool(OBJECT(accel), + "one-insn-per-tb", NULL); info->running = runstate_is_running(); - info->singlestep = singlestep; info->status = current_run_state; return info;