From nobody Mon Feb 9 04:31:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163543737525775.47140111926262; Thu, 28 Oct 2021 09:09:35 -0700 (PDT) Received: from localhost ([::1]:57756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mg7yA-0002JK-3J for importer@patchew.org; Thu, 28 Oct 2021 12:09:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mg7mb-0004Xh-Vc for qemu-devel@nongnu.org; Thu, 28 Oct 2021 11:57:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53488) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mg7ma-0004VE-9k for qemu-devel@nongnu.org; Thu, 28 Oct 2021 11:57:37 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-q1JpUH71PUifPEJrCb4Z6A-1; Thu, 28 Oct 2021 11:57:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0959C1023F5E; Thu, 28 Oct 2021 15:57:31 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.195.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06AC86F920; Thu, 28 Oct 2021 15:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635436655; h=from:from: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; bh=SYdCvuAoRByUR70HdBQfqN8NwbjlvZg0vexUnZ1CsrU=; b=cnkQkkq6Vw15cSDIyiUK1Ft385O8tC+gPZnzEay7kWUYL1ZSVs4ebVrokO/5gsXBeViykN RYwLFJd4qjjFQGBGMed8oyGgGhgXFkEfPMH2NunL5mtRYVMkjyQPYKnujJgOKQ4EzxqYcv R1Fi+yg5+CW+IlaPX+S+yuR4mN4tEL8= X-MC-Unique: q1JpUH71PUifPEJrCb4Z6A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v4 10/22] qapi: introduce x-query-roms QMP command Date: Thu, 28 Oct 2021 16:54:45 +0100 Message-Id: <20211028155457.967291-11-berrange@redhat.com> In-Reply-To: <20211028155457.967291-1-berrange@redhat.com> References: <20211028155457.967291-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Laurent Vivier , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , David Hildenbrand , Michael Roth , Cornelia Huck , Richard Henderson , "Dr. David Alan Gilbert" , Peter Xu , Yuval Shaia , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1635437376436100001 This is a counterpart to the HMP "info roms" command. It is being added with an "x-" prefix because this QMP command is intended as an adhoc debugging tool and will thus not be modelled in QAPI as fully structured data, nor will it have long term guaranteed stability. The existing HMP command is rewritten to call the QMP command. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hmp-commands-info.hx | 2 +- hw/core/loader.c | 39 ++++++++++++++++++++++----------------- monitor/misc.c | 1 + qapi/machine.json | 12 ++++++++++++ 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 24c478aead..b6325d36ed 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -594,7 +594,7 @@ ERST .args_type =3D "", .params =3D "", .help =3D "show roms", - .cmd =3D hmp_info_roms, + .cmd_info_hrt =3D qmp_x_query_roms, }, =20 SRST diff --git a/hw/core/loader.c b/hw/core/loader.c index c7f97fdce8..052a0fd719 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -46,6 +46,8 @@ #include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" +#include "qapi/type-helpers.h" #include "trace.h" #include "hw/hw.h" #include "disas/disas.h" @@ -1474,32 +1476,35 @@ void *rom_ptr_for_as(AddressSpace *as, hwaddr addr,= size_t size) return cbdata.rom; } =20 -void hmp_info_roms(Monitor *mon, const QDict *qdict) +HumanReadableText *qmp_x_query_roms(Error **errp) { Rom *rom; + g_autoptr(GString) buf =3D g_string_new(""); =20 QTAILQ_FOREACH(rom, &roms, next) { if (rom->mr) { - monitor_printf(mon, "%s" - " size=3D0x%06zx name=3D\"%s\"\n", - memory_region_name(rom->mr), - rom->romsize, - rom->name); + g_string_append_printf(buf, "%s" + " size=3D0x%06zx name=3D\"%s\"\n", + memory_region_name(rom->mr), + rom->romsize, + rom->name); } else if (!rom->fw_file) { - monitor_printf(mon, "addr=3D" TARGET_FMT_plx - " size=3D0x%06zx mem=3D%s name=3D\"%s\"\n", - rom->addr, rom->romsize, - rom->isrom ? "rom" : "ram", - rom->name); + g_string_append_printf(buf, "addr=3D" TARGET_FMT_plx + " size=3D0x%06zx mem=3D%s name=3D\"%s\"= \n", + rom->addr, rom->romsize, + rom->isrom ? "rom" : "ram", + rom->name); } else { - monitor_printf(mon, "fw=3D%s/%s" - " size=3D0x%06zx name=3D\"%s\"\n", - rom->fw_dir, - rom->fw_file, - rom->romsize, - rom->name); + g_string_append_printf(buf, "fw=3D%s/%s" + " size=3D0x%06zx name=3D\"%s\"\n", + rom->fw_dir, + rom->fw_file, + rom->romsize, + rom->name); } } + + return human_readable_text_from_str(buf); } =20 typedef enum HexRecord HexRecord; diff --git a/monitor/misc.c b/monitor/misc.c index 3cb5269356..54df4e9e24 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -71,6 +71,7 @@ #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-qom.h" #include "qapi/qapi-commands-trace.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-init-commands.h" #include "qapi/error.h" #include "qapi/qmp-event.h" diff --git a/qapi/machine.json b/qapi/machine.json index 5db54df298..26d4ef8195 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1411,3 +1411,15 @@ '*cores': 'int', '*threads': 'int', '*maxcpus': 'int' } } + +## +# @x-query-roms: +# +# Query information on the registered ROMS +# +# Returns: registered ROMs +# +# Since: 6.2 +## +{ 'command': 'x-query-roms', + 'returns': 'HumanReadableText' } --=20 2.31.1