From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907648; cv=none; d=zohomail.com; s=zohoarc; b=jntWbGg5lTgCqCPg9MJ5tfODrpPtpJ5pBvsLn0u+32jFw/JrLr6g8ahWRM30hzJJeBjV++3UudeKnaUd6mCDC3GrXwN2TBMy8ZDCHd2/S1Ylr1YzahEMX4KZgGIfoOge5PyD7BGj+70tgiFXlUSYreFvVDZNqjSoKQaHYrnYDHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907648; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JHUWUIlV1L88EuNWpXBRzIO9zHPWAXRW9+Hdx8pgeCk=; b=CoWMjyI+CTzSLgGORyvtDS0JlaZTV/NpI14zROnaRwSGiF2Gxx4oIF9xCyzfc4SSIdlitD0duhFwj4VASo/i4hM3AA9FlFIT5bD7eNRGvER6suLbYGFOXHwhOk2gnH/m8FNtsHaFHGZyyJWGsyyh0sRXVhRzIFpbrpDkrhYSKIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907648306845.0340978908911; Sun, 16 Aug 2026 12:14:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgId-0008PZ-F4; Sun, 16 Aug 2026 15:13:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIO-0008Kk-FM for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgII-0007EA-Qm for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:23 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-17-qdTL-OdPNCeDIVnFyWGogQ-1; Sun, 16 Aug 2026 15:13:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7BB941956080; Sun, 16 Aug 2026 19:13:01 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 314FF30001A2; Sun, 16 Aug 2026 19:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907584; 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=JHUWUIlV1L88EuNWpXBRzIO9zHPWAXRW9+Hdx8pgeCk=; b=f1zdj52CkvY0OWPJ3k1g7bGmC5DpLl+Bi7r5JjvoonhZive5PEnfAJZOdnoV9nr55gs37q L18o5rSTqJRCPinqIzLZd8lte6PpQeEojVVj4w/iKiHUAddvnD4UEnfWkGP3OUJy9Qkzo5 KBiboGI6+HgrZvJCLfGEJ3RlK99E6fA= X-MC-Unique: qdTL-OdPNCeDIVnFyWGogQ-1 X-Mimecast-MFC-AGG-ID: qdTL-OdPNCeDIVnFyWGogQ_1786907582 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:28 +0400 Subject: [PATCH v3 01/49] vl: fix -monitor none prefix matching MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-1-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=937; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=3iiRReSd94lLGBmuGE+7JzjtOZA9/s2KBjEkNLxXG5k=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguv3dVdsIPiywaCP8/+YKQQp+he4LmMAWzRo NOHvmYA3p2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILrwAKCRDa6OEJdZac 5czZD/9XOIzzMt3YF6dJj7V8Wi8JGFJND5a3UFxv7tVn5RDF37mxwjZbQ2kkaDi36PZAZ5x3NNd Q1WZXVIMqOCoW0Ito0BG6SX48B53Fs1nviJF0TgJMWu43ziUyS4gRxBGSHOijqct2b/yRXz4Q2R aVD7ZQsy0h5EdGhxnE/RCrGhmRBMndtI0LJukSNCD7Bbx6d8Gt9M1E0CfTV4qFozE3x9bebU3wY xmcZWkupQk9o6NYs8k/w9+voIUIGWBWBqbwAgie692atim8cHj+0gLT2jEh6ffxVtff7krPVY5S zm6MNjz/vCeSdYgXtGejKWV4OtwogDvy+QHehk5SpWtfsqLYbfd2wvNFqYQ98fEvgvrYq7aHPcv DM9iHeLB7EBN4Waxe+6WZwKob/mnjmiNJ/3pbF4rsdUHx277QhBt5SXqb/FsFc63JG91xPJ2ZKn 1+WD++7lJg2zglDYIJ2SVXlHsnms8bo67o6rJlGOt1a4kD0qZ8FrFAFcYRf40YmsSzLY3bQ0TA8 Zb04/xNhDEjwk/B+n3KFVSukFuKum3vW0eoCIQFcPTCjFvXaKGSspQaSbaEdsFwSRvBLFU9umgz wjZ8OmkAe6L3piBcmjWFoasPO9gR9UWslz+cv39NNCuJiY8WrxrUv4MVZhUoxUIZILu7YRsVsGi Ojl5MYS80XvJdvQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907649822158500 Use g_strcmp0() for exact match instead of strncmp() which would incorrectly treat any string starting with "none" as disabling the monitor. Fixes: 70e098af88f ("monitor: allow to disable the default monitor") Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- system/vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/vl.c b/system/vl.c index 061cbdf860bf..5ccc19282ba2 100644 --- a/system/vl.c +++ b/system/vl.c @@ -3226,7 +3226,7 @@ void qemu_init(int argc, char **argv) } case QEMU_OPTION_monitor: default_monitor =3D 0; - if (strncmp(optarg, "none", 4)) { + if (g_strcmp0(optarg, "none")) { monitor_parse(optarg, "readline", false); } break; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907642; cv=none; d=zohomail.com; s=zohoarc; b=cgGFCFyDieqWAghNuGsIX4PWz6SstNircxhOiLDfFb3uan538zbsipLB+cbWHWiacwEIoy3tVrh3paHI7rvYCOGahjsIe/ddzrqAIqkz7qNP12X1iwmoWheGvKMVd7sMHzCKHDgQxCN+aMG8g/P0lLfC9FV9x6mK/wBs0LagMV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907642; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RGi09MNmySOgH4WHAvnetZBypHn4P+kRuWbKiz64GwI=; b=I5rLkTrYVUvkruVfUJcAgTjYcZJ+r7l0ZIvWn/TTsK/y+HPgQEG74ENl6L1qLhoy83aCXqaTIquhsF812YN9CVv80q/QUZvn5UiC3hmlxzPoIf6IqbLCDWwUyGfFyHx8owBqTu+UIDWcYwlUFH7ypmrKNAsk+18NllUvu838OLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907642971389.58819036323814; Sun, 16 Aug 2026 12:14:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIS-0008MG-0e; Sun, 16 Aug 2026 15:13:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIM-0008K6-F9 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgII-0007El-Qc for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:21 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-3pxQa0u9OdaGqKc-NVbUPg-1; Sun, 16 Aug 2026 15:13:06 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0BF011800471; Sun, 16 Aug 2026 19:13:05 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2E5681956041; Sun, 16 Aug 2026 19:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907587; 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=RGi09MNmySOgH4WHAvnetZBypHn4P+kRuWbKiz64GwI=; b=OlihJaSVVg2M9almatui3iWsutGOoz1oEmClZiPnqiahSjt9/jDpi7gq4U4qZ2lVGXXHtU pB00BaawtzsUBdYTelSSC1k077DpHiDBM7knaZe75dki5XXz45BWaStgCGkT+zwstlLB/B 1nIUBfa1p09PsJxW5UY/TNQMOkmxBj4= X-MC-Unique: 3pxQa0u9OdaGqKc-NVbUPg-1 X-Mimecast-MFC-AGG-ID: 3pxQa0u9OdaGqKc-NVbUPg_1786907585 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:29 +0400 Subject: [PATCH v3 02/49] hmp: remove 'vcpu' argument from trace-event help MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-2-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1813; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=tuapEdWlbge9nQ8zXoXUzq/8HC5xbWVmFJeX4uAItoY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguvUS/JPw1iF1nkig4RNlO341jPEpFUwskyR rD9JL1Cgo6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILrwAKCRDa6OEJdZac 5VcBD/40MD+s7tV8Dgv9THlhfq5nt3n8Hb1sOPtL34xRKhk8p6w1vnPLE7XYbzRJzFAzZoQqeOq JbZVrBlxXebzyq68HERCuGcMWM0iYY8pNCGIVaNlifNhAJ1+fT1j9DGFBE2kpHbPjrIJWjUJQ6X 50gjQlGZBPna4l2qwOBW984TGD2hAIg3zsN8ek3GvjWszECuSpkPJYLJTPSIwWSkfXcTgt5XIof tMatkXK7h2fEOU23JGbT9dS27gjd1BzqEG+T8Hjj4AC+lNqlJPoJ21iYkPnYrIvhiK9rvxf/Bdo y4FWOgc4hWu7EhDdz7kRC3ZoPfgNUs1P6ern4yUYCBqHYNS3ekz3hwO6RO8MUd8x77+gx63RCEO E4CcbNqQ/0PO5K2Z/Q4LOFiypo0BE+QjfhrOCv77zofEbym6MKFyH+YQm+qFaH1oJPicOIbySGb aZ6i1LqOP9Ienqw+RWYfWvTycF3UaFa6Am2GsLe0SfK/yBqh2M7Vwc0qdSY4vSzBXkAv4OOfE+p frTOSTn4dsnx8IqJHcWBh+r9Zfci1aXD9dw0Ziop108XOswO4SY92aosW5EQuptRD2ufWpHcPZ/ iF09EFrcW43v9URSV3mPwSqrLDOVjfqGQUmxlnb5MMhrXsJ5IVMYLIc8Q6MaGY9DLmwNCl43gDJ rEYnT91Rm959WaA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907644606158500 Fixes: 89aafcf2a793 ("trace: remove code that depends on setting vcpu") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hmp-commands-info.hx | 6 +++--- hmp-commands.hx | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 82134eb6c21d..2695ff04ffce 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -587,10 +587,10 @@ ERST =20 { .name =3D "trace-events", - .args_type =3D "name:s?,vcpu:i?", - .params =3D "[name] [vcpu]", + .args_type =3D "name:s?", + .params =3D "[name]", .help =3D "show available trace-events & their state " - "(name: event name pattern; vcpu: vCPU to query, def= ault is any)", + "(name: event name pattern)", .cmd =3D hmp_info_trace_events, .command_completion =3D info_trace_events_completion, }, diff --git a/hmp-commands.hx b/hmp-commands.hx index 43ff220b5feb..ea4a1db78f18 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -299,10 +299,9 @@ ERST =20 { .name =3D "trace-event", - .args_type =3D "name:s,option:b,vcpu:i?", - .params =3D "name on|off [vcpu]", - .help =3D "changes status of a specific trace event " - "(vcpu: vCPU to set, default is all)", + .args_type =3D "name:s,option:b", + .params =3D "name on|off", + .help =3D "changes status of a specific trace event", .cmd =3D hmp_trace_event, .command_completion =3D trace_event_completion, }, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907906; cv=none; d=zohomail.com; s=zohoarc; b=VH0Lr6S/GkdJsNq1twsNR8bnXfzVcQj4N6iHUADPyAe++nH02+2CvxWZEzynU4HPl3ZpC49CtKVxAkj550xnKgD6ILIs1PmEFLKv2PENrf6Am4JR1NxJ+FajVk6Ke9dupOU3QHhFsBtPR2iPLEjHmlw5tI1r8QANWFSPlsN0FJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907906; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xwqJgBYcOrqzsn6Uz+zENbJ1dQ1zJzkv1tuTOfCGPRI=; b=Z95ub+0XTHveMDbFO5hMeuYuhKNppGctWrzoFJCBpDIm1cp8T8URdG02AD0RuVqNdKNVrfwSMgBYOU6bnMjAE1AKh+/vqkmobTYafwtW6F9HfkUYs+3n6tWksnFKeVknUK87B65KejpXDaK8wgTTwJTYWtBZa6XoPfcxjMWwdiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178690790629890.89931955136058; Sun, 16 Aug 2026 12:18:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIV-0008NL-Cz; Sun, 16 Aug 2026 15:13:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIO-0008Kj-F9 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgII-0007GV-Qh for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:23 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-172-h3M1YAErNkKbH5dqVFvgRw-1; Sun, 16 Aug 2026 15:13:10 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AD6731800366; Sun, 16 Aug 2026 19:13:08 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C3FC423; Sun, 16 Aug 2026 19:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907593; 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=xwqJgBYcOrqzsn6Uz+zENbJ1dQ1zJzkv1tuTOfCGPRI=; b=MEhCX9VVA+c5wENfOXEy3haC52ZBDqg3PtcORBShjcui86B5DWWpUMbzQxx+NQ2W09OusI 868spDL3PCNZHCS53hfRZTDQTBAJx0u3JfTYtKSzfPtx/B5K4SEmWcHn/qDQQKol8FUzF+ C4vAGzu8TmqU+x709e6R7kWnT67ylGs= X-MC-Unique: h3M1YAErNkKbH5dqVFvgRw-1 X-Mimecast-MFC-AGG-ID: h3M1YAErNkKbH5dqVFvgRw_1786907589 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:30 +0400 Subject: [PATCH v3 03/49] hmp: fix snapshot_blkdev argument type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-3-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , "Dr. David Alan Gilbert" , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2272; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2agSZFonX9AReo2U/44kc7VY3Ymspa6PTHpu0NPMtnE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguw3d4F2iYCXZDV9q3UE4CMospkPv2f2CATQ aIVl5HzSwOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5Rw3EACPuy3PH1G7tRtCGh37AX3Z3xT62uqT08cjvt+6ZK7ln/fbQ3mWr7HkoxbfskEJCAdQ+NF 6t8uyLjCVNgyEz7rys/7DeosJbgtMkIlfFf23lQihn+F4UD9t/ap2GumCxx+ySa3B3XFrN0ZfiK ZShQSXBp+LbTs37useOAzgfddzKKRbSFsMNuiLWVWZEy1HG4v761NsOIfy0VEF4MD0b9WoA6bzf ogQ51A3Ylq0+HSP0gnVe/DxqPpH/rBXkQL4dYPZZzSnM2qQsDvGNQZQcXap6PxkVn2DH1kexXEQ PP08/KY2k4Y4aQ87ZLOlr5UVG1EPDbsv352fECXq7rwa18deH/Hvbwn0Gx6sxIdf78qUfsbkPoC DvZEFAvfbh4JxWQHdZEHodyDQX2hpsmVH1zCk7SdEWPql61An/K/xNlDvnTMW/oM1JOhmV4BvcO QBbWWWpK+JAmTWBoUOmLBxDSNQBhLZSbfDGqBJr86q7U8OzCS7j79aBD3kMP4A3GFbSxBBYCGvj pWRiNCwLvPAl90yQatfE4H2JmzFja9B5cFOh/qomAL9u8oy+dMipYqBNNyBN9iEWPoHJt+lx8qp 02Dre4CjXhmxtTqvJfppNladzkwuR0lfEm4RrpgJXVxZ4uF9TvnWZANC4TSwvc6skDEOoXtknM/ usL2SVagSFnFGag== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907906772158500 The `snapshot-file` argument for `snapshot_blkdev` is mandatory. Correct the `args_type` definition to reflect this. Fixes: 6106e2492fe ("qapi: Convert blockdev_snapshot_sync") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- block/monitor/block-hmp-cmds.c | 12 +----------- hmp-commands.hx | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 69ade0534f1c..39b82e8ef501 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -344,25 +344,15 @@ void hmp_block_job_complete(Monitor *mon, const QDict= *qdict) void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) { const char *device =3D qdict_get_str(qdict, "device"); - const char *filename =3D qdict_get_try_str(qdict, "snapshot-file"); + const char *filename =3D qdict_get_str(qdict, "snapshot-file"); const char *format =3D qdict_get_try_str(qdict, "format"); bool reuse =3D qdict_get_try_bool(qdict, "reuse", false); enum NewImageMode mode; Error *err =3D NULL; =20 - if (!filename) { - /* - * In the future, if 'snapshot-file' is not specified, the snapshot - * will be taken internally. Today it's actually required. - */ - error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file"); - goto end; - } - mode =3D reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PAT= HS; qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format, true, mode, &err); -end: hmp_handle_error(mon, err); } =20 diff --git a/hmp-commands.hx b/hmp-commands.hx index ea4a1db78f18..f0b8d8914c98 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1173,7 +1173,7 @@ ERST =20 { .name =3D "snapshot_blkdev", - .args_type =3D "reuse:-n,device:B,snapshot-file:s?,format:s?", + .args_type =3D "reuse:-n,device:B,snapshot-file:s,format:s?", .params =3D "[-n] device [new-image-file] [format]", .help =3D "initiates a live snapshot\n\t\t\t" "of device. If a new image file is specified, the\n\= t\t\t" --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907642; cv=none; d=zohomail.com; s=zohoarc; b=nMza5cuzB/9nb6JJHKZq+vdOaprynYIH6uP0ppjZ956vKVDPTD88/H0z04UFLwck8mYQyXl6Q5tGhC5h4YVY/oDpK3tj+xt2DAzxTj7cHJOOSlwekklZIUMwMzpaexvpwXrE57NT9BGI+A3AsT06Ng88ncyl6R7RDYJeaeZj9/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907642; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+5wpuBZXAGueWMmgc7XSO8gFuXPjkb9QB1fhiVwJj/Q=; b=ceoKc7uHJLC4MzW4dynDgbR9BnBfmzkabwzUoDBP6nL+MVtfIzVS7rtrzFEljD0MdH0xj/Ebv6K8kRMHLLDpEiFJoTzp5+GRU1ymfDtf9qghaLVKdJ5oxyZIZmtZIYQQJMdhQf03iG3FV2QWcp1iIfKY7XTj9Xoi56bGJdwVoiI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178690764243821.621711829621177; Sun, 16 Aug 2026 12:14:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIk-0008QX-O2; Sun, 16 Aug 2026 15:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIU-0008N3-0c for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIS-0007LA-73 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:29 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-8siE_Vi6M-287743nMDNgA-1; Sun, 16 Aug 2026 15:13:13 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BCF231800471; Sun, 16 Aug 2026 19:13:12 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7718718005BB; Sun, 16 Aug 2026 19:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907607; 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=+5wpuBZXAGueWMmgc7XSO8gFuXPjkb9QB1fhiVwJj/Q=; b=BDgHJUk1SNfLAikPqxYBUuh61njzdT2W8JOZkfmMwgq4O49uYBWI9A01eURfuXpkEY7MK9 XqXZS7CprrF1t1IWzaB1BTFD/Wce2hNAX0lb6RUJKJG4JqSffOaO5wLBIGhEMfI4LkeIge ec/lIgpG+26sbC/ty69/ucjHUqxrU5k= X-MC-Unique: 8siE_Vi6M-287743nMDNgA-1 X-Mimecast-MFC-AGG-ID: 8siE_Vi6M-287743nMDNgA_1786907592 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:31 +0400 Subject: [PATCH v3 04/49] target/i386: decouple cpu_x86_inject_mce() from Monitor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-4-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Zhao Liu , Marcelo Tosatti , kvm@vger.kernel.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7649; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=o/yEwsZkXnbE4yqKZMMJ1dRx5P6T3KLfXBYSN+saGmk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguw/K+6+Wb9ySL/wnYLu5qf6JBMHQdY2tXNP VxBIKL3BauJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5S6+D/9p5VmubM0NyBiQerNIxYrPJ3uhqE5TBYq5YReIM6GfwQ6g7aPmIf19hoYReKkQyPmr+aS dwMB3FvsB2H/hZiJqHn4DQo+7WeYIDdkLiNCem1jK2iIUKyExZo2G2CIzYHN55pVQ+OU2bffnPP xMVkbYv3eKVOZJBMm03FNwRfbeinpZ+XPgsAWytQ0F3Yc2DmVerK0UhhmWKWSd7ktWI9WaFfd0t ihitg+AY8oKUlfIUPslTKGqLJ+CN4qFZGzT29BaBHmLPnSa99SNrQm2l60dutYhMGsnEQNWHcu4 8HHWCulkyMz0RPtijPv+YYB9L3UEV/MjUMft203Q6yd+Yk5UMDuz6LoHJ3erzk8iquWqgHow/Tz aeeztJ126yNZRFbBWyTTJXookfh5iuvg02tsGrigewxx0xW+rkR+pmEM4c68eujaLfNlPBjBq5i Hmlp+gaLhjUOzl004g/KrS7ZNiP4GDb05eOy8qNJeNe7bbA3m4y+EJ+/vpdEarhy7SixYxrymI5 sLyjOUcvF21kExh7eayYhMR2/6769Vtg7r7ygcjLDcceFfer0BXnwf53edTmjo4teAP8acm55AR lQVNUIXIU/ThhS6ta9OQ0B4VDtNgDvx7GPcYXXd+WbvHrk2XCpjUpEYCMwwXGF4nj//upx9BDjK XSskOL3YhU9mfgA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907644668158500 Replace monitor_printf() error reporting with the standard **errp pattern. Drop the Monitor *mon parameter and return bool to indicate success, improving the function usage from non-HMP contexts. Update the KVM MCE injection path and hmp_mce() accordingly. Notes: - we may want to print the error in KVM path too Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/cpu.h | 4 ++-- target/i386/helper.c | 49 ++++++++++++++++++++++++++++-------------------= -- target/i386/kvm/kvm.c | 4 ++-- target/i386/monitor.c | 6 ++++-- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index e6a197602d87..4f342b69f471 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2847,9 +2847,9 @@ void do_cpu_init(X86CPU *cpu); #define MCE_INJECT_BROADCAST 1 #define MCE_INJECT_UNCOND_AO 2 =20 -void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank, +bool cpu_x86_inject_mce(X86CPU *cpu, int bank, uint64_t status, uint64_t mcg_status, uint64_t add= r, - uint64_t misc, int flags); + uint64_t misc, int flags, Error **errp); =20 uint32_t cpu_cc_compute_all(CPUX86State *env1); =20 diff --git a/target/i386/helper.c b/target/i386/helper.c index 683621416213..4133b5f244c6 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -18,6 +18,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "qapi/qapi-events-run-state.h" #include "cpu.h" #include "exec/cputlb.h" @@ -27,7 +28,6 @@ #ifndef CONFIG_USER_ONLY #include "system/hw_accel.h" #include "system/memory.h" -#include "monitor/monitor.h" #include "kvm/kvm_i386.h" #endif #include "qemu/log.h" @@ -381,7 +381,7 @@ out: } =20 typedef struct MCEInjectionParams { - Monitor *mon; + Error **errp; int bank; uint64_t status; uint64_t mcg_status; @@ -428,9 +428,9 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_= data data) * reporting is disabled */ if ((cenv->mcg_cap & MCG_CTL_P) && cenv->mcg_ctl !=3D ~(uint64_t)0= ) { - monitor_printf(params->mon, - "CPU %d: Uncorrected error reporting disabled\n= ", - cs->cpu_index); + error_setg(params->errp, + "CPU %d: Uncorrected error reporting disabled", + cs->cpu_index); return; } =20 @@ -439,10 +439,9 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu= _data data) * reporting is disabled for the bank */ if (banks[0] !=3D ~(uint64_t)0) { - monitor_printf(params->mon, - "CPU %d: Uncorrected error reporting disabled f= or" - " bank %d\n", - cs->cpu_index, params->bank); + error_setg(params->errp, + "CPU %d: Uncorrected error reporting disabled for bank %d", + cs->cpu_index, params->bank); return; } =20 @@ -459,7 +458,7 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_= data data) if (need_reset) { emit_guest_memory_failure(MEMORY_FAILURE_ACTION_RESET, ar, recursive); - monitor_printf(params->mon, "%s", msg); + error_setg(params->errp, "%s", msg); qemu_log_mask(CPU_LOG_RESET, "%s\n", msg); qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); return; @@ -488,14 +487,15 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cp= u_data data) emit_guest_memory_failure(MEMORY_FAILURE_ACTION_INJECT, ar, recursive); } =20 -void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank, +bool cpu_x86_inject_mce(X86CPU *cpu, int bank, uint64_t status, uint64_t mcg_status, uint64_t add= r, - uint64_t misc, int flags) + uint64_t misc, int flags, Error **errp) { + ERRP_GUARD(); CPUState *cs =3D CPU(cpu); CPUX86State *cenv =3D &cpu->env; MCEInjectionParams params =3D { - .mon =3D mon, + .errp =3D errp, .bank =3D bank, .status =3D status, .mcg_status =3D mcg_status, @@ -506,24 +506,27 @@ void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, in= t bank, unsigned bank_num =3D cenv->mcg_cap & 0xff; =20 if (!cenv->mcg_cap) { - monitor_printf(mon, "MCE injection not supported\n"); - return; + error_setg(errp, "MCE injection not supported"); + return false; } if (bank >=3D bank_num) { - monitor_printf(mon, "Invalid MCE bank number\n"); - return; + error_setg(errp, "Invalid MCE bank number"); + return false; } if (!(status & MCI_STATUS_VAL)) { - monitor_printf(mon, "Invalid MCE status code\n"); - return; + error_setg(errp, "Invalid MCE status code"); + return false; } if ((flags & MCE_INJECT_BROADCAST) && !cpu_x86_support_mca_broadcast(cenv)) { - monitor_printf(mon, "Guest CPU does not support MCA broadcast\n"); - return; + error_setg(errp, "Guest CPU does not support MCA broadcast"); + return false; } =20 run_on_cpu(cs, do_inject_x86_mce, RUN_ON_CPU_HOST_PTR(¶ms)); + if (*errp) { + return false; + } if (flags & MCE_INJECT_BROADCAST) { CPUState *other_cs; =20 @@ -537,8 +540,12 @@ void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int= bank, continue; } run_on_cpu(other_cs, do_inject_x86_mce, RUN_ON_CPU_HOST_PTR(&p= arams)); + if (*errp) { + return false; + } } } + return true; } =20 static inline target_ulong get_memio_eip(CPUX86State *env) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 644c45fb0a02..1eeadb99adac 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -748,8 +748,8 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, i= nt code) flags =3D 0; } =20 - cpu_x86_inject_mce(NULL, cpu, 9, status, mcg_status, paddr, - (MCM_ADDR_PHYS << 6) | 0xc, flags); + cpu_x86_inject_mce(cpu, 9, status, mcg_status, paddr, + (MCM_ADDR_PHYS << 6) | 0xc, flags, NULL); } =20 static void emit_hypervisor_memory_failure(MemoryFailureAction action, boo= l ar) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index a536712c755a..785a13dd7107 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -580,6 +580,7 @@ void hmp_mce(Monitor *mon, const QDict *qdict) uint64_t addr =3D qdict_get_int(qdict, "addr"); uint64_t misc =3D qdict_get_int(qdict, "misc"); int flags =3D MCE_INJECT_UNCOND_AO; + Error *err =3D NULL; =20 if (qdict_get_try_bool(qdict, "broadcast", false)) { flags |=3D MCE_INJECT_BROADCAST; @@ -587,7 +588,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict) cs =3D qemu_get_cpu(cpu_index); if (cs !=3D NULL) { cpu =3D X86_CPU(cs); - cpu_x86_inject_mce(mon, cpu, bank, status, mcg_status, addr, misc, - flags); + cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc, + flags, &err); + hmp_handle_error(mon, err); } } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907839; cv=none; d=zohomail.com; s=zohoarc; b=fqXJ5HNh/0FqAIyEVD/yCfxSVbIlC8dV1+ZsBPQFAciZe7gh3c8+EXXVFHJQLByx+MTYbmnEAy/aolPclsMlRVXx3jjhhrtIdaYKkpJHviMWi2cp+mNIlWlk8n3F0n0qXkULaNsd2Vl98wx06qSmtTPhiV7mW1knltmN3qONGLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907839; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ryj4j8cwb+L87RB5THQx359dU0bCD3EIL92GqKreHVI=; b=Xok2FmR9u8HGsSYUr7BU6izYL8qIDw1qwWxoXdWGDZQZL9N7lb6GdKPWN33Wo6WVBvUA8900Ahf1bNefb7+1ABtf46yykeCgkJUaQunu5T1Iph3bnw5Ciatg8dVnfVHLFKowTe+D8NyngXOqO2ZhQKX0mHmIHtPgQlNee0vuRCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907839625329.76254194878356; Sun, 16 Aug 2026 12:17:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIZ-0008NV-01; Sun, 16 Aug 2026 15:13:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIO-0008Kh-EM for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIK-0007Hq-Tb for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:23 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-355-KVXtn_asMoeoWKj5HxfNsA-1; Sun, 16 Aug 2026 15:13:17 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2BF9618004A9; Sun, 16 Aug 2026 19:13:16 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BC1918005BD; Sun, 16 Aug 2026 19:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907599; 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=ryj4j8cwb+L87RB5THQx359dU0bCD3EIL92GqKreHVI=; b=VglvaMB1mIIvqL07p/XWWXA0SIHYNsX/L7TcNbRCR0LbNKLscHbiLajCcHNsVYfhl0lvA3 mGAKIj1ZyOhI1td9d1J1ufXucp+aUVl2cYaSodHPosygNnpgvSeV4d2vwcGyqdN4nzzrae FatkGFJvV8taKFQhEivyO0r75/a095I= X-MC-Unique: KVXtn_asMoeoWKj5HxfNsA-1 X-Mimecast-MFC-AGG-ID: KVXtn_asMoeoWKj5HxfNsA_1786907596 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:32 +0400 Subject: [PATCH v3 05/49] target/i386: return an error for invalid CPU in hmp_mce() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-5-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1062; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TKMHsISeJFnOg9PU9gqpis8lZrnYbUihXFpgcYqdi0w=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwZtExIYvtqBlpUM2ZCcMdXuU1TQdSl0nbD ft0JxNV+QmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5aJ8EACQlLFUtB76czn0TH8+B6lkqCawWnN6mqikLSB2U1AMhyEsHqmNHjh/IpP4AFBcKHvbIkL 65pZZmBIeFPpcZy1kZgOwOBU4iYONKpVXgUTd9lBu7C+pExo73e9yPtv34VMrhItTgnZN+GY/j9 9pIPBOt7K3JPfLtykXZxFSt2iqp9QuC16R2W6qE2JdaNl3XjQmClSzqQ2tXi7UYmhZmifyFrgH3 IkR7B8aAcG7XAJHjBtuGBOaDUv0zXwFeGbS9IZeVazzbc+cVv+Zr8w6jmrSqTFBZVZMIY7AjKIk mFgJKEu3iXvzS2mmjbn4+idOHNNLTs7Lb6fpDX7+8Bv2UI25CcAX79LGLm1idx2s3+mM6IjG1yx T6RIk2YdcXNUSCm5ZgUaGSDDPvDIeqYpkOdFdxMzB3U48Uyy/XNbtXMcLUJalpXjCUohCS0HQyP 5dkpiWrGRC7QkvzBCu7qHocsXn9JV+GIs8jwRo+7ds5Z5gmHJHin2XgFFB4WlfKYE0aNP1jkiBG Z9ZcOKbz31egB54aQtV1GLXfPNYBki0ul/Q0Vqrmn7rRV2/D0jI9lfNwa+I3M8Q2CDY6yG91jnn 97XK/iLsJazMU0vXffvMKTOIhVTcf/B7e6+hC/HvJlg2GL9ZvJC17Vo1Q8qjRzVYEtyLedAKy1H YOBVtNJWU0+h7gA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907840529158500 Rather than silently doing nothing. Suggested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 785a13dd7107..9ed772e6d7f2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -586,10 +586,12 @@ void hmp_mce(Monitor *mon, const QDict *qdict) flags |=3D MCE_INJECT_BROADCAST; } cs =3D qemu_get_cpu(cpu_index); - if (cs !=3D NULL) { + if (cs) { cpu =3D X86_CPU(cs); cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc, flags, &err); - hmp_handle_error(mon, err); + } else { + error_setg(&err, "Invalid CPU %d", cpu_index); } + hmp_handle_error(mon, err); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907679; cv=none; d=zohomail.com; s=zohoarc; b=GmTPdH0lUEY8y9ZoJn76nmBhNoF4QrqOBH3nBr/4+utO4AE6HAOt6sWXyCEsnAWn+vbzY7jGSiVAwH527pfH0CzA8YKDLklnRHai9s8YE6V4qw7F0UVMM3VP0hUCACxlPRnSvxDTeMSV7pAp062SGSDJLx3d+v5nM/C4qlEgIJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907679; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l6kUigrlIhW5lDQflJBIlNr7RimcAGbj2MbyqJLdEI4=; b=gl3X5tdgbafGFQ2nyQooCr4VEOtqjo0f9fGdjOQhDMcp8jvvs+Gm4+PhkPz2DzQbLdv59Le7JpxtUdU2mINcohwBY4Q5o/G+lbLWbx8rCTjYWvV26/1yzGJZjD6VzfmtglkhbK69JEA27yeLeRF0Wr6od1J732Q2+GW/YzU2BLI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907679566607.2284927949676; Sun, 16 Aug 2026 12:14:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIw-00008D-7n; Sun, 16 Aug 2026 15:13:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIS-0008Mc-9Z for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIQ-0007KH-7O for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:28 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-I6NqQiiZPFSZ3mcSr-vKhQ-1; Sun, 16 Aug 2026 15:13:21 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 42FB0180034F; Sun, 16 Aug 2026 19:13:20 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E77FD18005BB; Sun, 16 Aug 2026 19:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907605; 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=l6kUigrlIhW5lDQflJBIlNr7RimcAGbj2MbyqJLdEI4=; b=C7MsXkAczPNH1VJCuzhZL2Yr6CzEwu7qiqheIKrJ4I0NDfFudE/c/LjfKelVztLJAYlStu ntFO7QUN0EqAOh4Zu1Q0z/0+WVDwiCy7Ksk5f6tfLOphSeDEhHl1x6K9QTgQuHH7bHjpp6 A0iRQEEGBH55c5TApF9Kf1m4IpFkYPE= X-MC-Unique: I6NqQiiZPFSZ3mcSr-vKhQ-1 X-Mimecast-MFC-AGG-ID: I6NqQiiZPFSZ3mcSr-vKhQ_1786907600 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:33 +0400 Subject: [PATCH v3 06/49] system: move gpa2hva() to system memory unit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-6-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Peter Xu , "Dr. David Alan Gilbert" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=4376; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UkN1HvNZWl3MPBsr0N0lhRKtt1UrsfqkUkLxVSggBA4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwUrb9P1SPZlHh6ucauDTbvekfPt7jWriNA FbXtzbbi++JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5bC/D/9mlkFvDEfO/4ztvtYRKmLr529qN75cJiDOJmvE9UTPRJOJpnQtfSXLw/fTAq/JACnCvb4 chC6LVkDiIvaDb/epjEZE4wxc6WUm045XqD8dl/V+8oyd1+DicdvrIXZ+fmZGTTvaaMVmtsKX+C tfw2zfPwNeTwIDpQ1UIX2WI82yGshu4W5G211g5CULZkVsfFjuPzSC477x9Vo49uYHCRQP5XF6r dlA3ph8FwE1W6pYFXP03g8kNlwgvNqpy8tiby+k6Tv7gYpPAt1GvEmY+3HEwPIVhqKczT+1dU5A NmDrilSDkpRXXmt3iGrMYoWlMDskqfc5GFGKf7/QKpYqugwQyv6uULsEEgybCsljIIbq/PoJxIc uIIMGKhA5FMCjV9HnThd9Yx2ILlN6fhCsINQhYGuGlcDofZ6+dOY2vVAdjiCYe47hUwJc5pxU5R O7HhgrdWzCbr1jzXRIG8C4uDz7XH5ssy0NxbuTKVozqB7WhAfEHWDg497lcGCsSNbEyHYC3PkC9 lcNQ/emr/9ChfeiyOy0zlSyjvnzNTn5QzbOxTJ2V2Z4dcfdIadeXUDka9uz9aDCU7Smc72RoGoQ A6sPTwMr/IvIS9R4tm7dybeVWxVFFFsVxVuZWDWvYf6AXLlsE1GEpqujC9wtEONJa1XzNydwfle xnH5fbdGgqkMrJg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907680022158500 The function is now used by SEV code path. Move it to physmem.c rather than hmp-cmds.c. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/monitor/monitor.h | 2 -- include/system/memory.h | 2 ++ monitor/hmp-cmds.c | 31 ------------------------------- system/physmem.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 54134f2aa4fc..9f048ba103b5 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -53,8 +53,6 @@ int monitor_get_cpu_index(Monitor *mon); int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); =20 -void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p); - void monitor_read_command(MonitorHMP *hmp, int show_prompt); int monitor_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, void *opaque); diff --git a/include/system/memory.h b/include/system/memory.h index 1dc761058f52..a7e03fc3e7c3 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -2860,4 +2860,6 @@ bool ram_block_discard_is_required(void); void ram_block_add_cpr_blocker(RAMBlock *rb, Error **errp); void ram_block_del_cpr_blocker(RAMBlock *rb); =20 +void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p); + #endif diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 4e8d996dbb5b..6b1114fdaf13 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -712,37 +712,6 @@ void hmp_physical_memory_dump(Monitor *mon, const QDic= t *qdict) memory_dump(mon, count, format, size, addr, true); } =20 -void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p) -{ - Int128 gpa_region_size; - MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), - addr, size); - - if (!mrs.mr) { - error_setg(errp, - "No memory is mapped at address 0x%" HWADDR_PRIx, addr); - return NULL; - } - - if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) { - error_setg(errp, - "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr= ); - memory_region_unref(mrs.mr); - return NULL; - } - - gpa_region_size =3D int128_make64(size); - if (int128_lt(mrs.size, gpa_region_size)) { - error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx - " exceeded.", addr); - memory_region_unref(mrs.mr); - return NULL; - } - - *p_mr =3D mrs.mr; - return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); -} - void hmp_gpa2hva(Monitor *mon, const QDict *qdict) { hwaddr addr =3D qdict_get_int(qdict, "addr"); diff --git a/system/physmem.c b/system/physmem.c index 362a00f76c03..a4a6a4710c64 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -4534,3 +4534,34 @@ void ram_block_del_cpr_blocker(RAMBlock *rb) { migrate_del_blocker(&rb->cpr_blocker); } + +void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p) +{ + Int128 gpa_region_size; + MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), + addr, size); + + if (!mrs.mr) { + error_setg(errp, + "No memory is mapped at address 0x%" HWADDR_PRIx, addr); + return NULL; + } + + if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) { + error_setg(errp, + "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr= ); + memory_region_unref(mrs.mr); + return NULL; + } + + gpa_region_size =3D int128_make64(size); + if (int128_lt(mrs.size, gpa_region_size)) { + error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx + " exceeded.", addr); + memory_region_unref(mrs.mr); + return NULL; + } + + *p_mr =3D mrs.mr; + return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); +} --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907666; cv=none; d=zohomail.com; s=zohoarc; b=AEpPebiUXJ04q3or6UcXfOpKRemJs/EyEyGzqgqsfJfS4N9KjLmR7lszTafFHyaLm/Uce+x9um813PBb+GA9kAjbMPoF+28YyohHd/p58bcnZlLoCIw2HK1aN8xgIbQV+ySgAT84CF3RBfdIwwYdbvmGqgFlGsl4soe7PPLV/hk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907666; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TjP6IZyL1wZfBA11ddnUfYEtbz1AdcHT+GDTQx9g4qQ=; b=jvchs6CXJ/CuAEQaql0QDsXt9+8QI8PJb8cA8sxDMFssM3EbKnBxZ7ciLMDvpnaBbQN1s2qeU5Kh6k4C6qAqi60SUcHo1lHb7zpgm134wWwgqN2dPtoaG7PaKnM5ijKf0K/oSh3WdDC54C+cfwAtL+iGEkgsua+jUHWhRXQolJk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907666079261.2380151038136; Sun, 16 Aug 2026 12:14:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIg-0008Pv-Rm; Sun, 16 Aug 2026 15:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIZ-0008Os-Jh for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIV-0007MI-Jy for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:32 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-VZJe16jSPVO0ycrvDK6Pmw-1; Sun, 16 Aug 2026 15:13:26 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 928BD195608B; Sun, 16 Aug 2026 19:13:23 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7F94A195608A; Sun, 16 Aug 2026 19:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907610; 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=TjP6IZyL1wZfBA11ddnUfYEtbz1AdcHT+GDTQx9g4qQ=; b=KN2gN42ZsHtxWsFxU7UDckiqR+V8qwMZTsF3j4F4t+X6JbKluXNrPJXTJo8sIIuHdKJtYT cZA9CxqUvdkySHb2/GC9E9ZN++qWRiMts0QoVOoYFnwaJmsR5ZlMDUjBwVlYUSFhmwHqFY vgVpipojAuQuwH4EU3YGbIjdfq9Glho= X-MC-Unique: VZJe16jSPVO0ycrvDK6Pmw-1 X-Mimecast-MFC-AGG-ID: VZJe16jSPVO0ycrvDK6Pmw_1786907603 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:34 +0400 Subject: [PATCH v3 07/49] system: decouple qmp_inject_nmi() from Monitor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-7-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , Zhao Liu X-Developer-Signature: v=1; a=openpgp-sha256; l=1181; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=I1/fzKLWiT+n3BHD7LJOXQzdIK2ISEvPZsiae/7j/8o=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwvSwMDYDaej4u5U9kayz/8WRUR9E5khFPd IAWC7/JLDeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5RI0D/9fetknzWA2oQvv3XSS4psa7S2GxcEDucsXB5F8m5i8gkTXH0XYG0W9yJeDfzRxMyIJ7e0 0IH6rt3I7S+n7ds39mXJE+CXwSItR1jUWaHXpr0t2E5yPJfN6BXY4X5hYjVN4vKtLnUbvL6m6P4 pB4FoPMKa1zD4NXArkC0zvkJAiu3ifX/CngjnVYUcDOC4aTXQzvSancbDC49P8NmuxJ3d8J7uPp hC2sbU27w1nt4u0pMtkxjOlT1IbBMaVPHg9JRX0K1X0X02mxsljV2nLYbHXHtH5UwpZ1l/+Qt5C U7X4EPSQOiIRCjCPTW2u531BMvi/dwWeVf1meZ/6nx4vv6iRPEQTUQs5L9kYk4hMpL7r5kNN/YJ EQFXEGmcmSZq2+XaBrKvUln4vKlqA+1m+5ihJhWMWWH7Zpc9lj9/MZeFf7x7sBhRDCVry1w2Ail rbytc/ICUq6D5rM4xCKz5fzPIFadByHCuoVc2goyGad3fyIxnHDabyYQ0dcXqnUYzbVn2LQ3ISv gHQYev/UCNxWq0QvUtbxG4tKdb7/RUBxavpIyhWSAlF0hNts9tnLrjc9XqbrxkM6iP/yhVyT8OJ bE8sJAvuzWI8iQp0+mjkBtx4JZZrKsAaTcSGVFnvW4zRouEXIyTyrew2H81H/DWek0sOnIhHarQ tm2HFnTxiRt2PRg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907668427158500 Use first_cpu directly instead of going through monitor_get_cpu_index(), as this is HMP-territory. QMP doesn't have a `cpu` command, we should add arguments instead when needed. Update the inject-nmi doc to accurately describe per-architecture NMI delivery. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/machine.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 2d63c1bac3b4..29ab1cb9d7f4 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -432,10 +432,10 @@ ## # @inject-nmi: # -# Injects a Non-Maskable Interrupt (machine specific: for example on -# s390x CCW only the first vCPU receives the NMI, but on x86 machines -# all vCPUs receive it). The command fails when the guest doesn't -# support injecting. +# Injects a Non-Maskable Interrupt into the virtual machine. The NMI +# is delivered to all vCPUs (x86, hppa, ppc64) or to the first vCPU +# (s390). The command fails when the guest doesn't support +# injecting. # # Since: 0.14 # --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907667; cv=none; d=zohomail.com; s=zohoarc; b=NXpJ/nvHg8xYj2nG8+PqkJZHSFx/QojrmTYPZr8q0qv7tb72ZjOxy6ujQTE2XZq6pgtHTNczypF0xu9pV536mOL1Os9fub4Ur2Awj75mFnMo7683PpzhB6V2VqiGTuLd7rK8DWNQGrJiVxnCYDF8y6vvSteAXgCQaJwNHzkakio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907667; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZJQnMGT3qPvOFeMDZSH+QYBFaicXbP9+52KZazx/GNM=; b=kCGCqOPPcT0AqcvK03rFqs7MMbWLMMScd9Mcgh9Cq6tAMYScfHnLd9rYUHUM5+oBpfIfBhX+yIPfWFWSZ/30YsXuUtH4eRNhiOUxT0aAyiAz8kPm+V0csYp3ls53cPfjM7Sg+utebz/OR10RByy409sqxF0WKVFxY1HG1KF21MU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907666976309.18045064998785; Sun, 16 Aug 2026 12:14:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJA-0000TI-5M; Sun, 16 Aug 2026 15:14:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIb-0008PV-FK for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIW-0007Ma-D7 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:36 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-MJdn2pyDNbOEVqHQnMaYoA-1; Sun, 16 Aug 2026 15:13:28 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A927180028A; Sun, 16 Aug 2026 19:13:27 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 42677423; Sun, 16 Aug 2026 19:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907611; 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=ZJQnMGT3qPvOFeMDZSH+QYBFaicXbP9+52KZazx/GNM=; b=TJfASx5EAE01gM7TdD+lzOYRw1FFhxuox/X8KVnKzPlPKjoEp01cwEK/Pm5HMhiOwKM97L DhZ7Tfx/C8AQx/n27A8M9xxD0snSyF9crihkjq5WwmGa1EDwCotwsbLQuFMv5H2Z3jdsKM Kb8qMP9etoNd9F0Vp6/QtrOS9zrJEGc= X-MC-Unique: MJdn2pyDNbOEVqHQnMaYoA-1 X-Mimecast-MFC-AGG-ID: MJdn2pyDNbOEVqHQnMaYoA_1786907607 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:35 +0400 Subject: [PATCH v3 08/49] monitor: move HMP-only fields from Monitor to MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-8-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=5135; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=wkR8gnQD/9TIbnh3sLfGrwv66uEiNuUKUoUzahWjols=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwAvNs5y5rPlLID73V7+WROK2fHVrtKyYKw ncVYHrcdb6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5Z+JD/oDlwSUbzSbtiPR9ULDb4Y+8P+vHYyZRLw1HdciZ+GBXxwcpVLM8O7eQyRJsezu+z03BMh zD5otcKbFFD3pq0c5Fozz4CrUFIxSqIfYzdg9e1Ae9goQ1yNFwKVhnopxC0BvBxNRSScbxXCcgF 88sokqwFxC6z2tI60wlyN+gkCnRmWGZ/CFiP6J7UXF8mrb9DpwNXRFMvHOodbOuErzYzdYm9NBt CCbMppWdHU/rhZ6pZn0RuiIKPC3cU4HSDZT34JFnd7ET3ZvAEN3SiKEsld8dST2nxow83dlIIAR 2ZSiRLmB7mdj0qZz/1PvN9vjvQyo+pmuuwpuN796920yRFpgclQT3fbBSLevMAm3n/D9q1L9IMg jC1hcNViUfdg6HZXD+dy+3o1hmf43GqcgoUUMAGEClEh4mo5jnO4p4xxppCjHGdMnO0KSr0onsJ R16KrabA5hFvZDcAdoQX7DtVhdCJ+4ZQATy0oxUlYyQxfLoi1pnfRq9NDUXY9567Zd6h3y7bhkq t/ntC167WCJOyETCNwDVXY28Rd5sGWPvLmjI6oka+3q+uqB15jl7F3X5TEdfVgyIP5HaqwjyQWq rX49lWLK8DFn551tz6zky0/kQfriT8HCacWtYv3c6V9/CYPfVgHlkbc+fe1fhsWKkCoU+cabIuq vojw1N/lWhu8VJA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907668477158500 mon_cpu_path and reset_seen are only used by HMP monitors; move them from the base Monitor struct into MonitorHMP to properly encapsulate HMP-specific state. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- monitor/hmp-cmds.c | 16 +++++++++------- monitor/hmp.c | 9 +++++---- monitor/monitor-internal.h | 4 ++-- monitor/monitor.c | 1 - 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 6b1114fdaf13..6718fec97047 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -499,31 +499,33 @@ void hmp_dumpdtb(Monitor *mon, const QDict *qdict) /* Set the current CPU defined by the user. Callers must hold BQL. */ int monitor_set_cpu(Monitor *mon, int cpu_index) { + MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu; =20 cpu =3D qemu_get_cpu(cpu_index); if (cpu =3D=3D NULL) { return -1; } - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); + g_free(hmp_mon->mon_cpu_path); + hmp_mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); return 0; } =20 /* Callers must hold BQL. */ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize) { + MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu =3D NULL; =20 - if (mon->mon_cpu_path) { - cpu =3D (CPUState *) object_resolve_path_type(mon->mon_cpu_path, + if (hmp_mon->mon_cpu_path) { + cpu =3D (CPUState *) object_resolve_path_type(hmp_mon->mon_cpu_pat= h, TYPE_CPU, NULL); if (!cpu) { - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D NULL; + g_free(hmp_mon->mon_cpu_path); + hmp_mon->mon_cpu_path =3D NULL; } } - if (!mon->mon_cpu_path) { + if (!hmp_mon->mon_cpu_path) { if (!first_cpu) { return NULL; } diff --git a/monitor/hmp.c b/monitor/hmp.c index 22b1972d346a..8134dfaad4bb 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -50,6 +50,7 @@ OBJECT_DEFINE_TYPE(MonitorHMP, monitor_hmp, MONITOR_HMP, = MONITOR); static void monitor_hmp_finalize(Object *obj) { MonitorHMP *hmp =3D MONITOR_HMP(obj); + g_free(hmp->mon_cpu_path); if (hmp->rs) { readline_free(hmp->rs); } @@ -112,8 +113,8 @@ int monitor_hmp_vprintf(Monitor *mon, const char *fmt, = va_list ap) static void monitor_hmp_accept_input(Monitor *mon) { qemu_mutex_lock(&mon->mon_lock); - if (mon->reset_seen) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); + MonitorHMP *hmp =3D MONITOR_HMP(mon); + if (hmp->reset_seen) { assert(hmp->rs); readline_restart(hmp->rs); qemu_chr_fe_accept_input(&mon->chr); @@ -1556,7 +1557,7 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) case CHR_EVENT_MUX_OUT: qemu_mutex_lock(&mon->mon_lock); if (!mon->mux_out) { - if (mon->reset_seen && !mon->suspend_cnt) { + if (hmp->reset_seen && !mon->suspend_cnt) { monitor_puts_locked(mon, "\n"); } else { monitor_flush_locked(mon); @@ -1573,7 +1574,7 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); qemu_mutex_lock(&mon->mon_lock); - mon->reset_seen =3D 1; + hmp->reset_seen =3D 1; if (!mon->mux_out && hmp->use_readline) { /* Suspend-resume forces the prompt to be printed. */ monitor_suspend(mon); diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index e0a124a317a5..fdeeeb853636 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -137,7 +137,6 @@ struct Monitor { CharFrontend chr; int suspend_cnt; /* Needs to be accessed atomically */ QEMUBH *accept_input_bh; /* persistent BH for monitor_accept_input = */ - char *mon_cpu_path; QTAILQ_ENTRY(Monitor) entry; =20 /* @@ -153,7 +152,6 @@ struct Monitor { GString *outbuf; guint out_watch; int mux_out; - int reset_seen; }; =20 struct MonitorHMPClass { @@ -170,6 +168,8 @@ struct MonitorHMP { * These members can be safely accessed without locks. */ ReadLineState *rs; + char *mon_cpu_path; + int reset_seen; }; =20 struct MonitorQMPClass { diff --git a/monitor/monitor.c b/monitor/monitor.c index 6af09f2f6eac..6d6ffbb0f78a 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -89,7 +89,6 @@ static void monitor_finalize(Object *obj) qemu_bh_delete(mon->accept_input_bh); } g_free(mon->chardev_id); - g_free(mon->mon_cpu_path); qemu_chr_fe_deinit(&mon->chr, false); g_string_free(mon->outbuf, true); qemu_mutex_destroy(&mon->mon_lock); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907642; cv=none; d=zohomail.com; s=zohoarc; b=gZGuscI7bBKC7TkQ5KNRrF7bYZgncQ88zQjJ+OQqpgBRaBb5T0f3OCGMr+ZCJ50q+jnRqad7y/vIMwNvN4v0/jO6sCWRR61/4lYPNd2hDS6+yGMqlEoUNbBvkqUYuuY/r/HlyzaDDti+Hxj7BDp9mAwpSWCuu8LNHxFBSVKNsQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907642; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SQ3k0bOKS5GQKJg6KQ1y4RmKrPluHHk47PS3dTfcuK0=; b=FtymLODRBsf3jWvtLh4G4xmU2xZyaq30kdpLbJJLe+apjezvIfcdkVz/Ql+WUIu5VDqoI8BoyYfWM6124RrEbA7Rp9ZFxcrdYuKdSVhrbpQYNOCJZLiIXvVz8jd+tT7adXTm9IDcM/5vZhDq05mXbmbgWJYPCbFXlMFrsThNvBY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907642453537.7392091257769; Sun, 16 Aug 2026 12:14:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgIg-0008Q7-TY; Sun, 16 Aug 2026 15:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIb-0008PW-Fl for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIZ-0007N0-Au for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:36 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-XA3-cFr2OjaXlfYezbIFUw-1; Sun, 16 Aug 2026 15:13:31 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9901C1800471; Sun, 16 Aug 2026 19:13:30 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3891195608A; Sun, 16 Aug 2026 19:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907613; 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=SQ3k0bOKS5GQKJg6KQ1y4RmKrPluHHk47PS3dTfcuK0=; b=Ju48hxyiuKFy4fBbX1Z47gTp3Tk39Bk/sVQq37fotc75VcyQRgnqPXNe+rGDQwvcbyUz6G eypDjToG6UPFUF/Aqlj0u3bpo1AwzpChQ8syfbTAeLgsBYJyscxtcmUQawwEV0fy6S/u4I PvUbvWoBQiSf8oy89WMZalkPWWFYbGc= X-MC-Unique: XA3-cFr2OjaXlfYezbIFUw-1 X-Mimecast-MFC-AGG-ID: XA3-cFr2OjaXlfYezbIFUw_1786907610 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:36 +0400 Subject: [PATCH v3 09/49] tests/functional: use query-version QMP command instead of HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-9-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1415; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=E12bnf1BnZYcd0xThQbrRXQW65sQtsWdYsKbNPUWaYA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwSy2zHKpRBjLGI1wyFExGyKY4WbVVpXVEy MyLFbkcU3WJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5UanD/99stKWn8ev0/PxOkHsHV+5zDOyIpWg9nz5HI7IWZPJTXBy4xzD9kyJWCjAZVPy5EQDI88 ejiUGKFD/1JxR2qEPGaotKy/5a4ROMlk4bazCN+qHdZSJLSvonuT6uhVL75tMrmgUrpnE6KFNzT qhAeHANRo2QHvnJ/aNj1U/JJBoWxYvUwuPW5dcX/j0IuCF8eYbJnMVaSQU+VKBCbU6htLE/XNZy xYRNtpGcC9/BwdL6wzJW2moHUa1OeXJcUqPssXZC+HNRfVMtS4V0MbrMVL5rKd/x7zP18Mi/u4Y EouEQvx3iF8qmE6Guo3qtTbsW0P9gfupXamfV4ZSnH3mQwPgre7nczTuY18/fDwzVM6DyHPuXM0 OQ3a8KeB+C0QwkbZ4fIiEuH4szVvoGlShgh1GKVBGfsqwUy9MPRJx3m6j5b49p9RIsIw/z14OFr W4jvyGjvn/KdB2T0MXNmJsmlSQp8/T+NdduffMdh2+OH3N+z8Up2LJpAsUNmTyEHV96Tjf6+FWP FMyrsZZC82txnSWbcbVpdRXjt4C0LtJCLOElOt3nbdz+eJwGKzyWf7C3SFJWxRO9msKnQVjxhl1 9cD9BYGGSAJmGXahWFHfoVuSk7MsSlggA6HNJvgWZdBSfRb1SrAHCJrVnDX2Z3nlsDVTeC05fgR aQx8rvSq6dPmc2w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907644614158500 Replace the human-monitor-command based version test with the native QMP query-version command, which returns structured version data. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/functional/generic/test_version.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/functional/generic/test_version.py b/tests/functional/ge= neric/test_version.py index 3ab3b67f7e39..7764424826e0 100755 --- a/tests/functional/generic/test_version.py +++ b/tests/functional/generic/test_version.py @@ -16,13 +16,15 @@ =20 class Version(QemuSystemTest): =20 - def test_qmp_human_info_version(self): + def test_qmp_query_version(self): self.set_machine('none') self.vm.add_args('-nodefaults') self.vm.launch() - res =3D self.vm.cmd('human-monitor-command', - command_line=3D'info version') - self.assertRegex(res, r'^(\d+\.\d+\.\d)') + res =3D self.vm.cmd('query-version') + version =3D res['qemu'] + self.assertIsInstance(version['major'], int) + self.assertIsInstance(version['minor'], int) + self.assertIsInstance(version['micro'], int) =20 if __name__ =3D=3D '__main__': QemuSystemTest.main() --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907840; cv=none; d=zohomail.com; s=zohoarc; b=ZiqFG4IFsoSaS1rvgtn8ZaF0NtJyY1yLeWa1DWNoNsAq6/vX22/SBT+p8d9FYfFBVYTGYIAAJ0Z5+FShGedYDEEvw/2hiTKrs2G3uzwic+EshVdVntPfxU4xFLxtx5wPuPc1OVckenVI+5S7lGwAhkHzMuGZ6Gg/pIRZI1/AlKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907840; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=A5rJL39r60/35LZLysmBCrpC68JHwhbcZtjRUJEvMqk=; b=h6VTzW0z9JSjLWcMedXAUCAtaeACUTsd2t7FLJAwgZ7mWNMISJc/DT9JiSD95n7kOJRyEiI9AoAqicJ0EzsCb9jo+khkSPyrK2zxeRZcNDy3vYvLdWTj7rx3KpNxWI0pkBZO0G25oHw80bzfzGzwc3c1px/VJ3E6E0qQ+Be1O2o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907840805992.474962287064; Sun, 16 Aug 2026 12:17:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJ3-0000IY-TX; Sun, 16 Aug 2026 15:14:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIf-0008Pt-4r for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgId-0007PG-Nq for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:40 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-o4ufYitaM5yP7ykAbqC23w-1; Sun, 16 Aug 2026 15:13:35 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 573D61956045; Sun, 16 Aug 2026 19:13:34 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 51133180049F; Sun, 16 Aug 2026 19:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907619; 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=A5rJL39r60/35LZLysmBCrpC68JHwhbcZtjRUJEvMqk=; b=OgYGmsuMZp0xYyear4hrQU6ODMOiAKVAbq5wfc4Bf8cD7tZn65B9Nvg7bBCwU/XkYoe971 xmGH8IRpEeBgazWD3PjZ4s2CJ2FEuzrAl1mkztSeKVzZ5mC8ILBS12M0sgtcuxG1E226Be pU8ccD8INOZ/P+cIGPCE9J/SVG+Xy/w= X-MC-Unique: o4ufYitaM5yP7ykAbqC23w-1 X-Mimecast-MFC-AGG-ID: o4ufYitaM5yP7ykAbqC23w_1786907614 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:37 +0400 Subject: [PATCH v3 10/49] net/qapi: add x-query-usernet command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-10-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Samuel Thibault , Jason Wang , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=3816; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=f+pBY7K9E3HdtzS9Ahsq3e8j7aQZanCIxcPzFBfxZu8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwf6twXMbLLOs22e7iDkQKeHSfBU5rukgAB xl7DxIJs6KJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5WoKD/9eJbLLcT0N9aQ2Uj7FFs3JmX1qGP7a7AETFM5cEIG+Rq4LMNRCWFvmBrg8g2NVPSHuKhz VI1ZVbjfrJiZls9TUPxjLkE4m35e3CRyK/crtKcuupdzRLKmc9cDsilA4p2V0x0efSB4SsIeoqJ 3jSW8TumYTCZZ9oRfbI3+uu2oBAxiBZ8xbFrWBNdOOuVaY4bSlzKgxUGZABRgncYrZOLhhzo7zN 7jDxDu96E9PA0Ju+qQKnDg2iATjc9Z/eq5oia13l3CoUqDo/A3nlcvC8tLpN/W58BATnilpnNsR vdb4Z46BP/+OQtff769C+WSbM6X+KvGVpTav4hv02Hk1d7wMSEH32yLIiyYDqYrBSRfsJ/trWYb xUhlBgA4a6fw1pd63YEb7EBeLbzFdybrzs4lSCCTEpH6Ggq7PEzBnPWUx6Ky9mOtcFy38KeMIY/ gSY3dd23xrznPmLh+qyTuh0YKi5+ctP7dnAqiHiMRtsNnvHVKNXba2yVibi7LtYSBECk/PU2GMT +P92+D13K7Bdae7gXSZDfnWV94qKGta9rnegZisDp/tJC7xXin2bQfj2KyYS6fNWw05RlHh+dw/ 7yiI5HaZfjFUY4wnCgLYYfvFu4nsEc0ZNNa34alcpOwyS2Bk9JfmrbzPdTheyuSvUOWxs0N5t8v k0Deb4nPCkIsAwg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907842605158500 Add a QMP command to query user-mode network stack (slirp) connection states, providing a structured alternative to "info usernet" HMP. The new command returns a list of UsernetInfo, with hub-id, hub-name, and connection info for each slirp stack. It is marked unstable as it is meant for debugging. Rewrite hmp_info_usernet() as a thin wrapper over qmp_x_query_usernet() so the HMP and QMP paths share the same implementation. This is part of the effort to decouple HMP from QEMU core. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- net/slirp.c | 34 ++++++++++++++++++++++++++++------ qapi/net.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 9e9941fe73e7..517dd23be14b 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -43,6 +43,7 @@ #include "system/system.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "qapi/qapi-commands-net.h" #include "qobject/qdict.h" #include "util.h" #include "migration/register.h" @@ -1200,18 +1201,39 @@ static int slirp_guestfwd(SlirpState *s, const char= *config_str, Error **errp) return -1; } =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict) +UsernetInfoList *qmp_x_query_usernet(Error **errp) { + UsernetInfoList *head =3D NULL, **tail =3D &head; SlirpState *s; =20 QTAILQ_FOREACH(s, &slirp_stacks, entry) { + UsernetInfo *ui =3D g_new0(UsernetInfo, 1); int id; - bool got_hub_id =3D net_hub_id_for_client(&s->nc, &id) =3D=3D 0; - char *info =3D slirp_connection_info(s->slirp); + + if (net_hub_id_for_client(&s->nc, &id) =3D=3D 0) { + ui->has_hub_id =3D true; + ui->hub_id =3D id; + } + ui->hub_name =3D g_strdup(s->nc.name); + ui->info =3D slirp_connection_info(s->slirp); + + QAPI_LIST_APPEND(tail, ui); + } + + return head; +} + +void hmp_info_usernet(Monitor *mon, const QDict *qdict) +{ + g_autoptr(UsernetInfoList) list =3D NULL; + UsernetInfoList *entry; + + list =3D qmp_x_query_usernet(&error_abort); + for (entry =3D list; entry; entry =3D entry->next) { + UsernetInfo *ui =3D entry->value; monitor_printf(mon, "Hub %d (%s):\n%s", - got_hub_id ? id : -1, - s->nc.name, info); - g_free(info); + ui->has_hub_id ? (int)ui->hub_id : -1, + ui->hub_name, ui->info); } } =20 diff --git a/qapi/net.json b/qapi/net.json index 1a6382825c5e..5d3342fba23b 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1261,3 +1261,47 @@ ## { 'event': 'NETDEV_VHOST_USER_DISCONNECTED', 'data': { 'netdev-id': 'str' } } + +## +# @UsernetInfo: +# +# Information about a user-mode network stack (slirp). +# +# @hub-id: The hub id, if available. +# +# @hub-name: The name of the hub. +# +# @info: Network information from slirp. +# +# Since: 11.2 +## +{ 'struct': 'UsernetInfo', + 'data': { + '*hub-id': 'int', + 'hub-name': 'str', + 'info': 'str' }, + 'if': 'CONFIG_SLIRP' } + +## +# @x-query-usernet: +# +# Query user-mode network stack connection states. +# +# Features: +# +# @unstable: This command is meant for debugging. +# +# Returns: list of user-mode network stack information. +# +# Since: 11.2 +# +# .. qmp-example:: +# +# -> { "execute": "x-query-usernet" } +# <- { "return": [ { "hub-id": 0, "hub-name": "vnet", +# "info": "..." } ] } +## +{ 'command': 'x-query-usernet', + 'returns': ['UsernetInfo'], + 'if': 'CONFIG_SLIRP', + 'features': [ 'unstable' ] } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907704; cv=none; d=zohomail.com; s=zohoarc; b=VoJ5CPr5u1Nh5ctjYhGBg4MTnvCUaqpfYS0j4RxdLeIElmPIH1Po1ZLzKaFlUa1XNnyBukpJad2JzyZNws+axzbhOCoEb6+qxwXiVapcXnGxek1Ts3FBMpKR+wU2I12avZJe62guGCbQh5BXXUsm0OBjVi0GnyaesmB9TNQ6b48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907704; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qCX+g+9B5pUAIu9lN6dO+J/k9b2ZyYTzjJYZl5J/LV0=; b=ACZPPL+WIdbb+W8Kfe65Gehxd8IQFsKuiJSRnRBYeDqwRQigFBdF59fr1MGzCo3polPQzYIkglyAHJYAYezbN/Y7M04PMYHTD42nr6ZPxArJsC6TrdjO/23yznVp3m+cOquOqBVvWAVcPhShdqc5Bioq9oM2f0ogv56k7SQyJTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907703993874.5557325015861; Sun, 16 Aug 2026 12:15:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJE-0000ci-OA; Sun, 16 Aug 2026 15:14:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIh-0008QC-DT for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIf-0007Py-UF for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:43 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-294-CF-a_gYvOgyUU0PQr2qQ4Q-1; Sun, 16 Aug 2026 15:13:39 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D632618002C0; Sun, 16 Aug 2026 19:13:37 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BF711362; Sun, 16 Aug 2026 19:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907621; 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=qCX+g+9B5pUAIu9lN6dO+J/k9b2ZyYTzjJYZl5J/LV0=; b=TTXwmTd8NfM18a6dWJDJE0jjAaOlKXvUbacDo7uQio8IqtWnr4NcOtsnvW2ICCbBgq0TAO eLvxBW+Sy7G2W9K45BYhBYZv37MaYQN8q6q4Do01AtdPH6bgH31t3F7RLV4Cr2euiditWS dw93MKrR/ikApPxj5nGaPnNUJ/5fZJs= X-MC-Unique: CF-a_gYvOgyUU0PQr2qQ4Q-1 X-Mimecast-MFC-AGG-ID: CF-a_gYvOgyUU0PQr2qQ4Q_1786907618 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:38 +0400 Subject: [PATCH v3 11/49] python, tests: switch usernet queries from HMP to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-11-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , John Snow , Cleber Rosa , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=3487; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=BGr4jMtvHXTYjpFsBnp2mkhw2E82vBePeQYIs1jgUAU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguwNMR3vM0CQLMcYrQq72k9Ks19StDxagivs tNwS6MKQe+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsAAKCRDa6OEJdZac 5WZnEACpHpgKsfkD7OfoRjEhykFfHGb+O8Bbq+UP7yMmWcsi/HjG9l3bOotSFL4207SVEh7+w1I kDLdLRV1cRHFW/Fpp0iLJCNOu4u2n5wPzs/g1KEvlCXPi5jWs7vC8zgBLV+olYmHFdh9LlAHVOk B++9leOYVLKGkVDvqbWVxRt8eUh2ofcRoe9uzPt5r4UFv0BXJkS+qFE7yD2irh8W8sdIRJi2yut vLbMD5bm7FwJCPm6nSNG3n5kAPR9t98beZV6vcR+fMSEaPPNd/nO3tPYASYwot/aQPHjsqBYieV Px/HYJBuIP+K09qytw3QOq6lDkiN0Vs/R8Xg8urJy5Y8E4Tc85LK/AKMn+GIDWoBI2ydRpHIyXz 6/7RbkNQB6YA44nhJrI4AKeinYCR80w86QFe9+3kv+ExE7QvsCQOAhffVMbgSdXSa1mEapomWoL 3dbHs6wtMKZ+QF2/BcHmezigXt1aAattEl5c9yN5lspFoAb44ut5VXRTxMcTauG9SifTx57K1Xo kdkXMT93UhmE0KdLeIEnzv0bSM1usWrHQ6fJntfUPGuKtk82nsWmIfxoAxatEuid6OEZgnb/tou oKGPhurZfy9yAQVUGjVtVmGhV/RXnnMWWkVjhyK7MraDExrXUZ4LivboTwhgCY6G9wDwrWw8i+N 6z9skFJx53L588w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907706266158500 Replace human-monitor-command "info usernet" calls with the structured x-query-usernet QMP command in get_usernet_hostfwd_port() and the VM test runner boot path. Since x-query-usernet returns a list of UsernetInfo entries, callers now iterate over the result and extract the port from each entry's "info" field. Also switch get_info_usernet_hostfwd_port() from split('\r\n') to splitlines(), since QMP strings use \n rather than the HMP monitor's \r\n line endings. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- python/qemu/utils/__init__.py | 5 +++-- tests/functional/qemu_test/utils.py | 8 ++++++-- tests/vm/basevm.py | 13 ++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/python/qemu/utils/__init__.py b/python/qemu/utils/__init__.py index be5daa836340..e32911d4c6df 100644 --- a/python/qemu/utils/__init__.py +++ b/python/qemu/utils/__init__.py @@ -46,10 +46,11 @@ def get_info_usernet_hostfwd_port(info_usernet_output: = str) -> Optional[int]: """ Returns the port given to the hostfwd parameter via info usernet =20 - :param info_usernet_output: output generated by hmp command "info user= net" + :param info_usernet_output: output generated by "info usernet" or + the "info" field from x-query-usernet :return: the port number allocated by the hostfwd option """ - for line in info_usernet_output.split('\r\n'): + for line in info_usernet_output.splitlines(): regex =3D r'TCP.HOST_FORWARD.*127\.0\.0\.1\s+(\d+)\s+10\.' match =3D re.search(regex, line) if match is not None: diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 826c267785bd..0992db49ab28 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -14,8 +14,12 @@ =20 =20 def get_usernet_hostfwd_port(vm): - res =3D vm.cmd('human-monitor-command', command_line=3D'info usernet') - return get_info_usernet_hostfwd_port(res) + res =3D vm.cmd('x-query-usernet') + for entry in res: + port =3D get_info_usernet_hostfwd_port(entry['info']) + if port is not None: + return port + return None =20 def pow2ceil(x): """ diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 9e879e966a36..198b04e8c375 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -312,12 +312,15 @@ def boot(self, img, extra_args=3D[]): self._guest =3D guest # Init console so we can start consuming the chars. self.console_init() - usernet_info =3D guest.cmd("human-monitor-command", - command_line=3D"info usernet") - self.ssh_port =3D get_info_usernet_hostfwd_port(usernet_info) + res =3D guest.cmd("x-query-usernet") + for entry in res: + port =3D get_info_usernet_hostfwd_port(entry['info']) + if port is not None: + self.ssh_port =3D port + break if not self.ssh_port: - raise Exception("Cannot find ssh port from 'info usernet':\n%s= " % \ - usernet_info) + raise Exception("Cannot find ssh port from" + " 'x-query-usernet': %s" % res) =20 def console_init(self, timeout =3D None): if timeout =3D=3D None: --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786908000; cv=none; d=zohomail.com; s=zohoarc; b=TlcfgQsHR/OKbFXWUuMqHjNd8iPdCCwMUVmhczvqy9NFiAUq5vkY5/Fo99snObz4g5lMFSKiO6Q64IUD63t2x/Pc6Oh2D/QScSwv1nwB2QlsGXPSDdNLmul1KujkHENNLA37GAt9UqtljMd4QKXcJMTZ5cJuAl50UyOlz0l4ZEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786908000; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SopzVZmki+Hnpy0NQ2yaF9P+Y9MMP6qFbH7RSqmwlo0=; b=DTmWyh/XWgM4ECEzbDW8c+kstvLUQQ4w9vIz52rm1mZdNzq7QRzcUDddjoRwLFenOJxqM8qJhgD/2iGhfzKbjaiAtkse26pGSJgS4+NbBEOaswL3EJ32hIFTKmt3Pu5+3/acX4OpJ0HPPkyvIVhIyYdmAyC4zFnuUganwpR1a2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178690800037792.03360188992713; Sun, 16 Aug 2026 12:20:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJA-0000Xs-Tj; Sun, 16 Aug 2026 15:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIo-0008Uy-Qa for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIl-0007R7-2J for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:50 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-99-T5LWhpN1Mfuw0YfBZVO6bg-1; Sun, 16 Aug 2026 15:13:43 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6E01619560A5; Sun, 16 Aug 2026 19:13:41 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 88FB7422; Sun, 16 Aug 2026 19:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907626; 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=SopzVZmki+Hnpy0NQ2yaF9P+Y9MMP6qFbH7RSqmwlo0=; b=AGqGzbCpuMsBrD+sTWMOcBwipwM/DKyc5OuowI+DCJxKXnWoC7li2x8jvOdvH8nsVhGXQi hUMf6N52nTJ8X55Pk02DLHMwZiBRKjPlyc9/SXWUjXJP3BOUVpB4jIeN5VCanQtF05wgy2 a94mEbmQBL9IBrGOIyAW+ft2hCfHG+w= X-MC-Unique: T5LWhpN1Mfuw0YfBZVO6bg-1 X-Mimecast-MFC-AGG-ID: T5LWhpN1Mfuw0YfBZVO6bg_1786907621 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:39 +0400 Subject: [PATCH v3 12/49] tests/qtest/pnv: drop unnecessary -serial mon:stdio MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-12-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Gautam Menghani , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1774; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VqG8CcLp6vBSBhgsb7VgD9sJ4gnMAM/5MArloE3n1GI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguxBKnyPTzS4WkTm2IG5eX1y40GezABWDBug m/pdS1CwHqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5U3FEACUhEO1fdhdOkvcuhltT/j08r5H/SQa0bq0Ev7paXEUP/vXLT6i/pTKcSabVdvLP/tl9Yg Kx8+FZLyyKmGkoUBFJLx9KO31d709dpf1lPsh/vMBxww+tjBRvUnZlw0VZ2EAwf+tpF/+vnCx/r xVhH+xt6JKADgxHVnHmQhRh64mexcOCsG84GEYIANePGMNMZlDIigaznIAvZYtw+/lE2c1paFaJ /jtq6nNVsfANfl4ykQpx9aFhe2gOHGyhoT2d/jQzyXrM7gSiYYmuh+opLuixAYQ44pI8qgpDIp1 Frd3lIfAT3JOwDzjsktEelwLju7zh3aD4DNvF0lmGlKnAtwbogbjDK/Wr9Up+UlQR2j+55yYkW5 UQIIvpWmqPgBnr1MGlfqgPBj/1As/xAuV91WnXyw1rVlWWKM4TR+V49JNBjH0qdCtZtwlyFcmLD FBuLOcnODAFXcylUT/r0Txnj5fPCWj7xxwVMl64KhCiNpmXbhnAEV1RFefC8tQHwsPfRag82sbX KCVdwxDlXpzcxBmbtlYqZPO3RbJSlUdkLw9U+b3zjBZ44YEVyp/hedCI3eyp0Mu6aqy7zzuFZB0 HTZCSKjl2Ztui6+U9EsmfI02LXp383lu6AR//PVf4gCd8mkOAZq9ZjhkJj9nwxcqaln6XpReEo7 OBW0urmCi29ti3A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786908001084158500 The pnv-xive2-test and pnv-host-i2c-test pass "-serial mon:stdio" but never use HMP commands. The "mon:" chardev prefix creates an HMP monitor mux, which fails when HMP is disabled. Other pnv tests (e.g. pnv-spi-seeprom-test) don't specify -serial at all. Drop the unnecessary -serial mon:stdio option. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/pnv-host-i2c-test.c | 2 +- tests/qtest/pnv-xive2-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/pnv-host-i2c-test.c b/tests/qtest/pnv-host-i2c-tes= t.c index 5fd54f9de771..f97f6f65eed3 100644 --- a/tests/qtest/pnv-host-i2c-test.c +++ b/tests/qtest/pnv-host-i2c-test.c @@ -414,7 +414,7 @@ static void test_host_i2c(const void *data) } =20 qts =3D qtest_initf("-M %s -smp %d,cores=3D1,threads=3D%d -nographic " - "-nodefaults -serial mon:stdio -S " + "-nodefaults -S " "-d guest_errors", machine, SMT, SMT); =20 diff --git a/tests/qtest/pnv-xive2-test.c b/tests/qtest/pnv-xive2-test.c index 9f67a0066864..a0892c0f8e89 100644 --- a/tests/qtest/pnv-xive2-test.c +++ b/tests/qtest/pnv-xive2-test.c @@ -552,7 +552,7 @@ static void test_xive(const void *data) QTestState *qts; =20 qts =3D qtest_initf("-M %s -smp %d,cores=3D1,threads=3D%d -nographic " - "-nodefaults -serial mon:stdio -S " + "-nodefaults -S " "-d guest_errors -trace '*xive*'", machine, SMT, SMT); init_xive(qts); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907686; cv=none; d=zohomail.com; s=zohoarc; b=MG7Cc51651f2UoI5S9UWXb7PGu8Mr+NiSQTW79s0UBnGKBTwes7WQTM0mHiQrSs8eHBcI8yC56bMDcmu2bmCVTPDtxW+AFOeWiT/W7OtZRLX8VBC3IVfS8UYhDve8tN6LcNmoJF5CDvtoMYlO2LlXILkCIlyMxiPV+cKydO+Z0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907686; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=awsGiKws/Oc72EBonW3yVf4RQnkpQdBbgtMuliluxhg=; b=fMoZt59OlZUg9PGjpUcSEBw5o5wUgcFeOa4KJGaT5GIYoQJnZ/TDmzwtOi5pQlk7dk1Mxi0NPFm/y9/YjU4aX4T/CN9ghpezn1PCRb9ttRwsUH8oC4j7m5oo0NdiPuf+0ZmzsyhpjmxsAw+H3iKZnsAgXDrDzbxMrLmtdL9D220= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907685899301.11039428771255; Sun, 16 Aug 2026 12:14:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJB-0000Zt-O4; Sun, 16 Aug 2026 15:14:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIu-00005D-TS for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIs-0007T6-TP for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:56 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-fBI3YJIQMCikYKiTCp-u6g-1; Sun, 16 Aug 2026 15:13:45 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DA6A0195608A; Sun, 16 Aug 2026 19:13:44 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D670C30001A2; Sun, 16 Aug 2026 19:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907634; 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=awsGiKws/Oc72EBonW3yVf4RQnkpQdBbgtMuliluxhg=; b=DigsCAfnrklGv+BJe6bL+NYThPS5qDUle2LpDZVyWamgnpnijKYP7uv5Mu+f2/E+hFevdX MV2k+DgXegnjaWAF3218JzFbHH8vdTZng/9vChvgZ0jqr9SyidP6MqDzNlPUH+Oe0GLzl+ zreYR8FqJ75kkQHKwP9K0CFBiTemLw8= X-MC-Unique: fBI3YJIQMCikYKiTCp-u6g-1 X-Mimecast-MFC-AGG-ID: fBI3YJIQMCikYKiTCp-u6g_1786907625 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:40 +0400 Subject: [PATCH v3 13/49] tests/qtest/qmp-test: don't depend on human-monitor-command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-13-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2187; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=LYlALLNnLGBmvLJkUw/CVWFy33xbwEoBffB+2rz9Cl0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguxzrD1VnZ1vVvL58TJDHlr2PKWNh21Duq6z UV1MEbW4j+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5aC4EACG9+uvegKK7V50rrQVzW9Z2Hhb37zDkJTau6nN8Woygh69frO+Zre6funuGUyCm/an0WL ur2+Ej3QdpimwjVbqrEhc0B55og5JOaVDiikcT/OFWK4hMCQ9PlK3xjpUdGyhbRwlUXDSx689so G7PpZppjz9E1byK/ehiGv0ODb2OTz0ALE9+cHySffwO2itJNPlObfmRm0+iMNAjqIN7z8nwRWbS zZYseI2gQGTfESL43I/G9udT6V9eCStEcJLBxq/VhwOSyHdXmtyNYWaOxi2yG3yiWgDaPz9/drC ObOrWCUmv3ECezdU8skxbc3VyEB26/ZmFeBJIUZ8x/W6WM1LEp7uG0gQwMsFsrfpJNHTNC1rij9 cpvGHCFn4EYdItYr+MFmMJE0jOka3hyRQco930/0lcsCAvXGoM7oe3xU7SCXw62e21I/k7kTMG1 ZJZfALszcOvabnyL/xSDH+QA4GrUCIszo1FofLJW8hXu5aj72ZCxOXFuue9PBNvTFNv72x8uReJ hyNYjvUdc8BIt6erP65ZuRlm8PTJ7g76FUygkKMEjP6kMpodMq7TGpOQCwhRyDsl/Rdfbvi0ePI PjPza5EZJKJ59YBAa1zHID5ksRRhAYoDy35ZaNbuvA1BQF56mLnuHy2uk2uIv+at5SIfUxZu2gh oU1SbHSoNVt917Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907688341158500 The test was using 'human-monitor-command' (which requires HMP) to verify that an integer 'id' is echoed back on failure. Replace with 'query-name' for the success case and 'block_resize' (missing required args) for the failure case, so the test works regardless of HMP availability. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/qmp-test.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index 3a325a04e07b..927ab053f8ab 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -151,9 +151,14 @@ static void test_qmp_protocol(void) g_assert_cmpstr(qdict_get_try_str(resp, "id"), =3D=3D, "cookie#1"); qobject_unref(resp); =20 - /* Test command failure with 'id' */ - resp =3D qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2= }"); + /* Test integer 'id' is echoed back on success */ + resp =3D qtest_qmp(qts, "{ 'execute': 'query-name', 'id': 2 }"); g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 2); + qobject_unref(resp); + + /* Test integer 'id' is echoed back on failure */ + resp =3D qtest_qmp(qts, "{ 'execute': 'block_resize', 'id': 3 }"); + g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 3); qmp_expect_error_and_unref(resp, "GenericError"); =20 qtest_quit(qts); @@ -487,6 +492,7 @@ static void test_qmp_monitor_remove_cli(void) qtest_quit(qts); } =20 +#ifdef CONFIG_HMP static void test_qmp_monitor_remove_hmp(void) { QTestState *qts; @@ -504,6 +510,7 @@ static void test_qmp_monitor_remove_hmp(void) =20 qtest_quit(qts); } +#endif =20 int main(int argc, char *argv[]) { @@ -521,7 +528,9 @@ int main(int argc, char *argv[]) qtest_add_func("qmp/monitor-chardev-in-use", test_qmp_monitor_chardev_in_use); qtest_add_func("qmp/monitor-remove-cli", test_qmp_monitor_remove_cli); +#ifdef CONFIG_HMP qtest_add_func("qmp/monitor-remove-hmp", test_qmp_monitor_remove_hmp); +#endif =20 return g_test_run(); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907713; cv=none; d=zohomail.com; s=zohoarc; b=OzVGGVGAZmznYaco8dEtYed0kgMqazOfTw27v2fjipw0LXm2cOK3SEM5kt6L9hs0qAuS+beQ4hTV3tGtJ5YoprkaVB+S9V0gM+ccxwOVh77eR7z1/Pu30hlBp2IdP2NVpYZPqJEJInwGuZaz1jeUAGCGyyFAilqucPbB7LtyhC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907713; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WuTj5x+fSNUVNN2LMJ3vFG3XqkgK85waEsJYQTSVFbk=; b=Q+k2u4rGGE6bRAisqpTjC1t1qMmWKKPW+sMBnGJGuKJ5xO4ukGOEbFesnD8qgAspon7t2frYXEVF6YdpRZbfK3r3gmWaJjUkoqnXumIWN9DELnETxYHcwi8X0s6vQQKC1EUuVkxLdwW1alcs4aLeibF5yENh4fKSSgmRokiPeS4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907713430600.4502586755649; Sun, 16 Aug 2026 12:15:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJ8-0000Pg-7H; Sun, 16 Aug 2026 15:14:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIt-0008VC-Ng for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIs-0007Sj-8A for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:13:55 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-3ViPWouGPsGHQX9jhKG51w-1; Sun, 16 Aug 2026 15:13:49 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B25C7195608E; Sun, 16 Aug 2026 19:13:48 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 93FC518005BB; Sun, 16 Aug 2026 19:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907633; 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=WuTj5x+fSNUVNN2LMJ3vFG3XqkgK85waEsJYQTSVFbk=; b=d8sdZb3UX6CbMR4odjnhFKeXMKQHMXbmsODBD9MBSdpW1UgAEqnVkW0CtZGH1X0tMLopOP b9wlp5AhcGGGyOVoe3QvXC4ZEhptVDFuro3Djm5v/FhlDQAeSAdOZfHfvM//mjEVCwjzKS +I84EOCrVf9WfEFSKcpiPRNMDoUYpSE= X-MC-Unique: 3ViPWouGPsGHQX9jhKG51w-1 X-Mimecast-MFC-AGG-ID: 3ViPWouGPsGHQX9jhKG51w_1786907628 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:41 +0400 Subject: [PATCH v3 14/49] tests/qtest/numa-test: replace HMP "info numa" with QMP query-cpus-fast MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-14-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=4041; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+FBAR2ZPq7hb97oLmYP2VfmJ5ZxlMcXNs2ksRVhW/zk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggux9kYy2x5ZsB5IkhvhiwGJZCd9BPSsfFwai rBA4Xyz6gWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5U0eEACuKFgzKf3GeiHr2gTYpb0q+1cchZi08okjpYoJ79QvbXKf7h5inzxYkSbhlVTSz6m4Bw3 Uesd1VJcWJz31UaMvioQSc/LQJzRJIyQHJW0VbQeYFdj2ulX2FS74qk/OYM0Eiw0bMhRVZs2/ad WtyiR17kAQ81qiK4vwaa0trqEmqChy+Fw3UmbMfmNkY9DUJZpmPGpcJ7skzhfqt3z+ulIDdl0hK DV2o8aNWxsNV54tknludbc2lsmvlvwxiQQTOFBMBYXc/VLHb9+EvgYhZ30rP0ox6Vrnkt9xDtfs c3HfJupuLgQbjksXDOehJFe6mRQg47i3U/e1KvE9x1qZJiRmaidLvSARxrJ77kTzHMgI2qmanxX WZyyDo7eAWfDINpReY1FttQ24XsQvt+kQj1C5mNoYUjiwhkypBTkx6ohO9WVGmCsiJJZSs3oH6o j7afl2q4Z6zObWzHx14H6666ED13XpGSX2GutAEkTSRZ0Rvr891jAIhTzQAwe5bsHSz7sVP7jrx BWT2BMPkzg1Wn7vCBmz3egmy2HNh9HG3NjmAm7ALFTvLRPBrBOwytbQoaTVCWTGg6VgLLURtqW7 EpJf0JX8YdnZkeiodcBJxuL8gJuKVTUoWNeRkixBtbDvCASN1PTZM0lOfw2AOmobrUDcwC+VadA 0IouH5GOsDIgwuw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907714190158500 Convert the three test functions that relied on HMP "info numa" to use QMP "query-cpus-fast" instead, verifying each CPU's node-id through the structured response. Add a check_cpu_node() helper for the per-CPU assertions. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/numa-test.c | 63 +++++++++++++++++++++++++++++++++++++++------= ---- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index d657f3894743..8f563c079f62 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -19,19 +19,50 @@ static char *make_cli(const GString *generic_cli, const= char *test_cli) return g_strdup_printf("%s %s", generic_cli->str, test_cli); } =20 +static void check_cpu_node(QTestState *qts, int cpu_idx, int expected_node) +{ + QDict *resp; + QList *cpus; + QListEntry *e; + bool found =3D false; + + resp =3D qtest_qmp(qts, "{ 'execute': 'query-cpus-fast' }"); + g_assert(resp); + g_assert(qdict_haskey(resp, "return")); + cpus =3D qdict_get_qlist(resp, "return"); + g_assert(cpus); + + QLIST_FOREACH_ENTRY(cpus, e) { + QDict *cpu =3D qobject_to(QDict, qlist_entry_obj(e)); + int64_t idx =3D qdict_get_int(cpu, "cpu-index"); + if (idx =3D=3D cpu_idx) { + QDict *props =3D qdict_get_qdict(cpu, "props"); + g_assert(qdict_haskey(props, "node-id")); + g_assert_cmpint(qdict_get_int(props, "node-id"), =3D=3D, expec= ted_node); + found =3D true; + break; + } + } + g_assert(found); + qobject_unref(resp); +} + static void test_mon_explicit(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8 -numa node,nodeid=3D0,me= mdev=3Dram,cpus=3D0-3 " "-numa node,nodeid=3D1,cpus=3D4-7"); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3")); - g_assert(strstr(s, "node 1 cpus: 4 5 6 7")); + for (i =3D 0; i < 4; i++) { + check_cpu_node(qts, i, 0); + } + for (i =3D 4; i < 8; i++) { + check_cpu_node(qts, i, 1); + } =20 qtest_quit(qts); } @@ -39,16 +70,19 @@ static void test_mon_explicit(const void *data) static void test_def_cpu_split(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int even_cpus[] =3D {0, 2, 4, 6}; + int odd_cpus[] =3D {1, 3, 5, 7}; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8,smp.sockets=3D8 " "-numa node,memdev=3Dram -numa node"); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 2 4 6")); - g_assert(strstr(s, "node 1 cpus: 1 3 5 7")); + for (i =3D 0; i < 4; i++) { + check_cpu_node(qts, even_cpus[i], 0); + check_cpu_node(qts, odd_cpus[i], 1); + } =20 qtest_quit(qts); } @@ -56,17 +90,22 @@ static void test_def_cpu_split(const void *data) static void test_mon_partial(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int node0_cpus[] =3D {0, 1, 2, 3, 6, 7}; + int node1_cpus[] =3D {4, 5}; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8 " "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-1 " "-numa node,nodeid=3D1,cpus=3D4-5 "); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7")); - g_assert(strstr(s, "node 1 cpus: 4 5")); + for (i =3D 0; i < 6; i++) { + check_cpu_node(qts, node0_cpus[i], 0); + } + for (i =3D 0; i < 2; i++) { + check_cpu_node(qts, node1_cpus[i], 1); + } =20 qtest_quit(qts); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907656; cv=none; d=zohomail.com; s=zohoarc; b=KGl5as6Im5B+Pinggu9Uy5/Z6l4J6zPCYqE/om3rVKuw94PAIVF0dylxy2q9/fJVc3Up3H0ra2B/sTCoFjloq1HTqplLU54U+SRo+ERJaB1rwkzQGonRyIGom5XXN5HUlxiKUNZMqbIOjw5WAcRs1IMljkH0oqvCFQ1yPLK6k4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907656; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hUCHRq2Ok04LdmPe7Y32jbNNusp9xmvBIAs7AR4+PV8=; b=Gi19GzVq8jpy2ToTTlRl4dDk1yKvz3LSMybi0C12mftOQCfnHpDBxHL2a8UPG8B12N4EtgzUcC+fjans/rGkrIZwo5Ga9QKyIUl5l3CFsJIo881/XjeOLf9jTxXUlZlWU8GPueJ5YL65HtjAImFTHQaoUHjHkGsOgfpHOfa1p/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907656386396.7612555909981; Sun, 16 Aug 2026 12:14:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJA-0000Uh-9S; Sun, 16 Aug 2026 15:14:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIy-0000BL-El for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIv-0007Tl-48 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:00 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-513-R0UlX5KaM1GWaUzbWm2kyw-1; Sun, 16 Aug 2026 15:13:53 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CFEDE195608B; Sun, 16 Aug 2026 19:13:51 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EE01F30001A2; Sun, 16 Aug 2026 19:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907636; 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=hUCHRq2Ok04LdmPe7Y32jbNNusp9xmvBIAs7AR4+PV8=; b=O0dZ0A1TkcP7VvuXqLIX6+NPZ5tqajNhDkKaVeoWY9J3BDU3hQ9w6Q/z0kj1/OIh+Mq5Ci yCUfFfJrp4CebkYzk+EZYdBQOCzPd4KWHmHSYCZklvW7pshVYvF5AhbUwjDlRAijPKCErx DNVuDDcDBNQRe+xbKjl59827n3AM/fc= X-MC-Unique: R0UlX5KaM1GWaUzbWm2kyw-1 X-Mimecast-MFC-AGG-ID: R0UlX5KaM1GWaUzbWm2kyw_1786907632 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:42 +0400 Subject: [PATCH v3 15/49] tests/qtest/cdrom-test: replace HMP "info block" with QMP query-block MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-15-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , John Snow , "Denis V. Lunev" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2255; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=T/T/dWIHE7tVy83U045hqtVQSWYIwyZRSt/Bfc8zxxU=; b=kA0DAAoB2ujhCXWWnOUByyZiAGqCC7Gja6NvFIRm6AlpWRm1UzZyf6JmPNM7+E5Hxqr2YwySM IkCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJqgguxAAoJENro4Ql1lpzliIMP/0fd LgWZjQJFufEMyhfGeGkSz5CF7cXN21S5M4fkMyUEBUrhw80APTsgYkpTELItnQmCWLsA7T2fCPc vw6O6yWxsDYptCpN8nAC6AfV0kSxRBVY7VA1tqm4/xnlwg4GQOTil3wtCIg1MRpebjtkv62iuPT ROUiRp5/BwAEYX9Ftip3gGl/uD4pjX9AGDHQNze3ve3zOZPvwmdjMTLdX4nLsDClpAJkaFfvVz9 MN9WwFF09nEgvZgiZ6lIdgBMRKAg8rV98c+60U1h9IcIqC8OXLv1PJzkdrbcI1ojIaDLqRYSzMS gK0BniM/XIwsNT9UiqSeo86+euSzVGKnGweI6jBU+w20iuLk8job+MkTW9jUpqff6QlB+OR/i5e w30JQ8GHaabceCUm67ZX0OBrTaJl3OYTDPAjbTscQ/LMP+vYntUrX/R6y26Q+3FXg09DZWFM8D2 xfeDOSSrO5pXilTSdoLdX/P9rS8MDH3TRCQqFxe7jc9DxDw0YxGpa09vgq0dn9TJJ93nxBdP7Bz fgVmt7kXrNCPm2XGpI44jzns0SFFfgbgR6+dDBBNdf1cFdBLxVC7rtKzX0ye8YDCavwlW5qOjEq Te+XeTABfi+t9X7E97gq8LDGE1QPopaskzqH7/qED56xSSIqyT+2losSf7Zz5/9rrNGgRd39rGn KDzri X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907658222158500 The test_cdrom_param() function uses qtest_hmp() to run "info block", which depends on the human-monitor-command QMP endpoint. Replace it with the QMP query-block command so the test works when HMP is disabled (-Dhmp=3Ddisabled). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Denis V. Lunev --- tests/qtest/cdrom-test.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index a65854d2bc53..bf997be6d690 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -14,6 +14,7 @@ #include "libqtest.h" #include "boot-sector.h" #include "qobject/qdict.h" +#include "qobject/qlist.h" =20 static char isoimage[] =3D "cdrom-boot-iso-XXXXXX"; =20 @@ -92,17 +93,35 @@ cleanup: =20 /** * Check that at least the -cdrom parameter is basically working, i.e. we = can - * see the filename of the ISO image in the output of "info block" afterwa= rds + * see the filename of the ISO image in the output of "query-block" afterw= ards */ static void test_cdrom_param(gconstpointer data) { QTestState *qts; - char *resp; + QDict *response; + QList *ret; + QListEntry *entry; + bool found =3D false; =20 qts =3D qtest_initf("-M %s -cdrom %s", (const char *)data, isoimage); - resp =3D qtest_hmp(qts, "info block"); - g_assert(strstr(resp, isoimage) !=3D 0); - g_free(resp); + response =3D qtest_qmp(qts, "{'execute': 'query-block'}"); + g_assert(response && qdict_haskey(response, "return")); + ret =3D qdict_get_qlist(response, "return"); + + QLIST_FOREACH_ENTRY(ret, entry) { + QDict *entry_dict =3D qobject_to(QDict, entry->value); + QDict *inserted =3D qdict_get_qdict(entry_dict, "inserted"); + if (inserted) { + const char *file =3D qdict_get_str(inserted, "file"); + if (file && strstr(file, isoimage)) { + found =3D true; + break; + } + } + } + + g_assert(found); + qobject_unref(response); qtest_quit(qts); } =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907697; cv=none; d=zohomail.com; s=zohoarc; b=BRVu4YrhLj1MOXiSkpFICxJz9N5j12q/gCCoEQQpgWkszYBG/rvZROYfbDWpMi5I8ZVDIHw7egwPn1DuWC/vZYWwIDnvsimfdU9UuwGGL0P0h55MQPXwBoYtonMVu+kb2nTabjxrIg0M8nUFIyKf9G7IXq0aKbCJicjNpSakB5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907697; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UZRz3EkbKUI26MlQnyuxQXcUyNkJElc5W8Guw6Tk6gI=; b=Kferl/45rlvLj2ExrP26E4P279y/wmj9I0N8iXKfOxmTjrKfQHC63vWJn7WwBhGkT5ec1ZJmRaeE0/o9w3uL4GP8+JHjxVhZIyXTEuJ1cYBgO1G+WU3DZKuqExYycntvni1l5pTLtCogssdzW32AhHf0J0rbR7D/V10sM/RiuKc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907697671817.0196269168721; Sun, 16 Aug 2026 12:14:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJ6-0000O2-4u; Sun, 16 Aug 2026 15:14:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIz-0000Cl-1p for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgIw-0007W2-Tz for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:00 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-OOEjt81mPLqDF6_m7TskMw-1; Sun, 16 Aug 2026 15:13:56 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 867B8180049D; Sun, 16 Aug 2026 19:13:55 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D2B71800347; Sun, 16 Aug 2026 19:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907638; 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=UZRz3EkbKUI26MlQnyuxQXcUyNkJElc5W8Guw6Tk6gI=; b=VgskfFo9tMkdfLqp49wh/OdlTcH4yAilPFjiRUnKL46IcY4eoia73J/jd5dfm4ImHaYVO/ zxjMGKNeqckCxdeH9392p07AY17sN4oYi2BFKm/ubs6HpWtM91OHs5D0mFCS9EVDJaiZjD 2uBmjFvzxk1/3UDn/spucN1J42Gh0NQ= X-MC-Unique: OOEjt81mPLqDF6_m7TskMw-1 X-Mimecast-MFC-AGG-ID: OOEjt81mPLqDF6_m7TskMw_1786907635 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:43 +0400 Subject: [PATCH v3 16/49] tests/qtest/device-introspect-test: fix test without HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-16-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=7518; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9Kj/FtbaZbFHg5LizU23usl5iX+58YVJ4JW3Ey5xlPk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguxNeTVUYD655MqOz1Kg8mK9s7pm7TUKZ70p m0heNaCtVGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5YYaEACZINcvIXIgTSGEe2HPVGA6lPkxDjfXZ9dDLnQPTrQvcEy3X24UimiM4DYqgTzwnphTgY9 YKRAZuwg0LpW+sI+UbDTDGSPNRc/lA/7+yikliBrUg/opfye6jpOlvUFIoIIW+pNjjBM9GsR72Z 3Mlkq1toHGUmTTI0ZwFG/8Y20lnBchP8bthL6TYH+PD74aXVVajZrKHL5w0Yf29LsnAifWVOnRp GNKV1HzOYkfHVjmJS3jpyCJ/AEHobG6rbl2/dxE0g3En01a7+rdbL+letaz7ylJXBovjBSy026N eWTH0Be9HbMjUVCMId5KfLfQQHVYns/+u+cCt2+AeQ7xZvhLcnZE/qaAbVPn+ajzFn3SaWZhvbn Gg/q1XJ0KUlRCd+BPWLqxMs/YCnU+rlI5ZguaZTuSywVwrdDCDqsAxOIzBKqWI8ddi/FmHq+7EG +yfrW7eH/ZFFLMTbuC2yG0nOYrDMArppkiEvn7ZXq7BYfbMfM+eItWmEzxETtBF6oj5lkxN47WX KgBaZFbl+QCjJXgMk2uTOe9WK1SPKfHPOcpHipAuwjClErKhMKXFdVhF8iiecj9pyzCHrT4N4/I 9xUUBBjOwcsDNfg2vBu9sd9tZZ+i3t1TVMDHtSbhB4oA/BHck0i1eDIAynJTOq0+2QqTqcKOMzP fyeZ6NaAU3w6cAg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907698088158500 Replace "info qom-tree" with recursive qom-list walk. Disable HMP-only code paths, info qtree, kinda duplicating the test. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/device-introspect-test.c | 111 +++++++++++++++++++++++++++----= ---- 1 file changed, 88 insertions(+), 23 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index f84cec51dc2e..f6eca2c8eb7e 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -11,10 +11,10 @@ */ =20 /* - * Covers QMP device-list-properties and HMP device_add help. We - * currently don't check that their output makes sense, only that QEMU - * survives. Useful since we've had an astounding number of crash - * bugs around here. + * Covers QMP device-list-properties and HMP device_add help (if + * CONFIG_HMP). We currently don't check that the output makes sense, + * only that QEMU survives. Useful since we've had an astounding + * number of crash bugs around here. */ =20 #include "qemu/osdep.h" @@ -100,11 +100,60 @@ static QList *device_type_list(QTestState *qts, bool = abstract) return qom_list_types(qts, "device", abstract); } =20 +/* + * Recursively walk the QOM composition tree via qom-list and build a + * string representation. This serves two purposes: detecting dangling + * pointers (qom-list would crash QEMU) and detecting leaked objects + * (by comparing the output before and after device introspection). + */ +static void qom_tree_walk(QTestState *qts, const char *path, GString *resu= lt) +{ + QDict *resp; + QList *list; + QListEntry *e; + GList *children =3D NULL; + + resp =3D qtest_qmp(qts, "{'execute': 'qom-list'," + " 'arguments': {'path': %s}}", path); + g_assert(qdict_haskey(resp, "return")); + list =3D qdict_get_qlist(resp, "return"); + + QLIST_FOREACH_ENTRY(list, e) { + QDict *prop =3D qobject_to(QDict, qlist_entry_obj(e)); + const char *type =3D qdict_get_str(prop, "type"); + if (g_str_has_prefix(type, "child<")) { + const char *name =3D qdict_get_str(prop, "name"); + children =3D g_list_prepend(children, g_strdup(name)); + } + } + + children =3D g_list_sort_with_data(children, (GCompareDataFunc)g_strcm= p0, + NULL); + + for (GList *l =3D children; l; l =3D l->next) { + const char *name =3D l->data; + g_autofree char *child_path =3D (!strcmp(path, "/")) + ? g_strdup_printf("/%s", name) + : g_strdup_printf("%s/%s", path, name); + + g_string_append_printf(result, "%s\n", child_path); + qom_tree_walk(qts, child_path, result); + } + + g_list_free_full(children, g_free); + qobject_unref(resp); +} + +static char *qom_tree_str(QTestState *qts) +{ + GString *result =3D g_string_new(""); + qom_tree_walk(qts, "/", result); + return g_string_free(result, FALSE); +} + static void test_one_device(QTestState *qts, const char *type) { QDict *resp; - char *help, *escaped; - GRegex *comma; =20 g_test_message("Testing device '%s'", type); =20 @@ -113,19 +162,21 @@ static void test_one_device(QTestState *qts, const ch= ar *type) type); qobject_unref(resp); =20 - comma =3D g_regex_new(",", 0, 0, NULL); - escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, NULL); - g_regex_unref(comma); +#ifdef CONFIG_HMP + { + g_autofree char *escaped =3D NULL; + g_autoptr(GRegex) comma =3D NULL; =20 - help =3D qtest_hmp(qts, "device_add \"%s,help\"", escaped); - g_free(help); - g_free(escaped); + comma =3D g_regex_new(",", 0, 0, NULL); + escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, N= ULL); + g_free(qtest_hmp(qts, "device_add \"%s,help\"", escaped)); + } +#endif } =20 static void test_device_intro_list(void) { QList *types; - char *help; QTestState *qts; =20 qts =3D qtest_init(common_args); @@ -133,8 +184,11 @@ static void test_device_intro_list(void) types =3D device_type_list(qts, true); qobject_unref(types); =20 - help =3D qtest_hmp(qts, "device_add help"); - g_free(help); +#ifdef CONFIG_HMP + { + g_free(qtest_hmp(qts, "device_add help")); + } +#endif =20 qtest_quit(qts); } @@ -198,18 +252,22 @@ static void test_qom_list_fields(void) static void test_device_intro_none(void) { QTestState *qts =3D qtest_init(common_args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 test_one_device(qts, "nonexistent"); =20 /* Make sure that really nothing changed in the trees */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qtest_quit(qts); } @@ -217,18 +275,22 @@ static void test_device_intro_none(void) static void test_device_intro_abstract(void) { QTestState *qts =3D qtest_init(common_args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 test_one_device(qts, "device"); =20 /* Make sure that really nothing changed in the trees */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qtest_quit(qts); } @@ -239,10 +301,12 @@ static void test_device_intro_concrete(const void *ar= gs) QListEntry *entry; const char *type; QTestState *qts =3D qtest_init(args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 types =3D device_type_list(qts, false); =20 @@ -255,14 +319,15 @@ static void test_device_intro_concrete(const void *ar= gs) =20 /* * Some devices leave dangling pointers in QOM behind. - * "info qom-tree" or "info qtree" have a good chance at crashing then. + * Walking the QOM tree via qom-list has a good chance at crashing the= n. * Also make sure that the tree did not change. */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); - +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qobject_unref(types); qtest_quit(qts); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907688; cv=none; d=zohomail.com; s=zohoarc; b=bgy6Sr3xlpHjLtBms4DcSsG+CS2Rq5myhLhpVeitweyJue25gg2w9IEKZyK4lcX/qCW50w1ZLKufeuj3eWmpMjmgLut0oLTOm12Es5jTKAYCyZwP9IBdBLMTGA+RHKFUtiH5q3e5B5J0fJWwtcbqvuQUnep1av0IhpxE0yy/XwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907688; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Mpb/2b3qMFQzTLzTCER3qNfrQzUe3H5wt66hPLCR09I=; b=P1WZPyGx5tBmHF59MPa4414bmv0x64BUbZggZBx3H4YA1kaHPt+pmL01cKlEY/LGoKcCXk/+o1vP4KvViWsLKg65qpvE3dMcwnxlj0taD/XeLGpImKHNLH6jDhAYAuQnanOkTigMFa7JUpcmEqxP0Wbx7Azn2O+gEobEsUSvi78= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907688519959.7382570175337; Sun, 16 Aug 2026 12:14:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJC-0000bR-Bv; Sun, 16 Aug 2026 15:14:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJ6-0000Ns-1H for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJ3-0007YY-Fp for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:06 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-97-CZgBsuL2Mj21gun8HpRe_g-1; Sun, 16 Aug 2026 15:14:00 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FC9A195608E; Sun, 16 Aug 2026 19:13:59 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 47BF6423; Sun, 16 Aug 2026 19:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907644; 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=Mpb/2b3qMFQzTLzTCER3qNfrQzUe3H5wt66hPLCR09I=; b=idZhVGgQPppx5WGxr/1KgIsagUrS7c7KwCL1aqzuGitBgpBI/bsns5GllJrsMzozPidtAr lpvaN7KIrUSy0xB8lBobEPM213GdDi1lcIFiA69w7D7A5dqTlwGkDwo189FAOw/QqS0Jik zbZYuSW1gDGwXnQCZxh1frBxiPT1zkg= X-MC-Unique: CZgBsuL2Mj21gun8HpRe_g-1 X-Mimecast-MFC-AGG-ID: CZgBsuL2Mj21gun8HpRe_g_1786907639 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:44 +0400 Subject: [PATCH v3 17/49] tests/qemu-iotests/205: fix race in assertExportNotFound MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-17-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1493; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=skNsYNNV1xMEy9mfAYu0UimfTtL6eome8md1k82hjKA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggux9xF8HBJifP6ufTRARF2NfrLymW+A1BByN DNHywYIsVaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5c+gD/9AkCvoLEpbu8RuKptdxfRV/oHBz7UDgQQt4hw9jyxHENG4ZGpicaE9a9hGULLj3S2ozwx L2QZdgvp1YIEFO5/XXYHE0WaFJ1mCGfo3ZOWy/l3JTXa/i1eBcM45U9a3mbRJqlZNQ74m1ST64C 5llcwTyQUkrSuR3ewYGD+pfGiSR1La1Q2OphTpCdhRecQO+jJKs0hsR1H8FaWgiIKuqpQXjK1ck kfOErWf/igmXrv518iackVIBAOXs+L61w5IUZdqH/fF9tQYUDtMLcGTrEGdCRpfk5iqnsJPMXQ1 pkuJ3Mqbdu1hsmBeJV+mFXm0MgTZGr2nyRRstY3NSHpbQwRePnC8jnRFIZqLo8esyeFlI7dn1n+ Y/y8kkqtoQO7wzRJ8a4h9bIW0zMIwHxu5lkFqIsC0kH2k656V/AdvQyLSTaSfCrUcDm4RAJqHIo dvqY0TosRcei3czA426eVlf9lLH3KGZ29EyCnTX0cqgXmU3hviQw0fwDWv8gGGDwP95F4ZkI9QN FLohYJ3pOMlEWrV8+ElDCWQQRfX3P90hCPsVy3Ex45JR0tPr9XxdIo5W6M64oTYjkFyXCsH6pM/ D4uLQ1VEy1kUqr5CZsv58BG+SzITtfsCzYxrkgF7R/3VzoGF037BmvtTEhJ2OE6CvMSAW8y7wFR tZ8la7V+0VOCFEw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907689974158500 After nbd-server-remove with mode=3Dhard and an active client, the export is removed from the NBD export list synchronously but remains in the block export list until async cleanup completes (via blk_exp_delete_bh bottom-half). A subsequent nbd-server-remove call may find the export still in the block list with user_owned=3Dfalse, returning "already shutting down" instead of "not found". Accept both error messages in assertExportNotFound, since both indicate the export is no longer usable. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/205 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index 2370e1a138b1..78459065418c 100755 --- a/tests/qemu-iotests/205 +++ b/tests/qemu-iotests/205 @@ -60,7 +60,9 @@ class TestNbdServerRemove(iotests.QMPTestCase): =20 def assertExportNotFound(self, name): result =3D self.vm.qmp('nbd-server-remove', name=3Dname) - self.assert_qmp(result, 'error/desc', "Export 'exp' is not found") + desc =3D result.get('error', {}).get('desc', '') + self.assertIn(desc, ("Export '%s' is not found" % name, + "Export '%s' is already shutting down" % name= )) =20 def assertExistingClients(self, result): self.assert_qmp(result, 'error/desc', "export 'exp' still in use") --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907668; cv=none; d=zohomail.com; s=zohoarc; b=L6BTs2VY7wxyoCKt3H+g5vVqSBfd7aJbJBMndk+Scp+s5IikDWl1H1duH/rodgQsGS1s8u59WWYQmAg6bxjO0Q6WnTBOEpUxI6xyVrC9xV/NDpsqynw/KMw/XuCfg/Ai2WLuok3qR65sgXFRdVC7Y4UHNQPdoYUt7pddy9HlBYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907668; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L1xp1lTvd3MdMUX8dmf1CMEjnTVNcsxKTotSufqvHi0=; b=Y+NSKiXcgTb+Hi3XbnjSyez9An+pK2kQbFlTUw5THRaLdQdSDGZXNXhXqibF41Pe5WaQwSYMgfDHbCkujYqZqLfdlK/1EvxAl6RjuUqP2fs/QQwxot7CgcC63pdmW2ayD5Eq+alAEas+o3QgXhzi6i6Gf17dquGJYSWE3emrMl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907668278618.7077483834723; Sun, 16 Aug 2026 12:14:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJJ-0000gw-So; Sun, 16 Aug 2026 15:14:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJB-0000Yj-6D for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJ9-0007Zf-01 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:12 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-JtaLwHRvOP-gGKvlWJboJA-1; Sun, 16 Aug 2026 15:14:04 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E394C1800611; Sun, 16 Aug 2026 19:14:02 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E5AB330001A2; Sun, 16 Aug 2026 19:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907650; 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=L1xp1lTvd3MdMUX8dmf1CMEjnTVNcsxKTotSufqvHi0=; b=JN/+maie+mORTGdiXcLpp/34OYLPyx1swOAPrwt+tyFzSbH4PcokvijZRTPOv2TWrnsAtE oBrTf/XWKHzECO+65LvTDb6RR7FXjf+DCcY1Hki46TGpDWM1QTW+5x1yrkqSa44VpXOEVX +sOw4s3GJcBV6B08vJ714Nn4b7vT300= X-MC-Unique: JtaLwHRvOP-gGKvlWJboJA-1 X-Mimecast-MFC-AGG-ID: JtaLwHRvOP-gGKvlWJboJA_1786907643 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:45 +0400 Subject: [PATCH v3 18/49] net: add x-query-network QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-18-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Jason Wang , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=13471; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=5ogvqlrNxwtpqR/CR70+i3muFtGVdTJv35bVBwQ7mug=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguxiWDneMcMQp3ZEh6DwVxZwJ/JDuRvKdCKx AH7kUujW7aJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5cZDD/9aPiEh2GkPM0cnAL5u0riohBy3ENYT0d6PSIUZh8EebmFm64yatZOwvVdzBgbWDMcS5Pe bPkOHztkj/abolMD//n/4nC/0byWWd0UiiixckvEIG24/dD7+SGLxRB53ToL/le0amXkGQ6Dqop iyl2QZnlFor4h2lPQEniwIQdubSb9GmeH6nqTkwpXAw6KNtfh+QjoXkzCJ377InKHwGB6+8Me8u b5HVwCS0Ks546otjug5dVX08VEhVy4HIwccG5paZqYa+d5LP5dljGbyxSvWlpIC3xqLb6Fd22Fv 3k4QxghedPg9u+zRvDhXzJTv0PZ5WS2spYVwo7SKbRT0VFLYY5uqw7igG2L0smvPM8llenVPa+I Qd19192hunH/tErd1Y+bggaUCp5kDMdwppFacyJwZZwnp2c5GgAxOUadpUr5k0dcolWsYwf6U5d nOLejmeD+IyHb/0DS7wk0sCO9YYFFKCVQcn90Cu8EFRXaV38IyGqyaB8la+14PuvQcCcJlcpKrw idpviYxMNUnJqbAT1TbpsoDhq8aWoi6cnF/12I60D2eBFt+466tsp2KmuelVwubcyQJ4gQG/ncJ ghbs1apXCyvGpHZsiwofqTbR2L0liUDEItLWT9iC/3THiJ61fu80dXquM8gKixbuDPMTSjzVjmw eOpPcb2FMcFpLeg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907670021158500 Add a structured x-query-network QMP command that returns network configuration as a NetworkInfo struct with pre-grouped hub information and a flat list of non-hub clients. Each hub includes its ports with inlined peer client info, and each client includes attached netfilter details. Refactor hmp_info_network() to consume only the QMP result instead of directly accessing internal net_clients state. This decouples HMP from internal data structures, making it possible to remove HMP support without losing programmatic network introspection. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/net/net.h | 3 +- net/hub.c | 29 +++++++------ net/hub.h | 4 +- net/net-hmp-cmds.c | 57 +++++++++++++++++++------ net/net.c | 70 +++++++++++++++++++++++------- qapi/net.json | 122 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 6 files changed, 242 insertions(+), 43 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 9edfacf827ca..a7c49c543783 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -274,7 +274,6 @@ DeviceState *qemu_create_nic_device(const char *typenam= e, bool match_default, void qemu_create_nic_bus_devices(BusState *bus, const char *parent_type, const char *default_model, const char *alias, const char *alias_targ= et); -void print_net_client(Monitor *mon, NetClientState *nc); void net_socket_rs_init(SocketReadState *rs, SocketReadStateFinalize *finalize, bool vnet_hdr); @@ -325,6 +324,8 @@ void netdev_add(QemuOpts *opts, Error **errp); =20 int net_hub_id_for_client(NetClientState *nc, int *id); =20 +NetworkClientInfo *net_client_info(NetClientState *nc); + #define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown" #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" diff --git a/net/hub.c b/net/hub.c index ee5881f6d5cb..b53a4cc872ca 100644 --- a/net/hub.c +++ b/net/hub.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "monitor/monitor.h" +#include "qapi/util.h" #include "net/net.h" #include "clients.h" #include "hub.h" @@ -199,26 +199,31 @@ NetClientState *net_hub_add_port(int hub_id, const ch= ar *name, return &port->nc; } =20 -/** - * Print hub configuration - */ -void net_hub_info(Monitor *mon) +NetHubInfoList *net_hub_query_info(void) { + NetHubInfoList *head =3D NULL, **tail =3D &head; NetHub *hub; - NetHubPort *port; =20 QLIST_FOREACH(hub, &hubs, next) { - monitor_printf(mon, "hub %d\n", hub->id); + NetHubInfo *hi =3D g_new0(NetHubInfo, 1); + NetHubPortInfoList **ptail =3D &hi->ports; + NetHubPort *port; + + hi->id =3D hub->id; + QLIST_FOREACH(port, &hub->ports, next) { - monitor_printf(mon, " \\ %s", port->nc.name); + NetHubPortInfo *pi =3D g_new0(NetHubPortInfo, 1); + pi->name =3D g_strdup(port->nc.name); if (port->nc.peer) { - monitor_printf(mon, ": "); - print_net_client(mon, port->nc.peer); - } else { - monitor_printf(mon, "\n"); + pi->peer =3D net_client_info(port->nc.peer); } + QAPI_LIST_APPEND(ptail, pi); } + + QAPI_LIST_APPEND(tail, hi); } + + return head; } =20 /** diff --git a/net/hub.h b/net/hub.h index ce45f7b399d3..cab6b1459b1a 100644 --- a/net/hub.h +++ b/net/hub.h @@ -15,10 +15,12 @@ #ifndef NET_HUB_H #define NET_HUB_H =20 +#include "qapi/qapi-types-net.h" + NetClientState *net_hub_add_port(int hub_id, const char *name, NetClientState *hubpeer); -void net_hub_info(Monitor *mon); void net_hub_check_clients(void); bool net_hub_flush(NetClientState *nc); +NetHubInfoList *net_hub_query_info(void); =20 #endif /* NET_HUB_H */ diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 2b24c9e60498..52ac8da770d9 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -19,37 +19,66 @@ #include "monitor/hmp-completion.h" #include "monitor/monitor.h" #include "net/net.h" -#include "net/hub.h" #include "qapi/clone-visitor.h" #include "qapi/qapi-commands-net.h" #include "qapi/qapi-visit-net.h" +#include "qapi/error.h" #include "qobject/qdict.h" #include "qemu/config-file.h" #include "qemu/help_option.h" #include "qemu/option.h" =20 +static void hmp_print_client_info(Monitor *mon, NetworkClientInfo *ci) +{ + NetFilterInfoList *f; + + monitor_printf(mon, "%s: index=3D%" PRIu32 ",type=3D%s,%s\n", + ci->name, ci->queue_index, + NetClientDriver_str(ci->type), ci->info_str); + if (ci->filters) { + monitor_printf(mon, "filters:\n"); + for (f =3D ci->filters; f; f =3D f->next) { + monitor_printf(mon, " - %s: type=3D%s%s%s\n", + f->value->name, f->value->type, + f->value->info[0] ? "," : "", f->value->info); + } + } +} + void hmp_info_network(Monitor *mon, const QDict *qdict) { - NetClientState *nc, *peer; - NetClientDriver type; + Error *err =3D NULL; + g_autoptr(NetworkInfo) info =3D qmp_x_query_network(&err); + NetHubInfoList *h; + NetworkClientInfoList *entry; =20 - net_hub_info(mon); + if (hmp_handle_error(mon, err)) { + return; + } =20 - QTAILQ_FOREACH(nc, &net_clients, next) { - peer =3D nc->peer; - type =3D nc->info->type; + for (h =3D info->hubs; h; h =3D h->next) { + NetHubPortInfoList *p; =20 - /* Skip if already printed in hub info */ - if (net_hub_id_for_client(nc, NULL) =3D=3D 0) { - continue; + monitor_printf(mon, "hub %d\n", (int)h->value->id); + for (p =3D h->value->ports; p; p =3D p->next) { + if (p->value->peer) { + monitor_printf(mon, " \\ %s: ", p->value->name); + hmp_print_client_info(mon, p->value->peer); + } else { + monitor_printf(mon, " \\ %s\n", p->value->name); + } } + } =20 - if (!peer || type =3D=3D NET_CLIENT_DRIVER_NIC) { - print_net_client(mon, nc); + for (entry =3D info->clients; entry; entry =3D entry->next) { + NetworkClientInfo *ci =3D entry->value; + + if (!ci->peer || ci->type =3D=3D NET_CLIENT_DRIVER_NIC) { + hmp_print_client_info(mon, ci); } /* else it's a netdev connected to a NIC, printed with the NIC */ - if (peer && type =3D=3D NET_CLIENT_DRIVER_NIC) { + if (ci->peer && ci->type =3D=3D NET_CLIENT_DRIVER_NIC) { monitor_printf(mon, " \\ "); - print_net_client(mon, peer); + hmp_print_client_info(mon, ci->peer); } } } diff --git a/net/net.c b/net/net.c index 0a30579ca4a7..1161183e183d 100644 --- a/net/net.c +++ b/net/net.c @@ -1525,14 +1525,14 @@ void qmp_netdev_del(const char *id, Error **errp) } } =20 -static void netfilter_print_info(Monitor *mon, NetFilterState *nf) +static char *netfilter_get_info_str(NetFilterState *nf) { char *str; ObjectProperty *prop; ObjectPropertyIterator iter; Visitor *v; + GString *buf =3D g_string_new(NULL); =20 - /* generate info str */ object_property_iter_init(&iter, OBJECT(nf)); while ((prop =3D object_property_iter_next(&iter))) { if (!strcmp(prop->name, "type")) { @@ -1542,29 +1542,69 @@ static void netfilter_print_info(Monitor *mon, NetF= ilterState *nf) object_property_get(OBJECT(nf), prop->name, v, NULL); visit_complete(v, &str); visit_free(v); - monitor_printf(mon, ",%s=3D%s", prop->name, str); + if (buf->len > 0) { + g_string_append_c(buf, ','); + } + g_string_append_printf(buf, "%s=3D%s", prop->name, str); g_free(str); } - monitor_printf(mon, "\n"); + + return g_string_free(buf, false); } =20 -void print_net_client(Monitor *mon, NetClientState *nc) +static NetworkClientInfo *net_client_info_no_peer(NetClientState *nc) { + NetworkClientInfo *info =3D g_new0(NetworkClientInfo, 1); NetFilterState *nf; =20 - monitor_printf(mon, "%s: index=3D%d,type=3D%s,%s\n", nc->name, - nc->queue_index, - NetClientDriver_str(nc->info->type), - nc->info_str); + info->name =3D g_strdup(nc->name); + info->queue_index =3D nc->queue_index; + info->type =3D nc->info->type; + info->info_str =3D g_strdup(nc->info_str); + if (!QTAILQ_EMPTY(&nc->filters)) { - monitor_printf(mon, "filters:\n"); + NetFilterInfoList **ftail =3D &info->filters; + QTAILQ_FOREACH(nf, &nc->filters, next) { + NetFilterInfo *fi =3D g_new0(NetFilterInfo, 1); + fi->name =3D g_strdup( + object_get_canonical_path_component(OBJECT(nf))); + fi->type =3D g_strdup(object_get_typename(OBJECT(nf))); + fi->info =3D netfilter_get_info_str(nf); + QAPI_LIST_APPEND(ftail, fi); + } } - QTAILQ_FOREACH(nf, &nc->filters, next) { - monitor_printf(mon, " - %s: type=3D%s", - object_get_canonical_path_component(OBJECT(nf)), - object_get_typename(OBJECT(nf))); - netfilter_print_info(mon, nf); + + return info; +} + +NetworkClientInfo *net_client_info(NetClientState *nc) +{ + NetworkClientInfo *info =3D net_client_info_no_peer(nc); + + if (nc->peer) { + info->peer =3D net_client_info_no_peer(nc->peer); } + + return info; +} + +NetworkInfo *qmp_x_query_network(Error **errp) +{ + NetworkInfo *info =3D g_new0(NetworkInfo, 1); + NetworkClientInfoList **tail =3D &info->clients; + NetClientState *nc; + + info->hubs =3D net_hub_query_info(); + + QTAILQ_FOREACH(nc, &net_clients, next) { + /* Skip if already gathered in hub info */ + if (net_hub_id_for_client(nc, NULL) =3D=3D 0) { + continue; + } + QAPI_LIST_APPEND(tail, net_client_info(nc)); + } + + return info; } =20 RxFilterInfoList *qmp_query_rx_filter(const char *name, Error **errp) diff --git a/qapi/net.json b/qapi/net.json index 5d3342fba23b..85c78710fe88 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1305,3 +1305,125 @@ 'returns': ['UsernetInfo'], 'if': 'CONFIG_SLIRP', 'features': [ 'unstable' ] } + +## +# @NetFilterInfo: +# +# Information about a netfilter attached to a network client. +# +# @name: filter object name (QOM path component) +# +# @type: QOM type name (e.g. "filter-mirror") +# +# @info: filter properties as comma-separated key=3Dvalue pairs +# (excluding @type) +# +# Since: 11.2 +## +{ 'struct': 'NetFilterInfo', + 'data': { + 'name': 'str', + 'type': 'str', + 'info': 'str' } } + +## +# @NetworkClientInfo: +# +# Information about a network client. +# +# @name: unique network client identifier +# +# @queue-index: index of this queue (0 for single-queue clients) +# +# @type: network client driver type +# +# @info-str: driver-specific formatted information string (e.g. +# "model=3De1000,macaddr=3D52:54:00:12:34:56") +# +# @peer: the connected peer client (always a leaf; the peer's own +# peer field is never populated) +# +# @filters: attached netfilters +# +# Since: 11.2 +## +{ 'struct': 'NetworkClientInfo', + 'data': { + 'name': 'str', + 'queue-index': 'uint32', + 'type': 'NetClientDriver', + 'info-str': 'str', + '*peer': 'NetworkClientInfo', + 'filters': ['NetFilterInfo'] } } + +## +# @NetHubPortInfo: +# +# Information about a hub port. +# +# @name: hub port identifier +# +# @peer: the network client connected through this port +# +# Since: 11.2 +## +{ 'struct': 'NetHubPortInfo', + 'data': { + 'name': 'str', + '*peer': 'NetworkClientInfo' } } + +## +# @NetHubInfo: +# +# Information about a network hub. +# +# @id: hub identifier +# +# @ports: list of ports on this hub +# +# Since: 11.2 +## +{ 'struct': 'NetHubInfo', + 'data': { + 'id': 'int', + 'ports': ['NetHubPortInfo'] } } + +## +# @NetworkInfo: +# +# Information about the network configuration. +# +# @hubs: network hubs and their ports +# +# @clients: network clients not associated with a hub +# +# Since: 11.2 +## +{ 'struct': 'NetworkInfo', + 'data': { + 'hubs': ['NetHubInfo'], + 'clients': ['NetworkClientInfo'] } } + +## +# @x-query-network: +# +# Query the network configuration including hubs and clients. +# +# Features: +# +# @unstable: This command is meant for debugging. +# +# Returns: @NetworkInfo describing hubs and clients. +# +# Since: 11.2 +# +# .. qmp-example:: +# +# -> { "execute": "x-query-network" } +# <- { "return": { "clients": [ { "name": "st0", +# "queue-index": 0, "type": "stream", +# "info-str": "listening" } ] } } +## +{ 'command': 'x-query-network', + 'returns': 'NetworkInfo', + 'features': [ 'unstable' ] } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907854; cv=none; d=zohomail.com; s=zohoarc; b=C6zEWHuUtJEaU762YsSRkQS4DGs9mgtk0veQ6bdcE2bRpwv5ccAsu4QIHAkue3J7G1Bkf1tOjMTot36PIArjBfrryqDj18sxVi9QqzOzYSVBBi4xJW4NT6NtBMyLWoo/Qv+kBagZJ78XQIEwyukX33F8qPz4a8WPAMRAXz3FDag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907854; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5me9IKB/1eEE3FMoQ1tv4Jcm7F9fMPCSAmLmmud3nJs=; b=GlvtQWHBib6jk+97t1ivjLmmJRuBzQF1DbRHyg4F65ID/Bom9w/j1UUtiN/+NRl2adX4vgyyKT8Ar66YYt29y3PMg/OiZKlqyNdaNncQniC5DiWQ6dqtPJ5Kod4Ev0zM95+1NhyOo7ecHmlimT45/gn1AJHUB4WvCoyc27O4Y+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907854053249.48094228469245; Sun, 16 Aug 2026 12:17:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJK-0000hU-BX; Sun, 16 Aug 2026 15:14:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJB-0000Yd-4c for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJ9-0007Zh-2Z for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:12 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-349-_6zVyEdNORiSaWcwdIyV8w-1; Sun, 16 Aug 2026 15:14:07 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2F6B6195608D; Sun, 16 Aug 2026 19:14:06 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4A0C9180049F; Sun, 16 Aug 2026 19:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907650; 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=5me9IKB/1eEE3FMoQ1tv4Jcm7F9fMPCSAmLmmud3nJs=; b=LV3sGlpEEHVCB4gvk9imYUpUXs4aOA8vxqafjBYh4wVok12QbVI/jkIO9s/e/SHAlxBrZv iS3OHrqZWjfT0kDvF2nRFdoP4QD0eaLbHS+8rlsWSqzK15jlfy2fJfO4gCNvCX0vlLe4u/ tsowuou+xoE9c+XAMIvrK15hAilP0F8= X-MC-Unique: _6zVyEdNORiSaWcwdIyV8w-1 X-Mimecast-MFC-AGG-ID: _6zVyEdNORiSaWcwdIyV8w_1786907646 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:46 +0400 Subject: [PATCH v3 19/49] tests/qtest/netdev-socket: replace HMP with x-query-network QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-19-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=12768; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=YA9IeNRf5eE0PbcbZTc2CKcxjqnSRjTaO3sj+6MVCNQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguxi/vpWK9Z2C/+UcFydxT2pbpB3UBu8NIai 3A5SRhSjjCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5V0ZEACowKQf/VH/NmcYBCsbUjL4vmyuXDPgNytr2rl5ZsZ4NPpkiqP360+vM5knjSG1HIWuG12 yCYiUvD1wJbGkj/3prB7P9gh+l2lT2MM8B2qocCIgh2jPSiRKM7Flqxsfs80GijXY53qhrR1ZsO lnAeq2jk+Cy9SlPUP0wYmewkSTTDWU7UuaOZFw52r3PbYsfGhFsYYTuYwd3LSqYu7ZxpCaM4xIw dfC8+Rf0JiTjGeoFZzPC4AMvCnN+4twAhH87msbA7dQ4PJHpD23UqazXAT0QLxpq00QAUrAX8Qt M51kpJUBAUMRH0I4kNwSt79sL3+90c9vS7Rlsu32LQPkZ0YpLoweDCFKLos+APugyi5jhNVzwcq eJNzb3iEl9GOH/nxWc3xV77huTnxb1Pfu9KsMR0UnL/Whi3we/0jk+El+59IBNatkllqQ5vTk+4 gADgdeO9bQVcFRLaHmLm/bbM3QefjYwgG1VfErgT0wvYPk6xxPNasWt4BVJrbxbjC+QxwW0XfUy UQ8DlTBXhnXkYBue/6fCzu/RkfW+zR7msVIV3hTy+PpeaA8qEY0EfwsMrm9bYkijfAmbX+wQ/qD cUQuYTRYy5sgeLFlGb4Xi0aYmOPfsRiaVNSWx5ev+hdgUuL5W0gALGTdiNC5iBWFT+H/Ug6zl7S PjHeM84uqG4ewoA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907854690158500 Replace the HMP "info network" text parsing with the structured x-query-network QMP command. This makes the test assertions more robust by matching individual fields (info-str) instead of parsing the full HMP line format. The EXPECT_STATE macro now takes an explicit netdev id argument to look up the client by name in the QMP response. The strrchr truncation is made NULL-safe: if the truncation character is not found, the full string is compared (and the final g_assert_cmpstr will catch mismatches). While at it, fix the pre-existing duplicate "qemu/sockets.h" include, and reorder includes. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/netdev-socket.c | 143 +++++++++++++++++++++++++---------------= ---- 1 file changed, 82 insertions(+), 61 deletions(-) diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c index b731af0ad959..30005c2e0015 100644 --- a/tests/qtest/netdev-socket.c +++ b/tests/qtest/netdev-socket.c @@ -7,33 +7,62 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/sockets.h" #include #include "../unit/socket-helpers.h" #include "libqtest.h" -#include "qobject/qstring.h" -#include "qemu/sockets.h" -#include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-sockets.h" +#include "qapi/qobject-input-visitor.h" +#include "qemu/sockets.h" +#include "qobject/qdict.h" +#include "qobject/qlist.h" +#include "qobject/qstring.h" =20 #define CONNECTION_TIMEOUT 60 =20 -#define EXPECT_STATE(q, e, t) \ -do { \ - char *resp =3D NULL; \ - g_test_timer_start(); \ - do { \ - g_free(resp); \ - resp =3D qtest_hmp(q, "info network"); \ - if (t) { \ - strrchr(resp, t)[0] =3D 0; \ - } \ - if (g_str_equal(resp, e)) { \ - break; \ - } \ - } while (g_test_timer_elapsed() < CONNECTION_TIMEOUT); \ - g_assert_cmpstr(resp, =3D=3D, e); \ - g_free(resp); \ +/* + * Only checks info-str; type is implicit from the netdev created by each = test + */ +static char *query_net_info_str(QTestState *q, const char *name) +{ + QDict *ret; + QList *clients; + QListEntry *entry; + + ret =3D qtest_qmp_assert_success_ref(q, "{'execute': 'x-query-network'= }"); + clients =3D qdict_get_qlist(ret, "clients"); + g_assert_nonnull(clients); + + QLIST_FOREACH_ENTRY(clients, entry) { + QDict *client =3D qobject_to(QDict, qlist_entry_obj(entry)); + if (g_str_equal(qdict_get_str(client, "name"), name)) { + char *info =3D g_strdup(qdict_get_str(client, "info-str")); + qobject_unref(ret); + return info; + } + } + + g_assert_not_reached(); +} + +#define EXPECT_STATE(q, id, e, t) \ +do { \ + char *info =3D NULL; \ + g_test_timer_start(); \ + do { \ + g_free(info); \ + info =3D query_net_info_str(q, id); \ + if (t) { \ + char *p =3D strrchr(info, t); \ + if (p) { \ + p[0] =3D 0; \ + } \ + } \ + if (g_str_equal(info, e)) { \ + break; \ + } \ + } while (g_test_timer_elapsed() < CONNECTION_TIMEOUT); \ + g_assert_cmpstr(info, =3D=3D, e); \ + g_free(info); \ } while (0) =20 static gchar *tmpdir; @@ -127,20 +156,19 @@ static void test_stream_inet_ipv4(void) "addr.ipv4=3Don,addr.ipv6=3Doff," "addr.host=3D127.0.0.1,addr.port=3D%d", port); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dinet," "addr.ipv4=3Don,addr.ipv6=3Doff," "addr.host=3D127.0.0.1,addr.port=3D%d", port); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,tcp:127.0.0.1= :%d\r\n", - port); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("tcp:127.0.0.1:%d", port); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 /* the port is unknown, check only the address */ - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,tcp:127.0.0.1", ':'); + EXPECT_STATE(qts0, "st0", "tcp:127.0.0.1", ':'); =20 qtest_quit(qts1); qtest_quit(qts0); @@ -200,7 +228,7 @@ static void test_stream_unix_reconnect(void) "-netdev stream,id=3Dst0,server=3Dtrue,addr.type=3D= unix," "addr.path=3D%s", path); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dunix," @@ -250,20 +278,19 @@ static void test_stream_inet_ipv6(void) "addr.ipv4=3Doff,addr.ipv6=3Don," "addr.host=3D::1,addr.port=3D%d", port); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dinet," "addr.ipv4=3Doff,addr.ipv6=3Don," "addr.host=3D::1,addr.port=3D%d", port); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,tcp:::1:%d\r\= n", - port); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("tcp:::1:%d", port); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 /* the port is unknown, check only the address */ - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,tcp:::1", ':'); + EXPECT_STATE(qts0, "st0", "tcp:::1", ':'); =20 qtest_quit(qts1); qtest_quit(qts0); @@ -282,16 +309,16 @@ static void test_stream_unix(void) "addr.type=3Dunix,addr.path=3D%s,", path); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,id=3Dst0,server=3Dfalse," "addr.type=3Dunix,addr.path=3D%s", path); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,unix:%s\r\n",= path); - EXPECT_STATE(qts1, expect, 0); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("unix:%s", path); + EXPECT_STATE(qts1, "st0", expect, 0); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); g_free(path); =20 @@ -314,16 +341,16 @@ static void test_stream_unix_abstract(void) "addr.abstract=3Don", path); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,id=3Dst0,server=3Dfalse," "addr.type=3Dunix,addr.path=3D%s,addr.abstract=3Don= ", path); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,unix:%s\r\n",= path); - EXPECT_STATE(qts1, expect, 0); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("unix:%s", path); + EXPECT_STATE(qts1, "st0", expect, 0); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); g_free(path); =20 @@ -346,14 +373,14 @@ static void test_stream_fd(void) "-netdev stream,id=3Dst0,addr.type=3Dfd,addr.str=3D= %d", sock[0]); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,unix:\r\n", 0); + EXPECT_STATE(qts0, "st0", "unix:", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,id=3Dst0,addr.type=3Dfd,addr.str=3D= %d", sock[1]); =20 - EXPECT_STATE(qts1, "st0: index=3D0,type=3Dstream,unix:\r\n", 0); - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,unix:\r\n", 0); + EXPECT_STATE(qts1, "st0", "unix:", 0); + EXPECT_STATE(qts0, "st0", "unix:", 0); =20 qtest_quit(qts1); qtest_quit(qts0); @@ -379,10 +406,9 @@ static void test_dgram_inet(void) "remote.type=3Dinet,remote.host=3D127.0.0.1,remote.= port=3D%d", port[0], port[1]); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram," - "udp=3D127.0.0.1:%d/127.0.0.1:%d\r\n", + expect =3D g_strdup_printf("udp=3D127.0.0.1:%d/127.0.0.1:%d", port[0], port[1]); - EXPECT_STATE(qts0, expect, 0); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); =20 qts1 =3D qtest_initf("-nodefaults -M none " @@ -391,10 +417,9 @@ static void test_dgram_inet(void) "remote.type=3Dinet,remote.host=3D127.0.0.1,remote.= port=3D%d", port[1], port[0]); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram," - "udp=3D127.0.0.1:%d/127.0.0.1:%d\r\n", + expect =3D g_strdup_printf("udp=3D127.0.0.1:%d/127.0.0.1:%d", port[1], port[0]); - EXPECT_STATE(qts1, expect, 0); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 qtest_quit(qts1); @@ -410,7 +435,7 @@ static void test_dgram_mcast(void) "-netdev dgram,id=3Dst0," "remote.type=3Dinet,remote.host=3D230.0.0.1,remote.p= ort=3D1234"); =20 - EXPECT_STATE(qts, "st0: index=3D0,type=3Ddgram,mcast=3D230.0.0.1:1234\= r\n", 0); + EXPECT_STATE(qts, "st0", "mcast=3D230.0.0.1:1234", 0); =20 qtest_quit(qts); } @@ -431,9 +456,8 @@ static void test_dgram_unix(void) "remote.type=3Dunix,remote.path=3D%s", path0, path1); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,udp=3D%s:%s\r\= n", - path0, path1); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("udp=3D%s:%s", path0, path1); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); =20 qts1 =3D qtest_initf("-nodefaults -M none " @@ -441,10 +465,8 @@ static void test_dgram_unix(void) "remote.type=3Dunix,remote.path=3D%s", path1, path0); =20 - - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,udp=3D%s:%s\r\= n", - path1, path0); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("udp=3D%s:%s", path1, path0); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 unlink(path0); @@ -470,17 +492,16 @@ static void test_dgram_fd(void) "-netdev dgram,id=3Dst0,local.type=3Dfd,local.str= =3D%d", sv[0]); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,fd=3D%d unix\r= \n", sv[0]); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("fd=3D%d unix", sv[0]); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev dgram,id=3Dst0,local.type=3Dfd,local.str= =3D%d", sv[1]); =20 - - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,fd=3D%d unix\r= \n", sv[1]); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("fd=3D%d unix", sv[1]); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 qtest_quit(qts1); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907846; cv=none; d=zohomail.com; s=zohoarc; b=nuBMdnaQyIhzIB2nTxXQPrYjQyE7rM3m6z0fMV9TOE3T4947Ppfd6hJQ8aBpgf4Ky61rkeW+2cYUwY6dVFcgg+jweFeWoypa9pzhpr9em3YePSi2fE/KL1KPmCe0RksB4bQRXImN/eT4vqYKmrRqmopagfd9EKjgezgTkJmQphM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907846; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n7cL9jkG1qTwA+bQqy6YVKpxCwpQSIY9VApSEqym9nA=; b=GLop42XtQb+I6qAFU1SnRldbkLJ1M4jn0l75HuoIiFet70ZLcWXI3RMenQ4jeAs7liYpn0lc7xvQF+TsAbKsyJ4f7Lk5c2M7PwQNTTOHZ3fYQvyUdRE+0wDWhRubRuTyr5kPZsoAiPjLIbcIkg/EN9siG1FRDK9J5L0xM36GSws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907846782996.1158772036018; Sun, 16 Aug 2026 12:17:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJP-00010A-Js; Sun, 16 Aug 2026 15:14:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJI-0000iT-TP for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJE-0007ax-CO for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:20 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-t52TwVFcM9m22M9BuSYNcQ-1; Sun, 16 Aug 2026 15:14:12 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 90B31195608E; Sun, 16 Aug 2026 19:14:10 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A63C330001A2; Sun, 16 Aug 2026 19:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907655; 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=n7cL9jkG1qTwA+bQqy6YVKpxCwpQSIY9VApSEqym9nA=; b=gO6QeMpL0Pi1X+KaOVM10kqFYzk8AEsH8+IBAFf16pXE1QP66lJ0pQ/e3U7UOuXGg4pPIM 1dS4kQjGc9EF0UvHHzhXcU+l/lAD4kmpAfywQUDWNk3B4SKfuNB3joIRYD3NFrUygc86cz cRaAKTQJyL7nDhl7JTgd5zamrmSxs9k= X-MC-Unique: t52TwVFcM9m22M9BuSYNcQ-1 X-Mimecast-MFC-AGG-ID: t52TwVFcM9m22M9BuSYNcQ_1786907651 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:47 +0400 Subject: [PATCH v3 20/49] qemu-io: propagate errors through Error API instead of printf MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-20-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Eric Blake , Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=150642; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zQHMNaYObNXnDZ8CiRgCLzH9MMH+iYmDHmRqyMJuIzc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguxdum8JjoacweLxuY+7mILSJ9IG5Zxk/KXx E/aOZli8T2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsQAKCRDa6OEJdZac 5amJD/9eMp8tR0TzsKyRLS5fVlvlk6v5Rfx/g2BZaYz4/MhL+Rz4d4Cn5tm+h8KQxq+9fuU0lX9 L1HC7jXrT6DXdMNsR/132JcUvdXy4YNME6gu269b3pysaK8Fn7DbaDpwcjzZWaeLYiA1zPEefIj NlQspp2ROZsVZsCHATtmbjGbaP5JQySFzNUe1cpwctnd0AJZqM/6pvwd1dWFlcTQWiKXo58IcPO Ra6CnJDb2hVic73M4xx2ZGMoADd7nKWPOID8xT+Hc1RcTmRe0pz1DhgEzT/mGe6fy0YsChbz7oZ o7yi92sBPLLKJQdf5KJOJN3zFd/VpF650kCJT19iFJxNl/LqzarMncml9UUsCumrhWwrHiA0A3/ Ud8apvsa0JvN76d6s6LRG7NW9ixBYvfTV1n6UkrHhFvP4PNT5qDzERlqAogUMC8THH7+HftE62A J9HNVuXmXJBb5X8xY3syYqNXXkVeL3Oz/ApA0uvsTzBzCVYuKxqTYrzg97+fpx/S1evEXxx8DMw 3GPWWgeExnyqZ3ypxNWbziyzFvNoktuR9cpU5a+CiSYAyhjoEeNKdqvGtJSyih0l1iGL4iSSPVZ +vVnax4QuJtNkyZiTMjzwXIr4PUgYxeEdiSg5nE6TwBKkhrBmxrcH8pyoXTP2x66Yt4WPqQpbxk mucOhLCp6iFIGVw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907848859158500 Convert the qemu-io command infrastructure to use QEMU's Error API (Error **errp) for error propagation instead of printing directly to stdout/stderr via printf/fprintf. The cfunc_t typedef, all ~35 command functions, the dispatcher chain (command/init_check_command/qemuio_command), and helper functions (parse_pattern, create_iovec, qemu_io_alloc_from_file) all gain an Error **errp parameter. Async completion callbacks (aio_read_done, aio_write_done, aio_discard_done) use error_report() since they have no Error path back to the caller. Update tests: - error_report_err() prepends qemu-io: prefix - copy-before-write: check the HMP return value, rather than stdio - other tests: update to check JSON {"return": "Error: error text"} Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- block/monitor/block-hmp-cmds.c | 2 +- include/qemu-io.h | 4 +- qemu-io-cmds.c | 414 +++++++++++++--------= ---- qemu-io.c | 17 +- tests/qemu-iotests/004.out | 20 +- tests/qemu-iotests/021.out | 60 ++-- tests/qemu-iotests/026.out | 228 +++++++------- tests/qemu-iotests/060.out | 44 ++- tests/qemu-iotests/071.out | 10 +- tests/qemu-iotests/072.out | 2 +- tests/qemu-iotests/080.out | 4 +- tests/qemu-iotests/081.out | 2 +- tests/qemu-iotests/083.out | 36 +-- tests/qemu-iotests/089.out | 4 +- tests/qemu-iotests/114.out | 2 +- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/137.out | 2 +- tests/qemu-iotests/153.out | 12 +- tests/qemu-iotests/171 | 2 +- tests/qemu-iotests/171.out | 68 ++-- tests/qemu-iotests/205 | 2 +- tests/qemu-iotests/214.out | 2 +- tests/qemu-iotests/220.out | 2 +- tests/qemu-iotests/225.out | 4 +- tests/qemu-iotests/244.out | 12 +- tests/qemu-iotests/249.out | 6 +- tests/qemu-iotests/271.out | 14 +- tests/qemu-iotests/289.out | 2 +- tests/qemu-iotests/305.out | 2 +- tests/qemu-iotests/307.out | 2 +- tests/qemu-iotests/tests/backup-discard-source | 4 +- tests/qemu-iotests/tests/copy-before-write | 66 ++-- tests/qemu-iotests/tests/file-io-error.out | 2 +- tests/qemu-iotests/tests/image-fleecing.out | 12 +- tests/qemu-iotests/tests/inactive-node-nbd.out | 8 +- 35 files changed, 552 insertions(+), 523 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 39b82e8ef501..9930620a4a16 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -598,7 +598,7 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) * extended, possibly resulting in a read-only guest device keeping wr= ite * permissions. Ugly, but it appears to be the lesser evil. */ - qemuio_command(blk, command); + qemuio_command(blk, command, &err); =20 fail: blk_unref(local_blk); diff --git a/include/qemu-io.h b/include/qemu-io.h index 3af513004a68..240764bb35cd 100644 --- a/include/qemu-io.h +++ b/include/qemu-io.h @@ -25,7 +25,7 @@ * Operate on @blk using @argc/@argv as the command's arguments, and * return 0 on success or negative errno on failure. */ -typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv); +typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv, Error **e= rrp); =20 typedef void (*helpfunc_t)(void); =20 @@ -45,7 +45,7 @@ typedef struct cmdinfo { =20 extern bool qemuio_misalign; =20 -int qemuio_command(BlockBackend *blk, const char *cmd); +int qemuio_command(BlockBackend *blk, const char *cmd, Error **errp); =20 void qemuio_add_command(const cmdinfo_t *ci); void qemuio_command_usage(const cmdinfo_t *ci); diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index de4c1966feae..aa795fd87a14 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -55,40 +55,43 @@ void qemuio_command_usage(const cmdinfo_t *ci) printf("%s %s -- %s\n", ci->name, ci->args, ci->oneline); } =20 -static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct) +static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct, + Error **errp) { if (ct->flags & CMD_FLAG_GLOBAL) { return 1; } if (!(ct->flags & CMD_NOFILE_OK) && !blk) { - fprintf(stderr, "no file open, try 'help open'\n"); + error_setg(errp, "no file open, try 'help open'"); return 0; } return 1; } =20 static int command(BlockBackend *blk, const cmdinfo_t *ct, int argc, - char **argv) + char **argv, Error **errp) { char *cmd =3D argv[0]; =20 - if (!init_check_command(blk, ct)) { + if (!init_check_command(blk, ct, errp)) { return -EINVAL; } =20 if (argc - 1 < ct->argmin || (ct->argmax !=3D -1 && argc - 1 > ct->arg= max)) { if (ct->argmax =3D=3D -1) { - fprintf(stderr, - "bad argument count %d to %s, expected at least %d arg= uments\n", - argc-1, cmd, ct->argmin); + error_setg(errp, + "bad argument count %d to %s," + " expected at least %d arguments", + argc - 1, cmd, ct->argmin); } else if (ct->argmin =3D=3D ct->argmax) { - fprintf(stderr, - "bad argument count %d to %s, expected %d arguments\n", - argc-1, cmd, ct->argmin); + error_setg(errp, + "bad argument count %d to %s, expected %d arguments= ", + argc - 1, cmd, ct->argmin); } else { - fprintf(stderr, - "bad argument count %d to %s, expected between %d and = %d arguments\n", - argc-1, cmd, ct->argmin, ct->argmax); + error_setg(errp, + "bad argument count %d to %s," + " expected between %d and %d arguments", + argc - 1, cmd, ct->argmin, ct->argmax); } return -EINVAL; } @@ -112,21 +115,19 @@ static int command(BlockBackend *blk, const cmdinfo_t= *ct, int argc, =20 if (ct->perm & ~orig_perm) { uint64_t new_perm; - Error *local_err =3D NULL; int ret; =20 new_perm =3D orig_perm | ct->perm; =20 - ret =3D blk_set_perm(blk, new_perm, orig_shared_perm, &local_e= rr); + ret =3D blk_set_perm(blk, new_perm, orig_shared_perm, errp); if (ret < 0) { - error_report_err(local_err); return ret; } } } =20 qemu_reset_optind(); - return ct->cfunc(blk, argc, argv); + return ct->cfunc(blk, argc, argv, errp); } =20 static const cmdinfo_t *find_command(const char *cmd) @@ -192,18 +193,18 @@ static int64_t cvtnum(const char *s) return value; } =20 -static void print_cvtnum_err(int64_t rc, const char *arg) +static void set_cvtnum_err(int64_t rc, const char *arg, Error **errp) { switch (rc) { case -EINVAL: - printf("Parsing error: non-numeric argument," - " or extraneous/unrecognized suffix -- %s\n", arg); + error_setg(errp, "Parsing error: non-numeric argument," + " or extraneous/unrecognized suffix -- %s", arg); break; case -ERANGE: - printf("Parsing error: argument too large -- %s\n", arg); + error_setg(errp, "Parsing error: argument too large -- %s", arg); break; default: - printf("Parsing error: %s\n", arg); + error_setg(errp, "Parsing error: %s", arg); } } =20 @@ -316,14 +317,14 @@ static void timestr(struct timespec *tv, char *ts, si= ze_t size, int format) * Because the pattern is used as an argument to memset it must evaluate * to an unsigned integer that fits into a single byte. */ -static int parse_pattern(const char *arg) +static int parse_pattern(const char *arg, Error **errp) { char *endptr =3D NULL; long pattern; =20 pattern =3D strtol(arg, &endptr, 0); if (pattern < 0 || pattern > UCHAR_MAX || *endptr !=3D '\0') { - printf("%s is not a valid pattern byte\n", arg); + error_setg(errp, "%s is not a valid pattern byte", arg); return -1; } =20 @@ -386,7 +387,8 @@ static void qemu_io_free(BlockBackend *blk, void *p, si= ze_t len, * NULL on error */ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, - const char *file_name, bool register_= buf) + const char *file_name, bool register_= buf, + Error **errp) { size_t alloc_len =3D len + (qemuio_misalign ? MISALIGN_OFFSET : 0); char *alloc_buf, *buf, *end; @@ -394,7 +396,7 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk,= size_t len, int pattern_len; =20 if (!f) { - perror(file_name); + error_setg_errno(errp, errno, "%s", file_name); return NULL; } =20 @@ -407,12 +409,12 @@ static void *qemu_io_alloc_from_file(BlockBackend *bl= k, size_t len, pattern_len =3D fread(buf, 1, len, f); =20 if (ferror(f)) { - perror(file_name); + error_setg_errno(errp, errno, "%s", file_name); goto error; } =20 if (pattern_len =3D=3D 0) { - fprintf(stderr, "%s: file is empty\n", file_name); + error_setg(errp, "%s: file is empty", file_name); goto error; } =20 @@ -494,7 +496,7 @@ static void print_report(const char *op, struct timespe= c *t, int64_t offset, */ static void * create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_io= v, - int pattern, bool register_buf) + int pattern, bool register_buf, Error **errp) { size_t *sizes =3D g_new0(size_t, nr_iov); size_t count =3D 0; @@ -508,19 +510,20 @@ create_iovec(BlockBackend *blk, QEMUIOVector *qiov, c= har **argv, int nr_iov, =20 len =3D cvtnum(arg); if (len < 0) { - print_cvtnum_err(len, arg); + set_cvtnum_err(len, arg, errp); goto fail; } =20 if (len > BDRV_REQUEST_MAX_BYTES) { - printf("Argument '%s' exceeds maximum size %" PRIu64 "\n", arg, - (uint64_t)BDRV_REQUEST_MAX_BYTES); + error_setg(errp, "Argument '%s' exceeds maximum size %" PRIu64, + arg, (uint64_t)BDRV_REQUEST_MAX_BYTES); goto fail; } =20 if (count > BDRV_REQUEST_MAX_BYTES - len) { - printf("The total number of bytes exceed the maximum size %" P= RIu64 - "\n", (uint64_t)BDRV_REQUEST_MAX_BYTES); + error_setg(errp, + "The total number of bytes exceed the maximum size = %" + PRIu64, (uint64_t)BDRV_REQUEST_MAX_BYTES); goto fail; } =20 @@ -692,7 +695,7 @@ static void read_help(void) "\n"); } =20 -static int read_f(BlockBackend *blk, int argc, char **argv); +static int read_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t read_cmd =3D { .name =3D "read", @@ -705,7 +708,7 @@ static const cmdinfo_t read_cmd =3D { .help =3D read_help, }; =20 -static int read_f(BlockBackend *blk, int argc, char **argv) +static int read_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, vflag =3D false; @@ -732,7 +735,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) lflag =3D true; pattern_count =3D cvtnum(optarg); if (pattern_count < 0) { - print_cvtnum_err(pattern_count, optarg); + set_cvtnum_err(pattern_count, optarg, errp); return pattern_count; } break; @@ -741,7 +744,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -756,7 +759,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) sflag =3D true; pattern_offset =3D cvtnum(optarg); if (pattern_offset < 0) { - print_cvtnum_err(pattern_offset, optarg); + set_cvtnum_err(pattern_offset, optarg, errp); return pattern_offset; } break; @@ -776,18 +779,18 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); return count; } else if (count > BDRV_REQUEST_MAX_BYTES) { - printf("length cannot exceed %" PRIu64 ", given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, "length cannot exceed %" PRIu64 ", given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 @@ -801,24 +804,26 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) } =20 if ((pattern_count < 0) || (pattern_count + pattern_offset > count)) { - printf("pattern verification range exceeds end of read data\n"); + error_setg(errp, "pattern verification range exceeds end of read d= ata"); return -EINVAL; } =20 if (bflag) { if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) { - printf("%" PRId64 " is not a sector-aligned value for 'offset'= \n", - offset); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'off= set'", + offset); return -EINVAL; } if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) { - printf("%"PRId64" is not a sector-aligned value for 'count'\n", - count); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'cou= nt'", + count); return -EINVAL; } if (flags & BDRV_REQ_REGISTERED_BUF) { - printf("I/O buffer registration is not supported when reading " - "from vmstate\n"); + error_setg(errp, "I/O buffer registration is not supported whe= n" + " reading from vmstate"); return -EINVAL; } } @@ -834,7 +839,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("read failed: %s\n", strerror(-ret)); + error_setg(errp, "read failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -845,9 +850,9 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) void *cmp_buf =3D g_malloc(pattern_count); memset(cmp_buf, pattern, pattern_count); if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) { - printf("Pattern verification failed at offset %" - PRId64 ", %"PRId64" bytes\n", - offset + pattern_offset, pattern_count); + error_setg(errp, "Pattern verification failed at offset %" + PRId64 ", %" PRId64 " bytes", + offset + pattern_offset, pattern_count); ret =3D -EINVAL; } g_free(cmp_buf); @@ -890,7 +895,7 @@ static void readv_help(void) "\n"); } =20 -static int readv_f(BlockBackend *blk, int argc, char **argv); +static int readv_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t readv_cmd =3D { .name =3D "readv", @@ -902,7 +907,7 @@ static const cmdinfo_t readv_cmd =3D { .help =3D readv_help, }; =20 -static int readv_f(BlockBackend *blk, int argc, char **argv) +static int readv_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, vflag =3D false; @@ -924,7 +929,7 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -952,14 +957,14 @@ static int readv_f(BlockBackend *blk, int argc, char = **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; =20 nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, 0xab, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } @@ -969,7 +974,7 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("readv failed: %s\n", strerror(-ret)); + error_setg(errp, "readv failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -980,8 +985,8 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) void *cmp_buf =3D g_malloc(qiov.size); memset(cmp_buf, pattern, qiov.size); if (memcmp(buf, cmp_buf, qiov.size)) { - printf("Pattern verification failed at offset %" - PRId64 ", %zu bytes\n", offset, qiov.size); + error_setg(errp, "Pattern verification failed at offset %" + PRId64 ", %zu bytes", offset, qiov.size); ret =3D -EINVAL; } g_free(cmp_buf); @@ -1031,7 +1036,7 @@ static void write_help(void) "\n"); } =20 -static int write_f(BlockBackend *blk, int argc, char **argv); +static int write_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t write_cmd =3D { .name =3D "write", @@ -1045,7 +1050,7 @@ static const cmdinfo_t write_cmd =3D { .help =3D write_help, }; =20 -static int write_f(BlockBackend *blk, int argc, char **argv) +static int write_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, bflag =3D false; @@ -1082,7 +1087,7 @@ static int write_f(BlockBackend *blk, int argc, char = **argv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -1115,72 +1120,78 @@ static int write_f(BlockBackend *blk, int argc, cha= r **argv) } =20 if (bflag && zflag) { - printf("-b and -z cannot be specified at the same time\n"); + error_setg(errp, "-b and -z cannot be specified at the same time"); return -EINVAL; } =20 if ((flags & BDRV_REQ_FUA) && (bflag || cflag)) { - printf("-f and -b or -c cannot be specified at the same time\n"); + error_setg(errp, + "-f and -b or -c cannot be specified at the same time"); return -EINVAL; } =20 if ((flags & BDRV_REQ_NO_FALLBACK) && !zflag) { - printf("-n requires -z to be specified\n"); + error_setg(errp, "-n requires -z to be specified"); return -EINVAL; } =20 if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) { - printf("-u requires -z to be specified\n"); + error_setg(errp, "-u requires -z to be specified"); return -EINVAL; } =20 if (zflag + Pflag + sflag > 1) { - printf("Only one of -z, -P, and -s " - "can be specified at the same time\n"); + error_setg(errp, "Only one of -z, -P, and -s " + "can be specified at the same time"); return -EINVAL; } =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); return count; } else if (count > BDRV_REQUEST_MAX_BYTES && !(flags & BDRV_REQ_NO_FALLBACK)) { - printf("length cannot exceed %" PRIu64 " without -n, given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, + "length cannot exceed %" PRIu64 " without -n, given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 if (bflag || cflag) { if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) { - printf("%" PRId64 " is not a sector-aligned value for 'offset'= \n", - offset); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'off= set'", + offset); return -EINVAL; } =20 if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) { - printf("%"PRId64" is not a sector-aligned value for 'count'\n", - count); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'cou= nt'", + count); return -EINVAL; } } =20 if (zflag) { if (flags & BDRV_REQ_REGISTERED_BUF) { - printf("cannot combine zero write with registered I/O buffer\n= "); + error_setg(errp, + "cannot combine zero write with registered I/O buff= er"); return -EINVAL; } } else { if (sflag) { buf =3D qemu_io_alloc_from_file(blk, count, file_name, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, + errp); if (!buf) { return -EINVAL; } @@ -1203,7 +1214,7 @@ static int write_f(BlockBackend *blk, int argc, char = **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("write failed: %s\n", strerror(-ret)); + error_setg(errp, "write failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -1245,7 +1256,7 @@ writev_help(void) "\n"); } =20 -static int writev_f(BlockBackend *blk, int argc, char **argv); +static int writev_f(BlockBackend *blk, int argc, char **argv, Error **errp= ); =20 static const cmdinfo_t writev_cmd =3D { .name =3D "writev", @@ -1258,7 +1269,7 @@ static const cmdinfo_t writev_cmd =3D { .help =3D writev_help, }; =20 -static int writev_f(BlockBackend *blk, int argc, char **argv) +static int writev_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false; @@ -1287,7 +1298,7 @@ static int writev_f(BlockBackend *blk, int argc, char= **argv) flags |=3D BDRV_REQ_REGISTERED_BUF; break; case 'P': - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -1305,14 +1316,14 @@ static int writev_f(BlockBackend *blk, int argc, ch= ar **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; =20 nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } @@ -1322,7 +1333,7 @@ static int writev_f(BlockBackend *blk, int argc, char= **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("writev failed: %s\n", strerror(-ret)); + error_setg(errp, "writev failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -1367,7 +1378,7 @@ static void aio_write_done(void *opaque, int ret) =20 =20 if (ret < 0) { - printf("aio_write failed: %s\n", strerror(-ret)); + error_report("aio_write failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -1399,7 +1410,7 @@ static void aio_read_done(void *opaque, int ret) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("readv failed: %s\n", strerror(-ret)); + error_report("readv failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -1409,8 +1420,8 @@ static void aio_read_done(void *opaque, int ret) =20 memset(cmp_buf, ctx->pattern, ctx->qiov.size); if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) { - printf("Pattern verification failed at offset %" - PRId64 ", %zu bytes\n", ctx->offset, ctx->qiov.size); + error_report("Pattern verification failed at offset %" + PRId64 ", %zu bytes", ctx->offset, ctx->qiov.size= ); } g_free(cmp_buf); } @@ -1461,7 +1472,7 @@ static void aio_read_help(void) "\n"); } =20 -static int aio_read_f(BlockBackend *blk, int argc, char **argv); +static int aio_read_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); =20 static const cmdinfo_t aio_read_cmd =3D { .name =3D "aio_read", @@ -1473,7 +1484,7 @@ static const cmdinfo_t aio_read_cmd =3D { .help =3D aio_read_help, }; =20 -static int aio_read_f(BlockBackend *blk, int argc, char **argv) +static int aio_read_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { int nr_iov, c; struct aio_ctx *ctx =3D g_new0(struct aio_ctx, 1); @@ -1486,7 +1497,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) break; case 'P': ctx->Pflag =3D true; - ctx->pattern =3D parse_pattern(optarg); + ctx->pattern =3D parse_pattern(optarg, errp); if (ctx->pattern < 0) { g_free(ctx); return -EINVAL; @@ -1522,7 +1533,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { int ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -1530,7 +1541,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) =20 nr_iov =3D argc - optind; ctx->buf =3D create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab, - ctx->flags & BDRV_REQ_REGISTERED_BUF); + ctx->flags & BDRV_REQ_REGISTERED_BUF, errp); if (ctx->buf =3D=3D NULL) { block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_READ); g_free(ctx); @@ -1573,7 +1584,7 @@ static void aio_write_help(void) "\n"); } =20 -static int aio_write_f(BlockBackend *blk, int argc, char **argv); +static int aio_write_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp); =20 static const cmdinfo_t aio_write_cmd =3D { .name =3D "aio_write", @@ -1586,7 +1597,7 @@ static const cmdinfo_t aio_write_cmd =3D { .help =3D aio_write_help, }; =20 -static int aio_write_f(BlockBackend *blk, int argc, char **argv) +static int aio_write_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { int nr_iov, c; int pattern =3D 0xcd; @@ -1611,7 +1622,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) ctx->flags |=3D BDRV_REQ_MAY_UNMAP; break; case 'P': - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { g_free(ctx); return -EINVAL; @@ -1639,25 +1650,26 @@ static int aio_write_f(BlockBackend *blk, int argc,= char **argv) } =20 if (ctx->zflag && optind !=3D argc - 2) { - printf("-z supports only a single length parameter\n"); + error_setg(errp, "-z supports only a single length parameter"); g_free(ctx); return -EINVAL; } =20 if ((ctx->flags & BDRV_REQ_MAY_UNMAP) && !ctx->zflag) { - printf("-u requires -z to be specified\n"); + error_setg(errp, "-u requires -z to be specified"); g_free(ctx); return -EINVAL; } =20 if (ctx->zflag && ctx->Pflag) { - printf("-z and -P cannot be specified at the same time\n"); + error_setg(errp, "-z and -P cannot be specified at the same time"); g_free(ctx); return -EINVAL; } =20 if (ctx->zflag && (ctx->flags & BDRV_REQ_REGISTERED_BUF)) { - printf("cannot combine zero write with registered I/O buffer\n"); + error_setg(errp, + "cannot combine zero write with registered I/O buffer"); g_free(ctx); return -EINVAL; } @@ -1665,7 +1677,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { int ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -1674,7 +1686,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) if (ctx->zflag) { int64_t count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); g_free(ctx); return count; } @@ -1685,7 +1697,8 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) } else { nr_iov =3D argc - optind; ctx->buf =3D create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, - pattern, ctx->flags & BDRV_REQ_REGISTERED_= BUF); + pattern, + ctx->flags & BDRV_REQ_REGISTERED_BUF, errp= ); if (ctx->buf =3D=3D NULL) { block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_WRITE); g_free(ctx); @@ -1703,7 +1716,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) return 0; } =20 -static int aio_flush_f(BlockBackend *blk, int argc, char **argv) +static int aio_flush_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { BlockAcctCookie cookie; block_acct_start(blk_get_stats(blk), &cookie, 0, BLOCK_ACCT_FLUSH); @@ -1718,7 +1731,7 @@ static const cmdinfo_t aio_flush_cmd =3D { .oneline =3D "completes all outstanding aio requests" }; =20 -static int flush_f(BlockBackend *blk, int argc, char **argv) +static int flush_f(BlockBackend *blk, int argc, char **argv, Error **errp) { return blk_flush(blk); } @@ -1735,7 +1748,7 @@ static inline int64_t tosector(int64_t bytes) return bytes >> BDRV_SECTOR_BITS; } =20 -static int zone_report_f(BlockBackend *blk, int argc, char **argv) +static int zone_report_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; int64_t offset; @@ -1745,17 +1758,17 @@ static int zone_report_f(BlockBackend *blk, int arg= c, char **argv) ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; val =3D cvtnum(argv[optind]); if (val < 0) { - print_cvtnum_err(val, argv[optind]); + set_cvtnum_err(val, argv[optind], errp); return val; } if (val > UINT_MAX) { - printf("Number of zones must be less than 2^32\n"); + error_setg(errp, "Number of zones must be less than 2^32"); return -ERANGE; } nr_zones =3D val; @@ -1764,7 +1777,7 @@ static int zone_report_f(BlockBackend *blk, int argc,= char **argv) zones =3D g_new(BlockZoneDescriptor, nr_zones); ret =3D blk_zone_report(blk, offset, &nr_zones, zones); if (ret < 0) { - printf("zone report failed: %s\n", strerror(-ret)); + error_setg(errp, "zone report failed: %s", strerror(-ret)); } else { for (int i =3D 0; i < nr_zones; ++i) { printf("start: 0x%" PRIx64 ", len 0x%" PRIx64 ", " @@ -1788,25 +1801,25 @@ static const cmdinfo_t zone_report_cmd =3D { .oneline =3D "report zone information", }; =20 -static int zone_open_f(BlockBackend *blk, int argc, char **argv) +static int zone_open_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_OPEN, offset, len); if (ret < 0) { - printf("zone open failed: %s\n", strerror(-ret)); + error_setg(errp, "zone open failed: %s", strerror(-ret)); } return ret; } @@ -1821,25 +1834,25 @@ static const cmdinfo_t zone_open_cmd =3D { .oneline =3D "explicit open a range of zones in zone block device", }; =20 -static int zone_close_f(BlockBackend *blk, int argc, char **argv) +static int zone_close_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_CLOSE, offset, len); if (ret < 0) { - printf("zone close failed: %s\n", strerror(-ret)); + error_setg(errp, "zone close failed: %s", strerror(-ret)); } return ret; } @@ -1854,25 +1867,25 @@ static const cmdinfo_t zone_close_cmd =3D { .oneline =3D "close a range of zones in zone block device", }; =20 -static int zone_finish_f(BlockBackend *blk, int argc, char **argv) +static int zone_finish_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_FINISH, offset, len); if (ret < 0) { - printf("zone finish failed: %s\n", strerror(-ret)); + error_setg(errp, "zone finish failed: %s", strerror(-ret)); } return ret; } @@ -1887,25 +1900,25 @@ static const cmdinfo_t zone_finish_cmd =3D { .oneline =3D "finish a range of zones in zone block device", }; =20 -static int zone_reset_f(BlockBackend *blk, int argc, char **argv) +static int zone_reset_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_RESET, offset, len); if (ret < 0) { - printf("zone reset failed: %s\n", strerror(-ret)); + error_setg(errp, "zone reset failed: %s", strerror(-ret)); } return ret; } @@ -1934,7 +1947,7 @@ static int do_aio_zone_append(BlockBackend *blk, QEMU= IOVector *qiov, return async_ret < 0 ? async_ret : 1; } =20 -static int zone_append_f(BlockBackend *blk, int argc, char **argv) +static int zone_append_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; bool pflag =3D false; @@ -1956,19 +1969,19 @@ static int zone_append_f(BlockBackend *blk, int arg= c, char **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } ret =3D do_aio_zone_append(blk, &qiov, &offset, flags, &total); if (ret < 0) { - printf("zone append failed: %s\n", strerror(-ret)); + error_setg(errp, "zone append failed: %s", strerror(-ret)); goto out; } =20 @@ -1994,7 +2007,7 @@ static const cmdinfo_t zone_append_cmd =3D { .oneline =3D "append write a number of bytes at a specified offset", }; =20 -static int truncate_f(BlockBackend *blk, int argc, char **argv); +static int truncate_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); static const cmdinfo_t truncate_cmd =3D { .name =3D "truncate", .altname =3D "t", @@ -2006,9 +2019,8 @@ static const cmdinfo_t truncate_cmd =3D { .oneline =3D "truncates the current file at the given offset", }; =20 -static int truncate_f(BlockBackend *blk, int argc, char **argv) +static int truncate_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { - Error *local_err =3D NULL; int64_t offset; int c, ret; PreallocMode prealloc =3D PREALLOC_MODE_OFF; @@ -2019,7 +2031,7 @@ static int truncate_f(BlockBackend *blk, int argc, ch= ar **argv) prealloc =3D qapi_enum_parse(&PreallocMode_lookup, optarg, PREALLOC_MODE__MAX, NULL); if (prealloc =3D=3D PREALLOC_MODE__MAX) { - error_report("Invalid preallocation mode '%s'", optarg); + error_setg(errp, "Invalid preallocation mode '%s'", optarg= ); return -EINVAL; } break; @@ -2031,7 +2043,7 @@ static int truncate_f(BlockBackend *blk, int argc, ch= ar **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[1]); + set_cvtnum_err(offset, argv[1], errp); return offset; } =20 @@ -2040,23 +2052,22 @@ static int truncate_f(BlockBackend *blk, int argc, = char **argv) * exact=3Dtrue. It is better to err on the "emit more errors" side * than to be overly permissive. */ - ret =3D blk_truncate(blk, offset, false, prealloc, 0, &local_err); + ret =3D blk_truncate(blk, offset, false, prealloc, 0, errp); if (ret < 0) { - error_report_err(local_err); return ret; } =20 return 0; } =20 -static int length_f(BlockBackend *blk, int argc, char **argv) +static int length_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int64_t size; char s1[64]; =20 size =3D blk_getlength(blk); if (size < 0) { - printf("getlength: %s\n", strerror(-size)); + error_setg(errp, "getlength: %s", strerror(-size)); return size; } =20 @@ -2074,12 +2085,12 @@ static const cmdinfo_t length_cmd =3D { }; =20 =20 -static int info_f(BlockBackend *blk, int argc, char **argv) +static int info_f(BlockBackend *blk, int argc, char **argv, Error **errp) { + ERRP_GUARD(); BlockDriverState *bs =3D blk_bs(blk); BlockDriverInfo bdi; ImageInfoSpecific *spec_info; - Error *local_err =3D NULL; char s1[64], s2[64]; int ret; =20 @@ -2104,9 +2115,8 @@ static int info_f(BlockBackend *blk, int argc, char *= *argv) printf("cluster size: %s\n", s1); printf("vm state offset: %s\n", s2); =20 - spec_info =3D bdrv_get_specific_info(bs, &local_err); - if (local_err) { - error_report_err(local_err); + spec_info =3D bdrv_get_specific_info(bs, errp); + if (*errp) { return -EIO; } if (spec_info) { @@ -2143,7 +2153,7 @@ static void discard_help(void) "\n"); } =20 -static int discard_f(BlockBackend *blk, int argc, char **argv); +static int discard_f(BlockBackend *blk, int argc, char **argv, Error **err= p); =20 static const cmdinfo_t discard_cmd =3D { .name =3D "discard", @@ -2157,7 +2167,7 @@ static const cmdinfo_t discard_cmd =3D { .help =3D discard_help, }; =20 -static int discard_f(BlockBackend *blk, int argc, char **argv) +static int discard_f(BlockBackend *blk, int argc, char **argv, Error **err= p) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false; @@ -2185,18 +2195,18 @@ static int discard_f(BlockBackend *blk, int argc, c= har **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; bytes =3D cvtnum(argv[optind]); if (bytes < 0) { - print_cvtnum_err(bytes, argv[optind]); + set_cvtnum_err(bytes, argv[optind], errp); return bytes; } else if (bytes > BDRV_REQUEST_MAX_BYTES) { - printf("length cannot exceed %"PRIu64", given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, "length cannot exceed %" PRIu64 ", given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 @@ -2205,7 +2215,7 @@ static int discard_f(BlockBackend *blk, int argc, cha= r **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("discard failed: %s\n", strerror(-ret)); + error_setg(errp, "discard failed: %s", strerror(-ret)); return ret; } =20 @@ -2238,7 +2248,8 @@ static void aio_discard_help(void) "\n"); } =20 -static int aio_discard_f(BlockBackend *blk, int argc, char **argv); +static int aio_discard_f(BlockBackend *blk, int argc, char **argv, + Error **errp); =20 static const cmdinfo_t aio_discard_cmd =3D { .name =3D "aio_discard", @@ -2259,7 +2270,7 @@ static void aio_discard_done(void *opaque, int ret) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("aio_discard failed: %s\n", strerror(-ret)); + error_report("aio_discard failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -2278,7 +2289,7 @@ out: g_free(ctx); } =20 -static int aio_discard_f(BlockBackend *blk, int argc, char **argv) +static int aio_discard_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int c, ret; int64_t count; @@ -2310,7 +2321,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -2318,7 +2329,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) =20 count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); g_free(ctx); return count; } @@ -2332,7 +2343,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) return 0; } =20 -static int alloc_f(BlockBackend *blk, int argc, char **argv) +static int alloc_f(BlockBackend *blk, int argc, char **argv, Error **errp) { BlockDriverState *bs =3D blk_bs(blk); int64_t offset, start, remaining, count; @@ -2342,14 +2353,14 @@ static int alloc_f(BlockBackend *blk, int argc, cha= r **argv) =20 start =3D offset =3D cvtnum(argv[1]); if (offset < 0) { - print_cvtnum_err(offset, argv[1]); + set_cvtnum_err(offset, argv[1], errp); return offset; } =20 if (argc =3D=3D 3) { count =3D cvtnum(argv[2]); if (count < 0) { - print_cvtnum_err(count, argv[2]); + set_cvtnum_err(count, argv[2], errp); return count; } } else { @@ -2361,7 +2372,7 @@ static int alloc_f(BlockBackend *blk, int argc, char = **argv) while (remaining) { ret =3D bdrv_is_allocated(bs, offset, remaining, &num); if (ret < 0) { - printf("is_allocated failed: %s\n", strerror(-ret)); + error_setg(errp, "is_allocated failed: %s", strerror(-ret)); return ret; } offset +=3D num; @@ -2422,7 +2433,7 @@ static int map_is_allocated(BlockDriverState *bs, int= 64_t offset, return firstret; } =20 -static int map_f(BlockBackend *blk, int argc, char **argv) +static int map_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int64_t offset, bytes; char s1[64], s2[64]; @@ -2433,17 +2444,18 @@ static int map_f(BlockBackend *blk, int argc, char = **argv) offset =3D 0; bytes =3D blk_getlength(blk); if (bytes < 0) { - error_report("Failed to query image length: %s", strerror(-bytes)); + error_setg(errp, "Failed to query image length: %s", strerror(-byt= es)); return bytes; } =20 while (bytes) { ret =3D map_is_allocated(blk_bs(blk), offset, bytes, &num); if (ret < 0) { - error_report("Failed to get allocation status: %s", strerror(-= ret)); + error_setg(errp, "Failed to get allocation status: %s", + strerror(-ret)); return ret; } else if (!num) { - error_report("Unexpected end of image"); + error_setg(errp, "Unexpected end of image"); return -EIO; } =20 @@ -2485,7 +2497,7 @@ static void reopen_help(void) "\n"); } =20 -static int reopen_f(BlockBackend *blk, int argc, char **argv); +static int reopen_f(BlockBackend *blk, int argc, char **argv, Error **errp= ); =20 static QemuOptsList reopen_opts =3D { .name =3D "reopen", @@ -2507,7 +2519,7 @@ static const cmdinfo_t reopen_cmd =3D { .help =3D reopen_help, }; =20 -static int reopen_f(BlockBackend *blk, int argc, char **argv) +static int reopen_f(BlockBackend *blk, int argc, char **argv, Error **errp) { BlockDriverState *bs =3D blk_bs(blk); QemuOpts *qopts; @@ -2517,13 +2529,12 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **argv) bool writethrough =3D !blk_enable_write_cache(blk); bool has_rw_option =3D false; bool has_cache_option =3D false; - Error *local_err =3D NULL; =20 while ((c =3D getopt(argc, argv, "c:o:rw")) !=3D -1) { switch (c) { case 'c': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { - error_report("Invalid cache option: %s", optarg); + error_setg(errp, "Invalid cache option: %s", optarg); return -EINVAL; } has_cache_option =3D true; @@ -2536,7 +2547,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) break; case 'r': if (has_rw_option) { - error_report("Only one -r/-w option may be given"); + error_setg(errp, "Only one -r/-w option may be given"); return -EINVAL; } flags &=3D ~BDRV_O_RDWR; @@ -2544,7 +2555,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) break; case 'w': if (has_rw_option) { - error_report("Only one -r/-w option may be given"); + error_setg(errp, "Only one -r/-w option may be given"); return -EINVAL; } flags |=3D BDRV_O_RDWR; @@ -2566,7 +2577,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) if (!writethrough !=3D blk_enable_write_cache(blk) && blk_get_attached_dev(blk)) { - error_report("Cannot change cache.writeback: Device attached"); + error_setg(errp, "Cannot change cache.writeback: Device attached"); qemu_opts_reset(&reopen_opts); return -EBUSY; } @@ -2589,7 +2600,8 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) =20 if (qdict_haskey(opts, BDRV_OPT_READ_ONLY)) { if (has_rw_option) { - error_report("Cannot set both -r/-w and '" BDRV_OPT_READ_ONLY = "'"); + error_setg(errp, + "Cannot set both -r/-w and '" BDRV_OPT_READ_ONLY "'= "); qobject_unref(opts); return -EINVAL; } @@ -2600,7 +2612,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) if (qdict_haskey(opts, BDRV_OPT_CACHE_DIRECT) || qdict_haskey(opts, BDRV_OPT_CACHE_NO_FLUSH)) { if (has_cache_option) { - error_report("Cannot set both -c and the cache options"); + error_setg(errp, "Cannot set both -c and the cache options"); qobject_unref(opts); return -EINVAL; } @@ -2609,10 +2621,7 @@ static int reopen_f(BlockBackend *blk, int argc, cha= r **argv) qdict_put_bool(opts, BDRV_OPT_CACHE_NO_FLUSH, flags & BDRV_O_NO_FL= USH); } =20 - bdrv_reopen(bs, opts, true, &local_err); - - if (local_err) { - error_report_err(local_err); + if (bdrv_reopen(bs, opts, true, errp) < 0) { return -EINVAL; } =20 @@ -2620,26 +2629,28 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **argv) return 0; } =20 -static int break_f(BlockBackend *blk, int argc, char **argv) +static int break_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int ret; =20 ret =3D bdrv_debug_breakpoint(blk_bs(blk), argv[1], argv[2]); if (ret < 0) { - printf("Could not set breakpoint: %s\n", strerror(-ret)); + error_setg(errp, "Could not set breakpoint: %s", strerror(-ret)); return ret; } =20 return 0; } =20 -static int remove_break_f(BlockBackend *blk, int argc, char **argv) +static int remove_break_f(BlockBackend *blk, int argc, char **argv, + Error **errp) { int ret; =20 ret =3D bdrv_debug_remove_breakpoint(blk_bs(blk), argv[1]); if (ret < 0) { - printf("Could not remove breakpoint %s: %s\n", argv[1], strerror(-= ret)); + error_setg(errp, "Could not remove breakpoint %s: %s", + argv[1], strerror(-ret)); return ret; } =20 @@ -2665,13 +2676,13 @@ static const cmdinfo_t remove_break_cmd =3D { .oneline =3D "remove a breakpoint by tag", }; =20 -static int resume_f(BlockBackend *blk, int argc, char **argv) +static int resume_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int ret; =20 ret =3D bdrv_debug_resume(blk_bs(blk), argv[1]); if (ret < 0) { - printf("Could not resume request: %s\n", strerror(-ret)); + error_setg(errp, "Could not resume request: %s", strerror(-ret)); return ret; } =20 @@ -2687,7 +2698,7 @@ static const cmdinfo_t resume_cmd =3D { .oneline =3D "resumes the request tagged as tag", }; =20 -static int wait_break_f(BlockBackend *blk, int argc, char **argv) +static int wait_break_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { while (!bdrv_debug_is_suspended(blk_bs(blk), argv[1])) { aio_poll(blk_get_aio_context(blk), true); @@ -2704,7 +2715,7 @@ static const cmdinfo_t wait_break_cmd =3D { .oneline =3D "waits for the suspension of a request", }; =20 -static int abort_f(BlockBackend *blk, int argc, char **argv) +static int abort_f(BlockBackend *blk, int argc, char **argv, Error **errp) { abort(); } @@ -2730,7 +2741,7 @@ static void sigraise_help(void) "\n", SIGTERM); } =20 -static int sigraise_f(BlockBackend *blk, int argc, char **argv); +static int sigraise_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); =20 static const cmdinfo_t sigraise_cmd =3D { .name =3D "sigraise", @@ -2743,15 +2754,16 @@ static const cmdinfo_t sigraise_cmd =3D { .help =3D sigraise_help, }; =20 -static int sigraise_f(BlockBackend *blk, int argc, char **argv) +static int sigraise_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { int64_t sig =3D cvtnum(argv[1]); if (sig < 0) { - print_cvtnum_err(sig, argv[1]); + set_cvtnum_err(sig, argv[1], errp); return sig; } else if (sig > NSIG) { - printf("signal argument '%s' is too large to be a valid signal\n", - argv[1]); + error_setg(errp, + "signal argument '%s' is too large to be a valid signal= ", + argv[1]); return -EINVAL; } =20 @@ -2772,7 +2784,7 @@ static void sleep_cb(void *opaque) *expired =3D true; } =20 -static int sleep_f(BlockBackend *blk, int argc, char **argv) +static int sleep_f(BlockBackend *blk, int argc, char **argv, Error **errp) { char *endptr; long ms; @@ -2781,7 +2793,7 @@ static int sleep_f(BlockBackend *blk, int argc, char = **argv) =20 ms =3D strtol(argv[1], &endptr, 0); if (ms < 0 || *endptr !=3D '\0') { - printf("%s is not a valid number\n", argv[1]); + error_setg(errp, "%s is not a valid number", argv[1]); return -EINVAL; } =20 @@ -2833,7 +2845,7 @@ static void help_all(void) printf("\nUse 'help commandname' for extended help.\n"); } =20 -static int help_f(BlockBackend *blk, int argc, char **argv) +static int help_f(BlockBackend *blk, int argc, char **argv, Error **errp) { const cmdinfo_t *ct; =20 @@ -2844,7 +2856,7 @@ static int help_f(BlockBackend *blk, int argc, char *= *argv) =20 ct =3D find_command(argv[1]); if (ct =3D=3D NULL) { - printf("command %s not found\n", argv[1]); + error_setg(errp, "command %s not found", argv[1]); return -EINVAL; } =20 @@ -2867,7 +2879,7 @@ static const cmdinfo_t help_cmd =3D { * Called with aio context of blk acquired. Or with qemu_get_aio_context() * context acquired if blk is NULL. */ -int qemuio_command(BlockBackend *blk, const char *cmd) +int qemuio_command(BlockBackend *blk, const char *cmd, Error **errp) { char *input; const cmdinfo_t *ct; @@ -2880,9 +2892,9 @@ int qemuio_command(BlockBackend *blk, const char *cmd) if (c) { ct =3D find_command(v[0]); if (ct) { - ret =3D command(blk, ct, c, v); + ret =3D command(blk, ct, c, v, errp); } else { - fprintf(stderr, "command \"%s\" not found\n", v[0]); + error_setg(errp, "command \"%s\" not found", v[0]); ret =3D -EINVAL; } } diff --git a/qemu-io.c b/qemu-io.c index 8f2de83f3c80..598d5b1c9ca9 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -68,7 +68,7 @@ static int get_eof_char(void) #endif } =20 -static int close_f(BlockBackend *blk, int argc, char **argv) +static int close_f(BlockBackend *blk, int argc, char **argv, Error **errp) { blk_unref(qemuio_blk); qemuio_blk =3D NULL; @@ -140,7 +140,7 @@ static void open_help(void) "\n"); } =20 -static int open_f(BlockBackend *blk, int argc, char **argv); +static int open_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t open_cmd =3D { .name =3D "open", @@ -164,7 +164,7 @@ static QemuOptsList empty_opts =3D { }, }; =20 -static int open_f(BlockBackend *blk, int argc, char **argv) +static int open_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int flags =3D BDRV_O_UNMAP; int readonly =3D 0; @@ -268,7 +268,7 @@ static int open_f(BlockBackend *blk, int argc, char **a= rgv) return 0; } =20 -static int quit_f(BlockBackend *blk, int argc, char **argv) +static int quit_f(BlockBackend *blk, int argc, char **argv, Error **errp) { quit_qemu_io =3D true; return 0; @@ -414,7 +414,14 @@ static void prep_fetchline(void *opaque) =20 static int do_qemuio_command(const char *cmd) { - return qemuio_command(qemuio_blk, cmd); + Error *local_err =3D NULL; + int ret; + + ret =3D qemuio_command(qemuio_blk, cmd, &local_err); + if (local_err) { + error_report_err(local_err); + } + return ret; } =20 static int command_loop(void) diff --git a/tests/qemu-iotests/004.out b/tests/qemu-iotests/004.out index fb8593289f51..37da6024809f 100644 --- a/tests/qemu-iotests/004.out +++ b/tests/qemu-iotests/004.out @@ -6,36 +6,36 @@ wrote 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 write into image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 write at image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 write past image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 pwrite past image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 writev past image boundary -writev failed: Input/output error +qemu-io: writev failed: Input/output error =20 read before image boundary read 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 read into image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 read at image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 read past image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 pread past image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 readv past image boundary -readv failed: Input/output error +qemu-io: readv failed: Input/output error *** done diff --git a/tests/qemu-iotests/021.out b/tests/qemu-iotests/021.out index 8533f8e58ae6..dfdfeb503780 100644 --- a/tests/qemu-iotests/021.out +++ b/tests/qemu-iotests/021.out @@ -2,92 +2,92 @@ QA output created by 021 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 =20 =3D=3D testing writev -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing read -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing write -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing readv -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing aio_read -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing aio_write -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing writev -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing read -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing write -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing readv -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing aio_read -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing aio_write -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing writev -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing read -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing write -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing readv -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing aio_read -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing aio_write -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing writev -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing read -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing write -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing readv -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing aio_read -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing aio_write -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing writev -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing read -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing write -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing readv -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing aio_read -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing aio_write -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte *** done diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out index 83989996ff62..b998a9ac83da 100644 --- a/tests/qemu-iotests/026.out +++ b/tests/qemu-iotests/026.out @@ -4,442 +4,442 @@ Errors while writing 128 kB Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: on; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: on; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: off; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: off; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: on; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: on; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: off; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: off; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: off; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: off; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: off; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: off; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D Refcount table growth tests =3D=3D=3D @@ -447,122 +447,122 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write = -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write = -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D L1 growth tests =3D=3D=3D @@ -570,76 +570,76 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 5; imm: off; once: off -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 28; imm: off; once: off -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: off +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: off +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: off +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: off +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D Avoid cluster leaks after temporary failure =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 -write failed: Input/output error +qemu-io: write failed: Input/output error wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. @@ -651,6 +651,6 @@ wrote 1024/1024 bytes at offset 0 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 1024/1024 bytes at offset 0 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. *** done diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index a37bf446e942..27275fd6b70e 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -9,7 +9,7 @@ ERROR cluster 3 refcount=3D1 reference=3D3 Data may be corrupted, or further writes to the image may corrupt it. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with active L1 table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] image: TEST_DIR/t.IMGFMT file format: IMGFMT @@ -23,7 +23,7 @@ Format specific information: corrupt: true extended l2: false qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; ca= nnot be opened read/write -no file open, try 'help open' +qemu-io: no file open, try 'help open' read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -37,7 +37,7 @@ ERROR cluster 2 refcount=3D1 reference=3D2 Data may be corrupted, or further writes to the image may corrupt it. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with refcount block); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] ERROR refcount block 0 refcount=3D2 ERROR cluster 2 refcount=3D1 reference=3D2 @@ -73,7 +73,7 @@ Data may be corrupted, or further writes to the image may= corrupt it. This means waste of disk space, but no harm to data. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with inactive L2 table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] ERROR cluster 4 refcount=3D1 reference=3D2 Leaked cluster 9 refcount=3D1 reference=3D0 @@ -108,10 +108,10 @@ wrote 65536/65536 bytes at offset 0 wrote 65536/65536 bytes at offset 536870912 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with active L2 table); further corruption events will be suppressed +qemu-io: write failed: Input/output error +qemu-io: aio_write failed: No medium found blkdebug: Suspended request '0' -write failed: Input/output error blkdebug: Resuming request '0' -aio_write failed: No medium found =20 =3D=3D=3D Testing unallocated image header =3D=3D=3D =20 @@ -119,7 +119,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with qcow2_header); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing unaligned L1 entry =3D=3D=3D =20 @@ -127,7 +127,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 ind= ex: 0); further corruption events will be suppressed -read failed: Input/output error +qemu-io: read failed: Input/output error Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -140,7 +140,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unalign= ed (L2 offset: 0x40000, L2 index: 0); further corruption events will be sup= pressed -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing unaligned pre-allocated zero cluster =3D=3D=3D =20 @@ -154,7 +154,7 @@ qemu-img: Failed to turn zero into data clusters: Input= /output error =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Refblock offset 0x22a00 unaligned (reftab= le index: 0); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing non-fatal corruption on freeing =3D=3D=3D =20 @@ -171,8 +171,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Image is corrupt: Cluster allocation offset 0x52a00 unaligned (L2 o= ffset: 0x40000, L2 index: 0); further non-fatal corruption events will be s= uppressed -read failed: Input/output error -read failed: Input/output error +qemu-io: read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing non-fatal and then fatal corruption report =3D=3D=3D =20 @@ -181,15 +181,15 @@ wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Image is corrupt: Cannot free unaligned cluster 0x52a00; further no= n-fatal corruption events will be suppressed qcow2: Marking image as corrupt: Cluster allocation offset 0x62a00 unalign= ed (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be s= uppressed +qemu-io: read failed: Input/output error discard 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read failed: Input/output error =20 =3D=3D=3D Testing empty refcount table =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with refcount table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 3 refcount=3D0 reference=3D1 @@ -209,7 +209,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid allocation of refcount= block at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 3 refcount=3D0 reference=3D1 @@ -229,7 +229,7 @@ No errors were found on the image. =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 2 refcount=3D0 reference=3D1 @@ -251,7 +251,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 65536 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid allocation of compress= ed cluster at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 2 refcount=3D0 reference=3D1 @@ -286,7 +286,7 @@ No errors were found on the image. =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing dirty corrupt image =3D=3D=3D =20 @@ -319,7 +319,7 @@ wrote 65536/65536 bytes at offset 0 discard 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preallocated zero cluster offset 0x2a00 u= naligned (guest offset: 0); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error --- Repairing --- Repairing offset=3D2a00: Preallocated cluster is not properly aligned; L2 = entry corrupted. The following inconsistencies were found and repaired: @@ -337,7 +337,7 @@ wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftabl= e index: 0); further corruption events will be suppressed qcow2_free_clusters failed: Input/output error -discard failed: No medium found +qemu-io: discard failed: No medium found --- Repairing --- ERROR refcount block 0 is not cluster aligned; refcount table entry corrup= ted qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftabl= e index: 0); further corruption events will be suppressed @@ -419,8 +419,7 @@ qcow2: Marking image as corrupt: Preventing invalid wri= te on metadata (overlaps QMP_VERSION {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "none0", "msg": "Preventing i= nvalid write on metadata (overlaps with refcount table)", "offset": 65536, = "node-name": "drive", "fatal": true, "size": 65536}} -write failed: Input/output error -{"return": ""} +{"return": "Error: write failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 @@ -431,7 +430,6 @@ QMP_VERSION {"return": {}} qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0= ); further non-fatal corruption events will be suppressed {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0= x2a2a2a00 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}} -{"return": ""} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 diff --git a/tests/qemu-iotests/071.out b/tests/qemu-iotests/071.out index a2923b05c297..f2d015d8ccae 100644 --- a/tests/qemu-iotests/071.out +++ b/tests/qemu-iotests/071.out @@ -30,11 +30,11 @@ blkverify: read offset=3D0 bytes=3D512 contents mismatc= h at offset 0 =20 =3D=3D=3D Testing blkdebug through filename =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing blkdebug through file blockref =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing blkdebug on existing block device =3D=3D=3D =20 @@ -43,8 +43,7 @@ QMP_VERSION {"return": {}} {"return": {}} {"return": {}} -read failed: Input/output error -{"return": ""} +{"return": "Error: read failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 @@ -82,8 +81,7 @@ read 512/512 bytes at offset 0 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -read failed: Input/output error -{"return": ""} +{"return": "Error: read failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} QEMU_PROG: Failed to flush the L2 table cache: Input/output error QEMU_PROG: Failed to flush the refcount block cache: Input/output error diff --git a/tests/qemu-iotests/072.out b/tests/qemu-iotests/072.out index fe949d47817a..d7ce24da1f7a 100644 --- a/tests/qemu-iotests/072.out +++ b/tests/qemu-iotests/072.out @@ -15,7 +15,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Pattern verification failed at offset 0, 512 bytes +qemu-io: Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out index d8acb3e72355..b20c21faf6a9 100644 --- a/tests/qemu-iotests/080.out +++ b/tests/qemu-iotests/080.out @@ -66,8 +66,8 @@ wrote 512/512 bytes at offset 0 qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid qemu-img: Snapshot L1 table offset invalid qemu-img: Failed to turn zero into data clusters: Invalid argument +qemu-io: write failed: Invalid argument qemu-io: Failed to flush the refcount block cache: Invalid argument -write failed: Invalid argument qemu-img: Snapshot L1 table offset invalid qemu-img: Could not apply snapshot 'test': Failed to load snapshot: Invali= d argument qemu-img: Could not delete snapshot 'test': Snapshot L1 table offset inval= id @@ -89,8 +89,8 @@ wrote 512/512 bytes at offset 0 qemu-img: Failed to load snapshot: Snapshot L1 table too large qemu-img: Snapshot L1 table too large qemu-img: Failed to turn zero into data clusters: File too large +qemu-io: write failed: File too large qemu-io: Failed to flush the refcount block cache: File too large -write failed: File too large qemu-img: Snapshot L1 table too large qemu-img: Could not apply snapshot 'test': Failed to load snapshot: File t= oo large qemu-img: Could not delete snapshot 'test': Snapshot L1 table too large diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out index aba85ea56446..bc902bd81832 100644 --- a/tests/qemu-iotests/081.out +++ b/tests/qemu-iotests/081.out @@ -81,7 +81,7 @@ wrote 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D checking that quorum is broken =3D=3D -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D checking the blkverify mode with broken content =3D=3D quorum: offset=3D0 bytes=3D10485760 contents mismatch at offset 0 diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out index 2090ee693c16..a1c446d5365e 100644 --- a/tests/qemu-iotests/083.out +++ b/tests/qemu-iotests/083.out @@ -41,7 +41,7 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/foo =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 @@ -53,31 +53,31 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/foo =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 4 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before data =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after data =3D=3D=3D =20 @@ -106,7 +106,7 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/ =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before neg1 =3D=3D=3D =20 @@ -150,7 +150,7 @@ qemu-io: can't open device nbd+unix:///foo?socket=3DSOC= K_DIR/nbd.sock =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 @@ -162,31 +162,31 @@ qemu-io: can't open device nbd+unix:///foo?socket=3DS= OCK_DIR/nbd.sock =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 4 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before data =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after data =3D=3D=3D =20 @@ -215,6 +215,6 @@ qemu-io: can't open device nbd+unix:///?socket=3DSOCK_D= IR/nbd.sock =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 *** done diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out index c53fc4823a16..a29e19b12d7e 100644 --- a/tests/qemu-iotests/089.out +++ b/tests/qemu-iotests/089.out @@ -16,7 +16,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Pattern verification failed at offset 0, 512 bytes +qemu-io: Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -33,7 +33,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 512/512 bytes at offset 229376 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing qemu-img info output =3D=3D=3D =20 diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out index f51dd9d20a10..80220e440eca 100644 --- a/tests/qemu-iotests/114.out +++ b/tests/qemu-iotests/114.out @@ -11,7 +11,7 @@ cluster_size: 65536 backing file: TEST_DIR/t.IMGFMT.base backing file format: foo qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: = Unknown driver 'foo' -no file open, try 'help open' +qemu-io: no file open, try 'help open' read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qemu-img: Could not change the backing file to 'TEST_DIR/t.qcow2.base': ba= cking format must be specified diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out index 4abc5b5f7da6..ce2a0df166ee 100644 --- a/tests/qemu-iotests/134.out +++ b/tests/qemu-iotests/134.out @@ -24,7 +24,7 @@ read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D verify pattern failure with wrong password =3D=3D -Pattern verification failed at offset 0, 134217728 bytes +qemu-io: Pattern verification failed at offset 0, 134217728 bytes read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index e19df5b6ba82..1947c1a1bd7c 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -40,5 +40,5 @@ OK: Dirty bit not set Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error *** done diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out index 28e1a22952b6..e235d9e59e35 100644 --- a/tests/qemu-iotests/153.out +++ b/tests/qemu-iotests/153.out @@ -33,12 +33,12 @@ Is another process using the image [TEST_DIR/t.qcow2]? _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_img_wrapper info TEST_DIR/t.qcow2 qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock @@ -107,7 +107,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -176,7 +176,7 @@ _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -231,7 +231,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -336,7 +336,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171 index d1d77f701304..87a8aa24d967 100755 --- a/tests/qemu-iotests/171 +++ b/tests/qemu-iotests/171 @@ -188,7 +188,7 @@ img_offset=3D512 img_size=3D512 _make_test_img $size ( -$QEMU_IO "$(img_json)" <&1 < (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178690768722569.77085514223461; Sun, 16 Aug 2026 12:14:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJT-0001Jr-MN; Sun, 16 Aug 2026 15:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJR-0001Bo-1b for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJO-0007dH-AN for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:28 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-601-7sK_svujPsyXvrBycTfA8w-1; Sun, 16 Aug 2026 15:14:15 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 217EA1956080; Sun, 16 Aug 2026 19:14:14 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EFD91180034F; Sun, 16 Aug 2026 19:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907665; 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=9CMMKu6kzTPjhr60fVp/ni4m6u7V9jPpiJw4QDuDdfg=; b=Te1lj+we7WmPSrLBYV1KygnGdNG3uQNhk2U1IB67J08wqmGfkULxD1L6BZYrAYXQdo6kyF 6ae4jaXywkx2tS02Hhs8DCZGOEH0P/nXezfl534PBa2Nccak7aB+bs8LKEQqEPmxBnFxtr UaoyqgvtnQTYAyFA0V14W9T1YZZO3K8= X-MC-Unique: 7sK_svujPsyXvrBycTfA8w-1 X-Mimecast-MFC-AGG-ID: 7sK_svujPsyXvrBycTfA8w_1786907654 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:48 +0400 Subject: [PATCH v3 21/49] block: add x-qemu-io QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-21-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Eric Blake , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8511; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=H7kf02DdiNn1nFNRkOMtk6kTSmAJa1hNXFx4tWwfEJg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyF6mi5yc6OpkAK9buP7MMkziH9NP0Arj1S fid737VEXaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5T9oD/9DjHXefdLPB2+BDywc872PpxnVlLvGZzZVZkclFbONK6iwXT/C4KiLYZCyjanLpqESuUF 5PmseNhBZs8inRpl3vglVIjie8nNUQiJ+eVoootjUfZNruFdFBNQtGwHYBfrclQqxDCT1Qo5fsr hEbwrxA33wZA7qxs7MfRoXi3iIXQ07Mb+YAWVN83qHujlEqpfPfnPV/jmheCzy1zuvYhmAXXqrG 6ykIJAfFQiKY+DVLUkhpUUSJ6iosagPJgqP0CS/NzpGmHF8qBkSz4TTz/SBg7LAMPt7TDb7nJu3 1eaQ2vmKP1gjSUx9yuOP+J77drPUXunwTYrmz+c2xY13yCUcua9IeYgne1iP4SnPqxnSDO79wih JQ2+PtMCWLSrxCdgXM1UjYomwqZP/5S15YhyvrdyeP7T8SpGUle0Ges0d5+hFCdfZy379CA/gT/ nZzcRJMi0bFt6KuOUqRduFhW/6Q7P8WdZ7wGn14h0ijpRWrwmKPXIdxDHVGipxK+3rhO+hbP4vt YPm0Du//8BgCtKCoq61l+s1Vb+eGM6hg4xlGIbuMZQciAxD/Q4ej1MnyrYmr/ElLlx+Uvlu+PRC wQ2WZFags2ZBqol+9ENusDX2HWWIkrgrYspsh/SIZfBSX9h7zWu4XBUV2N4ToGtznQIMx7yXwJU hyIff+09HoRnH1w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907688399158500 Add an x-qemu-io QMP command that runs qemu-io commands on block devices. The command accepts a device name (block backend name, node-name, or qdev ID) and a qemu-io command string. Refactor hmp_qemu_io() to be a thin wrapper around the new QMP command, following the standard HMP-over-QMP pattern used by other block commands. This change is also required for the qtest qemu-io command in the following patch. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- block/monitor/block-hmp-cmds.c | 60 ++------------------------------ block/monitor/meson.build | 1 + block/monitor/qmp-cmds.c | 79 ++++++++++++++++++++++++++++++++++++++= ++++ qapi/block.json | 34 ++++++++++++++++++ 4 files changed, 117 insertions(+), 57 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 9930620a4a16..22fa03089ea3 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -56,7 +56,6 @@ #include "block/qapi.h" #include "block/block_int.h" #include "block/block-hmp-cmds.h" -#include "qemu-io.h" =20 static void hmp_drive_add_node(Monitor *mon, const char *optstr) { @@ -541,67 +540,14 @@ void hmp_eject(Monitor *mon, const QDict *qdict) =20 void hmp_qemu_io(Monitor *mon, const QDict *qdict) { - BlockBackend *blk =3D NULL; - BlockDriverState *bs =3D NULL; - BlockBackend *local_blk =3D NULL; bool qdev =3D qdict_get_try_bool(qdict, "qdev", false); const char *device =3D qdict_get_str(qdict, "device"); const char *command =3D qdict_get_str(qdict, "command"); Error *err =3D NULL; - int ret; =20 - if (qdev) { - blk =3D blk_by_qdev_id(device, &err); - if (!blk) { - goto fail; - } - } else { - blk =3D blk_by_name(device); - if (!blk) { - bs =3D bdrv_lookup_bs(NULL, device, &err); - if (!bs) { - goto fail; - } - } - } - - if (bs) { - blk =3D local_blk =3D blk_new(bdrv_get_aio_context(bs), 0, BLK_PER= M_ALL); - ret =3D blk_insert_bs(blk, bs, &err); - if (ret < 0) { - goto fail; - } - } - - /* - * Notably absent: Proper permission management. This is sad, but it s= eems - * almost impossible to achieve without changing the semantics and the= reby - * limiting the use cases of the qemu-io HMP command. - * - * In an ideal world we would unconditionally create a new BlockBacken= d for - * qemuio_command(), but we have commands like 'reopen' and want them = to - * take effect on the exact BlockBackend whose name the user passed in= stead - * of just on a temporary copy of it. - * - * Another problem is that deleting the temporary BlockBackend involves - * draining all requests on it first, but some qemu-iotests cases want= to - * issue multiple aio_read/write requests and expect them to complete = in - * the background while the monitor has already returned. - * - * This is also what prevents us from saving the original permissions = and - * restoring them later: We can't revoke permissions until all requests - * have completed, and we don't know when that is nor can we really let - * anything else run before we have revoken them to avoid race conditi= ons. - * - * What happens now is that command() in qemu-io-cmds.c can extend the - * permissions if necessary for the qemu-io command. And they simply s= tay - * extended, possibly resulting in a read-only guest device keeping wr= ite - * permissions. Ugly, but it appears to be the lesser evil. - */ - qemuio_command(blk, command, &err); - -fail: - blk_unref(local_blk); + qmp_x_qemu_io(qdev ? NULL : device, + qdev ? device : NULL, + command, &err); hmp_handle_error(mon, err); } =20 diff --git a/block/monitor/meson.build b/block/monitor/meson.build index 1022516e93c5..74faced9e17f 100644 --- a/block/monitor/meson.build +++ b/block/monitor/meson.build @@ -1,2 +1,3 @@ system_ss.add(files('block-hmp-cmds.c')) block_ss.add(files('bitmap-qmp-cmds.c')) +system_ss.add(files('qmp-cmds.c')) diff --git a/block/monitor/qmp-cmds.c b/block/monitor/qmp-cmds.c new file mode 100644 index 000000000000..e5759d824f13 --- /dev/null +++ b/block/monitor/qmp-cmds.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" + +#include "system/block-backend.h" +#include "block/block_int.h" +#include "qapi/qapi-commands-block.h" +#include "qapi/error.h" +#include "qemu-io.h" + +void qmp_x_qemu_io(const char *device, const char *qdev, + const char *command, Error **errp) +{ + BlockBackend *blk =3D NULL; + BlockBackend *local_blk =3D NULL; + BlockDriverState *bs =3D NULL; + int ret; + + if (!device && !qdev) { + error_setg(errp, "Must specify either device or qdev"); + return; + } + if (qdev && device) { + error_setg(errp, "Cannot specify both qdev and device"); + return; + } + + if (qdev) { + blk =3D blk_by_qdev_id(qdev, errp); + if (!blk) { + return; + } + } else { + blk =3D blk_by_name(device); + if (!blk) { + bs =3D bdrv_lookup_bs(NULL, device, errp); + if (!bs) { + return; + } + } + } + + if (bs) { + blk =3D local_blk =3D blk_new(bdrv_get_aio_context(bs), 0, BLK_PER= M_ALL); + ret =3D blk_insert_bs(blk, bs, errp); + if (ret < 0) { + goto fail; + } + } + + /* + * Notably absent: Proper permission management. This is sad, but it s= eems + * almost impossible to achieve without changing the semantics and the= reby + * limiting the use cases of the qemu-io command. + * + * In an ideal world we would unconditionally create a new BlockBacken= d for + * qemuio_command(), but we have commands like 'reopen' and want them = to + * take effect on the exact BlockBackend whose name the user passed in= stead + * of just on a temporary copy of it. + * + * Another problem is that deleting the temporary BlockBackend involves + * draining all requests on it first, but some qemu-iotests cases want= to + * issue multiple aio_read/write requests and expect them to complete = in + * the background while the monitor has already returned. + * + * This is also what prevents us from saving the original permissions = and + * restoring them later: We can't revoke permissions until all requests + * have completed, and we don't know when that is nor can we really let + * anything else run before we have revoken them to avoid race conditi= ons. + * + * What happens now is that command() in qemu-io-cmds.c can extend the + * permissions if necessary for the qemu-io command. And they simply s= tay + * extended, possibly resulting in a read-only guest device keeping wr= ite + * permissions. Ugly, but it appears to be the lesser evil. + */ + qemuio_command(blk, command, errp); + +fail: + blk_unref(local_blk); +} diff --git a/qapi/block.json b/qapi/block.json index 46955bbb3e34..012a9d73333b 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -603,3 +603,37 @@ '*boundaries-zap': ['uint64'], '*boundaries-flush': ['uint64'] }, 'allow-preconfig': true } + +## +# @x-qemu-io: +# +# Run a qemu-io command on a block device. Take either a block +# backend name or a qdev ID to identify the device. +# +# @device: the block backend name, node-name to run the +# command on. +# +# @qdev: the qdev ID of the block device to run the +# command on. +# +# @command: the qemu-io command string to execute. +# +# Features: +# +# @unstable: This command is for testing only. +# +# Since: 11.2 +# +# .. qmp-example:: +# +# -> { "execute": "x-qemu-io", +# "arguments": { "device": "virtio0", +# "command": "read 0 512" } } +# <- { "return": {} } +## +{ 'command': 'x-qemu-io', + 'data': { '*device': 'str', + '*qdev': 'str', + 'command': 'str' }, + 'features': [ 'unstable' ], + 'allow-preconfig': true } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907865; cv=none; d=zohomail.com; s=zohoarc; b=W9YuVOZBxviAT/iJ9FNyi8Eog5JBNStxN/8la0NpkLDSAKt5n+f/YsRN8mBiZticzBJMlE4FCyhWvkALG1jHwWKYcwRGR9WS1WdGZnQd3xrN/gb1GrRGt0sbhKKWHJAZlNOlAp6NV5eP3iTgCbubXxGMCR5s+tAhd95NiLy7b+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907865; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nGXAhfBpLxpleHXUaMGGydOdXD4tMcWImZiPu50J+gk=; b=CxSta+Ixs0WD7cL+VLbWVhqJALPCEZbULD2DbZn4NlTRGm7LxFjDy/V1bE7pTbf/VPgbYQfN6HCX9gANiR0wMe7baL6E2tXMYBvrTzs7Vb0OcS1jTaTAmQqKqUIpfZ4uVDkS0/+WE55e/bo+0rFT/OQVj6BCH9umzOlF+9eT1EI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907865575321.26105140296204; Sun, 16 Aug 2026 12:17:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJO-0000w3-N9; Sun, 16 Aug 2026 15:14:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJK-0000il-0X for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJI-0007bw-Gr for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:21 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-tLa2HLPdOqy0-q9g_u7_fg-1; Sun, 16 Aug 2026 15:14:18 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AD49A19560A5; Sun, 16 Aug 2026 19:14:17 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DF0323000239; Sun, 16 Aug 2026 19:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907660; 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=nGXAhfBpLxpleHXUaMGGydOdXD4tMcWImZiPu50J+gk=; b=byjqug0Q/lP8fVP6UWNhOi3IyVHlJYfPvo055an8SyH4LbZMw8KmPsp8KUzomS1o7+8pMj x0c2tv3w8XC6uFD6tU/1HiMlpe3d3IdrN/BCW1eg7ZbhQXRyQayUyBbqUhepvSIrN/NmEi 9RJSkiB0cH3lfE2IkwCNRHOZGuy0xdw= X-MC-Unique: tLa2HLPdOqy0-q9g_u7_fg-1 X-Mimecast-MFC-AGG-ID: tLa2HLPdOqy0-q9g_u7_fg_1786907657 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:49 +0400 Subject: [PATCH v3 22/49] qtest: add qemu-io command to the qtest protocol MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-22-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=3175; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/t/rxFqOTqXN7lUQMFkDya5LC8FusiHAJKcEHDbrgag=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyCFsBOXS0P433WoNUg1EGfxUnAFw0aANQU K+Yta4xjGaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5fU8D/4/ONrtNJGe70f2IL1dmyGIlawG7ksQihSc1dV89lD0crnFxvOXCF6Iib3k2L5U6mh49iV avD45cHZUCG6/A06igncXD+gLKNFtIWbsEUyEVyspvVFJpgj/Lm1m9isqKUZkET6xplE67rWP5H 6NgkARQxlbv3W+G7WMXEggm11Qqrr1O4GtCXjfEiV74lqnGLB0NDc9VEFPjhb44NhWEvYPcas4b BivNvv8/otbN7KjbT6Keo+MCLTm/zVi2tkbNJBmJGM9KzdOERJj6Bmpaa+WyQVLvw1xaRNW60vn g9ybohlwbUlFjC4DlAe67LiCh1BFYl3Ram+yc/wCzLa74y4NWEIjLwemmthdaL+OQryo71teXDp EJUNvJWpGpJ+foLWVZtQyIGSfCBMiumMUlprxcLU3T1otwFkDkYey5DWLcZzuOIavbi0+kezWgT XgbqxpXgMVha8Fwys3RsXLaESY0dK/x8Clqv2s/LzGmgc7kWJdkG98VyGHZD5DmmGizSUGgSTMA ah9YJPgyAGRT8hIkXopVCw6OOhmTc5cv7rdrgXpkLQ7BUzR6fM7I1/kI8xX9XaESlJELXdbwOmr HZy3jQDKS7G2qN65/HqUN+O/XAEek8yFJkXaJbZrdJaAgQVw+bd5mTKyE/Wsd4+t6JPKvTevk0B J8QTVovzZ7+WnBw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907866655158501 Add a "qemu-io" command to the qtest protocol so that tests can issue block layer I/O commands without going through the HMP monitor's "human-monitor-command" QMP, or use QMP at all. Unfortunately, many tests will prefer to use QMP as they also monitor and log other events. It's easier if it is pipelined in the same stream. Signed-off-by: Marc-Andr=C3=A9 Lureau --- system/qtest.c | 14 ++++++++++++++ tests/qtest/libqtest.c | 14 ++++++++++++++ tests/qtest/libqtest.h | 11 +++++++++++ 3 files changed, 39 insertions(+) diff --git a/system/qtest.c b/system/qtest.c index cf3012391774..47c954838dd0 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -33,6 +33,7 @@ #include "qom/object_interfaces.h" #include "qom/qom-qobject.h" #include "qobject/qobject.h" +#include "qapi-commands-block.h" =20 #define MAX_IRQ 256 =20 @@ -797,6 +798,19 @@ static void qtest_process_command(CharFrontend *chr, g= char **words) } g_slist_free(list); qtest_send(chr, "OK\n"); + } else if (strcmp(words[0], "qemu-io") =3D=3D 0) { + const char *io_dev; + g_autofree char *io_cmd =3D NULL; + Error *err =3D NULL; + + g_assert(words[1] && words[2]); + io_dev =3D words[1]; + io_cmd =3D g_strjoinv(" ", &words[2]); + + qmp_x_qemu_io(io_dev, NULL, io_cmd, &err); + qtest_sendf(chr, err ? "FAIL %s\n" : "OK\n", + err ? error_get_pretty(err) : NULL); + error_free(err); } else if (process_command_cb && process_command_cb(chr, words)) { /* Command got consumed by the callback handler */ } else { diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index c33c799c92d1..5e7b26e49ef9 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1012,6 +1012,20 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) return ret; } =20 +void qtest_qemu_io(QTestState *s, const char *device, + const char *fmt, ...) +{ + va_list ap; + g_autofree char *cmd =3D NULL; + + va_start(ap, fmt); + cmd =3D g_strdup_vprintf(fmt, ap); + va_end(ap); + + qtest_sendf(s, "qemu-io %s %s\n", device, cmd); + qtest_rsp(s); +} + const char *qtest_get_arch(void) { /* diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 45217fb8dc09..58491ca53ab7 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -424,6 +424,17 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) G= _GNUC_PRINTF(2, 3); char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); =20 +/** + * qtest_qemu_io: + * @s: #QTestState instance to operate on. + * @device: block device node-name or BlockBackend name. + * @fmt: qemu-io command to send, formats arguments like sprintf(). + * + * Send a qemu-io command via the qtest protocol. + */ +void qtest_qemu_io(QTestState *s, const char *device, + const char *fmt, ...) G_GNUC_PRINTF(3, 4); + void qtest_module_load(QTestState *s, const char *prefix, const char *libn= ame); =20 /** --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907705; cv=none; d=zohomail.com; s=zohoarc; b=C1Z6KO0hKvWX697E+GnXdHfV1EslS0fa767G5O+jYKiM9m+V9+kzpkQawiNClw/pjvFYbmwCfCPMg0r0B4i3lASFy50n3AufhUQa4oZWV7JfaweU3Akzn3kuF3dA/rzoFUCSzrgigGMBABx63vUu4/SX7GfvLgrsm8zKUrACZ6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907705; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W7+XpusORW4wlCqscaWWAqiyBJltRvz0lRaxsdzjW7Q=; b=jxrZ6jeZaMVc6SR/b+T4je2UIB/y4KzW60lmT7fCwnKrh18DHPxL3tG6epluwWrPDCgVtAc5aczWcJBa7a2SlRR2wJo+WqHK9yKmUmaUuSf0cSZdjaQ94JLtjZjFxLdebGeczr2GJffUGhRfXPT2ibJLbdy0Sf5ogGrdU7OfYFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907705829466.5594925266056; Sun, 16 Aug 2026 12:15:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJT-0001K1-Sn; Sun, 16 Aug 2026 15:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJQ-0001AZ-Ke for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJO-0007dF-7M for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:28 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-HFgsIqcBMJ6QLizbnhQjWw-1; Sun, 16 Aug 2026 15:14:22 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 467E71800471; Sun, 16 Aug 2026 19:14:21 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 333F830001A2; Sun, 16 Aug 2026 19:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907665; 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=W7+XpusORW4wlCqscaWWAqiyBJltRvz0lRaxsdzjW7Q=; b=IaNlKzjZjVJzb026AqxGq2rRFXB7ey2kZtSiSoPGCvlF+X1Fn+Dvg3pQfwxw3BEA2Pyga0 99dwD1culGY+OXP/ymWOUNHkl27zqDOvf67TU7gRj4bUfCAjbqE0LBGoxvBLIhNDJU69Am y/CEh8sLItV7NJmOnmgGHqItWMQD9ks= X-MC-Unique: HFgsIqcBMJ6QLizbnhQjWw-1 X-Mimecast-MFC-AGG-ID: HFgsIqcBMJ6QLizbnhQjWw_1786907661 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:50 +0400 Subject: [PATCH v3 23/49] qtest/ide-test: convert to use qtest qemu-io command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-23-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , John Snow , "Denis V. Lunev" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2333; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=EDFCU7tM+yp0a1oNO/cFTsJ8k7Zu6kbTjv7+XwDG1Gw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyferYHa5P+TlAS0W59P3fJm1KL8lyZKG0a heocQj8KHuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5VBtD/wLAAzDi2rhKSnZhmDZqnvDleHMWKclr7BgiT5J5Om5ImNumghosc4pwYBYDf32YwWRv4I R2Gi9Fbyd9gNlDNk+RilK3dWerWWAKbeioDuNDFsPzOh3WQYsehRbrvUzNA+G2OiEPH0j512SlG E+ueuDmt76uQJe6PeucYE4eVO2/r8eAcmlqbee1l1BSb8RLVhDLsdB8iB5Mnbg+a+L65WqfoBv9 WxnovFS4uY2EoXMu45R44iqMG8EbH3er2FrzCDh7wQCy5o0rxY2DrQrW/HZuukLv4x+OfFqanKD Tvg3DxCflUeMayOdWAUPux51aK2Gvu8dGFSuQUo/gZ6mB3Oi7JJVmVEjb0qKzFp1UbYsxfI0rLI 1P397izZmAoZ+TKFD45UyeY//rkVaVabISKyHlz+bE/ewvl67L52wEztn3LsynuiI1/buo/Fask giKudTi8m5QOjccsveihm7VOGoFZNOAY1ii/TGqBWFChlYb7HN2QbtDztNECdztWEd2VOXiqD8d +1vO5y/UJ1garEE7TyFAlHhm9PLUrHOp1z5Ggzm6Ks1kyNf0/N3PZFEEm/4ZiP8paVS2Io//Cga +YO+DsyZ4cclB4GFxJr6DROLiw934Wo8mMWRScFqC92rjCs/RgaU4Y5TdHusf7PP0Of0N99SeXi jAQAab1bMLPYKuA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907706054158500 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Denis V. Lunev --- tests/qtest/ahci-test.c | 5 ++--- tests/qtest/ide-test.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 71d23fe56af7..0528a422fafc 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1719,8 +1719,7 @@ static void test_atapi_engine_restart_in_flight(bool = dma) qtest_memset(ahci->parent->qts, buffer, 0x00, ATAPI_SECTOR_SIZE); =20 /* Suspend the next backend read so the ATAPI read stays in flight. */ - g_free(qtest_hmp(ahci->parent->qts, - "qemu-io drive0 \"break read_aio rd\"")); + qtest_qemu_io(ahci->parent->qts, "drive0", "break read_aio rd"); =20 cmd =3D ahci_atapi_command_create(CMD_ATAPI_READ_10, ATAPI_SECTOR_SIZE, dma); @@ -1732,7 +1731,7 @@ static void test_atapi_engine_restart_in_flight(bool = dma) ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST); ahci_px_set(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST); =20 - g_free(qtest_hmp(ahci->parent->qts, "qemu-io drive0 \"resume rd\"")); + qtest_qemu_io(ahci->parent->qts, "drive0", "resume rd"); =20 /* Round-trip through the device to confirm qemu is still alive. */ ahci_px_rreg(ahci, port, AHCI_PX_TFD); diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index b36b0f8875b2..31692f6925ac 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -836,7 +836,7 @@ static void test_flush(void) make_dirty(qts, 0); =20 /* Delay the completion of the flush request until we explicitly do it= */ - g_free(qtest_hmp(qts, "qemu-io ide0-hd0 \"break flush_to_os A\"")); + qtest_qemu_io(qts, "ide0-hd0", "break flush_to_os A"); =20 /* FLUSH CACHE command on device 0*/ qpci_io_writeb(dev, ide_bar, reg_device, 0); @@ -848,7 +848,7 @@ static void test_flush(void) assert_bit_clear(data, DF | ERR | DRQ); =20 /* Complete the command */ - g_free(qtest_hmp(qts, "qemu-io ide0-hd0 \"resume A\"")); + qtest_qemu_io(qts, "ide0-hd0", "resume A"); =20 /* Check registers */ data =3D qpci_io_readb(dev, ide_bar, reg_device); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907728; cv=none; d=zohomail.com; s=zohoarc; b=bmMETKKoG03YJZ5SdNqK65b1rMY/ZFRsv0Wm9FMiWww1/LxpupHt4rY7ksvWyWp00uIjw82ppI5pRX1CcOd2/9H/8HB7t8RawRSqexF8iPxXixL1GmOMIpYNSQ3NLxu6WTPGG/XHD0GT4SbYh2pARv0SdIcHm07R/KvhwqdR3zM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907728; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0PoiWTQyc+6CT3+XQBefK1rDjJHIoQVwAvU80roRsDk=; b=G6tci44JZRpiZdDN7xST6WByKghyvCAH9e5IgbeB5vWSrhNab1L0n7rdwbeWMtuHhPcsC3uJEY03a9CjUqAIrWuWiGYBbzw4g2jf4Mc03/a48A2DRQoJHFDpafY9dvFGLah/wQObe0mpypwJXxkAKWNQhTtCE+CKq7jsYWMMoDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907728530307.7324509229243; Sun, 16 Aug 2026 12:15:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJb-0002GS-OW; Sun, 16 Aug 2026 15:14:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJZ-0001ub-8z for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJX-0007fj-Bt for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:37 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-2sJYkqVnOhW7qTqgQ4eEZA-1; Sun, 16 Aug 2026 15:14:25 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B85DF1800471; Sun, 16 Aug 2026 19:14:24 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D7115180034F; Sun, 16 Aug 2026 19:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907674; 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=0PoiWTQyc+6CT3+XQBefK1rDjJHIoQVwAvU80roRsDk=; b=ObFvkbyzmAp61fW05AuMz3fGqueL3dPoPkNzVRSNnxSgGM0JMECmcDZJXZyebCYm+I4Vdh woJKnnVI+UrbMZc00R5gwIMSMrGslzGK6iEjm1q+d854yOSu43aiOvxj9bLTPOkuBCvThm DIIJcCuHgB3T1Vo8M+ZfG4+FJUcLXyY= X-MC-Unique: 2sJYkqVnOhW7qTqgQ4eEZA-1 X-Mimecast-MFC-AGG-ID: 2sJYkqVnOhW7qTqgQ4eEZA_1786907664 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:51 +0400 Subject: [PATCH v3 24/49] tests/qemu-iotests: add qmp_qemu_io() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-24-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1547; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2ie2jIETQhyqbbYcjhhut4gVUdDiVPF4PD6eQdFtxIU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyx3e9osmNQZwvs3dklmfo3O8xBvc3RhQZP 9IGrjm6LVOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5e6vEACWsFYS7OvZNcZDGIaEVYxRVilhtQNPA2EsSmMpS5dwgR0oMPvLkLtITdbnN6hGYizUwrf UrWyFWnm/AOyfwrYMhlWGHPMbQOIHqYGZzgB4hHjp8F/xVFvexfzKzVHPK+XTqEmmw97rcfBXxU Kx48J7IYkvZZDiU1zxcQ+V2mYbzR7fLRT5MMFjsGv9yFWDz+/bIcjr+fkBc7hDbeY5HlHLx0Tmk 8P1lSCMV9Gn6Id0zVZmNttt3icMSnLdmNZBXgpAf/IdGeivIV68FpFGVtM3qeqODxKUHwjgHi7L mpMtgimLUJD67SyB1hZpxi/sRHE2mL/uoiE55jMiqM2kdhB8oOTtQDfstwakSRWoi3yhdhxjcb4 ekbsQkfuIqs9XbA96xN5CfE3RypUPJ63G/G+clzRtEIcHkexAyeljZhvjUwbCPkg6xCCLGEpO8Z o1kUb+7V0FtFH14Tr/bt1r1CcSCQ70jvVhvfzuWuSbn/4/TLTTeZaGIO+jiej4FQ0gG2vLBBrv8 /YoS6XAdyzW33Kj2T5nd5aWVUbnNW83YUwlsC1Cjq5ArgrpocqTBM2v4zvCmSxXI3HimnPRbgNk HN7pEJgFi7oYWhXuuE3PY9wzKgkBpiN3YT+l/sGCSPD19SJm+v5O0kAJUYsiXeBV7AAIng3aR1+ 4t97/T6AOETFp5Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907730412158500 Add qmp_qemu_io() method as a QMP counterpart to hmp_qemu_io(), using the x-qemu-io QMP command instead of human-monitor-command. The x-qemu-io command takes separate 'device' (or 'qdev') and 'command' arguments, and returns the error string. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- tests/qemu-iotests/iotests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 072be80e0792..c24f1e3767c4 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -953,6 +953,20 @@ def hmp_qemu_io(self, drive: str, cmd: str, d =3D '-d ' if qdev else '' return self.hmp(f'qemu-io {d}{drive} "{cmd}"', use_log=3Duse_log) =20 + def qmp_qemu_io(self, drive: str, cmd: str, + use_log: bool =3D False, qdev: bool =3D False) -> str: + """Write to a given drive using the x-qemu-io QMP command""" + kwargs: Dict[str, Any] =3D {'command': cmd} + if qdev: + kwargs['qdev'] =3D drive + else: + kwargs['device'] =3D drive + if use_log: + res =3D self.qmp_log('x-qemu-io', **kwargs) + else: + res =3D self.qmp('x-qemu-io', **kwargs) + return res.get('error', {}).get('desc', '') + def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): if output is None: output =3D {} --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907690; cv=none; d=zohomail.com; s=zohoarc; b=SDrWmf8ZyNQdeaf3+DC3a5/sfFjNktmUAduzO9STanFO9ZAhOpjiciWwRHj8dez/wCIOZYBVfmaCBOUexTxesDdV8gxItIqFxMvr7d32BiG4PyJCMBiXslX0eMROtIsyGCp3VQe3+v5y4nkGjxTNWTpEWoly8ixJpImkL5opFVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907690; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Li9eaIRd/wq0aVwn/Br8is5mFw0E+0GI7agP3g+jan8=; b=m+hRZBQBxziD/q2ERRSgNs5Zm/LUXqp2efywyZvYPOo3P4jh46gzkFD4Y8phmd+YG3EiUbSzxXstwBhUGxX7eLtMdh/0OgVYRShhkXWEh6vnFXKBdtmXdOH3vyXk6CaKv0TFJQd5uUqwoLXit5zUAGiR+Wj3mveKKa+7AozzD1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907690438943.5155177919693; Sun, 16 Aug 2026 12:14:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJW-0001Xl-Lc; Sun, 16 Aug 2026 15:14:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJU-0001Kw-HX for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJT-0007eh-2I for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:32 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-xBFrfoJvNxmnvNihVQcVKw-1; Sun, 16 Aug 2026 15:14:28 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F00711800344; Sun, 16 Aug 2026 19:14:27 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 030CC195608A; Sun, 16 Aug 2026 19:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907670; 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=Li9eaIRd/wq0aVwn/Br8is5mFw0E+0GI7agP3g+jan8=; b=EjCdmixSYjfvTJO+gxGy/HZ4PAOMQ0n4MWoPLnN890LwuYRXKgLXdBglveYd5/+w0/N5gD r20EkI9v4oH3GiQJ+kN36rSjhSPwgFgVZz5HH78wsKprYZ4iN3s99/uQ0d1Sdkrn1FHHFc hqm9RiQz/F19smBaovSCKl/2yUeKNNM= X-MC-Unique: xBFrfoJvNxmnvNihVQcVKw-1 X-Mimecast-MFC-AGG-ID: xBFrfoJvNxmnvNihVQcVKw_1786907668 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:52 +0400 Subject: [PATCH v3 25/49] tests/qemu-iotests: convert pause/resume_drive() to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-25-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1251; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/L0hVAFEx3XIWnCzmZ1t+k9L/2lgK8hla0QlNAoAMqw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyHbad6hO7UA5n2apRt9oG1p8gXUFgkOtuu B1oAasvG9qJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5Q8YEACp9eZDrHLMgPz+mMf+BcqCfYtYS9fUKcSU+cI9xPTJpEKBQwIVvlvW8uF7LBO96jDNNT/ Oyp42Si9ro9Nsmfbt3fZjRhJskhXj8hFWdXV8qq3JQ1EtWVXBWBq+iFJPme9UH20sP7F63yLlP1 hiitzPup9ZLRpHnsMAQZAPuIxUD8CwD3qmIHdkjLxgpUQbJJyMdjoMS7gD5WTvSm9wDAd03ffd3 O/DUjrHTCq6B6hfXpq4vomosL+Bb2qqMz6wAOm6pa/XGRcx8xXafyB15Ot29hCPRvJhU5//nShg WqvwEML37bkqYcNhwWHMJeohH96shaWwmytliYGKC3/GDlf96EC6Sj3Hl1SCjMQ2+eqbwYLwL3A t2saxzorssyWc6hMhi1ZbZyLr3xYiZOwuttY4kOjK5sKg3rW+q1pnM88LwuCzVEzyYi7a1EgrQR b9UHpVaSIxlsghx086ER5+Z4OWpcau2P9fG7uSXJgq2ZCOZutKJoGjn1cCQhHXlKRJJrDjAX8HD xmzz9O4d1vxVajvCEZ9/PW3QFHoLehTNe7Mc3YZg8EgZDeJVlTh7oWdkyQtBh/Zfd2n8I38wc4e uEAr7JoaN2MrsI5xMfLxP0dLeaUH1LH4W1nqz+LJvdnvJSMeoXQDX6dvJmrpT39tTzGW+Z+/Q0s Bo92E9e8nUXZfgA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907691953158500 Convert pause_drive() and resume_drive() to use x-qemu-io directly instead of routing through hmp(). Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index c24f1e3767c4..f36bcf316429 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -941,11 +941,11 @@ def pause_drive(self, drive: str, event: Optional[str= ] =3D None) -> None: self.pause_drive(drive, "read_aio") self.pause_drive(drive, "write_aio") return - self.hmp(f'qemu-io {drive} "break {event} bp_{drive}"') + self.qmp_qemu_io(drive, f'break {event} bp_{drive}') =20 def resume_drive(self, drive: str) -> None: """Resume drive r/w operations""" - self.hmp(f'qemu-io {drive} "remove_break bp_{drive}"') + self.qmp_qemu_io(drive, f'remove_break bp_{drive}') =20 def hmp_qemu_io(self, drive: str, cmd: str, use_log: bool =3D False, qdev: bool =3D False) -> QMPM= essage: --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907693; cv=none; d=zohomail.com; s=zohoarc; b=HNO/ki/Z5Iwh3ri3/kWBUd2cv/ujNKB9a6I389AI5CsU8Dp3ZitBkNGQuOTTPfC00UapRIZ4MWQtNAtzt3ZeTx5SVJUNJQH+QMIzfHK+SxKfuUPDIyg8HVYTjcLb+afdAHlwBnkCKrDUpHEnUg+L5XZcJBsUnOvXm1Q4OD9uZVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907693; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Xio5ek/DtZoSh6Qdxkpsfo2CpELN36wjvQz9OIm/oog=; b=bE3Nk+Aiva68RMFRn4+gGce98uPxH7ddtmUtEQoCfk9qragXYjQO/CMIv7j63yWMv0V5Wq0e1f+TLDYPY3lxQn2Tf4Ze1Uvhu23n3oDfEnMdKr883tGuPfEgZ5oFZXOnXlEpcVwtQ1OFC7LIRsY0Fnbz3XGLBETNrKEpion2L14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907693912736.2850435400023; Sun, 16 Aug 2026 12:14:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJb-0002GG-NA; Sun, 16 Aug 2026 15:14:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJZ-0001yo-LY for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJX-0007fh-Cs for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:37 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-5aWXx9BvPCWJI8buowCAAQ-1; Sun, 16 Aug 2026 15:14:32 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A7FDD1800471; Sun, 16 Aug 2026 19:14:31 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A42A31956041; Sun, 16 Aug 2026 19:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907674; 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=Xio5ek/DtZoSh6Qdxkpsfo2CpELN36wjvQz9OIm/oog=; b=OsLYw8IRdlMENcubdrzNeWNpQB63iT6NU6a7ZyDwnhKBZg/1qy8We37oP/utUZLWRQjcT1 kWfNpzNoxkD4Hp0yaLCmauZ40EctBQklhRIDLIi7qc/LSA47ZfQAovIrfBJJaaTAUryiTV yFsx2CdvFX//L0Mfn69gc2Hl/VkSqHg= X-MC-Unique: 5aWXx9BvPCWJI8buowCAAQ-1 X-Mimecast-MFC-AGG-ID: 5aWXx9BvPCWJI8buowCAAQ_1786907671 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:53 +0400 Subject: [PATCH v3 26/49] build-sys: add 'hmp' option MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-26-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3106; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=GN8UARHzBp9ZPX0/G1E3GbVjjCI7VPL7U4mo31Lr1Pc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguy/fx+Y4rUEZFW3W7pOnvWUfb08jkQ1Ope1 eeWRyK/e1iJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5ZrWEACrN7AJNtRGbFfjOoB9VpPRt/viosgi+XGNrvIflQvj0OzUy6hSZjK19Qz6iG/qcI+cMTU hegE3R74GasdSJlGrLRG47Q3FaFy7AuELRDirhvc+OMIzcMUAvdViCDj2/69+htXb8KyuMaPl+/ Q8K3X4RSx0Wqh9Erd3VCT9NhfJE0othalqDIJ4F+M7EH4pH2L8UXpqX+71eHkap1+FarLD6QB6d BMpDMzPjPIE59TroyOlvYW7mevDqNb15WFnU/14l6tQHVBMtkhpDTU4nmUQs936P4aqlNrEBXDG 9R9cIdiCYdDy0+oHkUPE16GZ/gg51lfhowiYAOkeEobdbhS+nfrMynZEzEZwzLh7GZGbXzt8rEi qSRg5JgaeakC5DjUMghrmNcCD6G/H5VrinFMy08rgxBROAB05yDr0nEUNRvD/JPWglMbXLbh9YH gHn3T/bLJkQRNvN3wF51N70Rad1hsKGPOC4UEy9xJRvmtSMDbYV/8LY6/Zskt7qcYvcbl+G3k2P mY0et2O98un9Hu3D5TpvfLpD29WaKaJbUr/cNbduFk2MjjEvq8b95TfI8vWa3VpFoRFudFG9eUD uP1nDRHezK1C5U0mFqJfSxrMao0I3D1TbgAdoxcEzZ+UEv8MB21uCc3R1A3pBxAT2y4quUyz4nY NJY4lFF5rIYrbYg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907696291158500 Add an option to enable/disable HMP support, default to true. The following commits are going to make --disable-hmp gradually work. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 4 ++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 9 insertions(+) diff --git a/meson.build b/meson.build index 49a5baf5b52f..03b334549f23 100644 --- a/meson.build +++ b/meson.build @@ -247,6 +247,9 @@ have_vhost_net =3D have_vhost_net_kernel or have_vhost_= net_user or have_vhost_net_ =20 have_tcg =3D get_option('tcg').allowed() and (have_system or have_user) =20 +have_hmp =3D get_option('hmp') \ + .disable_auto_if(not have_system) \ + .allowed() have_tools =3D get_option('tools') \ .disable_auto_if(not have_system) \ .allowed() @@ -2266,6 +2269,7 @@ endif config_host_data =3D configuration_data() =20 config_host_data.set('CONFIG_HAVE_RUST', have_rust) +config_host_data.set('CONFIG_HMP', have_hmp) audio_drivers_selected =3D [] if have_system audio_drivers_available =3D { diff --git a/meson_options.txt b/meson_options.txt index a07cb47d35e9..d8f59cf92cae 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -111,6 +111,8 @@ option('cfi', type: 'boolean', value: false, description: 'Control-Flow Integrity (CFI)') option('cfi_debug', type: 'boolean', value: false, description: 'Verbose errors in case of CFI violation') +option('hmp', type : 'feature', value : 'auto', + description: 'HMP monitor support') option('multiprocess', type: 'feature', value: 'auto', description: 'Out of process device emulation support') option('relocatable', type : 'boolean', value : true, diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index c003985047c0..5a67e59a1671 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -125,6 +125,7 @@ meson_options_help() { printf "%s\n" ' gtk GTK+ user interface' printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Ag= ent' + printf "%s\n" ' hmp HMP monitor support' printf "%s\n" ' hv-balloon hv-balloon driver (requires Glib 2.68+ = GTree API)' printf "%s\n" ' hvf HVF acceleration support' printf "%s\n" ' iconv Font glyph conversion support' @@ -339,6 +340,8 @@ _meson_option_parse() { --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=3Ddisabled ;; --enable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=3Dtrue= ;; --disable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=3Dfal= se ;; + --enable-hmp) printf "%s" -Dhmp=3Denabled ;; + --disable-hmp) printf "%s" -Dhmp=3Ddisabled ;; --enable-hv-balloon) printf "%s" -Dhv_balloon=3Denabled ;; --disable-hv-balloon) printf "%s" -Dhv_balloon=3Ddisabled ;; --enable-hvf) printf "%s" -Dhvf=3Denabled ;; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907865; cv=none; d=zohomail.com; s=zohoarc; b=dbSLQuZZHREWN4VE1ntEl4VgvdRKip01RkOcEupZq6fRDeb891CMBUktOzbv5nnJfME6k52YZTKlKxf72dAVIvlPvkYQOtDQIYb99RI/RMj2v8TaP9G7rbk7Vy4P1PFBc+hBJp7LT1JNgsuQp8GPd8ZlV0WKo3FVjn9ypv3crYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907865; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=baVsEQw9XNWf+0jxiSbVi9djuAV9q5Yn/7vuMEEwozQ=; b=JynAJw/WuvVmktbPN/7YuZKJe8FlU4Gs3nCmHgbOOIdDEs3+dLAx1cRvrUq39C7vJUa1OCPrmScsX6PwSrC8T7JCn+7bXKWmuKXH/tgQu92DlOUBdnZBCy1bf3y7nFy4237+yYSR31DxnTkDM8Ryu3QpOWBHCeCc48mXdDXSb1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907865315148.93938026510784; Sun, 16 Aug 2026 12:17:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJe-0002hd-EQ; Sun, 16 Aug 2026 15:14:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJc-0002Kc-6Y for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJa-0007gg-Lk for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:39 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-620-IxB-PREINviZpMRiQDCRlg-1; Sun, 16 Aug 2026 15:14:36 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2DE4118002C0; Sun, 16 Aug 2026 19:14:35 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 07CE0180034F; Sun, 16 Aug 2026 19:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907678; 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=baVsEQw9XNWf+0jxiSbVi9djuAV9q5Yn/7vuMEEwozQ=; b=foV0wsly3wCkJvsR/ou0uT9wU6fUNetICWwL42uX+Wb6kGKzOemF2ZUwoPMk8ExmLN2HUl rMYPcq5nTGIiz1PAhDoiyXkN19l4iucnOjDCgDXIoBQQgTyImKCS2np63IrKHxqc96DIvV anA4NXfThjMeM3JKVupzEHDNCWSSoXQ= X-MC-Unique: IxB-PREINviZpMRiQDCRlg-1 X-Mimecast-MFC-AGG-ID: IxB-PREINviZpMRiQDCRlg_1786907675 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:54 +0400 Subject: [PATCH v3 27/49] monitor: reject readline monitor when HMP is disabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-27-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" X-Developer-Signature: v=1; a=openpgp-sha256; l=1056; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=twX3cnfqvNWtqcuR8yai47663XdB+jAHlsuulV8uGbI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyhUXwHsI+U35+gFBP27yxm3S6YHBIN10C5 hsOQooQ9nOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5aAFEACnkkhy2GTMRHRMHTkr3kR2N/3wkKbVzDheIkMi0k6k9qPbUvImQiFzpRNlb1q2rYWOC/z K51ckyrq7pZGpKQcqesdafapxD5y6SyeKMWC7XwKOwk0K0WgfoSXBw+5DC9TgQuUnSTqShQAZNc 8BTKBEzTAtJz7dGop15UPNHsuRo8sGkRcZU8v+VvWhp9mHX19yEetgp+5KV37sAncH+QCUAC66w BbYUxGLNmiTTKxtctRVmAwU5+bSPXV1VGmuNQuzecOJp+s1oB0gPxu3EzmLHzhBQWJhZ4AmTxh5 FF9Gt7PG8WgUN+tR2DZ6HKTChdSnEMXPMf+yRLMoSD5In26H60N9zIhynDYAVzOxG2pBQPbQBka WeAqM86sY6MCPOjdcAVpVdwonKXt/DorxNjF086V0vk+I11z1dQdlWI5S+2z6W0YAHf/CTVpqUj p9Dvi3pPSJTohIUYeN8vP2ndDF6/r3wdLfADlRJzdiN4a77VtbB7ry1xAjXD2/utiYw6umfP6wF HL+Rft6XNRfdcTve77diS2JUcDLwplcIfXUlFKcGVXOfJPBhEIdEmrsWo3i6lUfMhQRqefOPOcM /c+D977+GIOcsbz7kgENrBAM8A/8RRbE5bQdQTaS+J2iBDqnJsB3th5/872onk3qcruCJ1XBs1s rfE9ip4wkZkEeKA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907866626158500 When QEMU is built without HMP support, reject '-monitor' (which requests readline/HMP mode) early in monitor_new_opts() with a clear error message directing users to '-qmp' instead. Signed-off-by: Marc-Andre Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- monitor/monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monitor/monitor.c b/monitor/monitor.c index 6d6ffbb0f78a..8528af6f79b8 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -776,6 +776,16 @@ int monitor_new_opts(QemuOpts *opts, Error **errp) MonitorOptions *options; int ret; =20 +#ifndef CONFIG_HMP + const char *mode =3D qemu_opt_get(opts, "mode"); + /* readline is HMP.. */ + if (mode && g_str_equal(mode, "readline")) { + error_setg(errp, "HMP monitor is not available," + " use '-qmp' instead of '-monitor'"); + return -1; + } +#endif + v =3D opts_visitor_new(opts); visit_type_MonitorOptions(v, NULL, &options, errp); visit_free(v); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907714; cv=none; d=zohomail.com; s=zohoarc; b=QdS8NalgygV9J+TWVOsg32bLQ95Jic7c+8kCvtV8JevpG7KXcbhQCZsxg115+rmYnc/xRmm9o30if5KYv/mUAH0fiOzAdjZ5qKDX5DsXKlf/dleeaHBG7GIZYYcPFj/ihdLAeIaR3g8nXvdIS2IHwGT21NPhdwnLC9heApK0B4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907714; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JnBk68Zq8c2FeEBDk3jffL7jGhfnNM8eL9UVvNFqAb8=; b=Vwsp0HhsS6I/fTvk+fet7QpEz3850yRHrZ+U/z4wm5G31r+K8qciF5xKdvxDshNkITX5UDiU4hsM3tAj9L2VXLXR0/4bppXNzNqMMYYzj8izt726i41g0CYnMQilr9EW7Fga4piBVO4EN8NTKq3Ihy1hr2EiSyXQdw+PGIqLqOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907714942894.2731638824013; Sun, 16 Aug 2026 12:15:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJn-0003vn-Fs; Sun, 16 Aug 2026 15:14:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJl-0003hx-Hv for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJi-0007j2-Kd for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:49 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-JlOuNnA0NIaVIOfRN-rp9g-1; Sun, 16 Aug 2026 15:14:39 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E570195609F; Sun, 16 Aug 2026 19:14:38 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9200B18005BC; Sun, 16 Aug 2026 19:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907685; 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=JnBk68Zq8c2FeEBDk3jffL7jGhfnNM8eL9UVvNFqAb8=; b=GX+oYzWyV67HXc3c8L3yVfEGSWsuy9svE3Os5HXce9tFZ+fvT4i8LJkAL07kBQo7WLodWr J/rjwC07LM9gBn4UAkAdjfqTE6Gt5VpFd9rhT2a2QCvmparhhxuK31JRz/mjRStkBReiJG qyW+EXvY4XXBcXACwzeM0CE21RIoeL8= X-MC-Unique: JlOuNnA0NIaVIOfRN-rp9g-1 X-Mimecast-MFC-AGG-ID: JlOuNnA0NIaVIOfRN-rp9g_1786907678 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:55 +0400 Subject: [PATCH v3 28/49] system: guard HMP initialization paths with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-28-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3713; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=bT21iCtl9Pu5KvB+Qa+tcMfyxy2JpJWnyPgbphVlKfk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyuVJlnpU2Rzhc52IQwanl+NKz8xQenNNnD k8P85LQpRiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5fi1D/9d3hlJuEqDpA87VTh6D2dt+s0P2xp8oRsvRanP1PKOMwPCZE+mj/XiGTx7z5Peofq8M3w k4+gQm93I1Va0RxE5AnG337pMdn7NV6CvtSarzLNlwL0m+rIBMaCIjk4Ju8rUfmhZhXlthxNMUM MBUxteVMeDO0bgsMpxADBsoe21Py/pd5/mKyzmoL6G0mu7eR7sYUiaYxQzx17ot7oo1JffsTyHy kcXNuj+keacU6hSoGDDqpkQZF86aM8TOMsp5uAnMgoeonmvDDJNCPkk08VEwHKqjtKE1InmhCn1 kHqxKdz5cy2Dr8fizhm+37i0U+7l0c4TDghDmSd19oHCdo9oVb3pLud3wef+hCbmWQkw8Wzv8Fi SpjZHsWX8/2prPZdzZ4STsVJYyGuKrZDdBZbhSR7QWSPeTi5ISbj7jVQm9MwJ3Nu+bMQ6AHRAWg peE/FOltpErnBvYMK0uFQdGFKVNyvGA2DcwpGJn+Q53SEc/SXH0gnmiQkLAoUaqy1tAzzDtTXpL ZAE5Z1R4SSM0txB0Vanyuog5b+V5bm+xj6er9x9uIh5iAkFcVNgYm1cIBYWdc+qyvbgrJTfE9w0 KxXSwzJsEWIg1pefYgRVXqnC/AHKqB5gLwLGGfxbNfstgYFK+iTeP/lrHb/sgMjFpOSPMyDitBT Yz9QQKgen4V3JIQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907716088158500 - disable default monitor when HMP is not available - hide 'readline' from -mon help text - error out on mux chardev monitor when no HMP - skip HMP monitor terminal for gdb, return E01 for 'qRcmd' remote commands Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- chardev/char.c | 9 ++++++++- gdbstub/system.c | 8 ++++++++ qemu-options.hx | 6 +++++- system/vl.c | 4 ++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 22e5bae388ad..c6c8133f5c1d 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -804,8 +804,9 @@ static Chardev *qemu_chr_new_from_name(const char *labe= l, const char *filename, } =20 if (qemu_opt_get_bool(opts, "mux", 0)) { - const char *chardev_id =3D qemu_opts_id(opts); assert(permit_mux_mon); +#ifdef CONFIG_HMP + const char *chardev_id =3D qemu_opts_id(opts); monitor_new_hmp(NULL, chardev_id, true, &err); if (err) { error_report_err(err); @@ -813,6 +814,12 @@ static Chardev *qemu_chr_new_from_name(const char *lab= el, const char *filename, chr =3D NULL; goto out; } +#else + error_report("HMP monitor is disabled"); + object_unparent(OBJECT(chr)); + chr =3D NULL; + goto out; +#endif } =20 out: diff --git a/gdbstub/system.c b/gdbstub/system.c index c77d067ab458..070bc26f416c 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -387,10 +387,14 @@ bool gdbserver_start(const char *device, Error **errp) =20 qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL); =20 +#ifdef CONFIG_HMP /* Initialize a monitor terminal for gdb */ mon_chr =3D qemu_chardev_new(NULL, TYPE_CHARDEV_GDB, NULL, NULL, &error_abort); monitor_new_hmp(NULL, mon_chr->label, false, &error_abort); +#else + mon_chr =3D NULL; +#endif } else { qemu_chr_fe_deinit(&gdbserver_system_state.chr, true); mon_chr =3D gdbserver_system_state.mon_chr; @@ -524,10 +528,14 @@ void gdb_handle_query_rcmd(GArray *params, void *ctx) len =3D len / 2; gdb_hextomem(gdbserver_state.mem_buf, gdb_get_cmd_param(params, 0)->da= ta, len); g_byte_array_append(gdbserver_state.mem_buf, &zero, 1); +#ifdef CONFIG_HMP qemu_chr_be_write(gdbserver_system_state.mon_chr, gdbserver_state.mem_buf->data, gdbserver_state.mem_buf->len); gdb_put_packet("OK"); +#else + gdb_put_packet("E01"); +#endif } =20 /* diff --git a/qemu-options.hx b/qemu-options.hx index 34970fffc94b..680344162efb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4985,7 +4985,11 @@ SRST ERST =20 DEF("mon", HAS_ARG, QEMU_OPTION_mon, \ - "-mon [chardev=3D]name[,mode=3Dreadline|control][,pretty=3Don|off]\n",= QEMU_ARCH_ALL) + "-mon [chardev=3D]name[,mode=3D" +#ifdef CONFIG_HMP + "readline|" +#endif + "control][,pretty=3Don|off]\n", QEMU_ARCH_ALL) SRST ``-mon [chardev=3D]name[,mode=3Dreadline|control][,pretty=3Don|off]`` Set up a monitor connected to the chardev ``name``. diff --git a/system/vl.c b/system/vl.c index 5ccc19282ba2..760cf6e7265a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -199,7 +199,11 @@ static int has_defaults =3D 1; static int default_audio =3D 1; static int default_serial =3D 1; static int default_parallel =3D 1; +#ifdef CONFIG_HMP static int default_monitor =3D 1; +#else +static int default_monitor; /* false */ +#endif static int default_floppy =3D 1; static int default_cdrom =3D 1; static bool auto_create_sdcard =3D true; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907844; cv=none; d=zohomail.com; s=zohoarc; b=nYCs2btOJW/3j8upATppnpGIcaZaXzQCPUQ+iB0nqosu9IQC3HsrQg/4c6ovLrzwq+09aNdLTGvysB5g2Bx4/NkDlpmpVo9pJfEU2VIdtgYm9GDFw7fqKHycIOrBPK3hN5lbXaGtVg9xPJW0GDF68l1y40QDPSoTRWg1SahUzvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907844; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dlM1+ORKWaGilnqKbchYMI6/5dSzqyUj+CiiAvFCZWA=; b=R7X2ZU9LFHEuiPp5uhkSDhGUQrQque0xF7c0K6ugSPaGxyH2+YJrwc7gnMFy8DqbfAiXE8hDRwvsxymWOGuBLHbb3FIHOkZR7/0s6tXafupJpDck5zoQVVEHemD0N64CDZsBZBnYLwrlLECCAc3enPJfNGfd2O+mXvykUQKK9XQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907844259711.1861341039779; Sun, 16 Aug 2026 12:17:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgJv-0004mt-5m; Sun, 16 Aug 2026 15:14:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJs-0004aO-W3 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgJn-0007l2-Di for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:14:56 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-115-yBhsIGcxOqyqtVxMHFJXZg-1; Sun, 16 Aug 2026 15:14:43 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B09A718002C4; Sun, 16 Aug 2026 19:14:42 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CCECC180049F; Sun, 16 Aug 2026 19:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907690; 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=dlM1+ORKWaGilnqKbchYMI6/5dSzqyUj+CiiAvFCZWA=; b=Vj1L8t++hPadpW5CCop+3MyaPQI0YcNv6y61djYx41v0FYC55W+knSY76YGNqjgV+cdPHF 7akyqr00ob9HBi3kg+wXyfAxbB3ZYgUZMs/4e9oJxJDyH21eyMn2s2nQ6fjN2blqR9tJcE tcVqLo8KGvKTIFNQuiglKz4rkPYUHGU= X-MC-Unique: yBhsIGcxOqyqtVxMHFJXZg-1 X-Mimecast-MFC-AGG-ID: yBhsIGcxOqyqtVxMHFJXZg_1786907682 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:56 +0400 Subject: [PATCH v3 29/49] tests: skip HMP-dependent tests when HMP is disabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-29-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Hyman Huang , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=41066; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=vAZeiEG8RCavY/8lBctTUbjcYS3XjO8SCZHdt+Ccn8Q=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguyKsK+1hQch9vvaaa6XU6hC8on60gHydVr8 4ag07tN372JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILsgAKCRDa6OEJdZac 5X2dD/0RL4gTl7B1MCK7WI517U6Gv7p/9rcsS0lvdIMOClW0C4xw2UwtQFZ41lW47ZHFFj2/7Xc Qn5rJeLEiIQQsCMb05FvzolYf+o+xohtMe3AOUzow4LDd+IHzKyg650cIZpfJg1z4hzRQ8IlBPV xqKFd5GY+sxO2tVolUFIF5BeVcaVR7/y2XkAf807SbQ1QFdyNq/cRsjatzeKCxPf6mH/KqdoR0m W4DmfSRIu0OGuhUaHY/0opaDh47+jFg8g5OL54PHw93OcDfR4xT5wjdK+P5+uhN3PxODBj3J3K7 rmYPN02k8v10HhBqm9/4foHQNOa1KMewf3rQGP4x3jTCxHrP/N2AVp4RV7u539uAfDLu9XIx5e6 bcKqbrDGIGCTf3bb9OHFRi5SNMqT/rhjiTHXqMRSjqYF+WHDpg513UR/uksmVoR37PVqGq0w355 wFOXBk+CzJndlgeK6M1m1YWUxtZ1nw3u8A7wKwNBRR5eyOLIcqWLitaTLjUw+ObQ42or4qvRRt6 smm/A+dtuvPsBcQWUKZ7W4lUvxbwBQHGEmLz+Z91S2EOX6nmb9c4x+DnAA4jqucqY3UXoFSWK0o TSwWMDbIQgBopMxst/UXbv66Sz0F7vZ2hQFVr5KSS3lOjxfLbxjnN4bjiI8rf/yDKabBVg0SvYz OgssB5clagb+6fA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907844712158500 Add runtime detection of HMP availability so tests gracefully skip instead of failing when QEMU is built without HMP support. For qtests (drive_del-test), use compile-time #ifndef CONFIG_HMP guards. For bash iotests, add _require_hmp() to common.rc that probes QEMU. For Python iotests, add _verify_hmp() and a require_hmp parameter threaded through execute_setup_common()/main()/script_initialize()/ script_main(). An earlier version of this series did an almost-complete conversion of the tests to QMP. However, this made the series even longer. I decided to post-pone it for now. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- tests/qemu-iotests/028 | 1 + tests/qemu-iotests/045 | 3 ++- tests/qemu-iotests/051 | 1 + tests/qemu-iotests/056 | 3 ++- tests/qemu-iotests/060 | 1 + tests/qemu-iotests/068 | 1 + tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 1 + tests/qemu-iotests/091 | 1 + tests/qemu-iotests/093 | 3 ++- tests/qemu-iotests/102 | 1 + tests/qemu-iotests/117 | 1 + tests/qemu-iotests/119 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/124 | 3 ++- tests/qemu-iotests/130 | 1 + tests/qemu-iotests/132 | 3 ++- tests/qemu-iotests/136 | 3 ++- tests/qemu-iotests/142 | 1 + tests/qemu-iotests/145 | 1 + tests/qemu-iotests/146 | 1 + tests/qemu-iotests/148 | 3 ++- tests/qemu-iotests/151 | 3 ++- tests/qemu-iotests/152 | 3 ++- tests/qemu-iotests/153 | 1 + tests/qemu-iotests/156 | 1 + tests/qemu-iotests/157 | 1 + tests/qemu-iotests/161 | 1 + tests/qemu-iotests/165 | 3 ++- tests/qemu-iotests/172 | 1 + tests/qemu-iotests/181 | 1 + tests/qemu-iotests/185 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/192 | 1 + tests/qemu-iotests/201 | 1 + tests/qemu-iotests/216 | 3 ++- tests/qemu-iotests/225 | 1 + tests/qemu-iotests/232 | 1 + tests/qemu-iotests/236 | 3 ++- tests/qemu-iotests/245 | 3 ++- tests/qemu-iotests/246 | 3 ++- tests/qemu-iotests/249 | 1 + tests/qemu-iotests/254 | 3 ++- tests/qemu-iotests/255 | 3 ++- tests/qemu-iotests/257 | 3 ++- tests/qemu-iotests/260 | 3 ++- tests/qemu-iotests/264 | 3 ++- tests/qemu-iotests/267 | 1 + tests/qemu-iotests/274 | 3 ++- tests/qemu-iotests/280 | 1 + tests/qemu-iotests/281 | 3 ++- tests/qemu-iotests/283 | 1 + tests/qemu-iotests/286 | 1 + tests/qemu-iotests/298 | 3 ++- tests/qemu-iotests/300 | 3 ++- tests/qemu-iotests/304 | 3 ++- tests/qemu-iotests/310 | 3 ++- tests/qemu-iotests/common.rc | 8 +++++++ tests/qemu-iotests/iotests.py | 14 +++++++++++- tests/qemu-iotests/tests/backup-discard-source | 3 ++- tests/qemu-iotests/tests/copy-before-write | 3 ++- tests/qemu-iotests/tests/image-fleecing | 3 ++- tests/qemu-iotests/tests/iothreads-create | 3 ++- tests/qemu-iotests/tests/luks-detached-header | 3 ++- .../tests/migrate-bitmaps-postcopy-test | 3 ++- tests/qemu-iotests/tests/migrate-bitmaps-test | 3 ++- tests/qemu-iotests/tests/mirror-change-copy-mode | 3 ++- tests/qemu-iotests/tests/mirror-ready-cancel-error | 3 ++- tests/qemu-iotests/tests/qcow2-internal-snapshots | 1 + tests/qemu-iotests/tests/qsd-migrate | 3 ++- tests/qemu-iotests/tests/reopen-file | 3 ++- tests/qemu-iotests/tests/write-zeroes-unmap | 1 + tests/qtest/drive_del-test.c | 25 ++++++++++++++++++= ++++ 73 files changed, 152 insertions(+), 37 deletions(-) diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 2b232c461405..28f01439c525 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -49,6 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 # Choose a size that is not necessarily a cluster size multiple for image # formats that use clusters. This will ensure that the base image doesn't= end diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index a341f21cd70f..cd1b35edb17f 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -172,4 +172,5 @@ class TestSCMFd(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index 4c079b11e320..a722c0c1bc8f 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -45,6 +45,7 @@ _supported_proto file _unsupported_imgopts 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' data_file \ compression_type _require_drivers nbd +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" =3D "pc" ]; then _require_devices lsi53c895a diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 808ea6b48abe..7cc97486951c 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -332,4 +332,5 @@ class BackupTest(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 5cd21a6f686f..8d06f84df16b 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -56,6 +56,7 @@ _unsupported_imgopts 'compat=3D0.10' data_file \ =20 # The repair process will create a large file - so check for availability = first _require_large_file 64G +_require_hmp =20 rt_offset=3D65536 # 0x10000 (XXX: just an assumption) rb_offset=3D131072 # 0x20000 (XXX: just an assumption) diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068 index 7ecd2474093e..11b660a8b7c4 100755 --- a/tests/qemu-iotests/068 +++ b/tests/qemu-iotests/068 @@ -43,6 +43,7 @@ _supported_proto generic # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'compat=3D0.10' 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 IMG_SIZE=3D128K =20 diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 331f8cfddcf9..83c4ce6314c5 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -43,6 +43,7 @@ _require_drivers blkdebug blkverify # blkdebug can only inject errors on bs->file, not on the data_file, # so this test does not work with external data files _unsupported_imgopts data_file +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 index 1ac66f197e46..d9e729f674c6 100755 --- a/tests/qemu-iotests/081 +++ b/tests/qemu-iotests/081 @@ -44,6 +44,7 @@ _supported_proto file _supported_os Linux _require_drivers quorum _require_devices virtio-scsi +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index e396748a9179..626203d6fc93 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -48,6 +48,7 @@ _supported_fmt qcow2 _supported_proto file fuse _supported_os Linux _supported_cache_modes writethrough none writeback +_require_hmp _default_cache_mode none writeback =20 size=3D1G diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 4f9e224e8a8c..26ae6e2b2d56 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -419,4 +419,5 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): if __name__ =3D=3D '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=3D["raw"]) + iotests.main(supported_fmts=3D["raw"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index 141bfe1e9023..5db8180d3bb7 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto file fuse +_require_hmp =20 IMG_SIZE=3D64K =20 diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 index 6081473584fe..5cc9433f4a67 100755 --- a/tests/qemu-iotests/117 +++ b/tests/qemu-iotests/117 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto file fuse +_require_hmp =20 _make_test_img 64k =20 diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119 index 6cac8793bac6..ce1b62521f59 100755 --- a/tests/qemu-iotests/119 +++ b/tests/qemu-iotests/119 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt raw _supported_proto nbd _supported_os Linux +_require_hmp =20 _make_test_img 64M # This should not crash diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 index ac7bd8c4e3cd..e4ed87e1a705 100755 --- a/tests/qemu-iotests/120 +++ b/tests/qemu-iotests/120 @@ -42,6 +42,7 @@ _supported_fmt generic _supported_proto file fuse _unsupported_fmt luks _require_drivers raw +_require_hmp =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index b2f4328e3456..ab9ea4d8b59d 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -750,4 +750,5 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 index 7af85d20a892..3d10aba2594e 100755 --- a/tests/qemu-iotests/130 +++ b/tests/qemu-iotests/130 @@ -46,6 +46,7 @@ _supported_proto file _supported_os Linux # We are going to use lazy-refcounts _unsupported_imgopts 'compat=3D0.10' +_require_hmp =20 qemu_comm_method=3D"monitor" =20 diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index 12a64b3d95a3..3756573a57c0 100755 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -57,4 +57,5 @@ class TestSingleDrive(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw', 'qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 58df876bafca..72fd638aa04d 100755 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -410,4 +410,5 @@ class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTes= tCase): if __name__ =3D=3D '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=3D["raw"]) + iotests.main(supported_fmts=3D["raw"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142 index 86d65a2d1a1e..8538a727ac08 100755 --- a/tests/qemu-iotests/142 +++ b/tests/qemu-iotests/142 @@ -43,6 +43,7 @@ _supported_proto file # We test all cache modes anyway, but O_DIRECT needs to be supported _default_cache_mode none _supported_cache_modes none directsync +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145 index a2ce92516dc5..f61a50f63951 100755 --- a/tests/qemu-iotests/145 +++ b/tests/qemu-iotests/145 @@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt generic _supported_proto generic +_require_hmp =20 _make_test_img 1M =20 diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146 index 661a9d2625cc..f63291d0ffba 100755 --- a/tests/qemu-iotests/146 +++ b/tests/qemu-iotests/146 @@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt vpc _supported_proto file _supported_os Linux +_require_hmp =20 =20 qemu_comm_method=3D"monitor" diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index 7ccbde4633c2..4b092dccb7cc 100755 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -140,4 +140,5 @@ class TestFifoQuorumEvents(TestQuorumEvents): if __name__ =3D=3D '__main__': iotests.verify_quorum() iotests.main(supported_fmts=3D["raw"], - supported_protocols=3D["file"]) + supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 647194094a4c..204221a5738e 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -434,4 +434,5 @@ class TestHighThrottledWithNbdExport(TestThrottledWithN= bdExportBase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index 197bea9e7785..d9170359213a 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -61,4 +61,5 @@ class TestUnaligned(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw', 'qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153 index 1e02f6a6e344..def01d6f3ea4 100755 --- a/tests/qemu-iotests/153 +++ b/tests/qemu-iotests/153 @@ -59,6 +59,7 @@ _check_ofd || _notrun "OFD lock not available" =20 _supported_fmt qcow2 _supported_proto file +_require_hmp =20 _run_cmd() { diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 index 97c2d86ce573..a0e4d1ffd42a 100755 --- a/tests/qemu-iotests/156 +++ b/tests/qemu-iotests/156 @@ -53,6 +53,7 @@ _supported_fmt qcow2 qed _supported_proto file # Copying files around with cp does not work with external data files _unsupported_imgopts data_file +_require_hmp =20 # Create source disk TEST_IMG=3D"$TEST_IMG.backing" _make_test_img 1M diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157 index aa2ebbfb4b43..531dbd3122b1 100755 --- a/tests/qemu-iotests/157 +++ b/tests/qemu-iotests/157 @@ -41,6 +41,7 @@ _supported_fmt generic _supported_proto file =20 _require_devices virtio-blk +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161 index f25effab9360..8ca139262975 100755 --- a/tests/qemu-iotests/161 +++ b/tests/qemu-iotests/161 @@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 IMG_SIZE=3D1M =20 diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index b3b1709d71fa..8fc79daae16d 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -154,4 +154,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 4da0e0f2e297..a78e42ff0adf 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index b904e8ce0124..458cb737f1cb 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -47,6 +47,7 @@ _supported_fmt generic _unsupported_fmt qcow vdi vhdx vmdk vpc vvfat parallels _supported_proto generic _supported_os Linux +_require_hmp =20 _flaky_test https://gitlab.com/qemu-project/qemu/-/work_items/3515 =20 diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 index a62ae8d3293e..bb577a9cc999 100755 --- a/tests/qemu-iotests/185 +++ b/tests/qemu-iotests/185 @@ -50,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_require_hmp _flaky_test https://gitlab.com/qemu-project/qemu/-/issues/3270 =20 size=3D$((64 * 1048576)) diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 index eaf13c7a3340..9a4215d28e92 100755 --- a/tests/qemu-iotests/186 +++ b/tests/qemu-iotests/186 @@ -41,6 +41,7 @@ _supported_fmt qcow2 _supported_proto file fuse _require_drivers null-co _require_devices virtio-scsi-pci +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 index e66e1a4f06af..6869bd171537 100755 --- a/tests/qemu-iotests/192 +++ b/tests/qemu-iotests/192 @@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt generic _supported_proto file +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201 index 1b8eb51d8f38..a5c750c38a83 100755 --- a/tests/qemu-iotests/201 +++ b/tests/qemu-iotests/201 @@ -47,6 +47,7 @@ _supported_os Linux # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 size=3D64M _make_test_img $size diff --git a/tests/qemu-iotests/216 b/tests/qemu-iotests/216 index 311e02af3a7b..4eabada9b35d 100755 --- a/tests/qemu-iotests/216 +++ b/tests/qemu-iotests/216 @@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io =20 # Need backing file support iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vmdk'= ], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 log('') log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225 index b5949fcb58e0..8128d583d609 100755 --- a/tests/qemu-iotests/225 +++ b/tests/qemu-iotests/225 @@ -46,6 +46,7 @@ _supported_os Linux _unsupported_imgopts "subformat=3DmonolithicFlat" \ "subformat=3DtwoGbMaxExtentFlat" \ "subformat=3DtwoGbMaxExtentSparse" +_require_hmp =20 TEST_IMG=3D"$TEST_IMG.base" _make_test_img 1M TEST_IMG=3D"$TEST_IMG.not_base" _make_test_img 1M diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232 index b30faaa21806..1ee0aae481d4 100755 --- a/tests/qemu-iotests/232 +++ b/tests/qemu-iotests/232 @@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236 index 20419bbb9e54..3cf0de4043f6 100755 --- a/tests/qemu-iotests/236 +++ b/tests/qemu-iotests/236 @@ -23,7 +23,8 @@ import iotests from iotests import log =20 -iotests.script_initialize(supported_fmts=3D['generic']) +iotests.script_initialize(supported_fmts=3D['generic'], + require_hmp=3DTrue) size =3D 64 * 1024 * 1024 granularity =3D 64 * 1024 =20 diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index 03550b99715c..2f354d1d9205 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -1160,4 +1160,5 @@ class TestBlockdevReopen(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.activate_logging() iotests.main(supported_fmts=3D["qcow2"], - supported_protocols=3D["file"]) + supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/246 b/tests/qemu-iotests/246 index b009a7839775..cee5131c3ce4 100755 --- a/tests/qemu-iotests/246 +++ b/tests/qemu-iotests/246 @@ -24,7 +24,8 @@ import iotests from iotests import log =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) size =3D 64 * 1024 * 1024 * 1024 gran_small =3D 32 * 1024 gran_large =3D 128 * 1024 diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 index 28bffd4d5712..1254bf942913 100755 --- a/tests/qemu-iotests/249 +++ b/tests/qemu-iotests/249 @@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 IMG_SIZE=3D1M =20 diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 index 7ea098818cf0..d3d18a1bbf1f 100755 --- a/tests/qemu-iotests/254 +++ b/tests/qemu-iotests/254 @@ -23,7 +23,8 @@ import iotests from iotests import qemu_img_create, file_path, log =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) =20 disk, top =3D file_path('disk', 'top') size =3D 1024 * 1024 diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255 index 88b29d64b44e..8f88522f1e91 100755 --- a/tests/qemu-iotests/255 +++ b/tests/qemu-iotests/255 @@ -24,7 +24,8 @@ import iotests from iotests import imgfmt =20 -iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.script_initialize(supported_fmts=3D['qcow2'], + require_hmp=3DTrue) =20 iotests.log('Finishing a commit job with background reads') iotests.log('=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D') diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index cd0468aaa162..5e4dba02e769 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -533,4 +533,5 @@ def main(): =20 if __name__ =3D=3D '__main__': iotests.script_main(main, supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/260 b/tests/qemu-iotests/260 index c2133f998010..65165446607c 100755 --- a/tests/qemu-iotests/260 +++ b/tests/qemu-iotests/260 @@ -24,7 +24,8 @@ from iotests import qemu_img_create, file_path, log, filt= er_qmp_event =20 iotests.script_initialize( supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 base, top =3D file_path('base', 'top') diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index c6ba2754e279..b621f11ab427 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -114,4 +114,5 @@ class TestNbdReconnect(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2']) + iotests.main(supported_fmts=3D['qcow2'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267 index 2e2afdad9c57..e14aeb1f18d0 100755 --- a/tests/qemu-iotests/267 +++ b/tests/qemu-iotests/267 @@ -48,6 +48,7 @@ _require_drivers copy-on-read _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file =20 _require_devices virtio-blk +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/274 b/tests/qemu-iotests/274 index 2495e051a227..d91c11c70d2e 100755 --- a/tests/qemu-iotests/274 +++ b/tests/qemu-iotests/274 @@ -24,7 +24,8 @@ import iotests =20 iotests.script_initialize(supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], - unsupported_imgopts=3D['refcount_bits', 'compat'= ]) + unsupported_imgopts=3D['refcount_bits', 'compat'= ], + require_hmp=3DTrue) =20 size_short =3D 1 * 1024 * 1024 size_long =3D 2 * 1024 * 1024 diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280 index 5f50500fdb82..8f4750de074b 100755 --- a/tests/qemu-iotests/280 +++ b/tests/qemu-iotests/280 @@ -27,6 +27,7 @@ iotests.script_initialize( supported_fmts=3D['qcow2'], supported_protocols=3D['file'], supported_platforms=3D['linux'], + require_hmp=3DTrue, ) =20 with iotests.FilePath('base') as base_path , \ diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281 index f6746a12e881..5f3050f50d0b 100755 --- a/tests/qemu-iotests/281 +++ b/tests/qemu-iotests/281 @@ -336,4 +336,5 @@ class TestYieldingAndTimers(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283 index 5defe48e97d5..6d341d3e9745 100755 --- a/tests/qemu-iotests/283 +++ b/tests/qemu-iotests/283 @@ -24,6 +24,7 @@ import iotests # The test is unrelated to formats, restrict it to qcow2 to avoid extra ru= ns iotests.script_initialize( supported_fmts=3D['qcow2'], + require_hmp=3DTrue, ) =20 size =3D 1024 * 1024 diff --git a/tests/qemu-iotests/286 b/tests/qemu-iotests/286 index cc6aacf02283..3b030ec58aa0 100755 --- a/tests/qemu-iotests/286 +++ b/tests/qemu-iotests/286 @@ -40,6 +40,7 @@ _supported_proto file fuse # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 index 09c9290711a8..f2b94077f43a 100755 --- a/tests/qemu-iotests/298 +++ b/tests/qemu-iotests/298 @@ -177,4 +177,5 @@ class TestTruncate(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2'], required_fmts=3D['preallocate= ']) + iotests.main(supported_fmts=3D['qcow2'], required_fmts=3D['preallocate= '], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index e46616d7b19a..df2ba326327d 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -683,4 +683,5 @@ class TestAliasTransformMigration(TestDirtyBitmapMigrat= ion): self.verify_dest_error(None) =20 if __name__ =3D=3D '__main__': - iotests.main(supported_protocols=3D['file']) + iotests.main(supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/304 b/tests/qemu-iotests/304 index 198f2820871e..d465a519a932 100755 --- a/tests/qemu-iotests/304 +++ b/tests/qemu-iotests/304 @@ -24,7 +24,8 @@ import iotests from iotests import qemu_img_create, qemu_img_log, file_path =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) =20 test_img =3D file_path('test.qcow2') target_img =3D file_path('target.qcow2') diff --git a/tests/qemu-iotests/310 b/tests/qemu-iotests/310 index 650d2cb6fb3e..7f290898fea0 100755 --- a/tests/qemu-iotests/310 +++ b/tests/qemu-iotests/310 @@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io =20 # Need backing file support iotests.script_initialize(supported_fmts=3D['qcow2'], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 log('') log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index bcb1ec50a93d..262fe63da820 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -995,6 +995,14 @@ _notrun_on_fuse_error() esac } =20 +_require_hmp() +{ + if echo quit | $QEMU -M none -display none -monitor stdio 2>&1 | + grep -q "HMP monitor is not available"; then + _notrun "HMP monitor not available" + fi +} + # Check that we have a file system that allows huge (but very sparse) files # _require_large_file() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f36bcf316429..7d5a77a85e58 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1456,6 +1456,15 @@ def _verify_formats(required_formats: Sequence[str] = =3D ()) -> None: notrun(f'formats {usf_list} are not whitelisted') =20 =20 +def _verify_hmp() -> None: + args =3D [qemu_prog] + qemu_opts + ['-M', 'none', '-monitor', 'stdio'] + with subprocess.Popen(args, stdin=3Dsubprocess.PIPE, + stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.ST= DOUT, + universal_newlines=3DTrue) as subp: + out, _ =3D subp.communicate('quit\n') + if 'HMP monitor is not available' in out: + notrun('HMP monitor not available') + def _verify_virtio_blk() -> None: out =3D qemu_pipe('-M', 'none', '-device', 'help') if 'virtio-blk' not in out: @@ -1694,7 +1703,8 @@ def execute_setup_common(supported_fmts: Sequence[str= ] =3D (), supported_protocols: Sequence[str] =3D (), unsupported_protocols: Sequence[str] =3D (), required_fmts: Sequence[str] =3D (), - unsupported_imgopts: Sequence[str] =3D ()) -> boo= l: + unsupported_imgopts: Sequence[str] =3D (), + require_hmp: bool =3D False) -> bool: """ Perform necessary setup for either script-style or unittest-style test= s. =20 @@ -1715,6 +1725,8 @@ def execute_setup_common(supported_fmts: Sequence[str= ] =3D (), _verify_formats(required_fmts) _verify_virtio_blk() _verify_imgopts(unsupported_imgopts) + if require_hmp: + _verify_hmp() =20 return debug =20 diff --git a/tests/qemu-iotests/tests/backup-discard-source b/tests/qemu-io= tests/tests/backup-discard-source index 6c624bc8b0b0..80ea32c46e3f 100755 --- a/tests/qemu-iotests/tests/backup-discard-source +++ b/tests/qemu-iotests/tests/backup-discard-source @@ -160,4 +160,5 @@ class TestBackup(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index 3e43e7127f20..5531ad8a4c0d 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -321,4 +321,5 @@ wrote 524288/524288 bytes at offset 524288 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - required_fmts=3D['copy-before-write']) + required_fmts=3D['copy-before-write'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index 5e3b2c7e46a9..b42aa6967f68 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -31,7 +31,8 @@ iotests.script_initialize( supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], required_fmts=3D['copy-before-write'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 patterns =3D [('0x5d', '0', '64k'), diff --git a/tests/qemu-iotests/tests/iothreads-create b/tests/qemu-iotests= /tests/iothreads-create index 0c862d73f20e..09fe57a09ac0 100755 --- a/tests/qemu-iotests/tests/iothreads-create +++ b/tests/qemu-iotests/tests/iothreads-create @@ -22,7 +22,8 @@ import asyncio import iotests =20 iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vdi', - 'vmdk', 'parallels']) + 'vmdk', 'parallels'], + require_hmp=3DTrue) iotests.verify_virtio_scsi_pci_or_ccw() =20 with iotests.FilePath('disk.img') as img_path, \ diff --git a/tests/qemu-iotests/tests/luks-detached-header b/tests/qemu-iot= ests/tests/luks-detached-header index 3455fd8de1ef..58eb3c2cc484 100755 --- a/tests/qemu-iotests/tests/luks-detached-header +++ b/tests/qemu-iotests/tests/luks-detached-header @@ -313,4 +313,5 @@ class TestDetachedLUKSHeader(QMPTestCase): =20 if __name__ =3D=3D "__main__": # Test image creation and I/O - iotests.main(supported_fmts=3D["luks"], supported_protocols=3D["file"]) + iotests.main(supported_fmts=3D["luks"], supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests= /qemu-iotests/tests/migrate-bitmaps-postcopy-test index 33ff2b861f78..b2b37ada4b27 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test @@ -279,4 +279,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestC= ase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index 8fb4099201de..7b0e709f9b41 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -296,7 +296,8 @@ def main() -> None: iotests.main( supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 =20 diff --git a/tests/qemu-iotests/tests/mirror-change-copy-mode b/tests/qemu-= iotests/tests/mirror-change-copy-mode index 51788b85c7ac..c9c345f1397c 100755 --- a/tests/qemu-iotests/tests/mirror-change-copy-mode +++ b/tests/qemu-iotests/tests/mirror-change-copy-mode @@ -190,4 +190,5 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/mirror-ready-cancel-error b/tests/qem= u-iotests/tests/mirror-ready-cancel-error index ed2e46447e3e..ffa045af2191 100755 --- a/tests/qemu-iotests/tests/mirror-ready-cancel-error +++ b/tests/qemu-iotests/tests/mirror-ready-cancel-error @@ -139,4 +139,5 @@ if __name__ =3D=3D '__main__': # LUKS would require special key-secret handling in add_blockdevs() iotests.main(supported_fmts=3D['generic'], unsupported_fmts=3D['luks'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots b/tests/qemu= -iotests/tests/qcow2-internal-snapshots index 9f83aa890391..d301f0941b5c 100755 --- a/tests/qemu-iotests/tests/qcow2-internal-snapshots +++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots @@ -43,6 +43,7 @@ _supported_proto file # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'compat=3D0.10' 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 IMG_SIZE=3D64M =20 diff --git a/tests/qemu-iotests/tests/qsd-migrate b/tests/qemu-iotests/test= s/qsd-migrate index a4c6592420c4..d76278b576c2 100755 --- a/tests/qemu-iotests/tests/qsd-migrate +++ b/tests/qemu-iotests/tests/qsd-migrate @@ -24,7 +24,8 @@ from iotests import filter_qemu_io, filter_qtest =20 iotests.script_initialize(supported_fmts=3D['qcow2', 'qed', 'raw'], supported_protocols=3D['file'], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 with iotests.FilePath('disk.img') as path, \ iotests.FilePath('nbd-src.sock', base_dir=3Diotests.sock_dir) as nbd_= src, \ diff --git a/tests/qemu-iotests/tests/reopen-file b/tests/qemu-iotests/test= s/reopen-file index 5a50794ffc41..f8812320ea8f 100755 --- a/tests/qemu-iotests/tests/reopen-file +++ b/tests/qemu-iotests/tests/reopen-file @@ -85,4 +85,5 @@ if __name__ =3D=3D '__main__': # Must support creating images and reopen iotests.main(supported_fmts=3D['qcow', 'qcow2', 'qed', 'raw', 'vdi', '= vhdx', 'vmdk', 'vpc'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/write-zeroes-unmap b/tests/qemu-iotes= ts/tests/write-zeroes-unmap index f90fb8e8d270..506ced647bc1 100755 --- a/tests/qemu-iotests/tests/write-zeroes-unmap +++ b/tests/qemu-iotests/tests/write-zeroes-unmap @@ -33,6 +33,7 @@ _supported_fmt raw _supported_proto file _supported_os Linux _require_disk_usage +_require_hmp =20 create_test_image() { _make_test_img -f $IMGFMT 1m diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 30d9451ddda1..804f56cc58db 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -167,6 +167,11 @@ static void test_drive_without_dev(void) { QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + /* Start with an empty drive */ qts =3D qtest_init("-drive if=3Dnone,id=3Ddrive0 -M none"); =20 @@ -187,6 +192,11 @@ static void test_after_failed_device_add(void) QDict *response; QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-blk")) { g_test_skip("Device virtio-blk is not available"); return; @@ -223,6 +233,11 @@ static void test_drive_del_device_del(void) { QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-scsi")) { g_test_skip("Device virtio-scsi is not available"); return; @@ -397,6 +412,11 @@ static void test_drive_add_device_add_and_del(void) const char *arch =3D qtest_get_arch(); const char *machine_addition =3D ""; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-blk")) { g_test_skip("Device virtio-blk is not available"); return; @@ -424,6 +444,11 @@ static void test_drive_add_device_add_and_del_q35(void) { QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-blk")) { g_test_skip("Device virtio-blk is not available"); return; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907729; cv=none; d=zohomail.com; s=zohoarc; b=mJ90Dgqz//UxJFd4FZGqwtzOrNRcKgugwzb2lxyPh0C1fXpDUv1OJDN5HSMNe+SlK0hQDx8pbvOruyxu3S2q6Vv/ftS+ft3Qt4LoLHYAhxN1nx2ghOIdK36rP5SVKWmb9RFvgx0IXWlUMcNs9bB6WMxdshLgm0auU0NpuxVmmSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907729; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=29Cd1MkKHFXGJOIFN77UUpfOSmWLs5aRZxGgmBwR2hM=; b=UeWWGCSVZdF1awsGVabchLgO5yHUP+laC+eWBOQqtI5III1F93Gyra9J9yc6FtyMYLquEq6XJMGPjxslQK/fiutLlTzrc8/kfZ36rUcyAqejbwxC45CTZw4VI+uAKF2Jvs9kgQNADihUQUQG6MwcAxD6BHs7OR13losp1G8RwqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1786907729561992.1567599843088; Sun, 16 Aug 2026 12:15:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1392343.1631339 (Exim 4.92) (envelope-from ) id 1wvgJu-00023M-SI; Sun, 16 Aug 2026 19:14:58 +0000 Received: by outflank-mailman (output) from mailman id 1392343.1631339; Sun, 16 Aug 2026 19:14:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wvgJu-00023F-PQ; Sun, 16 Aug 2026 19:14:58 +0000 Received: by outflank-mailman (input) for mailman id 1392343; Sun, 16 Aug 2026 19:14:56 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wvgJs-000239-KM for xen-devel@lists.xenproject.org; Sun, 16 Aug 2026 19:14:56 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wvgJr-00Emcq-5d for xen-devel@lists.xenproject.org; Sun, 16 Aug 2026 21:14:55 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a820c12-8faa-0a2a0a5109dd-0a2a450cc58a-6 for ; Sun, 16 Aug 2026 21:14:54 +0200 Received: from [170.10.129.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a820c2d-f479-0a2a450c0019-aa0a817cbed1-3 for ; Sun, 16 Aug 2026 21:14:54 +0200 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-331-z92NXEkZMoqJj0Kwrh29Ng-1; Sun, 16 Aug 2026 15:14:49 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4C310180086F; Sun, 16 Aug 2026 19:14:47 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9326B1956041; Sun, 16 Aug 2026 19:14:45 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907693; 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=29Cd1MkKHFXGJOIFN77UUpfOSmWLs5aRZxGgmBwR2hM=; b=aPFq7JJEBN/ZcHDKwfQQEtU+lFSA+QLHg6N/OxLWsTZE+LwLRW/V70LzkH6XhzYKIyixG+ M8vKhjBb91nxwVkfsZXqeIEA3mYwQngv0Nhcfwid/VbdjtR2kXI0NAFUtXKTlMBvpzfftO 3l3TN/QcVZJzYA/1Wrf4JHJsL1a55q8= X-MC-Unique: z92NXEkZMoqJj0Kwrh29Ng-1 X-Mimecast-MFC-AGG-ID: z92NXEkZMoqJj0Kwrh29Ng_1786907687 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:57 +0400 Subject: [PATCH v3 30/49] monitor: isolate HMP declarations in hmp.h MIME-Version: 1.0 Message-Id: <20260816-qemu-no-hmp-v3-30-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Richard Henderson , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , Brian Cain , Pierrick Bouvier , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , "Dr. David Alan Gilbert" , Samuel Thibault , Jason Wang , Yoshinori Sato , Stefan Hajnoczi , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=15760; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=lsf9mg6WFQhbEoyc7nCPI/4kkgRjXQJY5QWnI4e34zM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguz2JplENevptot8NnAkDfYIJ5h+RL3Jgc2M 7gQ64J6GOeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5cdsEACjja4Rml6Moi8e/UgJOf2s68LY0fob2xDJm7Lh6z8hgQ6vKXpzgmzaWBpSw4bUYcZqrAu LS1cxllZ2BuYJkEWD68GKmUeCA/pB51MIiAFEAkRssMEMsoYKLZ1MsEN5y5k7LPagYcokAdF3gp rLwu2wl8o1711y1P+WhkqHbn5Rv4pi06EU/5RBZ9IHl+S1IMQBINPuKTbyqaH8aJIeLl1PApFPY k7UNK5WSE5/qUoRROq1TupbMt6otu6aYtMP62SQmjHnFtaa5g31q7XR6ZL5ZjwJsKZWN5G4VAnc TkcWJ+0MqPpqCncxDAzCGpqcHn3+TnP8JG9vGN8GPQqPzbDSGldaL+lAuIj9gDuMMeEN7QlRGsZ q+v5c3Uug5MRQLlkagEdq5Ekt8qLDWQmHdHSKmcutwGIUcKjnTTmBMNvca/UDSemaJn9Ur8Ophj cLIGa++6Fm2ADk1fuphMBjTrONMRFNTTZemGe/wXu+rVr0JLcTrE6f4xDaudfBnrnUq3JnQt83E qLWEX648V6xZF5YgYxYZAzBJRrbgSF2EZUE8srBQc91JV0FXmC3vG2woStTIBPx5F7XME9yExgC QJR0I72lI/dh1By0oy6zQPIf24Vhp9bFsTwbFh3Q7ckgj07VyX3mGT2xNEuBGmJ7ezO0gCWnzp+ G6mKU1/x24h7BxA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-MFC-PROC-ID: ZcCo5DK1sa0gNTKXm8xymQNgIAZtDhydKmHE9S8ykFM_1786907687 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1786907694-51538A5B-942D3E6B/0/0 X-purgate-type: clean X-purgate-size: 15762 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907730534158500 Also rename password & commands with hmp in the name, while at it. Other functions need larger changes which we will take care of next. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Dr. David Alan Gilbert --- accel/accel-system.c | 1 + accel/tcg/monitor.c | 1 + chardev/char.c | 2 +- disas/disas-mon.c | 1 + gdbstub/system.c | 2 +- hw/char/virtio-serial-bus.c | 1 + hw/core/machine-hmp-cmds.c | 1 - hw/core/sysbus.c | 1 + hw/hexagon/hexagon_tlb.c | 1 + hw/misc/auxbus.c | 1 + hw/usb/bus.c | 1 + hw/usb/host-libusb.c | 1 + hw/xen/xen-bus.c | 1 + include/monitor/hmp.h | 21 +++++++++++++++++++++ include/monitor/monitor.h | 18 ------------------ monitor/hmp.c | 8 ++++---- monitor/monitor-internal.h | 1 + net/slirp.c | 1 + stubs/monitor-core.c | 1 + stubs/monitor-internal.c | 2 +- target/rx/disas.c | 1 + tests/unit/test-util-sockets.c | 1 + tools/qemu-vnc/stubs.c | 1 + trace/trace-hmp-cmds.c | 1 - ui/ui-hmp-cmds.c | 4 ++-- util/error-report.c | 2 +- util/qemu-print.c | 1 + 27 files changed, 48 insertions(+), 30 deletions(-) diff --git a/accel/accel-system.c b/accel/accel-system.c index 9176665202d2..977804c4048a 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -28,6 +28,7 @@ #include "qom/compat-properties.h" #include "qapi/qapi-commands-accelerator.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "hw/core/boards.h" #include "hw/core/cpu.h" #include "accel/accel-ops.h" diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c index be5c1950177c..74170ddef708 100644 --- a/accel/tcg/monitor.c +++ b/accel/tcg/monitor.c @@ -11,6 +11,7 @@ #include "qapi/type-helpers.h" #include "qapi/qapi-commands-machine.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "system/tcg.h" #include "tcg/tcg.h" #include "internal-common.h" diff --git a/chardev/char.c b/chardev/char.c index c6c8133f5c1d..9da0911e503c 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/cutils.h" -#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "monitor/qmp-helpers.h" #include "qemu/config-file.h" #include "qemu/error-report.h" diff --git a/disas/disas-mon.c b/disas/disas-mon.c index 9c693618c277..bc9dec3a7761 100644 --- a/disas/disas-mon.c +++ b/disas/disas-mon.c @@ -10,6 +10,7 @@ #include "system/memory.h" #include "hw/core/cpu.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" =20 /* * Get LENGTH bytes from info's buffer, at target address memaddr. diff --git a/gdbstub/system.c b/gdbstub/system.c index 070bc26f416c..8a1cdb11db36 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -29,7 +29,7 @@ #include "hw/core/boards.h" #include "chardev/char.h" #include "chardev/char-fe.h" -#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "trace.h" #include "internals.h" =20 diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index c1973f0248fc..02604740f86a 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -25,6 +25,7 @@ #include "qemu/module.h" #include "migration/qemu-file-types.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qemu/error-report.h" #include "qemu/queue.h" #include "hw/core/qdev-properties.h" diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 686304bafab5..1c700aad3587 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -15,7 +15,6 @@ =20 #include "qemu/osdep.h" #include "monitor/hmp.h" -#include "monitor/monitor.h" #include "qapi/error.h" #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-accelerator.h" diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 3e1160ee921d..13df7cbafe10 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -21,6 +21,7 @@ #include "qapi/error.h" #include "hw/core/sysbus.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "system/address-spaces.h" =20 static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); diff --git a/hw/hexagon/hexagon_tlb.c b/hw/hexagon/hexagon_tlb.c index b6d4aff389e5..2d878cee736d 100644 --- a/hw/hexagon/hexagon_tlb.c +++ b/hw/hexagon/hexagon_tlb.c @@ -12,6 +12,7 @@ #include "hw/core/resettable.h" #include "migration/vmstate.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/error.h" #include "exec/page-protection.h" #include "exec/target_page.h" diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index 877f34560626..ac2525b90fec 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -33,6 +33,7 @@ #include "hw/misc/auxbus.h" #include "hw/i2c/i2c.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/error.h" =20 #ifndef DEBUG_AUX diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 3b6fbd46ac3f..9b9b2e7c2f8f 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -9,6 +9,7 @@ #include "system/system.h" #include "migration/vmstate.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "trace.h" #include "qemu/cutils.h" =20 diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index b9f3ad3f66dd..af67d5dfeb10 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -48,6 +48,7 @@ #include "qapi/error.h" #include "migration/vmstate.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index dfad2bc5085f..a563f6066bb4 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -17,6 +17,7 @@ #include "hw/xen/xen-bus.h" #include "hw/xen/xen-bus-helper.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/error.h" #include "qobject/qdict.h" #include "system/system.h" diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 9258a049bffb..166cd4100c63 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -18,6 +18,9 @@ #include "qapi/qapi-types-common.h" #include "monitor/monitor.h" =20 +#define TYPE_MONITOR_HMP "monitor-hmp" +OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP); + #define HMP_STUB(cmd) \ void hmp_##cmd(Monitor *mon, const QDict *qdict) \ { \ @@ -30,6 +33,24 @@ struct MonitorDef { int64_t (*get_value)(Monitor *mon, const MonitorDef *md, int offset); }; =20 +void monitor_new_hmp(const char *id, const char *chardev_id, + bool use_readline, Error **errp); + +int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) + G_GNUC_PRINTF(2, 0); +int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3); +void monitor_printc(Monitor *mon, int ch); + +void monitor_hmp_read_command(MonitorHMP *hmp, int show_prompt); +int monitor_hmp_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, + void *opaque); + +void monitor_register_hmp(const char *name, bool info, + void (*cmd)(Monitor *mon, const QDict *qdict)); +void monitor_register_hmp_info_hrt(const char *name, + HumanReadableText *(*handler)(Error **e= rrp)); + + CPUArchState *mon_get_cpu_env(Monitor *mon); CPUState *mon_get_cpu(Monitor *mon); =20 diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 9f048ba103b5..72a8f6ea5b4f 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -10,9 +10,6 @@ #define TYPE_MONITOR "monitor" OBJECT_DECLARE_TYPE(Monitor, MonitorClass, MONITOR); =20 -#define TYPE_MONITOR_HMP "monitor-hmp" -OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP); - #define TYPE_MONITOR_QMP "monitor-qmp" OBJECT_DECLARE_TYPE(MonitorQMP, MonitorQMPClass, MONITOR_QMP); =20 @@ -30,8 +27,6 @@ void monitor_init_globals_core(void); char *monitor_compat_id(void); void monitor_new_qmp(const char *id, const char *chardev_id, bool pretty, Error **errp); -void monitor_new_hmp(const char *id, const char *chardev_id, - bool use_readline, Error **errp); int monitor_new(MonitorOptions *opts, bool allow_hmp, Error **errp); int monitor_new_opts(QemuOpts *opts, Error **errp); void monitor_cleanup(void); @@ -43,28 +38,15 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Er= ror **errp); int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp); =20 int monitor_puts(Monitor *mon, const char *str); -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) - G_GNUC_PRINTF(2, 0); -int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3); -void monitor_printc(Monitor *mon, int ch); void monitor_flush(Monitor *mon); int monitor_get_cpu_index(Monitor *mon); =20 int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); =20 -void monitor_read_command(MonitorHMP *hmp, int show_prompt); -int monitor_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, - void *opaque); - AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_i= d, const char *opaque, Error **errp); int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags, Error **errp); void monitor_fdset_dup_fd_remove(int dup_fd); =20 -void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)); -void monitor_register_hmp_info_hrt(const char *name, - HumanReadableText *(*handler)(Error **e= rrp)); - #endif /* MONITOR_H */ diff --git a/monitor/hmp.c b/monitor/hmp.c index 8134dfaad4bb..b4d05d47c4bf 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -136,7 +136,7 @@ static void monitor_command_cb(void *opaque, const char= *cmdline, monitor_resume(&hmp->parent_obj); } =20 -void monitor_read_command(MonitorHMP *hmp, int show_prompt) +void monitor_hmp_read_command(MonitorHMP *hmp, int show_prompt) { if (!hmp->rs) { return; @@ -148,8 +148,8 @@ void monitor_read_command(MonitorHMP *hmp, int show_pro= mpt) } } =20 -int monitor_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, - void *opaque) +int monitor_hmp_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, + void *opaque) { if (hmp->rs) { readline_start(hmp->rs, "Password: ", 1, readline_func, opaque); @@ -1647,7 +1647,7 @@ static void monitor_hmp_complete(UserCreatable *uc, E= rror **errp) monitor_readline_flush, hmp, monitor_find_completion); - monitor_read_command(hmp, 0); + monitor_hmp_read_command(hmp, 0); } =20 qemu_chr_fe_set_handlers(&hmp->parent_obj.chr, diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index fdeeeb853636..ee9ba0c8231e 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -27,6 +27,7 @@ =20 #include "chardev/char-fe.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-emit-events.h" #include "qapi/qapi-types-control.h" #include "qapi/qapi-types-qom.h" diff --git a/net/slirp.c b/net/slirp.c index 517dd23be14b..9bf09a2c8bc9 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -36,6 +36,7 @@ #include "clients.h" #include "hub.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index a7c32297c90a..b0c7002bd406 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qapi/qapi-emit-events.h" =20 Monitor *monitor_cur(void) diff --git a/stubs/monitor-internal.c b/stubs/monitor-internal.c index 731fad221ecc..6f69f1f14ae4 100644 --- a/stubs/monitor-internal.c +++ b/stubs/monitor-internal.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "monitor/monitor.h" +#include "monitor/hmp.h" =20 int monitor_get_fd(Monitor *mon, const char *name, Error **errp) { diff --git a/target/rx/disas.c b/target/rx/disas.c index 67b932882914..0eb2ee6f4507 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "disas/dis-asm.h" #include "qemu/bitops.h" +#include "monitor/hmp.h" #include "cpu.h" =20 typedef struct DisasContext { diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index ab3f39c3efb5..b2a884529598 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -24,6 +24,7 @@ #include "qapi/error.h" #include "socket-helpers.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" =20 static void test_fd_is_socket_bad(void) { diff --git a/tools/qemu-vnc/stubs.c b/tools/qemu-vnc/stubs.c index 1c82d8cff430..26597fefaa99 100644 --- a/tools/qemu-vnc/stubs.c +++ b/tools/qemu-vnc/stubs.c @@ -9,6 +9,7 @@ #include "system/runstate.h" #include "hw/core/qdev.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "migration/vmstate.h" =20 bool runstate_is_running(void) diff --git a/trace/trace-hmp-cmds.c b/trace/trace-hmp-cmds.c index 390173095cff..c8f0133abecf 100644 --- a/trace/trace-hmp-cmds.c +++ b/trace/trace-hmp-cmds.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "monitor/hmp.h" #include "monitor/hmp-completion.h" -#include "monitor/monitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-trace.h" #include "qobject/qdict.h" diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 806a7bece7cb..4ef459490ba2 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -327,7 +327,7 @@ static void hmp_change_read_arg(void *opaque, const cha= r *password, void *readline_opaque) { qmp_change_vnc_password(password, NULL); - monitor_read_command(opaque, 1); + monitor_hmp_read_command(opaque, 1); } =20 void hmp_change_vnc(Monitor *mon, const char *device, const char *target, @@ -344,7 +344,7 @@ void hmp_change_vnc(Monitor *mon, const char *device, c= onst char *target, } if (!arg) { MonitorHMP *hmp =3D MONITOR_HMP(mon); - monitor_read_password(hmp, hmp_change_read_arg, NULL); + monitor_hmp_read_password(hmp, hmp_change_read_arg, NULL); } else { qmp_change_vnc_password(arg, errp); } diff --git a/util/error-report.c b/util/error-report.c index f333af9249b9..aaa15bc79827 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qemu/error-report.h" =20 /* diff --git a/util/qemu-print.c b/util/qemu-print.c index 7b9591035e57..a2d1f0244168 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "monitor/monitor.h" +#include "monitor/hmp.h" #include "qemu/qemu-print.h" =20 /* --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907747; cv=none; d=zohomail.com; s=zohoarc; b=JssKuRj2q5TjsKRpCkzRCGP3LKiUjARC/r6l58XQKlM6VS5NmNeb/4M3JXsE7LYU7TxFUALdEVmhGh0y/e8wJ+fiCi/FlpTb/3o2XbxkJpB2dEvNIgmJmZeD59c9HB6C52UIfDOFiVZKDZcTMT1w42geEX5WpvawvVkCFYYBJ3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907747; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=O7qsVk8Gh5cNQFEHmE4/eRTUy2EWFI+JnJSAe0japZM=; b=SKYGAeK2p3Aku4ZUQkRUzqK1CfdUGh9mBI43XCqqCgbD3zYso03uonT3tb4+uYU3SzYXQfp5B/GaI+MuBy2KduRaeB2fSms7uX7+IrLWntDUb0t3wEGzC2lTXiTJebGtiXiuc0F3Bz4UwpWAJ3LbXUL99AS2cLthvwdDugAxpXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907747387537.0784228804264; Sun, 16 Aug 2026 12:15:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKF-0006bb-2I; Sun, 16 Aug 2026 15:15:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKC-0006Q1-K8 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgK4-000856-BE for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:16 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-OwFMxZciPyeaAJPCM2E8hg-1; Sun, 16 Aug 2026 15:15:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C33C71956080; Sun, 16 Aug 2026 19:14:53 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6AF1F30001A2; Sun, 16 Aug 2026 19:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907707; 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=O7qsVk8Gh5cNQFEHmE4/eRTUy2EWFI+JnJSAe0japZM=; b=TYWv7bDA3YOReehgTg47S/lJwD1xO14CE8KScyoUqlARbFgGexSThT/9T3ieeNGyOvGgw1 g9Cn6vC+5XogpG+dYUSBsDw6CYx9xbRu0A3D3mcEpw9aLY9l4KK+aZFPyejocNxflJlmVB QoZIG/rs5gO6sRHIU6zmqDuMWY604Ww= X-MC-Unique: OwFMxZciPyeaAJPCM2E8hg-1 X-Mimecast-MFC-AGG-ID: OwFMxZciPyeaAJPCM2E8hg_1786907695 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:58 +0400 Subject: [PATCH v3 31/49] monitor: change HMPCommand cmd to take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-31-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Gerd Hoffmann , "Gonglei (Arei)" , zhenwei pi , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , David Woodhouse , Paul Durrant , "Michael S. Tsirkin" , Richard Henderson , Marcelo Tosatti , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Halil Pasic , Christian Borntraeger , Jason Herne , Ilya Leoshkevich , David Hildenbrand , Eric Farman , Matthew Rosato , Cornelia Huck , "Dr. David Alan Gilbert" , Samuel Thibault , Hyman Huang , Peter Xu , Fabiano Rosas , =?utf-8?q?Alex_Benn=C3=A9e?= , Stefan Berger , Zhao Liu , Laurent Vivier , Nicholas Piggin , Chinmay Rath , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Artyom Tarasenko , Max Filippov , Stefan Hajnoczi , qemu-block@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=108351; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ayaDbBm47+Uc+2sIZmwrVjENJVfXUJRlMxhsIRylhW4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguzTezfF1+pzcz5nCOoHgYCKN4Bw5R+wcosI MdOPw1EAHWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5czjD/9/QOlRiV8crXjdft0M52KDz926eOMpnrPIZf0yOPwx94GavKEfONauvgsescqVTf8OJIP Ts3xxYECP4JANSsEstP6KA6Kc/dmzCFh6tl5Q8twa8d9GNbCPiYUrCUqFRSOE/qeIuJaLnf71P0 nh5WReiywsS+qIlnVITeShmRO74fNe3Xho801WWEXJv632CnutaBRuxZy407qM49E0jQKrPbJCQ ZqvAVg1l/YNEXdvvXaYL9Xzy9UJg2qcEmpANk1WwCFgsThJN+jPo1Vr2vmt/SHTv5SUKwJYYrOM itFzf6DSvxH00OsNM/NxDQ8LchD94pA9kF1zu0h9OafrBHtMHcC195dwCRmmJHQOx0wAeUqUNqO wlnsQLAXbQu2eHYIscpPWEC3efQcicWkFCkK/ACD/8zdvLQmeNo+8JNA03o7axcF79/ql6k6wZM VO/0QvORuQQY9a60j4QWUoL1zlwhJoMEAOJMzm1goRYdkKIcvCzhN2tI0xiORrrswH8l7Uj+W7p MLbPO3Nqp1Z522SZd50rqQ0K4GIyEmXkD7kwcmmWTww6Y6XtrdF33ceE8XziFHKe/KtklmuAUn/ 6J0+qCQ8rBvVnHp6Te/SKvO+9b9ekQR1c9x6Ed2BgTXkESjVgopdEOm1GD1OSFJqh5Tk34P25BN Bf3F+EdciPKSqdQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907750724158500 HMP commands are specific to the HMP monitor, so make the cmd function pointer in HMPCommand take MonitorHMP * instead of Monitor *. This strengthens type safety and makes the HMP-specific nature of these handlers explicit. Handler functions are renamed to take MonitorHMP *hmp, with a local Monitor *mon =3D MONITOR(hmp) added where the body needs the base type. Following patches will drop it, since most functions are HMP specific. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Jason J. Herne --- audio/audio-hmp-cmds.c | 8 +- backends/cryptodev-hmp-cmds.c | 3 +- block/monitor/block-hmp-cmds.c | 78 +++++++---- chardev/char-hmp-cmds.c | 21 ++- dump/dump-hmp-cmds.c | 6 +- hw/core/machine-hmp-cmds.c | 49 ++++--- hw/i386/kvm/xen-stubs.c | 6 +- hw/i386/kvm/xen_evtchn.c | 6 +- hw/i386/sgx-hmp-stub.c | 3 +- hw/i386/sgx.c | 3 +- hw/misc/mos6522-stub.c | 3 +- hw/misc/mos6522.c | 3 +- hw/net/rocker/rocker-hmp-cmds.c | 12 +- hw/pci/pci-hmp-cmds.c | 6 +- hw/pci/pci-stub.c | 5 +- hw/s390x/s390-skeys.c | 5 +- hw/s390x/s390-stattrib.c | 6 +- hw/uefi/ovmf-log.c | 3 +- hw/usb/host-libusb.c | 3 +- hw/virtio/virtio-hmp-cmds.c | 15 +- include/block/block-hmp-cmds.h | 55 ++++---- include/hw/usb/usb.h | 3 +- include/monitor/hmp.h | 294 ++++++++++++++++++++----------------= ---- include/monitor/qdev.h | 5 +- include/net/net.h | 5 +- include/net/slirp.h | 8 +- migration/dirtyrate.c | 6 +- migration/migration-hmp-cmds.c | 48 ++++--- monitor/hmp-cmds.c | 96 ++++++++----- monitor/hmp.c | 17 ++- monitor/monitor-internal.h | 2 +- net/net-hmp-cmds.c | 14 +- net/slirp.c | 9 +- qom/qom-hmp-cmds.c | 18 ++- replay/replay-debugging.c | 9 +- replay/stubs-system.c | 8 +- stats/stats-hmp-cmds.c | 3 +- stubs/hmp-cmd-info_sev.c | 3 +- system/dirtylimit-hmp-cmds.c | 9 +- system/qdev-monitor.c | 11 +- system/runstate-hmp-cmds.c | 9 +- system/tpm-hmp-cmds.c | 3 +- target/i386/cpu-apic.c | 3 +- target/i386/monitor.c | 9 +- target/i386/sev.c | 3 +- target/m68k/monitor.c | 3 +- target/ppc/monitor.c | 3 +- target/riscv/monitor.c | 3 +- target/sh4/monitor.c | 3 +- target/sparc/monitor.c | 3 +- target/xtensa/monitor.c | 3 +- trace/trace-hmp-cmds.c | 8 +- ui/ui-hmp-cmds.c | 31 +++-- 53 files changed, 561 insertions(+), 390 deletions(-) diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 1ffb5ebc7420..4d326ec99fdf 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -32,8 +32,9 @@ =20 static QLIST_HEAD (capture_list_head, CaptureState) capture_head; =20 -void hmp_info_capture(Monitor *mon, const QDict *qdict) +void hmp_info_capture(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int i; CaptureState *s; =20 @@ -45,7 +46,7 @@ void hmp_info_capture(Monitor *mon, const QDict *qdict) } } =20 -void hmp_stopcapture(Monitor *mon, const QDict *qdict) +void hmp_stopcapture(MonitorHMP *hmp, const QDict *qdict) { int i; int n =3D qdict_get_int(qdict, "n"); @@ -63,8 +64,9 @@ void hmp_stopcapture(Monitor *mon, const QDict *qdict) } } =20 -void hmp_wavcapture(Monitor *mon, const QDict *qdict) +void hmp_wavcapture(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_str(qdict, "path"); int freq =3D qdict_get_try_int(qdict, "freq", 44100); int bits =3D qdict_get_try_int(qdict, "bits", 16); diff --git a/backends/cryptodev-hmp-cmds.c b/backends/cryptodev-hmp-cmds.c index 01396d227c88..fb62428d795a 100644 --- a/backends/cryptodev-hmp-cmds.c +++ b/backends/cryptodev-hmp-cmds.c @@ -17,8 +17,9 @@ #include "qobject/qdict.h" =20 =20 -void hmp_info_cryptodev(Monitor *mon, const QDict *qdict) +void hmp_info_cryptodev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); QCryptodevInfoList *il; QCryptodevBackendServiceTypeList *sl; QCryptodevBackendClientList *cl; diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 22fa03089ea3..3914b5189d56 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -87,8 +87,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_drive_add(Monitor *mon, const QDict *qdict) +void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; DriveInfo *dinfo; QemuOpts *opts; @@ -135,8 +136,9 @@ err: hmp_handle_error(mon, err); } =20 -void hmp_drive_del(Monitor *mon, const QDict *qdict) +void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); BlockBackend *blk; BlockDriverState *bs; @@ -194,8 +196,9 @@ unlock: hmp_handle_error(mon, err); } =20 -void hmp_commit(Monitor *mon, const QDict *qdict) +void hmp_commit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); BlockBackend *blk; int ret; @@ -232,8 +235,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_drive_mirror(Monitor *mon, const QDict *qdict) +void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "target"); const char *format =3D qdict_get_try_str(qdict, "format"); bool reuse =3D qdict_get_try_bool(qdict, "reuse", false); @@ -258,8 +262,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_drive_backup(Monitor *mon, const QDict *qdict) +void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *filename =3D qdict_get_str(qdict, "target"); const char *format =3D qdict_get_try_str(qdict, "format"); @@ -288,8 +293,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) +void hmp_block_job_set_speed(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); int64_t value =3D qdict_get_int(qdict, "speed"); @@ -299,8 +305,9 @@ void hmp_block_job_set_speed(Monitor *mon, const QDict = *qdict) hmp_handle_error(mon, error); } =20 -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) +void hmp_block_job_cancel(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); bool force =3D qdict_get_try_bool(qdict, "force", false); @@ -310,8 +317,9 @@ void hmp_block_job_cancel(Monitor *mon, const QDict *qd= ict) hmp_handle_error(mon, error); } =20 -void hmp_block_job_pause(Monitor *mon, const QDict *qdict) +void hmp_block_job_pause(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 @@ -320,8 +328,9 @@ void hmp_block_job_pause(Monitor *mon, const QDict *qdi= ct) hmp_handle_error(mon, error); } =20 -void hmp_block_job_resume(Monitor *mon, const QDict *qdict) +void hmp_block_job_resume(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 @@ -330,8 +339,9 @@ void hmp_block_job_resume(Monitor *mon, const QDict *qd= ict) hmp_handle_error(mon, error); } =20 -void hmp_block_job_complete(Monitor *mon, const QDict *qdict) +void hmp_block_job_complete(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 @@ -340,8 +350,9 @@ void hmp_block_job_complete(Monitor *mon, const QDict *= qdict) hmp_handle_error(mon, error); } =20 -void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) +void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *filename =3D qdict_get_str(qdict, "snapshot-file"); const char *format =3D qdict_get_try_str(qdict, "format"); @@ -355,8 +366,9 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdi= ct) hmp_handle_error(mon, err); } =20 -void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict) +void hmp_snapshot_blkdev_internal(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; @@ -365,8 +377,9 @@ void hmp_snapshot_blkdev_internal(Monitor *mon, const Q= Dict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict) +void hmp_snapshot_delete_blkdev_internal(MonitorHMP *hmp, const QDict *qdi= ct) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_str(qdict, "name"); const char *id =3D qdict_get_try_str(qdict, "id"); @@ -376,8 +389,9 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mon, = const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_nbd_server_start(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *uri =3D qdict_get_str(qdict, "uri"); bool writable =3D qdict_get_try_bool(qdict, "writable", false); bool all =3D qdict_get_try_bool(qdict, "all", false); @@ -438,8 +452,9 @@ exit: hmp_handle_error(mon, local_err); } =20 -void hmp_nbd_server_add(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_try_str(qdict, "name"); bool writable =3D qdict_get_try_bool(qdict, "writable", false); @@ -456,8 +471,9 @@ void hmp_nbd_server_add(Monitor *mon, const QDict *qdic= t) hmp_handle_error(mon, local_err); } =20 -void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_remove(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool force =3D qdict_get_try_bool(qdict, "force", false); Error *err =3D NULL; @@ -467,16 +483,18 @@ void hmp_nbd_server_remove(Monitor *mon, const QDict = *qdict) hmp_handle_error(mon, err); } =20 -void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_stop(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_nbd_server_stop(&err); hmp_handle_error(mon, err); } =20 -void coroutine_fn hmp_block_resize(Monitor *mon, const QDict *qdict) +void coroutine_fn hmp_block_resize(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); int64_t size =3D qdict_get_int(qdict, "size"); Error *err =3D NULL; @@ -485,8 +503,9 @@ void coroutine_fn hmp_block_resize(Monitor *mon, const = QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_block_stream(Monitor *mon, const QDict *qdict) +void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); const char *base =3D qdict_get_try_str(qdict, "base"); @@ -500,8 +519,9 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, error); } =20 -void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) +void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; char *device =3D (char *) qdict_get_str(qdict, "device"); BlockIOThrottle throttle =3D { @@ -528,8 +548,9 @@ void hmp_block_set_io_throttle(Monitor *mon, const QDic= t *qdict) hmp_handle_error(mon, err); } =20 -void hmp_eject(Monitor *mon, const QDict *qdict) +void hmp_eject(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool force =3D qdict_get_try_bool(qdict, "force", false); const char *device =3D qdict_get_str(qdict, "device"); Error *err =3D NULL; @@ -538,8 +559,9 @@ void hmp_eject(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_qemu_io(Monitor *mon, const QDict *qdict) +void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool qdev =3D qdict_get_try_bool(qdict, "qdev", false); const char *device =3D qdict_get_str(qdict, "device"); const char *command =3D qdict_get_str(qdict, "command"); @@ -666,8 +688,9 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, } } =20 -void hmp_info_block(Monitor *mon, const QDict *qdict) +void hmp_info_block(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockInfoList *block_list, *info; BlockDeviceInfoList *blockdev_list, *blockdev; const char *device =3D qdict_get_try_str(qdict, "device"); @@ -719,8 +742,9 @@ void hmp_info_block(Monitor *mon, const QDict *qdict) qapi_free_BlockDeviceInfoList(blockdev_list); } =20 -void hmp_info_blockstats(Monitor *mon, const QDict *qdict) +void hmp_info_blockstats(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockStatsList *stats_list, *stats; =20 stats_list =3D qmp_query_blockstats(false, false, NULL); @@ -757,8 +781,9 @@ void hmp_info_blockstats(Monitor *mon, const QDict *qdi= ct) qapi_free_BlockStatsList(stats_list); } =20 -void hmp_info_block_jobs(Monitor *mon, const QDict *qdict) +void hmp_info_block_jobs(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockJobInfoList *list; =20 list =3D qmp_query_block_jobs(&error_abort); @@ -793,8 +818,9 @@ void hmp_info_block_jobs(Monitor *mon, const QDict *qdi= ct) qapi_free_BlockJobInfoList(list); } =20 -void hmp_info_snapshots(Monitor *mon, const QDict *qdict) +void hmp_info_snapshots(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockDriverState *bs, *bs1; BdrvNextIterator it1; QEMUSnapshotInfo *sn_tab, *sn; diff --git a/chardev/char-hmp-cmds.c b/chardev/char-hmp-cmds.c index f377e00b6991..d4a5a3a255a5 100644 --- a/chardev/char-hmp-cmds.c +++ b/chardev/char-hmp-cmds.c @@ -24,8 +24,9 @@ #include "qemu/config-file.h" #include "qemu/option.h" =20 -void hmp_info_chardev(Monitor *mon, const QDict *qdict) +void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); ChardevInfoList *char_info, *info; =20 char_info =3D qmp_query_chardev(NULL); @@ -37,8 +38,9 @@ void hmp_info_chardev(Monitor *mon, const QDict *qdict) qapi_free_ChardevInfoList(char_info); } =20 -void hmp_ringbuf_write(Monitor *mon, const QDict *qdict) +void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *chardev =3D qdict_get_str(qdict, "device"); const char *data =3D qdict_get_str(qdict, "data"); Error *err =3D NULL; @@ -48,8 +50,9 @@ void hmp_ringbuf_write(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_ringbuf_read(Monitor *mon, const QDict *qdict) +void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *chardev =3D qdict_get_str(qdict, "device"); char *data; @@ -77,8 +80,9 @@ void hmp_ringbuf_read(Monitor *mon, const QDict *qdict) g_free(data); } =20 -void hmp_chardev_add(Monitor *mon, const QDict *qdict) +void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *args =3D qdict_get_str(qdict, "args"); Error *err =3D NULL; QemuOpts *opts; @@ -93,8 +97,9 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_chardev_change(Monitor *mon, const QDict *qdict) +void hmp_chardev_change(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *args =3D qdict_get_str(qdict, "args"); const char *id; Error *err =3D NULL; @@ -127,16 +132,18 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_chardev_remove(Monitor *mon, const QDict *qdict) +void hmp_chardev_remove(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; =20 qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err); hmp_handle_error(mon, local_err); } =20 -void hmp_chardev_send_break(Monitor *mon, const QDict *qdict) +void hmp_chardev_send_break(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; =20 qmp_chardev_send_break(qdict_get_str(qdict, "id"), &local_err); diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c index 21023db6fd85..ba78ad026f1e 100644 --- a/dump/dump-hmp-cmds.c +++ b/dump/dump-hmp-cmds.c @@ -12,8 +12,9 @@ #include "qapi/qapi-commands-dump.h" #include "qobject/qdict.h" =20 -void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) +void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; bool win_dmp =3D qdict_get_try_bool(qdict, "windmp", false); bool paging =3D qdict_get_try_bool(qdict, "paging", false); @@ -83,8 +84,9 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdi= ct) g_free(prot); } =20 -void hmp_info_dump(Monitor *mon, const QDict *qdict) +void hmp_info_dump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); DumpQueryResult *result =3D qmp_query_dump(NULL); =20 assert(result && result->status < DUMP_STATUS__MAX); diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 1c700aad3587..48fa27f12705 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -25,8 +25,9 @@ #include "system/numa.h" #include "hw/core/boards.h" =20 -void hmp_info_cpus(Monitor *mon, const QDict *qdict) +void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CpuInfoFastList *cpu_list, *cpu; =20 cpu_list =3D qmp_query_cpus_fast(NULL); @@ -48,8 +49,9 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) qapi_free_CpuInfoFastList(cpu_list); } =20 -void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) +void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; HotpluggableCPUList *l =3D qmp_query_hotpluggable_cpus(&err); HotpluggableCPUList *saved =3D l; @@ -106,8 +108,9 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *q= dict) qapi_free_HotpluggableCPUList(saved); } =20 -void hmp_info_memdev(Monitor *mon, const QDict *qdict) +void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemdevList *memdev_list =3D qmp_query_memdev(&err); MemdevList *m =3D memdev_list; @@ -147,8 +150,9 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_kvm(Monitor *mon, const QDict *qdict) +void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); KvmInfo *info; =20 info =3D qmp_query_kvm(NULL); @@ -162,8 +166,9 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict) qapi_free_KvmInfo(info); } =20 -void hmp_info_accelerators(Monitor *mon, const QDict *qdict) +void hmp_info_accelerators(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); AcceleratorInfo *info; AcceleratorList *accel; =20 @@ -180,8 +185,9 @@ void hmp_info_accelerators(Monitor *mon, const QDict *q= dict) qapi_free_AcceleratorInfo(info); } =20 -void hmp_info_uuid(Monitor *mon, const QDict *qdict) +void hmp_info_uuid(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); UuidInfo *info; =20 info =3D qmp_query_uuid(NULL); @@ -189,8 +195,9 @@ void hmp_info_uuid(Monitor *mon, const QDict *qdict) qapi_free_UuidInfo(info); } =20 -void hmp_info_balloon(Monitor *mon, const QDict *qdict) +void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BalloonInfo *info; Error *err =3D NULL; =20 @@ -204,18 +211,19 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdic= t) qapi_free_BalloonInfo(info); } =20 -void hmp_system_reset(Monitor *mon, const QDict *qdict) +void hmp_system_reset(MonitorHMP *hmp, const QDict *qdict) { qmp_system_reset(NULL); } =20 -void hmp_system_powerdown(Monitor *mon, const QDict *qdict) +void hmp_system_powerdown(MonitorHMP *hmp, const QDict *qdict) { qmp_system_powerdown(NULL); } =20 -void hmp_memsave(Monitor *mon, const QDict *qdict) +void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); @@ -231,8 +239,9 @@ void hmp_memsave(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_pmemsave(Monitor *mon, const QDict *qdict) +void hmp_pmemsave(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); @@ -242,24 +251,27 @@ void hmp_pmemsave(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_system_wakeup(Monitor *mon, const QDict *qdict) +void hmp_system_wakeup(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_system_wakeup(&err); hmp_handle_error(mon, err); } =20 -void hmp_nmi(Monitor *mon, const QDict *qdict) +void hmp_nmi(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_inject_nmi(&err); hmp_handle_error(mon, err); } =20 -void hmp_balloon(Monitor *mon, const QDict *qdict) +void hmp_balloon(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t value =3D qdict_get_int(qdict, "value"); Error *err =3D NULL; =20 @@ -267,8 +279,9 @@ void hmp_balloon(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) +void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemoryDeviceInfoList *info_list =3D qmp_query_memory_devices(&err); MemoryDeviceInfoList *info; @@ -370,8 +383,9 @@ void hmp_info_memory_devices(Monitor *mon, const QDict = *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) +void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; GuidInfo *info =3D qmp_query_vm_generation_id(&err); if (info) { @@ -381,8 +395,9 @@ void hmp_info_vm_generation_id(Monitor *mon, const QDic= t *qdict) qapi_free_GuidInfo(info); } =20 -void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) +void hmp_info_memory_size_summary(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemoryInfo *info =3D qmp_query_memory_size_summary(&err); if (info) { diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c index bf6ac28bef47..ab1eb14f99e0 100644 --- a/hw/i386/kvm/xen-stubs.c +++ b/hw/i386/kvm/xen-stubs.c @@ -40,12 +40,14 @@ void xen_primary_console_set_be_port(uint16_t port) { } =20 -void hmp_xen_event_list(Monitor *mon, const QDict *qdict) +void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); } =20 -void hmp_xen_event_inject(Monitor *mon, const QDict *qdict) +void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); } diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 8b243984e412..845838c372d5 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -2344,8 +2344,9 @@ void qmp_xen_event_inject(uint32_t port, Error **errp) } } =20 -void hmp_xen_event_list(Monitor *mon, const QDict *qdict) +void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); EvtchnInfoList *iter, *info_list; Error *err =3D NULL; =20 @@ -2379,8 +2380,9 @@ void hmp_xen_event_list(Monitor *mon, const QDict *qd= ict) qapi_free_EvtchnInfoList(info_list); } =20 -void hmp_xen_event_inject(Monitor *mon, const QDict *qdict) +void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int port =3D qdict_get_int(qdict, "port"); Error *err =3D NULL; =20 diff --git a/hw/i386/sgx-hmp-stub.c b/hw/i386/sgx-hmp-stub.c index cf1d9a6344b0..a4848ae1d1a7 100644 --- a/hw/i386/sgx-hmp-stub.c +++ b/hw/i386/sgx-hmp-stub.c @@ -10,7 +10,8 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 -void hmp_info_sgx(Monitor *mon, const QDict *qdict) +void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "SGX is not available in this QEMU\n"); } diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 7e4c509f5a4a..77b41d234c9f 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -234,8 +234,9 @@ SgxInfo *qmp_query_sgx(Error **errp) return info; } =20 -void hmp_info_sgx(Monitor *mon, const QDict *qdict) +void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; SgxEpcSectionList *section_list, *section; g_autoptr(SgxInfo) info =3D qmp_query_sgx(&err); diff --git a/hw/misc/mos6522-stub.c b/hw/misc/mos6522-stub.c index 85eb0ee36ee1..6a7d76292f00 100644 --- a/hw/misc/mos6522-stub.c +++ b/hw/misc/mos6522-stub.c @@ -10,7 +10,8 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 -void hmp_info_via(Monitor *mon, const QDict *qdict) +void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "MOS6522 VIA is not available in this QEMU\n"); } diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index bae766ef1782..15a6a1a75745 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -586,8 +586,9 @@ static HumanReadableText *qmp_x_query_via(Error **errp) return human_readable_text_from_str(buf); } =20 -void hmp_info_via(Monitor *mon, const QDict *qdict) +void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; g_autoptr(HumanReadableText) info =3D qmp_x_query_via(&err); =20 diff --git a/hw/net/rocker/rocker-hmp-cmds.c b/hw/net/rocker/rocker-hmp-cmd= s.c index df40991f6d20..856aaef5e210 100644 --- a/hw/net/rocker/rocker-hmp-cmds.c +++ b/hw/net/rocker/rocker-hmp-cmds.c @@ -20,8 +20,9 @@ #include "qapi/qapi-commands-rocker.h" #include "qobject/qdict.h" =20 -void hmp_rocker(Monitor *mon, const QDict *qdict) +void hmp_rocker(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); RockerSwitch *rocker; Error *err =3D NULL; @@ -38,8 +39,9 @@ void hmp_rocker(Monitor *mon, const QDict *qdict) qapi_free_RockerSwitch(rocker); } =20 -void hmp_rocker_ports(Monitor *mon, const QDict *qdict) +void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RockerPortList *list, *port; const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; @@ -65,8 +67,9 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict) qapi_free_RockerPortList(list); } =20 -void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict) +void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RockerOfDpaFlowList *list, *info; const char *name =3D qdict_get_str(qdict, "name"); uint32_t tbl_id =3D qdict_get_try_int(qdict, "tbl_id", -1); @@ -214,8 +217,9 @@ void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict = *qdict) qapi_free_RockerOfDpaFlowList(list); } =20 -void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict) +void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RockerOfDpaGroupList *list, *g; const char *name =3D qdict_get_str(qdict, "name"); uint8_t type =3D qdict_get_try_int(qdict, "type", 9); diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index a5f6483cc3d2..be24aecc8ac8 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -117,8 +117,9 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) } } =20 -void hmp_info_pci(Monitor *mon, const QDict *qdict) +void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); PciInfoList *info_list, *info; =20 info_list =3D qmp_query_pci(&error_abort); @@ -170,8 +171,9 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev, i= nt indent) } } =20 -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) +void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *id =3D qdict_get_str(qdict, "id"); const char *error_name; diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index 3397d0c82ea8..a80e34175462 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -34,12 +34,13 @@ PciInfoList *qmp_query_pci(Error **errp) return NULL; } =20 -void hmp_info_pci(Monitor *mon, const QDict *qdict) +void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) { } =20 -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) +void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "PCI devices not supported\n"); } =20 diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 7dca67d6618c..d8afaf730639 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -104,8 +104,9 @@ static void write_keys(FILE *f, uint8_t *keys, uint64_t= startgfn, } } =20 -void hmp_info_skeys(Monitor *mon, const QDict *qdict) +void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); S390SKeysState *ss =3D s390_get_skeys_device(); S390SKeysClass *skeyclass =3D S390_SKEYS_GET_CLASS(ss); uint64_t addr =3D qdict_get_int(qdict, "addr"); @@ -134,7 +135,7 @@ void hmp_info_skeys(Monitor *mon, const QDict *qdict) monitor_printf(mon, " key: 0x%X\n", key); } =20 -void hmp_dump_skeys(Monitor *mon, const QDict *qdict) +void hmp_dump_skeys(MonitorHMP *hmp, const QDict *qdict) { const char *filename =3D qdict_get_str(qdict, "filename"); Error *err =3D NULL; diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index b0f04eb30c7f..b4a405455901 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -59,8 +59,9 @@ void s390_stattrib_init(void) =20 /* Console commands: */ =20 -void hmp_migrationmode(Monitor *mon, const QDict *qdict) +void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); S390StAttribState *sas =3D s390_get_stattrib_device(); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint64_t what =3D qdict_get_int(qdict, "mode"); @@ -74,8 +75,9 @@ void hmp_migrationmode(Monitor *mon, const QDict *qdict) } } =20 -void hmp_info_cmma(Monitor *mon, const QDict *qdict) +void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); S390StAttribState *sas =3D s390_get_stattrib_device(); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint64_t addr =3D qdict_get_int(qdict, "addr"); diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 3a24afd9417d..c97622b2aad6 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -256,8 +256,9 @@ FirmwareLog *qmp_query_firmware_log(bool have_max_size,= uint64_t max_size, return ret; } =20 -void hmp_info_firmware_log(Monitor *mon, const QDict *qdict) +void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); g_autofree gchar *log_esc =3D NULL; g_autofree guchar *log_out =3D NULL; Error *err =3D NULL; diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index af67d5dfeb10..c02343d3a655 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1920,8 +1920,9 @@ static void usb_host_auto_check(void *unused) timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 200= 0); } =20 -void hmp_info_usbhost(Monitor *mon, const QDict *qdict) +void hmp_info_usbhost(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); libusb_device **devs =3D NULL; struct libusb_device_descriptor ddesc; char port[16]; diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c index a91bb7dbeda5..49f3367785ba 100644 --- a/hw/virtio/virtio-hmp-cmds.c +++ b/hw/virtio/virtio-hmp-cmds.c @@ -80,8 +80,9 @@ static void hmp_virtio_dump_features(Monitor *mon, } } =20 -void hmp_virtio_query(Monitor *mon, const QDict *qdict) +void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; VirtioInfoList *list =3D qmp_x_query_virtio(&err); VirtioInfoList *node; @@ -105,8 +106,9 @@ void hmp_virtio_query(Monitor *mon, const QDict *qdict) qapi_free_VirtioInfoList(list); } =20 -void hmp_virtio_status(Monitor *mon, const QDict *qdict) +void hmp_virtio_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); VirtioStatus *s =3D qmp_x_query_virtio_status(path, &err); @@ -183,8 +185,9 @@ void hmp_virtio_status(Monitor *mon, const QDict *qdict) qapi_free_VirtioStatus(s); } =20 -void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict) +void hmp_vhost_queue_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -216,8 +219,9 @@ void hmp_vhost_queue_status(Monitor *mon, const QDict *= qdict) qapi_free_VirtVhostQueueStatus(s); } =20 -void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict) +void hmp_virtio_queue_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -261,8 +265,9 @@ void hmp_virtio_queue_status(Monitor *mon, const QDict = *qdict) qapi_free_VirtQueueStatus(s); } =20 -void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict) +void hmp_virtio_queue_element(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); diff --git a/include/block/block-hmp-cmds.h b/include/block/block-hmp-cmds.h index 71113cd7efa4..0f5908958f05 100644 --- a/include/block/block-hmp-cmds.h +++ b/include/block/block-hmp-cmds.h @@ -16,41 +16,42 @@ #define BLOCK_BLOCK_HMP_CMDS_H =20 #include "qemu/coroutine.h" +#include "monitor/hmp.h" =20 -void hmp_drive_add(Monitor *mon, const QDict *qdict); +void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_commit(Monitor *mon, const QDict *qdict); -void hmp_drive_del(Monitor *mon, const QDict *qdict); +void hmp_commit(MonitorHMP *hmp, const QDict *qdict); +void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_drive_mirror(Monitor *mon, const QDict *qdict); -void hmp_drive_backup(Monitor *mon, const QDict *qdict); +void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict); +void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); -void hmp_block_job_pause(Monitor *mon, const QDict *qdict); -void hmp_block_job_resume(Monitor *mon, const QDict *qdict); -void hmp_block_job_complete(Monitor *mon, const QDict *qdict); +void hmp_block_job_set_speed(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_cancel(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_pause(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_resume(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_complete(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict); -void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict); -void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict); +void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict); +void hmp_snapshot_blkdev_internal(MonitorHMP *hmp, const QDict *qdict); +void hmp_snapshot_delete_blkdev_internal(MonitorHMP *hmp, const QDict *qdi= ct); =20 -void hmp_nbd_server_start(Monitor *mon, const QDict *qdict); -void hmp_nbd_server_add(Monitor *mon, const QDict *qdict); -void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict); -void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); +void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict); +void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_nbd_server_remove(MonitorHMP *hmp, const QDict *qdict); +void hmp_nbd_server_stop(MonitorHMP *hmp, const QDict *qdict); =20 -void coroutine_fn hmp_block_resize(Monitor *mon, const QDict *qdict); -void hmp_block_stream(Monitor *mon, const QDict *qdict); -void hmp_block_passwd(Monitor *mon, const QDict *qdict); -void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); -void hmp_eject(Monitor *mon, const QDict *qdict); +void coroutine_fn hmp_block_resize(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_passwd(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict); +void hmp_eject(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_qemu_io(Monitor *mon, const QDict *qdict); +void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_info_block(Monitor *mon, const QDict *qdict); -void hmp_info_blockstats(Monitor *mon, const QDict *qdict); -void hmp_info_block_jobs(Monitor *mon, const QDict *qdict); -void hmp_info_snapshots(Monitor *mon, const QDict *qdict); +void hmp_info_block(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_blockstats(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_block_jobs(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_snapshots(MonitorHMP *hmp, const QDict *qdict); =20 #endif diff --git a/include/hw/usb/usb.h b/include/hw/usb/usb.h index 78e2ceedd7fd..cbd4711933e8 100644 --- a/include/hw/usb/usb.h +++ b/include/hw/usb/usb.h @@ -31,6 +31,7 @@ #include "qemu/queue.h" #include "qom/object.h" #include "qapi/error.h" +#include "monitor/hmp.h" =20 /* Constants related to the USB / PCI interaction */ #define USB_SBRN 0x60 /* Serial Bus Release Number Register */ @@ -466,7 +467,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream); void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p); =20 /* usb-linux.c */ -void hmp_info_usbhost(Monitor *mon, const QDict *qdict); +void hmp_info_usbhost(MonitorHMP *hmp, const QDict *qdict); =20 /* usb ports of the VM */ =20 diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 166cd4100c63..7a270ad3f25c 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -22,7 +22,7 @@ OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP); =20 #define HMP_STUB(cmd) \ - void hmp_##cmd(Monitor *mon, const QDict *qdict) \ + void hmp_##cmd(MonitorHMP *hmp, const QDict *qdict) \ { \ g_assert_not_reached(); \ } @@ -46,7 +46,7 @@ int monitor_hmp_read_password(MonitorHMP *hmp, ReadLineFu= nc *readline_func, void *opaque); =20 void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)); + void (*cmd)(MonitorHMP *mon, const QDict *qdict)= ); void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)); =20 @@ -58,58 +58,58 @@ bool hmp_handle_error(Monitor *mon, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); strList *hmp_split_at_comma(const char *str); =20 -void hmp_info_name(Monitor *mon, const QDict *qdict); -void hmp_info_version(Monitor *mon, const QDict *qdict); -void hmp_info_kvm(Monitor *mon, const QDict *qdict); -void hmp_info_accelerators(Monitor *mon, const QDict *qdict); -void hmp_info_status(Monitor *mon, const QDict *qdict); -void hmp_info_uuid(Monitor *mon, const QDict *qdict); -void hmp_info_chardev(Monitor *mon, const QDict *qdict); -void hmp_info_mice(Monitor *mon, const QDict *qdict); -void hmp_info_migrate(Monitor *mon, const QDict *qdict); -void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); -void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); -void hmp_info_cpus(Monitor *mon, const QDict *qdict); -void hmp_info_vnc(Monitor *mon, const QDict *qdict); -void hmp_info_spice(Monitor *mon, const QDict *qdict); -void hmp_info_balloon(Monitor *mon, const QDict *qdict); -void hmp_info_pci(Monitor *mon, const QDict *qdict); -void hmp_info_tpm(Monitor *mon, const QDict *qdict); -void hmp_info_iothreads(Monitor *mon, const QDict *qdict); -void hmp_quit(Monitor *mon, const QDict *qdict); -void hmp_stop(Monitor *mon, const QDict *qdict); -void hmp_sync_profile(Monitor *mon, const QDict *qdict); -void hmp_system_reset(Monitor *mon, const QDict *qdict); -void hmp_system_powerdown(Monitor *mon, const QDict *qdict); -void hmp_exit_preconfig(Monitor *mon, const QDict *qdict); -void hmp_announce_self(Monitor *mon, const QDict *qdict); -void hmp_cpu(Monitor *mon, const QDict *qdict); -void hmp_memsave(Monitor *mon, const QDict *qdict); -void hmp_pmemsave(Monitor *mon, const QDict *qdict); -void hmp_ringbuf_write(Monitor *mon, const QDict *qdict); -void hmp_ringbuf_read(Monitor *mon, const QDict *qdict); -void hmp_cont(Monitor *mon, const QDict *qdict); -void hmp_system_wakeup(Monitor *mon, const QDict *qdict); -void hmp_nmi(Monitor *mon, const QDict *qdict); -void hmp_info_network(Monitor *mon, const QDict *qdict); -void hmp_set_link(Monitor *mon, const QDict *qdict); -void hmp_balloon(Monitor *mon, const QDict *qdict); -void hmp_loadvm(Monitor *mon, const QDict *qdict); -void hmp_savevm(Monitor *mon, const QDict *qdict); -void hmp_delvm(Monitor *mon, const QDict *qdict); -void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); -void hmp_migrate_continue(Monitor *mon, const QDict *qdict); -void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); -void hmp_migrate_recover(Monitor *mon, const QDict *qdict); -void hmp_migrate_pause(Monitor *mon, const QDict *qdict); -void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict); -void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict); -void hmp_client_migrate_info(Monitor *mon, const QDict *qdict); -void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict); -void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict); -void hmp_set_password(Monitor *mon, const QDict *qdict); -void hmp_expire_password(Monitor *mon, const QDict *qdict); -void hmp_change(Monitor *mon, const QDict *qdict); +void hmp_info_name(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_version(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_accelerators(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_uuid(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_migrate(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_migrate_capabilities(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_spice(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_tpm(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict); +void hmp_quit(MonitorHMP *hmp, const QDict *qdict); +void hmp_stop(MonitorHMP *hmp, const QDict *qdict); +void hmp_sync_profile(MonitorHMP *hmp, const QDict *qdict); +void hmp_system_reset(MonitorHMP *hmp, const QDict *qdict); +void hmp_system_powerdown(MonitorHMP *hmp, const QDict *qdict); +void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict); +void hmp_announce_self(MonitorHMP *hmp, const QDict *qdict); +void hmp_cpu(MonitorHMP *hmp, const QDict *qdict); +void hmp_memsave(MonitorHMP *hmp, const QDict *qdict); +void hmp_pmemsave(MonitorHMP *hmp, const QDict *qdict); +void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdict); +void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict); +void hmp_cont(MonitorHMP *hmp, const QDict *qdict); +void hmp_system_wakeup(MonitorHMP *hmp, const QDict *qdict); +void hmp_nmi(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_network(MonitorHMP *hmp, const QDict *qdict); +void hmp_set_link(MonitorHMP *hmp, const QDict *qdict); +void hmp_balloon(MonitorHMP *hmp, const QDict *qdict); +void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict); +void hmp_savevm(MonitorHMP *hmp, const QDict *qdict); +void hmp_delvm(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict); +void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict); +void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict); +void hmp_set_password(MonitorHMP *hmp, const QDict *qdict); +void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict); +void hmp_change(MonitorHMP *hmp, const QDict *qdict); #ifdef CONFIG_VNC void hmp_change_vnc(Monitor *mon, const char *device, const char *target, const char *arg, const char *read_only, bool force, @@ -118,101 +118,101 @@ void hmp_change_vnc(Monitor *mon, const char *devic= e, const char *target, void hmp_change_medium(Monitor *mon, const char *device, const char *targe= t, const char *arg, const char *read_only, bool force, Error **errp); -void hmp_migrate(Monitor *mon, const QDict *qdict); -void hmp_device_add(Monitor *mon, const QDict *qdict); -void hmp_device_del(Monitor *mon, const QDict *qdict); -void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict); -void hmp_netdev_add(Monitor *mon, const QDict *qdict); -void hmp_netdev_del(Monitor *mon, const QDict *qdict); -void hmp_getfd(Monitor *mon, const QDict *qdict); -void hmp_closefd(Monitor *mon, const QDict *qdict); -void hmp_mouse_move(Monitor *mon, const QDict *qdict); -void hmp_mouse_button(Monitor *mon, const QDict *qdict); -void hmp_mouse_set(Monitor *mon, const QDict *qdict); -void hmp_sendkey(Monitor *mon, const QDict *qdict); -void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict); -void hmp_chardev_add(Monitor *mon, const QDict *qdict); -void hmp_chardev_change(Monitor *mon, const QDict *qdict); -void hmp_chardev_remove(Monitor *mon, const QDict *qdict); -void hmp_chardev_send_break(Monitor *mon, const QDict *qdict); -void hmp_object_add(Monitor *mon, const QDict *qdict); -void hmp_object_del(Monitor *mon, const QDict *qdict); -void hmp_info_memdev(Monitor *mon, const QDict *qdict); -void hmp_info_memory_devices(Monitor *mon, const QDict *qdict); -void hmp_qom_list(Monitor *mon, const QDict *qdict); -void hmp_qom_get(Monitor *mon, const QDict *qdict); -void hmp_qom_set(Monitor *mon, const QDict *qdict); -void hmp_info_qom_tree(Monitor *mon, const QDict *dict); -void hmp_virtio_query(Monitor *mon, const QDict *qdict); -void hmp_virtio_status(Monitor *mon, const QDict *qdict); -void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict); -void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict); -void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict); -void hmp_xen_event_inject(Monitor *mon, const QDict *qdict); -void hmp_xen_event_list(Monitor *mon, const QDict *qdict); -void hmp_rocker(Monitor *mon, const QDict *qdict); -void hmp_rocker_ports(Monitor *mon, const QDict *qdict); -void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict); -void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict); -void hmp_info_dump(Monitor *mon, const QDict *qdict); -void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); -void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); -void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); -void hmp_info_replay(Monitor *mon, const QDict *qdict); -void hmp_replay_break(Monitor *mon, const QDict *qdict); -void hmp_replay_delete_break(Monitor *mon, const QDict *qdict); -void hmp_replay_seek(Monitor *mon, const QDict *qdict); -void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict); -void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdict); -void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); -void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); -void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); +void hmp_migrate(MonitorHMP *hmp, const QDict *qdict); +void hmp_device_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_device_del(MonitorHMP *hmp, const QDict *qdict); +void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict); +void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict); +void hmp_getfd(MonitorHMP *hmp, const QDict *qdict); +void hmp_closefd(MonitorHMP *hmp, const QDict *qdict); +void hmp_mouse_move(MonitorHMP *hmp, const QDict *qdict); +void hmp_mouse_button(MonitorHMP *hmp, const QDict *qdict); +void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict); +void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict); +void coroutine_fn hmp_screendump(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_change(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_remove(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_send_break(MonitorHMP *hmp, const QDict *qdict); +void hmp_object_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_object_del(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict); +void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict); +void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict); +void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *dict); +void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict); +void hmp_virtio_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_virtio_queue_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_vhost_queue_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_virtio_queue_element(MonitorHMP *hmp, const QDict *qdict); +void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict); +void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_dump(MonitorHMP *hmp, const QDict *qdict); +void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_memory_size_summary(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict); +void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict); +void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict); +void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *qdict); +void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *qdict); +void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict); +void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict); void hmp_human_readable_text_helper(Monitor *mon, HumanReadableText *(*qmp_handler)(Erro= r **)); -void hmp_info_stats(Monitor *mon, const QDict *qdict); -void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict); -void hmp_watchdog_action(Monitor *mon, const QDict *qdict); -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict); -void hmp_info_capture(Monitor *mon, const QDict *qdict); -void hmp_stopcapture(Monitor *mon, const QDict *qdict); -void hmp_wavcapture(Monitor *mon, const QDict *qdict); -void hmp_trace_event(Monitor *mon, const QDict *qdict); -void hmp_trace_file(Monitor *mon, const QDict *qdict); -void hmp_info_trace_events(Monitor *mon, const QDict *qdict); -void hmp_help(Monitor *mon, const QDict *qdict); -void hmp_clear(Monitor *mon, const QDict *qdict); -void hmp_info_help(Monitor *mon, const QDict *qdict); -void hmp_info_sync_profile(Monitor *mon, const QDict *qdict); -void hmp_info_history(Monitor *mon, const QDict *qdict); -void hmp_logfile(Monitor *mon, const QDict *qdict); -void hmp_log(Monitor *mon, const QDict *qdict); -void hmp_gdbserver(Monitor *mon, const QDict *qdict); -void hmp_print(Monitor *mon, const QDict *qdict); -void hmp_sum(Monitor *mon, const QDict *qdict); -void hmp_ioport_read(Monitor *mon, const QDict *qdict); -void hmp_ioport_write(Monitor *mon, const QDict *qdict); -void hmp_boot_set(Monitor *mon, const QDict *qdict); -void hmp_info_mtree(Monitor *mon, const QDict *qdict); -void hmp_info_cryptodev(Monitor *mon, const QDict *qdict); -void hmp_dumpdtb(Monitor *mon, const QDict *qdict); -void hmp_info_firmware_log(Monitor *mon, const QDict *qdict); -void hmp_info_mem(Monitor *mon, const QDict *qdict); -void hmp_info_tlb(Monitor *mon, const QDict *qdict); -void hmp_mce(Monitor *mon, const QDict *qdict); -void hmp_info_local_apic(Monitor *mon, const QDict *qdict); -void hmp_info_sev(Monitor *mon, const QDict *qdict); -void hmp_info_sgx(Monitor *mon, const QDict *qdict); -void hmp_info_via(Monitor *mon, const QDict *qdict); -void hmp_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_info_registers(Monitor *mon, const QDict *qdict); -void hmp_gva2gpa(Monitor *mon, const QDict *qdict); -void hmp_gpa2hva(Monitor *mon, const QDict *qdict); -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict); +void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict); +void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qdict); +void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict); +void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_capture(MonitorHMP *hmp, const QDict *qdict); +void hmp_stopcapture(MonitorHMP *hmp, const QDict *qdict); +void hmp_wavcapture(MonitorHMP *hmp, const QDict *qdict); +void hmp_trace_event(MonitorHMP *hmp, const QDict *qdict); +void hmp_trace_file(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_trace_events(MonitorHMP *hmp, const QDict *qdict); +void hmp_help(MonitorHMP *hmp, const QDict *qdict); +void hmp_clear(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_help(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_sync_profile(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_history(MonitorHMP *hmp, const QDict *qdict); +void hmp_logfile(MonitorHMP *hmp, const QDict *qdict); +void hmp_log(MonitorHMP *hmp, const QDict *qdict); +void hmp_gdbserver(MonitorHMP *hmp, const QDict *qdict); +void hmp_print(MonitorHMP *hmp, const QDict *qdict); +void hmp_sum(MonitorHMP *hmp, const QDict *qdict); +void hmp_ioport_read(MonitorHMP *hmp, const QDict *qdict); +void hmp_ioport_write(MonitorHMP *hmp, const QDict *qdict); +void hmp_boot_set(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_cryptodev(MonitorHMP *hmp, const QDict *qdict); +void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict); +void hmp_mce(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_via(MonitorHMP *hmp, const QDict *qdict); +void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict); +void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict); +void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict); +void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict); +void hmp_gpa2hpa(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_dump_skeys(Monitor *mon, const QDict *qdict); -void hmp_info_skeys(Monitor *mon, const QDict *qdict); -void hmp_info_cmma(Monitor *mon, const QDict *qdict); -void hmp_migrationmode(Monitor *mon, const QDict *qdict); +void hmp_dump_skeys(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict); =20 #endif diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h index f85f25738d58..8f7e2f616cf3 100644 --- a/include/monitor/qdev.h +++ b/include/monitor/qdev.h @@ -2,11 +2,12 @@ #define MONITOR_QDEV_H =20 #include "hw/core/qdev.h" +#include "monitor/hmp.h" =20 /*** monitor commands ***/ =20 -void hmp_info_qtree(Monitor *mon, const QDict *qdict); -void hmp_info_qdm(Monitor *mon, const QDict *qdict); +void hmp_info_qtree(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_qdm(MonitorHMP *hmp, const QDict *qdict); void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp); =20 int qdev_device_help(QemuOpts *opts); diff --git a/include/net/net.h b/include/net/net.h index a7c49c543783..626b99794806 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -5,6 +5,7 @@ #include "qapi/qapi-types-net.h" #include "net/queue.h" #include "hw/core/qdev-properties-system.h" +#include "monitor/hmp.h" =20 #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X" #define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \ @@ -318,8 +319,8 @@ void net_init_clients(void); void net_check_clients(void); void net_client_set_link(NetClientState **ncs, int queues, bool up); void net_cleanup(void); -void hmp_host_net_add(Monitor *mon, const QDict *qdict); -void hmp_host_net_remove(Monitor *mon, const QDict *qdict); +void hmp_host_net_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_host_net_remove(MonitorHMP *hmp, const QDict *qdict); void netdev_add(QemuOpts *opts, Error **errp); =20 int net_hub_id_for_client(NetClientState *nc, int *id); diff --git a/include/net/slirp.h b/include/net/slirp.h index bad3e1e2416b..38859edf58ae 100644 --- a/include/net/slirp.h +++ b/include/net/slirp.h @@ -24,13 +24,13 @@ #ifndef QEMU_NET_SLIRP_H #define QEMU_NET_SLIRP_H =20 - #ifdef CONFIG_SLIRP +#include "monitor/hmp.h" =20 -void hmp_hostfwd_add(Monitor *mon, const QDict *qdict); -void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict); +void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict); +void hmp_info_usernet(MonitorHMP *hmp, const QDict *qdict); =20 #endif =20 diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index b360f49efeaf..567abab321cc 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -856,8 +856,9 @@ struct DirtyRateInfo *qmp_query_dirty_rate(bool has_cal= c_time_unit, has_calc_time_unit ? calc_time_unit : TIME_UNIT_SECOND); } =20 -void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict) +void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); DirtyRateInfo *info =3D query_dirty_rate_info(TIME_UNIT_SECOND); =20 monitor_printf(mon, "Status: %s\n", @@ -891,8 +892,9 @@ void hmp_info_dirty_rate(Monitor *mon, const QDict *qdi= ct) g_free(info); } =20 -void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdict) +void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t sec =3D qdict_get_try_int(qdict, "second", 0); int64_t sample_pages =3D qdict_get_try_int(qdict, "sample_pages_per_GB= ", -1); bool has_sample_pages =3D (sample_pages !=3D -1); diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index ad68fa23aa4b..8d2e8735277e 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -135,8 +135,9 @@ static void migration_dump_blocktime(Monitor *mon, Migr= ationInfo *info) } } =20 -void hmp_info_migrate(Monitor *mon, const QDict *qdict) +void hmp_info_migrate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool show_all =3D qdict_get_try_bool(qdict, "all", false); MigrationInfo *info; =20 @@ -297,8 +298,9 @@ out: qapi_free_MigrationInfo(info); } =20 -void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict) +void hmp_info_migrate_capabilities(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); MigrationCapabilityStatusList *caps, *cap; =20 caps =3D qmp_query_migrate_capabilities(NULL); @@ -326,8 +328,9 @@ static void monitor_print_cpr_exec_command(Monitor *mon= , strList *args) monitor_printf(mon, "\n"); } =20 -void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) +void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); MigrationParameters *params; MigrationState *s =3D migrate_get_current(); =20 @@ -473,8 +476,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) qapi_free_MigrationParameters(params); } =20 -void hmp_loadvm(Monitor *mon, const QDict *qdict) +void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RunState saved_state =3D runstate_get(); =20 const char *name =3D qdict_get_str(qdict, "name"); @@ -489,8 +493,9 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_savevm(Monitor *mon, const QDict *qdict) +void hmp_savevm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 save_snapshot(qdict_get_try_str(qdict, "name"), @@ -498,8 +503,9 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_delvm(Monitor *mon, const QDict *qdict) +void hmp_delvm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *name =3D qdict_get_str(qdict, "name"); =20 @@ -507,13 +513,14 @@ void hmp_delvm(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) +void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict) { qmp_migrate_cancel(NULL); } =20 -void hmp_migrate_continue(Monitor *mon, const QDict *qdict) +void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *state =3D qdict_get_str(qdict, "state"); int val =3D qapi_enum_parse(&MigrationStatus_lookup, state, -1, &err); @@ -525,8 +532,9 @@ void hmp_migrate_continue(Monitor *mon, const QDict *qd= ict) hmp_handle_error(mon, err); } =20 -void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) +void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); MigrationChannelList *caps =3D NULL; @@ -544,8 +552,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_migrate_recover(Monitor *mon, const QDict *qdict) +void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); =20 @@ -554,8 +563,9 @@ void hmp_migrate_recover(Monitor *mon, const QDict *qdi= ct) hmp_handle_error(mon, err); } =20 -void hmp_migrate_pause(Monitor *mon, const QDict *qdict) +void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_migrate_pause(&err); @@ -564,8 +574,9 @@ void hmp_migrate_pause(Monitor *mon, const QDict *qdict) } =20 =20 -void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) +void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *cap =3D qdict_get_str(qdict, "capability"); bool state =3D qdict_get_bool(qdict, "state"); Error *err =3D NULL; @@ -589,8 +600,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) +void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); @@ -790,16 +802,18 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict) +void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; qmp_migrate_start_postcopy(&err); hmp_handle_error(mon, err); } =20 #ifdef CONFIG_REPLICATION -void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict) +void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_colo_lost_heartbeat(&err); @@ -833,8 +847,9 @@ static void hmp_migrate_status_cb(void *opaque) qapi_free_MigrationInfo(info); } =20 -void hmp_migrate(Monitor *mon, const QDict *qdict) +void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool detach =3D qdict_get_try_bool(qdict, "detach", false); bool resume =3D qdict_get_try_bool(qdict, "resume", false); const char *uri =3D qdict_get_str(qdict, "uri"); @@ -873,7 +888,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) =20 if (!detach) { HMPMigrationStatus *status; - MonitorHMP *hmp =3D MONITOR_HMP(mon); =20 if (!hmp->use_readline) { monitor_printf(mon, "terminal does not allow synchronous " diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 6718fec97047..afe4817b4056 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -103,8 +103,9 @@ strList *hmp_split_at_comma(const char *str) return res; } =20 -void hmp_info_name(Monitor *mon, const QDict *qdict) +void hmp_info_name(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); NameInfo *info; =20 info =3D qmp_query_name(NULL); @@ -114,8 +115,9 @@ void hmp_info_name(Monitor *mon, const QDict *qdict) qapi_free_NameInfo(info); } =20 -void hmp_info_version(Monitor *mon, const QDict *qdict) +void hmp_info_version(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); VersionInfo *info; =20 info =3D qmp_query_version(NULL); @@ -127,22 +129,23 @@ void hmp_info_version(Monitor *mon, const QDict *qdic= t) qapi_free_VersionInfo(info); } =20 -void hmp_quit(Monitor *mon, const QDict *qdict) +void hmp_quit(MonitorHMP *hmp, const QDict *qdict) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); + Monitor *mon =3D MONITOR(hmp); if (hmp->use_readline) { monitor_suspend(mon); } qmp_quit(NULL); } =20 -void hmp_stop(Monitor *mon, const QDict *qdict) +void hmp_stop(MonitorHMP *hmp, const QDict *qdict) { qmp_stop(NULL); } =20 -void hmp_sync_profile(Monitor *mon, const QDict *qdict) +void hmp_sync_profile(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *op =3D qdict_get_try_str(qdict, "op"); =20 if (op =3D=3D NULL) { @@ -166,16 +169,18 @@ void hmp_sync_profile(Monitor *mon, const QDict *qdic= t) } } =20 -void hmp_exit_preconfig(Monitor *mon, const QDict *qdict) +void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_exit_preconfig(&err); hmp_handle_error(mon, err); } =20 -void hmp_cpu(Monitor *mon, const QDict *qdict) +void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t cpu_index; =20 /* XXX: drop the monitor_set_cpu() usage when all HMP commands that @@ -186,16 +191,18 @@ void hmp_cpu(Monitor *mon, const QDict *qdict) } } =20 -void hmp_cont(Monitor *mon, const QDict *qdict) +void hmp_cont(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_cont(&err); hmp_handle_error(mon, err); } =20 -void hmp_change(Monitor *mon, const QDict *qdict) +void hmp_change(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *target =3D qdict_get_str(qdict, "target"); const char *arg =3D qdict_get_try_str(qdict, "arg"); @@ -216,8 +223,9 @@ void hmp_change(Monitor *mon, const QDict *qdict) } =20 #ifdef CONFIG_POSIX -void hmp_getfd(Monitor *mon, const QDict *qdict) +void hmp_getfd(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 @@ -226,8 +234,9 @@ void hmp_getfd(Monitor *mon, const QDict *qdict) } #endif =20 -void hmp_closefd(Monitor *mon, const QDict *qdict) +void hmp_closefd(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 @@ -235,8 +244,9 @@ void hmp_closefd(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_iothreads(Monitor *mon, const QDict *qdict) +void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); IOThreadInfoList *info_list =3D qmp_query_iothreads(NULL); IOThreadInfoList *info; IOThreadInfo *value; @@ -256,13 +266,15 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qd= ict) qapi_free_IOThreadInfoList(info_list); } =20 -void hmp_help(Monitor *mon, const QDict *qdict) +void hmp_help(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hmp_help_cmd(mon, qdict_get_try_str(qdict, "name")); } =20 -void hmp_clear(Monitor *mon, const QDict *qdict) +void hmp_clear(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); /* * Send an ANSI escape sequence: * "\x1b[H" - move cursor to top-left @@ -272,12 +284,13 @@ void hmp_clear(Monitor *mon, const QDict *qdict) monitor_printf(mon, "\x1b[H\x1b[2J\x1b[3J"); } =20 -void hmp_info_help(Monitor *mon, const QDict *qdict) +void hmp_info_help(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hmp_help_cmd(mon, "info"); } =20 -void hmp_info_sync_profile(Monitor *mon, const QDict *qdict) +void hmp_info_sync_profile(MonitorHMP *hmp, const QDict *qdict) { int64_t max =3D qdict_get_try_int(qdict, "max", 10); bool mean =3D qdict_get_try_bool(qdict, "mean", false); @@ -288,9 +301,9 @@ void hmp_info_sync_profile(Monitor *mon, const QDict *q= dict) qsp_report(max, sort_by, coalesce); } =20 -void hmp_info_history(Monitor *mon, const QDict *qdict) +void hmp_info_history(MonitorHMP *hmp, const QDict *qdict) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); + Monitor *mon =3D MONITOR(hmp); int i; const char *str; =20 @@ -308,7 +321,7 @@ void hmp_info_history(Monitor *mon, const QDict *qdict) } } =20 -void hmp_logfile(Monitor *mon, const QDict *qdict) +void hmp_logfile(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; =20 @@ -317,8 +330,9 @@ void hmp_logfile(Monitor *mon, const QDict *qdict) } } =20 -void hmp_log(Monitor *mon, const QDict *qdict) +void hmp_log(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int mask; const char *items =3D qdict_get_str(qdict, "items"); Error *err =3D NULL; @@ -338,8 +352,9 @@ void hmp_log(Monitor *mon, const QDict *qdict) } } =20 -void hmp_gdbserver(Monitor *mon, const QDict *qdict) +void hmp_gdbserver(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *device =3D qdict_get_try_str(qdict, "device"); =20 @@ -357,8 +372,9 @@ void hmp_gdbserver(Monitor *mon, const QDict *qdict) } } =20 -void hmp_print(Monitor *mon, const QDict *qdict) +void hmp_print(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int format =3D qdict_get_int(qdict, "format"); hwaddr val =3D qdict_get_int(qdict, "val"); =20 @@ -383,8 +399,9 @@ void hmp_print(Monitor *mon, const QDict *qdict) monitor_printf(mon, "\n"); } =20 -void hmp_sum(Monitor *mon, const QDict *qdict) +void hmp_sum(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t addr; uint16_t sum; uint32_t start =3D qdict_get_int(qdict, "start"); @@ -401,8 +418,9 @@ void hmp_sum(Monitor *mon, const QDict *qdict) monitor_printf(mon, "%05d\n", sum); } =20 -void hmp_ioport_read(Monitor *mon, const QDict *qdict) +void hmp_ioport_read(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int size =3D qdict_get_int(qdict, "size"); int addr =3D qdict_get_int(qdict, "addr"); int has_index =3D qdict_haskey(qdict, "index"); @@ -435,7 +453,7 @@ void hmp_ioport_read(Monitor *mon, const QDict *qdict) suffix, addr, size * 2, val); } =20 -void hmp_ioport_write(Monitor *mon, const QDict *qdict) +void hmp_ioport_write(MonitorHMP *hmp, const QDict *qdict) { int size =3D qdict_get_int(qdict, "size"); int addr =3D qdict_get_int(qdict, "addr"); @@ -457,8 +475,9 @@ void hmp_ioport_write(Monitor *mon, const QDict *qdict) } } =20 -void hmp_boot_set(Monitor *mon, const QDict *qdict) +void hmp_boot_set(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; const char *bootdevice =3D qdict_get_str(qdict, "bootdevice"); =20 @@ -470,7 +489,7 @@ void hmp_boot_set(Monitor *mon, const QDict *qdict) } } =20 -void hmp_info_mtree(Monitor *mon, const QDict *qdict) +void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdict) { bool flatview =3D qdict_get_try_bool(qdict, "flatview", false); bool dispatch_tree =3D qdict_get_try_bool(qdict, "dispatch_tree", fals= e); @@ -481,8 +500,9 @@ void hmp_info_mtree(Monitor *mon, const QDict *qdict) } =20 #if defined(CONFIG_FDT) -void hmp_dumpdtb(Monitor *mon, const QDict *qdict) +void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); Error *local_err =3D NULL; =20 @@ -558,8 +578,9 @@ int monitor_get_cpu_index(Monitor *mon) return cs ? cs->cpu_index : UNASSIGNED_CPU_INDEX; } =20 -void hmp_info_registers(Monitor *mon, const QDict *qdict) +void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool all_cpus =3D qdict_get_try_bool(qdict, "cpustate_all", false); int vcpu =3D qdict_get_try_int(qdict, "vcpu", -1); CPUState *cs; @@ -694,8 +715,9 @@ static void memory_dump(Monitor *mon, int count, int fo= rmat, int wsize, } } =20 -void hmp_memory_dump(Monitor *mon, const QDict *qdict) +void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); @@ -704,8 +726,9 @@ void hmp_memory_dump(Monitor *mon, const QDict *qdict) memory_dump(mon, count, format, size, addr, false); } =20 -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict) +void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); @@ -714,8 +737,9 @@ void hmp_physical_memory_dump(Monitor *mon, const QDict= *qdict) memory_dump(mon, count, format, size, addr, true); } =20 -void hmp_gpa2hva(Monitor *mon, const QDict *qdict) +void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hwaddr addr =3D qdict_get_int(qdict, "addr"); Error *local_err =3D NULL; MemoryRegion *mr =3D NULL; @@ -734,8 +758,9 @@ void hmp_gpa2hva(Monitor *mon, const QDict *qdict) memory_region_unref(mr); } =20 -void hmp_gva2gpa(Monitor *mon, const QDict *qdict) +void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); vaddr addr =3D qdict_get_int(qdict, "addr"); CPUState *cs =3D mon_get_cpu(mon); TranslateForDebugResult tres; @@ -787,8 +812,9 @@ out: return ret; } =20 -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict) +void hmp_gpa2hpa(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hwaddr addr =3D qdict_get_int(qdict, "addr"); Error *local_err =3D NULL; MemoryRegion *mr =3D NULL; diff --git a/monitor/hmp.c b/monitor/hmp.c index b4d05d47c4bf..6e6334b64685 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1228,12 +1228,12 @@ static void hmp_info_human_readable_text(Monitor *m= on, monitor_puts(mon, info->human_readable_text); } =20 -static void handle_hmp_command_exec(Monitor *mon, +static void handle_hmp_command_exec(MonitorHMP *mon, const HMPCommand *cmd, QDict *qdict) { if (cmd->cmd_info_hrt) { - hmp_info_human_readable_text(mon, + hmp_info_human_readable_text(MONITOR(mon), cmd->cmd_info_hrt); } else { cmd->cmd(mon, qdict); @@ -1241,7 +1241,7 @@ static void handle_hmp_command_exec(Monitor *mon, } =20 typedef struct HandleHmpCommandCo { - Monitor *mon; + MonitorHMP *mon; const HMPCommand *cmd; QDict *qdict; bool done; @@ -1289,19 +1289,18 @@ void handle_hmp_command(MonitorHMP *hmp, const char= *cmdline) =20 if (!cmd->coroutine) { /* old_mon is non-NULL when called from qmp_human_monitor_command(= ) */ - Monitor *old_mon =3D monitor_set_cur(qemu_coroutine_self(), - &hmp->parent_obj); - handle_hmp_command_exec(&hmp->parent_obj, cmd, qdict); + Monitor *old_mon =3D monitor_set_cur(qemu_coroutine_self(), MONITO= R(hmp)); + handle_hmp_command_exec(hmp, cmd, qdict); monitor_set_cur(qemu_coroutine_self(), old_mon); } else { HandleHmpCommandCo data =3D { - .mon =3D &hmp->parent_obj, + .mon =3D hmp, .cmd =3D cmd, .qdict =3D qdict, .done =3D false, }; Coroutine *co =3D qemu_coroutine_create(handle_hmp_command_co, &da= ta); - monitor_set_cur(co, &hmp->parent_obj); + monitor_set_cur(co, MONITOR(hmp)); aio_co_enter(qemu_get_aio_context(), co); AIO_WAIT_WHILE_UNLOCKED(NULL, !data.done); } @@ -1689,7 +1688,7 @@ int hmp_compare_cmd(const char *name, const char *lis= t) } =20 void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)) + void (*cmd)(MonitorHMP *mon, const QDict *qdict)) { HMPCommand *table =3D hmp_cmds_for_target(info); =20 diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index ee9ba0c8231e..a0fa37c887ed 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -77,7 +77,7 @@ typedef struct HMPCommand { const char *params; const char *help; const char *flags; /* p=3Dpreconfig */ - void (*cmd)(Monitor *mon, const QDict *qdict); + void (*cmd)(MonitorHMP *mon, const QDict *qdict); /* * If implementing a command that takes no arguments and simply * prints formatted data, then leave @cmd NULL, and then set diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 52ac8da770d9..702103b6a920 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -45,8 +45,9 @@ static void hmp_print_client_info(Monitor *mon, NetworkCl= ientInfo *ci) } } =20 -void hmp_info_network(Monitor *mon, const QDict *qdict) +void hmp_info_network(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; g_autoptr(NetworkInfo) info =3D qmp_x_query_network(&err); NetHubInfoList *h; @@ -83,8 +84,9 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) } } =20 -void hmp_set_link(Monitor *mon, const QDict *qdict) +void hmp_set_link(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool up =3D qdict_get_bool(qdict, "up"); Error *err =3D NULL; @@ -94,7 +96,7 @@ void hmp_set_link(Monitor *mon, const QDict *qdict) } =20 =20 -void hmp_announce_self(Monitor *mon, const QDict *qdict) +void hmp_announce_self(MonitorHMP *hmp, const QDict *qdict) { const char *interfaces_str =3D qdict_get_try_str(qdict, "interfaces"); const char *id =3D qdict_get_try_str(qdict, "id"); @@ -109,8 +111,9 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict) qapi_free_AnnounceParameters(params); } =20 -void hmp_netdev_add(Monitor *mon, const QDict *qdict) +void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; const char *type =3D qdict_get_try_str(qdict, "type"); @@ -133,8 +136,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_netdev_del(Monitor *mon, const QDict *qdict) +void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 diff --git a/net/slirp.c b/net/slirp.c index 9bf09a2c8bc9..d5c190b48b76 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -733,8 +733,9 @@ static SlirpState *slirp_lookup(Monitor *mon, const cha= r *id) } } =20 -void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict) +void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); /* TODO: support removing unix fwd */ struct sockaddr_in host_addr =3D { .sin_family =3D AF_INET, @@ -957,8 +958,9 @@ static int slirp_hostfwd(SlirpState *s, const char *red= ir_str, Error **errp) return -1; } =20 -void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) +void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *redir_str; SlirpState *s; const char *arg1 =3D qdict_get_str(qdict, "arg1"); @@ -1224,8 +1226,9 @@ UsernetInfoList *qmp_x_query_usernet(Error **errp) return head; } =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict) +void hmp_info_usernet(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); g_autoptr(UsernetInfoList) list =3D NULL; UsernetInfoList *entry; =20 diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index 47110ca58c0d..16847d1ce261 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -18,8 +18,9 @@ #include "qom/object.h" #include "qom/object_interfaces.h" =20 -void hmp_qom_list(Monitor *mon, const QDict *qdict) +void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_try_str(qdict, "path"); ObjectPropertyInfoList *list; Error *err =3D NULL; @@ -44,8 +45,9 @@ void hmp_qom_list(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_qom_set(Monitor *mon, const QDict *qdict) +void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const bool json =3D qdict_get_try_bool(qdict, "json", false); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); @@ -72,8 +74,9 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_qom_get(Monitor *mon, const QDict *qdict) +void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); Error *err =3D NULL; @@ -132,8 +135,9 @@ static void print_qom_composition(Monitor *mon, Object = *obj, int indent) g_array_free(children, TRUE); } =20 -void hmp_info_qom_tree(Monitor *mon, const QDict *dict) +void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *dict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_try_str(dict, "path"); Object *obj; bool ambiguous =3D false; @@ -154,8 +158,9 @@ void hmp_info_qom_tree(Monitor *mon, const QDict *dict) print_qom_composition(mon, obj, 0); } =20 -void hmp_object_add(Monitor *mon, const QDict *qdict) +void hmp_object_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *options =3D qdict_get_str(qdict, "object"); Error *err =3D NULL; =20 @@ -163,8 +168,9 @@ void hmp_object_add(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_object_del(Monitor *mon, const QDict *qdict) +void hmp_object_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index 7b904a141654..ef69d23ff507 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -31,8 +31,9 @@ bool replay_running_debug(void) return replay_is_debugging; } =20 -void hmp_info_replay(Monitor *mon, const QDict *qdict) +void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); if (replay_mode =3D=3D REPLAY_MODE_NONE) { monitor_printf(mon, "Record/replay is not active\n"); } else { @@ -103,7 +104,7 @@ void qmp_replay_break(int64_t icount, Error **errp) } } =20 -void hmp_replay_break(Monitor *mon, const QDict *qdict) +void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); Error *err =3D NULL; @@ -124,7 +125,7 @@ void qmp_replay_delete_break(Error **errp) } } =20 -void hmp_replay_delete_break(Monitor *mon, const QDict *qdict) +void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; =20 @@ -209,7 +210,7 @@ void qmp_replay_seek(int64_t icount, Error **errp) replay_seek(icount, replay_stop_vm, errp); } =20 -void hmp_replay_seek(Monitor *mon, const QDict *qdict) +void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); Error *err =3D NULL; diff --git a/replay/stubs-system.c b/replay/stubs-system.c index f8e17dcf1ce9..15e7411591ab 100644 --- a/replay/stubs-system.c +++ b/replay/stubs-system.c @@ -63,19 +63,19 @@ void replay_vmstate_init(void) #include "qapi/error.h" #include "qemu/error-report.h" =20 -void hmp_info_replay(Monitor *mon, const QDict *qdict) +void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } -void hmp_replay_break(Monitor *mon, const QDict *qdict) +void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } -void hmp_replay_delete_break(Monitor *mon, const QDict *qdict) +void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } -void hmp_replay_seek(Monitor *mon, const QDict *qdict) +void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index b93b471b1b25..f280ad8c4314 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -187,8 +187,9 @@ static StatsFilter *stats_filter(StatsTarget target, co= nst char *names, return filter; } =20 -void hmp_info_stats(Monitor *mon, const QDict *qdict) +void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *target_str =3D qdict_get_str(qdict, "target"); const char *provider_str =3D qdict_get_try_str(qdict, "provider"); const char *names =3D qdict_get_try_str(qdict, "names"); diff --git a/stubs/hmp-cmd-info_sev.c b/stubs/hmp-cmd-info_sev.c index f3624423a334..6f2b87d1ad10 100644 --- a/stubs/hmp-cmd-info_sev.c +++ b/stubs/hmp-cmd-info_sev.c @@ -10,7 +10,8 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 -void hmp_info_sev(Monitor *mon, const QDict *qdict) +void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "SEV is not available in this QEMU\n"); } diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c index 4928d57cc8e3..4c100783778f 100644 --- a/system/dirtylimit-hmp-cmds.c +++ b/system/dirtylimit-hmp-cmds.c @@ -15,8 +15,9 @@ #include "monitor/monitor.h" #include "system/dirtylimit.h" =20 -void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) +void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; =20 @@ -30,8 +31,9 @@ void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDic= t *qdict) "dirty limit for virtual CPU]\n"); } =20 -void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) +void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t dirty_rate =3D qdict_get_int(qdict, "dirty_rate"); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; @@ -47,8 +49,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) +void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); DirtyLimitInfoList *info; g_autoptr(DirtyLimitInfoList) head =3D NULL; Error *err =3D NULL; diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 00fed791cce1..e27b9724867a 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -851,8 +851,9 @@ static void qbus_print(Monitor *mon, BusState *bus, int= indent, bool details) } #undef qdev_printf =20 -void hmp_info_qtree(Monitor *mon, const QDict *qdict) +void hmp_info_qtree(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool details =3D !qdict_get_try_bool(qdict, "brief", false); =20 if (sysbus_get_default()) { @@ -860,7 +861,7 @@ void hmp_info_qtree(Monitor *mon, const QDict *qdict) } } =20 -void hmp_info_qdm(Monitor *mon, const QDict *qdict) +void hmp_info_qdm(MonitorHMP *hmp, const QDict *qdict) { qdev_print_devinfos(true); } @@ -1001,8 +1002,9 @@ void qmp_device_sync_config(const char *id, Error **e= rrp) qdev_sync_config(dev, errp); } =20 -void hmp_device_add(Monitor *mon, const QDict *qdict) +void hmp_device_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; DeviceState *dev; @@ -1035,8 +1037,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_device_del(Monitor *mon, const QDict *qdict) +void hmp_device_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 diff --git a/system/runstate-hmp-cmds.c b/system/runstate-hmp-cmds.c index 02d1d42bf392..834b95835339 100644 --- a/system/runstate-hmp-cmds.c +++ b/system/runstate-hmp-cmds.c @@ -23,8 +23,9 @@ #include "qobject/qdict.h" #include "qemu/accel.h" =20 -void hmp_info_status(Monitor *mon, const QDict *qdict) +void hmp_info_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); StatusInfo *info; =20 info =3D qmp_query_status(NULL); @@ -41,8 +42,9 @@ void hmp_info_status(Monitor *mon, const QDict *qdict) qapi_free_StatusInfo(info); } =20 -void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) +void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *option =3D qdict_get_try_str(qdict, "option"); AccelState *accel =3D current_accel(); bool newval; @@ -66,8 +68,9 @@ void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) newval, &error_abort); } =20 -void hmp_watchdog_action(Monitor *mon, const QDict *qdict) +void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; WatchdogAction action; char *qapi_value; diff --git a/system/tpm-hmp-cmds.c b/system/tpm-hmp-cmds.c index 9ed6ad6c4d46..094c3f16cf50 100644 --- a/system/tpm-hmp-cmds.c +++ b/system/tpm-hmp-cmds.c @@ -11,8 +11,9 @@ #include "monitor/hmp.h" #include "qapi/error.h" =20 -void hmp_info_tpm(Monitor *mon, const QDict *qdict) +void hmp_info_tpm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); #ifdef CONFIG_TPM TPMInfoList *info_list, *info; Error *err =3D NULL; diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 04b7257ad120..2cb3147837d1 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -80,8 +80,9 @@ void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) } } =20 -void hmp_info_local_apic(Monitor *mon, const QDict *qdict) +void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUState *cs; =20 if (qdict_haskey(qdict, "apic-id")) { diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 9ed772e6d7f2..f1d2a327ddad 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -209,8 +209,9 @@ static void tlb_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) } #endif /* TARGET_X86_64 */ =20 -void hmp_info_tlb(Monitor *mon, const QDict *qdict) +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env; AddressSpace *as; =20 @@ -535,8 +536,9 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) } #endif /* TARGET_X86_64 */ =20 -void hmp_info_mem(Monitor *mon, const QDict *qdict) +void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env; AddressSpace *as; =20 @@ -569,8 +571,9 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict) } } =20 -void hmp_mce(Monitor *mon, const QDict *qdict) +void hmp_mce(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); X86CPU *cpu; CPUState *cs; int cpu_index =3D qdict_get_int(qdict, "cpu_index"); diff --git a/target/i386/sev.c b/target/i386/sev.c index d7dcefc8ecf5..4473d02981ff 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -754,8 +754,9 @@ SevInfo *qmp_query_sev(Error **errp) return info; } =20 -void hmp_info_sev(Monitor *mon, const QDict *qdict) +void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); SevInfo *info =3D sev_get_info(); =20 if (!info || !info->enabled) { diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 3e0df40a6b8b..0414474f2ffb 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -10,8 +10,9 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 -void hmp_info_tlb(Monitor *mon, const QDict *qdict) +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D mon_get_cpu_env(mon); =20 if (!env1) { diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 7c88e0e2bda0..99eda7351877 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -11,8 +11,9 @@ #include "monitor/hmp.h" #include "cpu.h" =20 -void hmp_info_tlb(Monitor *mon, const QDict *qdict) +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D mon_get_cpu_env(mon); =20 if (!env1) { diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index f8042db9cdf3..496d519c978d 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -215,8 +215,9 @@ static void mem_info_svxx(Monitor *mon, CPUArchState *e= nv) last_paddr + last_size - pbase, last_attr); } =20 -void hmp_info_mem(Monitor *mon, const QDict *qdict) +void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env; =20 env =3D mon_get_cpu_env(mon); diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 50324d3600c4..50da650b2e04 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -38,8 +38,9 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) tlb->d, tlb->wt); } =20 -void hmp_info_tlb(Monitor *mon, const QDict *qdict) +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env =3D mon_get_cpu_env(mon); int i; =20 diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 36f3d8d58e9d..09a15b821a1a 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -27,8 +27,9 @@ #include "monitor/hmp.h" =20 =20 -void hmp_info_tlb(Monitor *mon, const QDict *qdict) +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D mon_get_cpu_env(mon); =20 if (!env1) { diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index 2af84934f83d..a1082c44e11c 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -26,8 +26,9 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 -void hmp_info_tlb(Monitor *mon, const QDict *qdict) +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D mon_get_cpu_env(mon); =20 if (!env1) { diff --git a/trace/trace-hmp-cmds.c b/trace/trace-hmp-cmds.c index c8f0133abecf..5a8158f4f4b6 100644 --- a/trace/trace-hmp-cmds.c +++ b/trace/trace-hmp-cmds.c @@ -33,7 +33,7 @@ #include "trace/simple.h" #endif =20 -void hmp_trace_event(Monitor *mon, const QDict *qdict) +void hmp_trace_event(MonitorHMP *hmp, const QDict *qdict) { const char *tp_name =3D qdict_get_str(qdict, "name"); bool new_state =3D qdict_get_bool(qdict, "option"); @@ -47,8 +47,9 @@ void hmp_trace_event(Monitor *mon, const QDict *qdict) } =20 #ifdef CONFIG_TRACE_SIMPLE -void hmp_trace_file(Monitor *mon, const QDict *qdict) +void hmp_trace_file(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *op =3D qdict_get_try_str(qdict, "op"); const char *arg =3D qdict_get_try_str(qdict, "arg"); =20 @@ -71,8 +72,9 @@ void hmp_trace_file(Monitor *mon, const QDict *qdict) } #endif =20 -void hmp_info_trace_events(Monitor *mon, const QDict *qdict) +void hmp_info_trace_events(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_try_str(qdict, "name"); TraceEventInfoList *events; TraceEventInfoList *elem; diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 4ef459490ba2..5f3522943c56 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -29,7 +29,7 @@ =20 static int mouse_button_state; =20 -void hmp_mouse_move(Monitor *mon, const QDict *qdict) +void hmp_mouse_move(MonitorHMP *hmp, const QDict *qdict) { int dx, dy, dz, button; const char *dx_str =3D qdict_get_str(qdict, "dx_str"); @@ -53,7 +53,7 @@ void hmp_mouse_move(Monitor *mon, const QDict *qdict) qemu_input_event_sync(); } =20 -void hmp_mouse_button(Monitor *mon, const QDict *qdict) +void hmp_mouse_button(MonitorHMP *hmp, const QDict *qdict) { /* HMP mouse_button bitmask: 1=3DL, 2=3DR, 4=3DM */ static uint32_t bmap[INPUT_BUTTON__MAX] =3D { @@ -71,16 +71,18 @@ void hmp_mouse_button(Monitor *mon, const QDict *qdict) mouse_button_state =3D button_state; } =20 -void hmp_mouse_set(Monitor *mon, const QDict *qdict) +void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qemu_mouse_set(qdict_get_int(qdict, "index"), &err); hmp_handle_error(mon, err); } =20 -void hmp_info_mice(Monitor *mon, const QDict *qdict) +void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); MouseInfoList *mice_list, *mouse; =20 mice_list =3D qmp_query_mice(NULL); @@ -148,8 +150,9 @@ static void hmp_info_vnc_servers(Monitor *mon, VncServe= rInfo2List *server) } } =20 -void hmp_info_vnc(Monitor *mon, const QDict *qdict) +void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); VncInfo2List *info2l, *info2l_head; Error *err =3D NULL; =20 @@ -189,8 +192,9 @@ void hmp_info_vnc(Monitor *mon, const QDict *qdict) #endif =20 #ifdef CONFIG_SPICE -void hmp_info_spice(Monitor *mon, const QDict *qdict) +void hmp_info_spice(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); SpiceChannelList *chan; SpiceInfo *info; const char *channel_name; @@ -260,8 +264,9 @@ out: } #endif =20 -void hmp_set_password(Monitor *mon, const QDict *qdict) +void hmp_set_password(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *password =3D qdict_get_str(qdict, "password"); const char *display =3D qdict_get_try_str(qdict, "display"); @@ -295,8 +300,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_expire_password(Monitor *mon, const QDict *qdict) +void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *whenstr =3D qdict_get_str(qdict, "time"); const char *display =3D qdict_get_try_str(qdict, "display"); @@ -366,8 +372,9 @@ static int index_from_key(const char *key, size_t key_l= ength) return i; } =20 -void hmp_sendkey(Monitor *mon, const QDict *qdict) +void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *keys =3D qdict_get_str(qdict, "keys"); KeyValue *v =3D NULL; KeyValueList *head =3D NULL, **tail =3D &head; @@ -456,8 +463,9 @@ void sendkey_completion(ReadLineState *rs, int nb_args,= const char *str) =20 #ifdef CONFIG_PIXMAN void coroutine_fn -hmp_screendump(Monitor *mon, const QDict *qdict) +hmp_screendump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); const char *id =3D qdict_get_try_str(qdict, "device"); int64_t head =3D qdict_get_try_int(qdict, "head", 0); @@ -478,8 +486,9 @@ end: } #endif =20 -void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) +void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *hostname =3D qdict_get_str(qdict, "hostname"); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907752; cv=none; d=zohomail.com; s=zohoarc; b=cqvbD79ECvZRq4A3Gimd9dODD+hqRMjUP4qvjwKnZBt7+izL+4p8HgDQhq0LUF2Un1Z03t+zyxMII+/eqgMaKWk07QPJMmNrJ9UYlsSLuGBKGGqLeiMZNZ9AkUog7UQE+l9QRrVNPade31ceNYcKv7kmapRVgFtf397aOeXWUy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907752; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EHX3WiPkh26mDzR0mCzMtdWQSfICNfYUpElQ5OUUU9U=; b=bGS0aH/XfLc3sejhzCfubxQZBL88/fIpJIQbwFkWyvlIPrYVvUQ4ofveG37lhZu1zATDf/tXh88nocj5y/bub8ZDYfWsrEViTKQ0w1+w4YZwITo1WZpPORCFCHM6muoUbaL20M8Owb1csj88i4dQUgXUV85gQjtXRQgOanQLVrc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907752297569.0826284463487; Sun, 16 Aug 2026 12:15:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKB-0006Ju-It; Sun, 16 Aug 2026 15:15:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgK8-00067J-Nm for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgK2-00083l-4r for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:12 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-rP9V1gptPJGN0t63mPIP4A-1; Sun, 16 Aug 2026 15:15:01 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 849371800990; Sun, 16 Aug 2026 19:14:59 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B8C341800347; Sun, 16 Aug 2026 19:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907705; 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=EHX3WiPkh26mDzR0mCzMtdWQSfICNfYUpElQ5OUUU9U=; b=Q4HpG86JK66YQv2RFopd0qqCj09qm/AP+JIbU9aL9z1orkzU1EvCu5ybibm8HZ2qktl3PK nklF0iYClO5jFO1vyR+1YsAI29OiHiC1YotaSvnIZb0rXugARPhoQ5VaLC7m5Y6Q2sxU1b slP03x53nQzoKqSH42TTnRNAr+O2aMM= X-MC-Unique: rP9V1gptPJGN0t63mPIP4A-1 X-Mimecast-MFC-AGG-ID: rP9V1gptPJGN0t63mPIP4A_1786907699 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:12:59 +0400 Subject: [PATCH v3 32/49] monitor: make hmp_handle_error() take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-32-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , David Woodhouse , Paul Durrant , Richard Henderson , "Michael S. Tsirkin" , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Gerd Hoffmann , "Dr. David Alan Gilbert" , Hyman Huang , Peter Xu , Fabiano Rosas , Zhao Liu , qemu-block@nongnu.org, qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=44405; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=iFCBLQGN+NjgsMfMxsSnm0z1iTGrutu/OlMNKgZrzDI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguz973RXB/inviIhs8vU476b+zRLdr/wcMoB nuLpePDsKOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5RqkD/wMdKF6yhuFnbYGa8rJ/kgEO6egcvmoQ5NCikjh7t5ibfW4jQrzLBqgtNNVQIr0NpuMDBP rn9tZ9OlLraIUYGVsz3jIMtXRs9MJ4++KRlUyukpwR3+3jVNxKeEOCo0/U/CCUNtvG+0LDimci0 SjqHy13opdjYUm2+sYmwuXCQSSJhFHdOna4irqEl/BunpCgfSICukJrUAwGUVKwqgj5h+TKLQQG HdmgNVRod4vFlrR+l5PzPKkw7CmXzmlEnazHpmMd9u+FZ8woMtoD7Ygwn0n7AiDdG4CqQ1nYl6Z +BdOz9N+LD5oKU+Yl2ZpYPocx98i3m1UrgHdbwRt9TAwEXH+F95Ei1hvzihsuZaMQvKj5vTX70e CBifhBKDFMESeq0a1PrpPvP3jFZ2s1fSZgmB255ibWHSHfjyhblLUoWZXR/1bWYShEaTvumnUqV SoeXSC2IY/Sa5CImRBGhJ+JhEMG1jEHH2YAS5gxMa0ko0E+04xL1WOwq3skIsVlB+fnPOW86SrR 8ZEDoCzUtWvjd2VacqO7Pifjrqf2gOOnFoNhZTS+LbAMGCkvEc4S4M+VNnOE93qNp3RMW9kzzlh TcG2SjfmN96Evimv3vqYEoljEgU/vwoXNQym21r1xBTeFFECEiR9aJRXJbbkgJkW7UtKRgP+vDW vbLJATv7WqaB0yQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907754355158500 Mostly mechanical, with a few adjustments around it. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- block/monitor/block-hmp-cmds.c | 73 +++++++++++++++----------------------= ---- chardev/char-hmp-cmds.c | 17 ++++------ dump/dump-hmp-cmds.c | 5 ++- hw/core/machine-hmp-cmds.c | 26 +++++++-------- hw/i386/kvm/xen_evtchn.c | 4 +-- hw/misc/mos6522.c | 2 +- hw/net/rocker/rocker-hmp-cmds.c | 8 ++--- hw/pci/pci-hmp-cmds.c | 2 +- hw/uefi/ovmf-log.c | 2 +- hw/virtio/virtio-hmp-cmds.c | 10 +++--- include/monitor/hmp.h | 2 +- migration/dirtyrate.c | 2 +- migration/migration-hmp-cmds.c | 37 ++++++++------------- monitor/hmp-cmds.c | 23 +++++-------- monitor/hmp.c | 12 +++---- net/net-hmp-cmds.c | 11 +++---- qom/qom-hmp-cmds.c | 13 +++----- system/dirtylimit-hmp-cmds.c | 7 ++-- system/qdev-monitor.c | 6 ++-- system/runstate-hmp-cmds.c | 3 +- target/i386/monitor.c | 3 +- ui/ui-hmp-cmds.c | 19 ++++------- 22 files changed, 112 insertions(+), 175 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 3914b5189d56..a2666e2f1b9b 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -57,7 +57,7 @@ #include "block/block_int.h" #include "block/block-hmp-cmds.h" =20 -static void hmp_drive_add_node(Monitor *mon, const char *optstr) +static void hmp_drive_add_node(MonitorHMP *hmp, const char *optstr) { QemuOpts *opts; QDict *qdict; @@ -84,7 +84,7 @@ static void hmp_drive_add_node(Monitor *mon, const char *= optstr) bdrv_set_monitor_owned(bs); out: qemu_opts_del(opts); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict) @@ -98,7 +98,7 @@ void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict) bool node =3D qdict_get_try_bool(qdict, "node", false); =20 if (node) { - hmp_drive_add_node(mon, optstr); + hmp_drive_add_node(hmp, optstr); return; } =20 @@ -133,12 +133,11 @@ err: monitor_remove_blk(blk); blk_unref(blk); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); BlockBackend *blk; BlockDriverState *bs; @@ -193,12 +192,11 @@ void hmp_drive_del(MonitorHMP *hmp, const QDict *qdic= t) =20 unlock: bdrv_graph_rdunlock_main_loop(); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_commit(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); BlockBackend *blk; int ret; @@ -232,12 +230,11 @@ void hmp_commit(MonitorHMP *hmp, const QDict *qdict) } =20 end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "target"); const char *format =3D qdict_get_try_str(qdict, "format"); bool reuse =3D qdict_get_try_bool(qdict, "reuse", false); @@ -259,12 +256,11 @@ void hmp_drive_mirror(MonitorHMP *hmp, const QDict *q= dict) } qmp_drive_mirror(&mirror, &err); end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *filename =3D qdict_get_str(qdict, "target"); const char *format =3D qdict_get_try_str(qdict, "format"); @@ -290,69 +286,63 @@ void hmp_drive_backup(MonitorHMP *hmp, const QDict *q= dict) =20 qmp_drive_backup(&backup, &err); end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_block_job_set_speed(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); int64_t value =3D qdict_get_int(qdict, "speed"); =20 qmp_block_job_set_speed(device, value, &error); =20 - hmp_handle_error(mon, error); + hmp_handle_error(hmp, error); } =20 void hmp_block_job_cancel(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); bool force =3D qdict_get_try_bool(qdict, "force", false); =20 qmp_block_job_cancel(device, true, force, &error); =20 - hmp_handle_error(mon, error); + hmp_handle_error(hmp, error); } =20 void hmp_block_job_pause(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 qmp_block_job_pause(device, &error); =20 - hmp_handle_error(mon, error); + hmp_handle_error(hmp, error); } =20 void hmp_block_job_resume(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 qmp_block_job_resume(device, &error); =20 - hmp_handle_error(mon, error); + hmp_handle_error(hmp, error); } =20 void hmp_block_job_complete(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 qmp_block_job_complete(device, &error); =20 - hmp_handle_error(mon, error); + hmp_handle_error(hmp, error); } =20 void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *filename =3D qdict_get_str(qdict, "snapshot-file"); const char *format =3D qdict_get_try_str(qdict, "format"); @@ -363,35 +353,32 @@ void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict= *qdict) mode =3D reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABSOLUTE_PAT= HS; qmp_blockdev_snapshot_sync(device, NULL, filename, NULL, format, true, mode, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_snapshot_blkdev_internal(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; =20 qmp_blockdev_snapshot_internal_sync(device, name, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_snapshot_delete_blkdev_internal(MonitorHMP *hmp, const QDict *qdi= ct) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_str(qdict, "name"); const char *id =3D qdict_get_try_str(qdict, "id"); Error *err =3D NULL; =20 qmp_blockdev_snapshot_delete_internal_sync(device, id, name, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *uri =3D qdict_get_str(qdict, "uri"); bool writable =3D qdict_get_try_bool(qdict, "writable", false); bool all =3D qdict_get_try_bool(qdict, "all", false); @@ -449,12 +436,11 @@ void hmp_nbd_server_start(MonitorHMP *hmp, const QDic= t *qdict) qapi_free_BlockInfoList(block_list); =20 exit: - hmp_handle_error(mon, local_err); + hmp_handle_error(hmp, local_err); } =20 void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_try_str(qdict, "name"); bool writable =3D qdict_get_try_bool(qdict, "writable", false); @@ -468,44 +454,40 @@ void hmp_nbd_server_add(MonitorHMP *hmp, const QDict = *qdict) }; =20 qmp_nbd_server_add(&export, &local_err); - hmp_handle_error(mon, local_err); + hmp_handle_error(hmp, local_err); } =20 void hmp_nbd_server_remove(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool force =3D qdict_get_try_bool(qdict, "force", false); Error *err =3D NULL; =20 /* Rely on BLOCK_EXPORT_REMOVE_MODE_SAFE being the default */ qmp_nbd_server_remove(name, force, BLOCK_EXPORT_REMOVE_MODE_HARD, &err= ); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_nbd_server_stop(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_nbd_server_stop(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void coroutine_fn hmp_block_resize(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); int64_t size =3D qdict_get_int(qdict, "size"); Error *err =3D NULL; =20 qmp_block_resize(device, NULL, size, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); const char *base =3D qdict_get_try_str(qdict, "base"); @@ -516,12 +498,11 @@ void hmp_block_stream(MonitorHMP *hmp, const QDict *q= dict) true, BLOCKDEV_ON_ERROR_REPORT, NULL, false, false, false, false, &error); =20 - hmp_handle_error(mon, error); + hmp_handle_error(hmp, error); } =20 void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; char *device =3D (char *) qdict_get_str(qdict, "device"); BlockIOThrottle throttle =3D { @@ -545,23 +526,21 @@ void hmp_block_set_io_throttle(MonitorHMP *hmp, const= QDict *qdict) } =20 qmp_block_set_io_throttle(&throttle, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_eject(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); bool force =3D qdict_get_try_bool(qdict, "force", false); const char *device =3D qdict_get_str(qdict, "device"); Error *err =3D NULL; =20 qmp_eject(device, NULL, true, force, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); bool qdev =3D qdict_get_try_bool(qdict, "qdev", false); const char *device =3D qdict_get_str(qdict, "device"); const char *command =3D qdict_get_str(qdict, "command"); @@ -570,7 +549,7 @@ void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict) qmp_x_qemu_io(qdev ? NULL : device, qdev ? device : NULL, command, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 static void print_block_info(Monitor *mon, BlockInfo *info, @@ -851,7 +830,7 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict *q= dict) =20 bs =3D bdrv_all_find_vmstate_bs(NULL, false, NULL, &err); if (!bs) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 diff --git a/chardev/char-hmp-cmds.c b/chardev/char-hmp-cmds.c index d4a5a3a255a5..71017fd2d19e 100644 --- a/chardev/char-hmp-cmds.c +++ b/chardev/char-hmp-cmds.c @@ -40,14 +40,13 @@ void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *chardev =3D qdict_get_str(qdict, "device"); const char *data =3D qdict_get_str(qdict, "data"); Error *err =3D NULL; =20 qmp_ringbuf_write(chardev, data, false, 0, &err); =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict) @@ -60,7 +59,7 @@ void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict) int i; =20 data =3D qmp_ringbuf_read(chardev, size, false, 0, &err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -82,7 +81,6 @@ void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *args =3D qdict_get_str(qdict, "args"); Error *err =3D NULL; QemuOpts *opts; @@ -94,12 +92,11 @@ void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdic= t) qemu_chr_new_from_opts(opts, NULL, &err); qemu_opts_del(opts); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_chardev_change(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *args =3D qdict_get_str(qdict, "args"); const char *id; Error *err =3D NULL; @@ -129,25 +126,23 @@ end: qapi_free_ChardevReturn(ret); qapi_free_ChardevBackend(backend); qemu_opts_del(opts); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_chardev_remove(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; =20 qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err); - hmp_handle_error(mon, local_err); + hmp_handle_error(hmp, local_err); } =20 void hmp_chardev_send_break(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; =20 qmp_chardev_send_break(qdict_get_str(qdict, "id"), &local_err); - hmp_handle_error(mon, local_err); + hmp_handle_error(hmp, local_err); } =20 void chardev_add_completion(ReadLineState *rs, int nb_args, const char *st= r) diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c index ba78ad026f1e..104ab5d2a53a 100644 --- a/dump/dump-hmp-cmds.c +++ b/dump/dump-hmp-cmds.c @@ -14,7 +14,6 @@ =20 void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; bool win_dmp =3D qdict_get_try_bool(qdict, "windmp", false); bool paging =3D qdict_get_try_bool(qdict, "paging", false); @@ -34,7 +33,7 @@ void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *= qdict) =20 if (zlib + lzo + snappy + win_dmp > 1) { error_setg(&err, "only one of '-z|-l|-s|-w' can be set"); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -80,7 +79,7 @@ void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *= qdict) =20 qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin, has_length, length, true, dump_format, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); g_free(prot); } =20 diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 48fa27f12705..4e2f0c212b0d 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -57,7 +57,7 @@ void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *= qdict) HotpluggableCPUList *saved =3D l; CpuInstanceProperties *c; =20 - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -147,7 +147,7 @@ void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdic= t) monitor_printf(mon, "\n"); =20 qapi_free_MemdevList(memdev_list); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict) @@ -202,7 +202,7 @@ void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdi= ct) Error *err =3D NULL; =20 info =3D qmp_query_balloon(&err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -236,47 +236,43 @@ void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) } =20 qmp_memsave(addr, size, filename, true, cpu_index, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_pmemsave(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); Error *err =3D NULL; =20 qmp_pmemsave(addr, size, filename, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_system_wakeup(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_system_wakeup(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_nmi(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_inject_nmi(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_balloon(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int64_t value =3D qdict_get_int(qdict, "value"); Error *err =3D NULL; =20 qmp_balloon(value, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict) @@ -380,7 +376,7 @@ void hmp_info_memory_devices(MonitorHMP *hmp, const QDi= ct *qdict) } =20 qapi_free_MemoryDeviceInfoList(info_list); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict) @@ -391,7 +387,7 @@ void hmp_info_vm_generation_id(MonitorHMP *hmp, const Q= Dict *qdict) if (info) { monitor_printf(mon, "%s\n", info->guid); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); qapi_free_GuidInfo(info); } =20 @@ -411,5 +407,5 @@ void hmp_info_memory_size_summary(MonitorHMP *hmp, cons= t QDict *qdict) =20 qapi_free_MemoryInfo(info); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 845838c372d5..00dff6ee8760 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -2352,7 +2352,7 @@ void hmp_xen_event_list(MonitorHMP *hmp, const QDict = *qdict) =20 info_list =3D qmp_xen_event_list(&err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -2388,7 +2388,7 @@ void hmp_xen_event_inject(MonitorHMP *hmp, const QDic= t *qdict) =20 qmp_xen_event_inject(port, &err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } else { monitor_printf(mon, "Delivered port %d\n", port); } diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 15a6a1a75745..1c20c7582c34 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -592,7 +592,7 @@ void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) Error *err =3D NULL; g_autoptr(HumanReadableText) info =3D qmp_x_query_via(&err); =20 - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } monitor_puts(mon, info->human_readable_text); diff --git a/hw/net/rocker/rocker-hmp-cmds.c b/hw/net/rocker/rocker-hmp-cmd= s.c index 856aaef5e210..6405ce26dd65 100644 --- a/hw/net/rocker/rocker-hmp-cmds.c +++ b/hw/net/rocker/rocker-hmp-cmds.c @@ -28,7 +28,7 @@ void hmp_rocker(MonitorHMP *hmp, const QDict *qdict) Error *err =3D NULL; =20 rocker =3D qmp_query_rocker(name, &err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -47,7 +47,7 @@ void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict) Error *err =3D NULL; =20 list =3D qmp_query_rocker_ports(name, &err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -76,7 +76,7 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict= *qdict) Error *err =3D NULL; =20 list =3D qmp_query_rocker_of_dpa_flows(name, tbl_id !=3D -1, tbl_id, &= err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -226,7 +226,7 @@ void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QD= ict *qdict) Error *err =3D NULL; =20 list =3D qmp_query_rocker_of_dpa_groups(name, type !=3D 9, type, &err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index be24aecc8ac8..51d95d76620e 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -247,5 +247,5 @@ void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const Q= Dict *qdict) PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index c97622b2aad6..0d59a74ad60e 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -269,7 +269,7 @@ void hmp_info_firmware_log(MonitorHMP *hmp, const QDict= *qdict) maxsize =3D qdict_get_try_int(qdict, "max-size", -1); log =3D qmp_query_firmware_log(maxsize !=3D -1, (uint64_t)maxsize, &er= r); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c index 49f3367785ba..fb36c8b9274c 100644 --- a/hw/virtio/virtio-hmp-cmds.c +++ b/hw/virtio/virtio-hmp-cmds.c @@ -88,7 +88,7 @@ void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict) VirtioInfoList *node; =20 if (err !=3D NULL) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -114,7 +114,7 @@ void hmp_virtio_status(MonitorHMP *hmp, const QDict *qd= ict) VirtioStatus *s =3D qmp_x_query_virtio_status(path, &err); =20 if (err !=3D NULL) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -195,7 +195,7 @@ void hmp_vhost_queue_status(MonitorHMP *hmp, const QDic= t *qdict) qmp_x_query_virtio_vhost_queue_status(path, queue, &err); =20 if (err !=3D NULL) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -228,7 +228,7 @@ void hmp_virtio_queue_status(MonitorHMP *hmp, const QDi= ct *qdict) VirtQueueStatus *s =3D qmp_x_query_virtio_queue_status(path, queue, &e= rr); =20 if (err !=3D NULL) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -278,7 +278,7 @@ void hmp_virtio_queue_element(MonitorHMP *hmp, const QD= ict *qdict) e =3D qmp_x_query_virtio_queue_element(path, queue, index !=3D -1, index, &err); if (err !=3D NULL) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 7a270ad3f25c..827a56144824 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -54,7 +54,7 @@ void monitor_register_hmp_info_hrt(const char *name, CPUArchState *mon_get_cpu_env(Monitor *mon); CPUState *mon_get_cpu(Monitor *mon); =20 -bool hmp_handle_error(Monitor *mon, Error *err); +bool hmp_handle_error(MonitorHMP *hmp, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); strList *hmp_split_at_comma(const char *str); =20 diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 567abab321cc..3c0931796ce2 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -926,7 +926,7 @@ void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *= qdict) true, mode, &err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 8d2e8735277e..73a974259478 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -478,7 +478,6 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, const= QDict *qdict) =20 void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); RunState saved_state =3D runstate_get(); =20 const char *name =3D qdict_get_str(qdict, "name"); @@ -490,27 +489,25 @@ void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict) load_snapshot_resume(saved_state); } =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_savevm(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 save_snapshot(qdict_get_try_str(qdict, "name"), true, NULL, false, NULL, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_delvm(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *name =3D qdict_get_str(qdict, "name"); =20 delete_snapshot(name, false, NULL, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict) @@ -520,7 +517,6 @@ void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *q= dict) =20 void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *state =3D qdict_get_str(qdict, "state"); int val =3D qapi_enum_parse(&MigrationStatus_lookup, state, -1, &err); @@ -529,12 +525,11 @@ void hmp_migrate_continue(MonitorHMP *hmp, const QDic= t *qdict) qmp_migrate_continue(val, &err); } =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); MigrationChannelList *caps =3D NULL; @@ -549,34 +544,31 @@ void hmp_migrate_incoming(MonitorHMP *hmp, const QDic= t *qdict) qapi_free_MigrationChannelList(caps); =20 end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); =20 qmp_migrate_recover(uri, &err); =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_migrate_pause(&err); =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 =20 void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *cap =3D qdict_get_str(qdict, "capability"); bool state =3D qdict_get_bool(qdict, "state"); Error *err =3D NULL; @@ -597,12 +589,11 @@ void hmp_migrate_set_capability(MonitorHMP *hmp, cons= t QDict *qdict) qapi_free_MigrationCapabilityStatusList(caps); =20 end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); @@ -799,25 +790,23 @@ void hmp_migrate_set_parameter(MonitorHMP *hmp, const= QDict *qdict) cleanup: qapi_free_MigrationParameters(p); visit_free(v); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; qmp_migrate_start_postcopy(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 #ifdef CONFIG_REPLICATION void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_colo_lost_heartbeat(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } #endif =20 @@ -860,7 +849,7 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) g_autoptr(MigrationChannel) channel_cpr =3D NULL; =20 if (!migrate_uri_parse(uri, &channel, &err)) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); @@ -882,7 +871,7 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) } =20 qmp_migrate(NULL, true, caps, true, resume, &err); - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index afe4817b4056..d1e7e4de6585 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -75,7 +75,7 @@ static void __attribute__((__constructor__)) sortcmdlist(= void) compare_mon_cmd); } =20 -bool hmp_handle_error(Monitor *mon, Error *err) +bool hmp_handle_error(MonitorHMP *hmp, Error *err) { if (err) { error_reportf_err(err, "Error: "); @@ -165,17 +165,16 @@ void hmp_sync_profile(MonitorHMP *hmp, const QDict *q= dict) =20 error_setg(&err, "invalid parameter '%s'," " expecting 'on', 'off', or 'reset'", op); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } } =20 void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_exit_preconfig(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) @@ -193,11 +192,10 @@ void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_cont(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_cont(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_change(MonitorHMP *hmp, const QDict *qdict) @@ -219,29 +217,27 @@ void hmp_change(MonitorHMP *hmp, const QDict *qdict) hmp_change_medium(mon, device, target, arg, read_only, force, &err= ); } =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 #ifdef CONFIG_POSIX void hmp_getfd(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 qmp_getfd(fdname, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } #endif =20 void hmp_closefd(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 qmp_closefd(fdname, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict) @@ -502,17 +498,16 @@ void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdi= ct) #if defined(CONFIG_FDT) void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); Error *local_err =3D NULL; =20 qmp_dumpdtb(filename, &local_err); =20 - if (hmp_handle_error(mon, local_err)) { + if (hmp_handle_error(hmp, local_err)) { return; } =20 - monitor_printf(mon, "DTB dumped to '%s'\n", filename); + monitor_printf(MONITOR(hmp), "DTB dumped to '%s'\n", filename); } #endif =20 diff --git a/monitor/hmp.c b/monitor/hmp.c index 6e6334b64685..57c4127641ac 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1215,28 +1215,28 @@ fail: return NULL; } =20 -static void hmp_info_human_readable_text(Monitor *mon, +static void hmp_info_human_readable_text(MonitorHMP *hmp, HumanReadableText *(*handler)(Err= or **)) { Error *err =3D NULL; g_autoptr(HumanReadableText) info =3D handler(&err); =20 - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 - monitor_puts(mon, info->human_readable_text); + monitor_puts(MONITOR(hmp), info->human_readable_text); } =20 -static void handle_hmp_command_exec(MonitorHMP *mon, +static void handle_hmp_command_exec(MonitorHMP *hmp, const HMPCommand *cmd, QDict *qdict) { if (cmd->cmd_info_hrt) { - hmp_info_human_readable_text(MONITOR(mon), + hmp_info_human_readable_text(hmp, cmd->cmd_info_hrt); } else { - cmd->cmd(mon, qdict); + cmd->cmd(hmp, qdict); } } =20 diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 702103b6a920..5b1c678f5d89 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -53,7 +53,7 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdict) NetHubInfoList *h; NetworkClientInfoList *entry; =20 - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -86,13 +86,12 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_set_link(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool up =3D qdict_get_bool(qdict, "up"); Error *err =3D NULL; =20 qmp_set_link(name, up, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 =20 @@ -113,7 +112,6 @@ void hmp_announce_self(MonitorHMP *hmp, const QDict *qd= ict) =20 void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; const char *type =3D qdict_get_try_str(qdict, "type"); @@ -133,17 +131,16 @@ void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdi= ct) } =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 qmp_netdev_del(id, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 =20 diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index 16847d1ce261..2e2eb33371e2 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -42,12 +42,11 @@ void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict) } qapi_free_ObjectPropertyInfoList(start); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const bool json =3D qdict_get_try_bool(qdict, "json", false); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); @@ -71,7 +70,7 @@ void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) } } =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) @@ -89,7 +88,7 @@ void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) } =20 qobject_unref(obj); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 typedef struct QOMCompositionState { @@ -160,22 +159,20 @@ void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *= dict) =20 void hmp_object_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *options =3D qdict_get_str(qdict, "object"); Error *err =3D NULL; =20 user_creatable_add_from_str(options, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_object_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 user_creatable_del(id, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void object_add_completion(ReadLineState *rs, int nb_args, const char *str) diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c index 4c100783778f..75194add7931 100644 --- a/system/dirtylimit-hmp-cmds.c +++ b/system/dirtylimit-hmp-cmds.c @@ -23,7 +23,7 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const Q= Dict *qdict) =20 qmp_cancel_vcpu_dirty_limit(!!(cpu_index !=3D -1), cpu_index, &err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -33,7 +33,6 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const Q= Dict *qdict) =20 void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int64_t dirty_rate =3D qdict_get_int(qdict, "dirty_rate"); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; @@ -46,7 +45,7 @@ void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDic= t *qdict) qmp_set_vcpu_dirty_limit(!!(cpu_index !=3D -1), cpu_index, dirty_rate,= &err); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) @@ -63,7 +62,7 @@ void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDi= ct *qdict) =20 head =3D qmp_query_vcpu_dirty_limit(&err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index e27b9724867a..5c2de2f53cc9 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -1004,7 +1004,6 @@ void qmp_device_sync_config(const char *id, Error **e= rrp) =20 void hmp_device_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; DeviceState *dev; @@ -1034,17 +1033,16 @@ void hmp_device_add(MonitorHMP *hmp, const QDict *q= dict) } object_unref(dev); out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_device_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 qmp_device_del(id, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void device_add_completion(ReadLineState *rs, int nb_args, const char *str) diff --git a/system/runstate-hmp-cmds.c b/system/runstate-hmp-cmds.c index 834b95835339..051ee45ee74c 100644 --- a/system/runstate-hmp-cmds.c +++ b/system/runstate-hmp-cmds.c @@ -70,7 +70,6 @@ void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qd= ict) =20 void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; WatchdogAction action; char *qapi_value; @@ -79,7 +78,7 @@ void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qd= ict) action =3D qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, &er= r); g_free(qapi_value); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } qmp_watchdog_set_action(action, &error_abort); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index f1d2a327ddad..f68dd38ac225 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -573,7 +573,6 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_mce(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); X86CPU *cpu; CPUState *cs; int cpu_index =3D qdict_get_int(qdict, "cpu_index"); @@ -596,5 +595,5 @@ void hmp_mce(MonitorHMP *hmp, const QDict *qdict) } else { error_setg(&err, "Invalid CPU %d", cpu_index); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 5f3522943c56..186209fd0234 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -73,11 +73,10 @@ void hmp_mouse_button(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qemu_mouse_set(qdict_get_int(qdict, "index"), &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict) @@ -158,7 +157,7 @@ void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict) =20 info2l =3D qmp_query_vnc_servers(&err); info2l_head =3D info2l; - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } if (!info2l) { @@ -266,7 +265,6 @@ out: =20 void hmp_set_password(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *password =3D qdict_get_str(qdict, "password"); const char *display =3D qdict_get_try_str(qdict, "display"); @@ -297,12 +295,11 @@ void hmp_set_password(MonitorHMP *hmp, const QDict *q= dict) qmp_set_password(&opts, &err); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *whenstr =3D qdict_get_str(qdict, "time"); const char *display =3D qdict_get_try_str(qdict, "display"); @@ -325,7 +322,7 @@ void hmp_expire_password(MonitorHMP *hmp, const QDict *= qdict) qmp_expire_password(&opts, &err); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 #ifdef CONFIG_VNC @@ -427,7 +424,7 @@ void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict) } =20 qmp_send_key(head, has_hold_time, hold_time, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); =20 out: qapi_free_KeyValue(v); @@ -465,7 +462,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args,= const char *str) void coroutine_fn hmp_screendump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); const char *id =3D qdict_get_try_str(qdict, "device"); int64_t head =3D qdict_get_try_int(qdict, "head", 0); @@ -482,13 +478,12 @@ hmp_screendump(MonitorHMP *hmp, const QDict *qdict) qmp_screendump(filename, id, id !=3D NULL, head, input_format !=3D NULL, format, &err); end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } #endif =20 void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *hostname =3D qdict_get_str(qdict, "hostname"); @@ -501,5 +496,5 @@ void hmp_client_migrate_info(MonitorHMP *hmp, const QDi= ct *qdict) qmp_client_migrate_info(protocol, hostname, has_port, port, has_tls_port, tls_port, cert_subject, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907743; cv=none; d=zohomail.com; s=zohoarc; b=gC0stMxCNEXEvUcNXV+EIKAdwTr1xd0d7+l/eyiJKwe45zjRwyQxSOAY53nuzIQXu73U1aYBAj9R0zQBiMfumynpKFYWYAVIUKYNtxdsuFH8Z1pqx/n+Ci/zM+0zFyXluMZn54Yh2bvgbuOPt/bK7VkvT7YHTdhL7lRnnPezXII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907743; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=b0+NrocGg2s2UfaRXQzaxbckp7GlywcmRnsoIlrWMm4=; b=ChcU7dqBQz7gwncdP8riOjJt/Wklr9YdKlMQ9GZQJ37oeLlcmPM2NXL6BPwjLtoFA5//wOVcBa6HtAog82rCERRqnxr3lSz+rviibSJ5r0FfKaxOZD/nLODWf+yY0WVJJKZRruegZaIfWMJdZN9gxiznXj0FhNoi0eJSuhVC4f4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907743096406.10961556657355; Sun, 16 Aug 2026 12:15:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKJ-0006uE-D3; Sun, 16 Aug 2026 15:15:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKH-0006kv-54 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgK9-00088M-9x for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:20 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-158-kdJ7Ngl9PUivQi3hu1FDcA-1; Sun, 16 Aug 2026 15:15:04 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5C47619560A2; Sun, 16 Aug 2026 19:15:03 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 71DBC195608A; Sun, 16 Aug 2026 19:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907712; 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=b0+NrocGg2s2UfaRXQzaxbckp7GlywcmRnsoIlrWMm4=; b=eHePZmOyrX086e8u3k4HeWwIhCo/EPj4N8DRVJOqulf3FPqjB2zzKcL9saOm0wKQzxLoBj MQ8T0BSXrrLMExKH4U+R3tP4LOL/zziE272ksj89uzn42VZ7AQ8Qjj0HEABOXkra1nbkCV 0EeK/6Dr8F/SSrqR7UD21WwG6N3N/xY= X-MC-Unique: kdJ7Ngl9PUivQi3hu1FDcA-1 X-Mimecast-MFC-AGG-ID: kdJ7Ngl9PUivQi3hu1FDcA_1786907703 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:00 +0400 Subject: [PATCH v3 33/49] monitor: add monitor_cur_hmp() helper MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-33-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2227; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=90aUJsjcWbB7AzInJ9UqT2isNsQm9fOohMSw1XfGyI0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguz2k/v7UDnaoaKfUvGZdEKP6bq35+SAcA5R 28DmilGVTSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5WVXEACpPp6wmJKthgwqcS7FeKB0UUiwgvRH0ng/2z/0w3Jjl795MYHkZVSpbjabvS3G/JAnhtt ipXLkd5RvgR5KArSwv1R9DkCpw85xVzWnOraC9B+ePaf2+2ld6X0Fc1SOLP0t2s7iO1o7yeug6l 0b5tUvEstMvi88tSk/H4DchJaVOqFRBQ0CnaRq9bszQ0EQLCh6F0Jq7JeuwTmTtk31wOQZJ5/lo uDcoK5SpZFrthWPhgrKa2qOH5R5ShOYLPXeh2mDBh+JdcW++or2NQv3zK6rwl6YWjr8mFreCyfT /wsie5UVqr7pIoff+qD6+/1Srw5lhGkJdQMyPG0YZxYZ8GPZ4cqPeX6lkUtCbxgwgrheqMOsulT hJbLWsUdjovOjeA3ODcCvowicKgXQn11gx8tL6z/GUq1I/N2UFXdI3JXtUgpZcbzvBXxVl+lLbe XklaiaoP8qQtFGJV/1bHhGg4XbAOSvNrZt3KShxqiwDHpdWqvrA9u9ulYrpBQq1KJSVu80c80dV gQAktkHlcx4LvacQSF7oBiBMEzgBZJYENH+y0/b6xZgnptdnk0PawjfRTdP4ZjqFfQCuzXF0YDS EBfNXUlAXULYSxErpI19JjZniufHddHmPJK/NUkGDLxRF72Up7Y/TxDDm00yRvCG273iGTsPDdQ PH6j2VdGMsSGSlw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907744323158500 This will help to simplify the code in the following changes. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Dr. David Alan Gilbert --- include/monitor/hmp.h | 2 ++ monitor/hmp.c | 10 ++++++++++ stubs/meson.build | 1 + stubs/monitor-hmp.c | 9 +++++++++ 4 files changed, 22 insertions(+) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 827a56144824..6aa562ddbaa2 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -36,6 +36,8 @@ struct MonitorDef { void monitor_new_hmp(const char *id, const char *chardev_id, bool use_readline, Error **errp); =20 +MonitorHMP *monitor_cur_hmp(void); + int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3); diff --git a/monitor/hmp.c b/monitor/hmp.c index 57c4127641ac..47fb7cef6de2 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -47,6 +47,16 @@ =20 OBJECT_DEFINE_TYPE(MonitorHMP, monitor_hmp, MONITOR_HMP, MONITOR); =20 +MonitorHMP *monitor_cur_hmp(void) +{ + Monitor *mon =3D monitor_cur(); + if (mon) { + return (MonitorHMP *)object_dynamic_cast(OBJECT(mon), + TYPE_MONITOR_HMP); + } + return NULL; +} + static void monitor_hmp_finalize(Object *obj) { MonitorHMP *hmp =3D MONITOR_HMP(obj); diff --git a/stubs/meson.build b/stubs/meson.build index 3b2f2680b193..7e15687a62b7 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -7,6 +7,7 @@ stub_ss.add(files('fdset.c')) stub_ss.add(files('iothread-lock.c')) stub_ss.add(files('is-daemonized.c')) stub_ss.add(files('monitor-core.c')) +stub_ss.add(files('monitor-hmp.c')) stub_ss.add(files('replay-mode.c')) stub_ss.add(files('trace-control.c')) =20 diff --git a/stubs/monitor-hmp.c b/stubs/monitor-hmp.c new file mode 100644 index 000000000000..9452a3f0c2c8 --- /dev/null +++ b/stubs/monitor-hmp.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "monitor/hmp.h" + +MonitorHMP *monitor_cur_hmp(void) +{ + return NULL; +} --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907732; cv=none; d=zohomail.com; s=zohoarc; b=lPBj4veTdc+cdtfnB9hkC4h5rWgFQww4Ot/YWBRSvAnKGW+eIdxhU2uWEHcx9Mg73GbXxw6Bk22afsYvW8Dc+CQSyXU9nrwv3e0EvjGbVa8jtUx7EU3Ske1X41dDgZRGqr4ZquUyGmSZpVELBYpuAw2772jTjizKwmis2Kf/fLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907732; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fwr76LCKNxOFLBeBXg/E6mdqS+bZIDMVvsuC1iRbH+0=; b=QFQpYXYoeZmipTnHQK+4eN7c7ZJHC3SbWxRcrirVry3+oH86otP4Bxl6zo+oEnuidbohxZTWq5epC6DQHqxXZOWTeyHxlTTKuPrH3FrTggchf9J5QqFIH2p7M0Odk8T7QQiE3D/KKbSsnlxme58xnUy1dlxWHqI04FZGDAFyOCY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907732313414.820823663229; Sun, 16 Aug 2026 12:15:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKK-00070f-QO; Sun, 16 Aug 2026 15:15:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKI-0006pz-HY for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKA-00088u-Uw for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:22 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-bYWR9-3wMVWwVCbVHjnFpQ-1; Sun, 16 Aug 2026 15:15:07 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C99319560A6; Sun, 16 Aug 2026 19:15:06 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C6BC930001A2; Sun, 16 Aug 2026 19:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907714; 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=fwr76LCKNxOFLBeBXg/E6mdqS+bZIDMVvsuC1iRbH+0=; b=binb7O0QAzL0im8ar05RTlDlZie3bLFZNlSpxuAotT1c8SuGDuQUGdsbN8PQxxQ+oaOhN/ V1F0Kquh+h8KItuDVY7mp2npIO5FX528/QZfBUljAZvtFZJYBq0v0lJQ4tGk9ri2Y2Aymi pNRx16JHDNypS7lH6CwCqs77uGrDlTY= X-MC-Unique: bYWR9-3wMVWwVCbVHjnFpQ-1 X-Mimecast-MFC-AGG-ID: bYWR9-3wMVWwVCbVHjnFpQ_1786907706 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:01 +0400 Subject: [PATCH v3 34/49] qemu-print: switch to use monitor_cur_hmp() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-34-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" X-Developer-Signature: v=1; a=openpgp-sha256; l=1339; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=vtbR9tAL+8maVG06CYe1fTcDDBCQLrWMYbbThpYR8Xs=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguzFPNY1DX6KTmMEwlzxQvcDncQPVoPl+q4j 4KEwDq+H4qJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5WNuD/9mn+ln1Nh26jkNVdKzeTbgxSx7dNT7TEArnRtaiIPCN5OcbfvGT+E2zjrOZFNxOiYzaj7 JjD8szaNh8QbV44dUX2uigK3KAfg8gzyKdJf19rIivxEWA19tsq32zf1xg4PtIkarguacI6InCY me5XOPmRBI29gv2IyVD2m45xvelMFjwvL1yF2P+fd0vKVvHW/RVa1ouK9r4S5+2owBo5AaKOJ/W LoOL2Vmsj552ElE/PSw39xpbToavyhRLATa/mcccOIzr2uy8b4ObP6gIaUdBUiXFXwfoEg3qpQG CbVD/voKKqDvZySDr1FLCpiuggFF0+a888bXbUbBG6FM409+sNWWcXFda5GBc+1YVGPAU2O8NYL 1eLz2XWCbse/RtkmCUGGa99Bnhw+iZdZdpzCpOioTMlieIncQnslLH6zoagOmcGBacvwfljcq+C H1VvaaOSlmJZqBpv76PIc96/o2bSzfAitCKuPF6hipaJu0pkaFXU4fboqJa2OxlqviC+fEXscmY +ZBTAcDDzB3MuJwoL7pwaFk571UhhtR/SpGPi4a/2PhA+7vFzAAyA7MGGSYnDK5oAcUgHErz12s xtASoty6tojgJyfURd4A3Ir8eO4OcZGIeAfY0Go9miV4Bd/Zt2qyOmEf5qifnqbL2A972V9mv7q mfEPV6PJ7ENUdFA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907734131158500 Note that this fixes qemu_vprintf() (and thus qemu_printf) to do as said in the code comment: print to current HMP if we have one, else to stdout, instead of trying to print to the current monitor (which may not actually have hmp-only print capability/callback and fail silently). Signed-off-by: Marc-Andr=C3=A9 Lureau --- util/qemu-print.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/util/qemu-print.c b/util/qemu-print.c index a2d1f0244168..0eecc05b0330 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -21,9 +21,9 @@ */ int qemu_vprintf(const char *fmt, va_list ap) { - Monitor *cur_mon =3D monitor_cur(); - if (cur_mon) { - return monitor_vprintf(cur_mon, fmt, ap); + MonitorHMP *hmp =3D monitor_cur_hmp(); + if (hmp) { + return monitor_vprintf(MONITOR(hmp), fmt, ap); } return vprintf(fmt, ap); } @@ -53,7 +53,8 @@ int qemu_printf(const char *fmt, ...) int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) { if (!stream) { - return monitor_vprintf(monitor_cur(), fmt, ap); + MonitorHMP *hmp =3D monitor_cur_hmp(); + return hmp ? monitor_vprintf(MONITOR(hmp), fmt, ap) : -1; } return vfprintf(stream, fmt, ap); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907753; cv=none; d=zohomail.com; s=zohoarc; b=hl6pML/LJhM0mI3U3ydZNEXpvr/vEtd4BFmV+hf1rdfe+zilBxlS2fFf/EHhN/NqjFj8+gkwBz0hD3DMgfsMXpXFNEGWQ+f2TzIkGz94nmwO5V92a3j9fWFpPEzV5CBp1HKd1qOskVdNk70/sPk+1pSX7D78xqtWo3N4R33bP84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907753; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NB19nROSaJxVR1WIi0VRBxVHI3bn9DkLC8WJKWPYYhI=; b=fm4S6/xytj0lVjTTD1PZX8z6JHtUxomNT3HrXVpL5OBDsrUmAvplTvCNMtFCSrB1HLVSmaBHG60QeTQTgDw7X7MTtLrIohyHaBeOom6+psE17HiYDwDXSaegGuW1jh3TN5pD4h4/U7iEqzgCdD4J5CRKKhf8UxKltaxkGn01zGI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17869077537932.3034046666888344; Sun, 16 Aug 2026 12:15:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKK-000709-Jd; Sun, 16 Aug 2026 15:15:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKI-0006q1-GY for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKA-00088Y-4R for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:21 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-411-ONbr4ShgPRCqw3syxp-L-g-1; Sun, 16 Aug 2026 15:15:11 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FCAE1956096; Sun, 16 Aug 2026 19:15:10 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5B39330001A2; Sun, 16 Aug 2026 19:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907713; 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=NB19nROSaJxVR1WIi0VRBxVHI3bn9DkLC8WJKWPYYhI=; b=aAgXuAaXhISbB/mYU6FPrfzghhILsVtb2KEhhOMYbOWGx6tsFOyb7Cdgm1diovMWn/xVzh cLWfuZrZB2u9uIFAFpRLV7tBzeEA67jiY54U69t47dalw0WXDHKWp9fYZzlMEHDyZ/4j96 DYmEUW2oLPJ1BYAb6pLQs/tYakULUeM= X-MC-Unique: ONbr4ShgPRCqw3syxp-L-g-1 X-Mimecast-MFC-AGG-ID: ONbr4ShgPRCqw3syxp-L-g_1786907710 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:02 +0400 Subject: [PATCH v3 35/49] error-report: switch to use monitor_cur_hmp() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-35-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=5626; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SVuAZWFVpZllbfA7jw/9vK74qQymNkwtSaEg9cSGiHc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguzessuR9HKH3C7U2XQ6Z/xZBcItMvX8FSQD 7vTCdB2WneJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5bJtEAC3kxdoQIpV9okEjJgqw0XRYZfZ5yEfrw3C9pUs9n2tvWWbHT7QvouEJILUrnhPH79pt0Z F5PDUIbgyCJ2NtRh8goDq/Zb4zgZH6EA5BUHO7UR9k4eCMmpP6Zzh6I1zuHqvfw1rH4UF6BirsJ ItCkyn4cb2RUtz3Z3p5oSwklIl0fdMDKr+3zKH53SUxa0MMVzdgjC3+7RWitNqWa0QojLeuD+WB Y1yniMHZ2Fnx6hmpvaWWDiuEsNqZ3ME1gzSzswCtO4ndxtALlgGfxyXuLQW8mtp34TpipSxtSQz iQXW65lH9uP7TrY+0kw0F5oys4VE7sr1w14RHUKB+xYR/11Nyy4gQ95Bg/3iB9VhPQY8AASoioL TTkGD8GeyVVAwi2rI6pWKGavyN9fQIfnNpkkX8F4ClGyWzUVaTza7ASgGBVnkBFpi+up9hAutzI pnJ4pbGaQD4Xr0N/qvBgyUCseePCZ2F1LXpPmY7SsTjX2pOd1FdEO7mdeWGhjxXCUkPC2VDIKj+ d81ZUufN46IbgXhre8N3SkEqpbSWLbwMxSzvTh+n/tYmJUfR+upc5O9SCwHT2WPoCddURm3LKM2 HEDZGZcKlJe9DlXfjxcBYJZNgTDOUtt0oUYCepzRiMVez3GjnJB+s3fVPeNZ3q0gRral0/jsp4A YtZsTLctv1Iu4nw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907754290158500 Instead of passing a Monitor pointer through error_vprintf_mon() and error_printf_mon(), call monitor_cur_hmp() directly. This removes the monitor parameter from the internal helpers and the manual object_dynamic_cast() in vreport(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- util/error-report.c | 72 +++++++++++++++++++++++++------------------------= ---- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/util/error-report.c b/util/error-report.c index aaa15bc79827..70cbd174ffae 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -30,34 +30,31 @@ bool error_with_guestname; const char *error_guest_name; =20 /* - * Print to the current human monitor if we have one, else to stderr. + * Print to the current HMP monitor if we have one, else to stderr. */ -static int G_GNUC_PRINTF(2, 0) -error_vprintf_mon(Monitor *cur_mon, const char *fmt, va_list ap) +static int G_GNUC_PRINTF(1, 0) +error_vprintf_mon(const char *fmt, va_list ap) { - /* - * This will return -1 if 'cur_mon' is NULL, or is QMP. - * IOW this will only print if in HMP, otherwise we - * fallback to stderr for QMP / no-monitor scenarios. - */ - int ret =3D monitor_vprintf(cur_mon, fmt, ap); - if (ret =3D=3D -1) { - ret =3D vfprintf(stderr, fmt, ap); + MonitorHMP *hmp =3D monitor_cur_hmp(); + + if (hmp) { + return monitor_vprintf(MONITOR(hmp), fmt, ap); } - return ret; + + return vfprintf(stderr, fmt, ap); } =20 /* - * Print to the current human monitor if we have one, else to stderr. + * Print to the current HMP monitor if we have one, else to stderr. */ -static int G_GNUC_PRINTF(2, 3) -error_printf_mon(Monitor *cur_mon, const char *fmt, ...) +static int G_GNUC_PRINTF(1, 2) +error_printf_mon(const char *fmt, ...) { va_list ap; int ret; =20 va_start(ap, fmt); - ret =3D error_vprintf_mon(cur_mon, fmt, ap); + ret =3D error_vprintf_mon(fmt, ap); va_end(ap); return ret; } @@ -67,7 +64,7 @@ error_printf_mon(Monitor *cur_mon, const char *fmt, ...) */ int error_vprintf(const char *fmt, va_list ap) { - return error_vprintf_mon(monitor_cur(), fmt, ap); + return error_vprintf_mon(fmt, ap); } =20 /* @@ -79,7 +76,7 @@ int error_printf(const char *fmt, ...) int ret; =20 va_start(ap, fmt); - ret =3D error_vprintf_mon(monitor_cur(), fmt, ap); + ret =3D error_vprintf_mon(fmt, ap); va_end(ap); return ret; } @@ -183,13 +180,13 @@ void loc_set_file(const char *fname, int lno) * Print current location to current HMP monitor if we have one, else * to stderr. */ -static void print_loc(Monitor *cur) +static void print_loc(MonitorHMP *hmp) { const char *sep =3D ""; int i; const char *const *argp; =20 - if (!cur && g_get_prgname()) { + if (!hmp && g_get_prgname()) { fprintf(stderr, "%s:", g_get_prgname()); sep =3D " "; } @@ -197,20 +194,20 @@ static void print_loc(Monitor *cur) case LOC_CMDLINE: argp =3D cur_loc->ptr; for (i =3D 0; i < cur_loc->num; i++) { - error_printf_mon(cur, "%s%s", sep, argp[i]); + error_printf_mon("%s%s", sep, argp[i]); sep =3D " "; } - error_printf_mon(cur, ": "); + error_printf_mon(": "); break; case LOC_FILE: - error_printf_mon(cur, "%s:", (const char *)cur_loc->ptr); + error_printf_mon("%s:", (const char *)cur_loc->ptr); if (cur_loc->num) { - error_printf_mon(cur, "%d:", cur_loc->num); + error_printf_mon("%d:", cur_loc->num); } - error_printf_mon(cur, " "); + error_printf_mon(" "); break; default: - error_printf_mon(cur, "%s", sep); + error_printf_mon("%s", sep); } } =20 @@ -233,45 +230,44 @@ static void vreport(report_type type, const char *fmt= , va_list ap) { /* * When current monitor is QMP, messages must go to stderr - * and have prefixes added, so we cast to HMP, leaving 'cur' + * and have prefixes added, so we cast to HMP, leaving 'hmp' * as NULL in QMP case */ - Monitor *cur =3D MONITOR( - object_dynamic_cast(OBJECT(monitor_cur()), TYPE_MONITOR_HMP)); + MonitorHMP *hmp =3D monitor_cur_hmp(); gchar *timestr; =20 - if (!cur) { + if (!hmp) { qemu_flockfile(stderr); } =20 - if (message_with_timestamp && !cur) { + if (message_with_timestamp && !hmp) { timestr =3D real_time_iso8601(); fprintf(stderr, "%s ", timestr); g_free(timestr); } =20 /* Only prepend guest name if -msg guest-name and -name guest=3D... ar= e set */ - if (error_with_guestname && error_guest_name && !cur) { + if (error_with_guestname && error_guest_name && !hmp) { fprintf(stderr, "%s ", error_guest_name); } =20 - print_loc(cur); + print_loc(hmp); =20 switch (type) { case REPORT_TYPE_ERROR: break; case REPORT_TYPE_WARNING: - error_printf_mon(cur, "warning: "); + error_printf_mon("warning: "); break; case REPORT_TYPE_INFO: - error_printf_mon(cur, "info: "); + error_printf_mon("info: "); break; } =20 - error_vprintf_mon(cur, fmt, ap); - error_printf_mon(cur, "\n"); + error_vprintf_mon(fmt, ap); + error_printf_mon("\n"); =20 - if (!cur) { + if (!hmp) { qemu_funlockfile(stderr); } } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907922; cv=none; d=zohomail.com; s=zohoarc; b=MY2GLDkYKFVKHb1Qw20ZLlKcN7gu/m7WjqPEdWNl8sXJVM+io2vve9ruttCtFI5IzD4RAz/2FmnoYT1tXjEDb8aYUA2FQWO3ughCMkq4nnFYgsXla1j4DFrLqXf2or2L04Jz87gE/D7DwTb/nUnt4WztbcIJSe7b/wfVYHQG8H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907922; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/tSTH9Fcc7PWh6vPeau9/c5WlR100WbWT1IoGN0aZLM=; b=E4fFSKmPkcnoPfLxsdMMxdjG+FcGIJXxgFO38Y34u97FgqJI4MhQwPrxtEt7eGK8CzNIHtK4kOydJLNdP17zLOJ8Y5MlZ0qanwk5FV7uw2rtT11w9JjBMcsN2eKTVAEBTk0DoHKzuXjhBjcYjvJHr0dxOZ5YamOfYKtjP4C3uaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907921963951.9997312747039; Sun, 16 Aug 2026 12:18:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKR-0007TH-0T; Sun, 16 Aug 2026 15:15:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKO-0007J9-Ez for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKI-0008Dx-O2 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:28 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-_5dz3Kc-OD-tlyrWCbgoQA-1; Sun, 16 Aug 2026 15:15:17 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5699C1956088; Sun, 16 Aug 2026 19:15:14 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA48730001A2; Sun, 16 Aug 2026 19:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907721; 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=/tSTH9Fcc7PWh6vPeau9/c5WlR100WbWT1IoGN0aZLM=; b=dHShGd8voIur2am/R59tLc5shot+qBVp+B0o3Xs59Hfll1KyOuVFcFchgkFJ27a+AyLQaz UnFNj0mhIEqlLxYp/5+wZwQjyXQoH61WC6DO2gXOP+8BwtDDG4HBdw+cpWn7bl4MhW4C9o yW4PqR1wih9c93s+OWlQhYHz8NnCvxM= X-MC-Unique: _5dz3Kc-OD-tlyrWCbgoQA-1 X-Mimecast-MFC-AGG-ID: _5dz3Kc-OD-tlyrWCbgoQA_1786907714 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:03 +0400 Subject: [PATCH v3 36/49] monitor: tighten monitor_set_cpu()/get_cpu() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-36-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini , Zhao Liu , Laurent Vivier , Nicholas Piggin , Chinmay Rath , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Mark Cave-Ayland , Artyom Tarasenko , Max Filippov , qemu-ppc@nongnu.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=18297; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=MfzBWXcdO7bR1T0ihwCdwz5mnsGcj9uvrIxKyGP2/2o=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguz2jcx55GFt9l5uo2cFg3gz55HZb8p3DcJS h4WCJ5gfuaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5cO6D/9fLutiOxMcRfcFo2Osm1xjIcNrpYAXsLBOJGBK5xnzCqI/8fKPeTxh2g5DsETxoZD8y8d Jr5JMh9R7NkMdavg8VC/s/z2gNfrWwEyC7lWKdiv/OhRRpE1rcaS73YADdiFVJ+4TANJw0G9jiZ yqn+H22l7a685KawWgBmnZBVdgkiPeQf1nHmfP7qeqy2OUq4S221g1Vu2fOe2Wx7f4wKkg8Odho dzJ2iY6WNHMhV5y4fUZJY/9P2XxKEtbjNuieXIxe1243rG4UhjS+3DsdlyB/RdTTSSVj5W2iLEF T0Lf2ZfFTdX72O2zvYR6/lQW49k6QtEZ4lWkfrO3VIF18HTznkRpw7Qqhp8alvDAmIJ+K7kUmMV TBjvV4B5pmBRAehCLeQyW3SSx8M0iIvsmK4h0IQasu5HLCZheWMgfNWh7pq4Av/dDzm9ONfv51H 0TuxJ4ViO0+uAsJH8Hrkt9IP9T8XQl5kaHEhYobivpy/eBMX0dCcpiBgqga2W6yLH8Kc3Tq4XXX yE/RqrZR+H70zMKSw27D4t0ESauUMWKZgeX4/l1pErJHro9RMc19gJ8MTNWmNqu49OVp9gclmGk lo4C6CwFHIZTyX2b67NB2X8+JjngXAlnK/y8NxntM1/DBMUxZLuLXVTl6vifJtBLlaicKDvmfeh WCfnNaFEvi27LJQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907922959158500 These functions access mon_cpu_path, which is a MonitorHMP-specific field. Narrowing their signatures from Monitor* to MonitorHMP* makes the type system enforce what was already true at runtime: every caller is in an HMP context. The expression parser's MONITOR_HMP() casts are safe because it is only reachable from handle_hmp_command(), they will be dropped with later patches. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Dr. David Alan Gilbert --- hw/core/machine-hmp-cmds.c | 4 ++-- include/monitor/hmp.h | 7 +++--- include/monitor/monitor.h | 1 - monitor/hmp-cmds.c | 53 ++++++++++++++++++++++--------------------= ---- monitor/hmp.c | 18 ++++++++-------- monitor/monitor-internal.h | 2 +- monitor/qmp-cmds.c | 2 +- stats/stats-hmp-cmds.c | 2 +- target/i386/cpu-apic.c | 2 +- target/i386/cpu.c | 4 ++-- target/i386/monitor.c | 4 ++-- target/m68k/monitor.c | 2 +- target/ppc/monitor.c | 2 +- target/riscv/monitor.c | 2 +- target/sh4/monitor.c | 2 +- target/sparc/monitor.c | 2 +- target/xtensa/monitor.c | 2 +- 17 files changed, 54 insertions(+), 57 deletions(-) diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 4e2f0c212b0d..702c798ccc56 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -36,7 +36,7 @@ void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) g_autofree char *cpu_model =3D cpu_model_from_type(cpu->value->qom= _type); int active =3D ' '; =20 - if (cpu->value->cpu_index =3D=3D monitor_get_cpu_index(mon)) { + if (cpu->value->cpu_index =3D=3D monitor_hmp_get_cpu_index(hmp)) { active =3D '*'; } =20 @@ -228,7 +228,7 @@ void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); Error *err =3D NULL; - int cpu_index =3D monitor_get_cpu_index(mon); + int cpu_index =3D monitor_hmp_get_cpu_index(hmp); =20 if (cpu_index < 0) { monitor_printf(mon, "No CPU available\n"); diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 6aa562ddbaa2..3fd17048b319 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -30,7 +30,7 @@ OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_= HMP); struct MonitorDef { const char *name; int offset; - int64_t (*get_value)(Monitor *mon, const MonitorDef *md, int offset); + int64_t (*get_value)(MonitorHMP *hmp, const MonitorDef *md, int offset= ); }; =20 void monitor_new_hmp(const char *id, const char *chardev_id, @@ -53,8 +53,9 @@ void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)); =20 =20 -CPUArchState *mon_get_cpu_env(Monitor *mon); -CPUState *mon_get_cpu(Monitor *mon); +CPUArchState *monitor_hmp_get_cpu_env(MonitorHMP *hmp); +CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp); +int monitor_hmp_get_cpu_index(MonitorHMP *hmp); =20 bool hmp_handle_error(MonitorHMP *hmp, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 72a8f6ea5b4f..2a550aec023f 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -39,7 +39,6 @@ int monitor_fd_param(Monitor *mon, const char *fdname, Er= ror **errp); =20 int monitor_puts(Monitor *mon, const char *str); void monitor_flush(Monitor *mon); -int monitor_get_cpu_index(Monitor *mon); =20 int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d1e7e4de6585..89cc19c2431d 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -182,10 +182,10 @@ void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) Monitor *mon =3D MONITOR(hmp); int64_t cpu_index; =20 - /* XXX: drop the monitor_set_cpu() usage when all HMP commands that + /* XXX: drop the monitor_hmp_set_cpu() usage when all HMP commands that use it are converted to the QAPI */ cpu_index =3D qdict_get_int(qdict, "index"); - if (monitor_set_cpu(mon, cpu_index) < 0) { + if (monitor_hmp_set_cpu(hmp, cpu_index) < 0) { monitor_printf(mon, "invalid CPU index\n"); } } @@ -512,39 +512,37 @@ void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) #endif =20 /* Set the current CPU defined by the user. Callers must hold BQL. */ -int monitor_set_cpu(Monitor *mon, int cpu_index) +int monitor_hmp_set_cpu(MonitorHMP *hmp, int cpu_index) { - MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu; =20 cpu =3D qemu_get_cpu(cpu_index); if (cpu =3D=3D NULL) { return -1; } - g_free(hmp_mon->mon_cpu_path); - hmp_mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); + g_free(hmp->mon_cpu_path); + hmp->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); return 0; } =20 /* Callers must hold BQL. */ -static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize) +static CPUState *monitor_hmp_get_cpu_sync(MonitorHMP *hmp, bool synchroniz= e) { - MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu =3D NULL; =20 - if (hmp_mon->mon_cpu_path) { - cpu =3D (CPUState *) object_resolve_path_type(hmp_mon->mon_cpu_pat= h, + if (hmp->mon_cpu_path) { + cpu =3D (CPUState *) object_resolve_path_type(hmp->mon_cpu_path, TYPE_CPU, NULL); if (!cpu) { - g_free(hmp_mon->mon_cpu_path); - hmp_mon->mon_cpu_path =3D NULL; + g_free(hmp->mon_cpu_path); + hmp->mon_cpu_path =3D NULL; } } - if (!hmp_mon->mon_cpu_path) { + if (!hmp->mon_cpu_path) { if (!first_cpu) { return NULL; } - monitor_set_cpu(mon, first_cpu->cpu_index); + monitor_hmp_set_cpu(hmp, first_cpu->cpu_index); cpu =3D first_cpu; } assert(cpu !=3D NULL); @@ -554,21 +552,21 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool = synchronize) return cpu; } =20 -CPUState *mon_get_cpu(Monitor *mon) +CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp) { - return mon_get_cpu_sync(mon, true); + return monitor_hmp_get_cpu_sync(hmp, true); } =20 -CPUArchState *mon_get_cpu_env(Monitor *mon) +CPUArchState *monitor_hmp_get_cpu_env(MonitorHMP *hmp) { - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); =20 return cs ? cpu_env(cs) : NULL; } =20 -int monitor_get_cpu_index(Monitor *mon) +int monitor_hmp_get_cpu_index(MonitorHMP *hmp) { - CPUState *cs =3D mon_get_cpu_sync(mon, false); + CPUState *cs =3D monitor_hmp_get_cpu_sync(hmp, false); =20 return cs ? cs->cpu_index : UNASSIGNED_CPU_INDEX; } @@ -586,7 +584,7 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict *q= dict) cpu_dump_state(cs, NULL, CPU_DUMP_FPU | CPU_DUMP_VPU); } } else { - cs =3D vcpu >=3D 0 ? qemu_get_cpu(vcpu) : mon_get_cpu(mon); + cs =3D vcpu >=3D 0 ? qemu_get_cpu(vcpu) : monitor_hmp_get_cpu(hmp); =20 if (!cs) { if (vcpu >=3D 0) { @@ -602,13 +600,14 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict = *qdict) } } =20 -static void memory_dump(Monitor *mon, int count, int format, int wsize, +static void memory_dump(MonitorHMP *hmp, int count, int format, int wsize, uint64_t addr, bool is_physical) { + Monitor *mon =3D MONITOR(hmp); int l, line_size, i, max_digits, len; uint8_t buf[16]; uint64_t v; - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); const unsigned int addr_width =3D is_physical ? 8 : (target_long_bits(= ) / 4); const bool big_endian =3D target_big_endian(); =20 @@ -712,24 +711,22 @@ static void memory_dump(Monitor *mon, int count, int = format, int wsize, =20 void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); vaddr addr =3D qdict_get_int(qdict, "addr"); =20 - memory_dump(mon, count, format, size, addr, false); + memory_dump(hmp, count, format, size, addr, false); } =20 void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); hwaddr addr =3D qdict_get_int(qdict, "addr"); =20 - memory_dump(mon, count, format, size, addr, true); + memory_dump(hmp, count, format, size, addr, true); } =20 void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict) @@ -757,7 +754,7 @@ void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); vaddr addr =3D qdict_get_int(qdict, "addr"); - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); TranslateForDebugResult tres; =20 if (!cs) { diff --git a/monitor/hmp.c b/monitor/hmp.c index 47fb7cef6de2..2484a2310dff 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -411,10 +411,10 @@ void hmp_help_cmd(Monitor *mon, const char *name) * Set @pval to the value in the register identified by @name. * return %true if the register is found, %false otherwise. */ -static bool gdb_get_register(Monitor *mon, int64_t *pval, const char *name) +static bool gdb_get_register(MonitorHMP *hmp, int64_t *pval, const char *n= ame) { g_autoptr(GArray) regs =3D NULL; - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); =20 if (cs =3D=3D NULL) { return false; @@ -452,7 +452,7 @@ static bool gdb_get_register(Monitor *mon, int64_t *pva= l, const char *name) static const char *pch; static sigjmp_buf expr_env; =20 -static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name); +static int get_monitor_def(MonitorHMP *mon, int64_t *pval, const char *nam= e); =20 static G_NORETURN G_GNUC_PRINTF(2, 3) void expr_error(Monitor *mon, const char *fmt, ...) @@ -535,8 +535,8 @@ static int64_t expr_unary(Monitor *mon) pch++; } *q =3D 0; - if (!gdb_get_register(mon, ®, buf) - && get_monitor_def(mon, ®, buf) < 0) { + if (!gdb_get_register(MONITOR_HMP(mon), ®, buf) + && get_monitor_def(MONITOR_HMP(mon), ®, buf) < 0) { expr_error(mon, "unknown register"); } n =3D reg; @@ -1733,9 +1733,9 @@ void monitor_register_hmp_info_hrt(const char *name, * Set @pval to the value in the register identified by @name. * return 0 if OK, -1 if not found */ -static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name) +static int get_monitor_def(MonitorHMP *hmp, int64_t *pval, const char *nam= e) { - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); const MonitorDef *md; void *ptr; =20 @@ -1750,9 +1750,9 @@ static int get_monitor_def(Monitor *mon, int64_t *pva= l, const char *name) for (; md->name !=3D NULL; md++) { if (hmp_compare_cmd(name, md->name)) { if (md->get_value) { - *pval =3D md->get_value(mon, md, md->offset); + *pval =3D md->get_value(hmp, md, md->offset); } else { - CPUArchState *env =3D mon_get_cpu_env(mon); + CPUArchState *env =3D monitor_hmp_get_cpu_env(hmp); ptr =3D (uint8_t *)env + md->offset; *pval =3D *(int32_t *)ptr; } diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index a0fa37c887ed..afdda1386080 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -215,7 +215,7 @@ int monitor_can_read(void *opaque); void monitor_cancel_out_watch(Monitor *mon); void monitor_list_append(Monitor *mon); void monitor_fdsets_cleanup(void); -int monitor_set_cpu(Monitor *mon, int cpu_index); +int monitor_hmp_set_cpu(MonitorHMP *mon, int cpu_index); =20 void qmp_send_response(MonitorQMP *mon, const QDict *rsp); void monitor_data_destroy_qmp(MonitorQMP *mon); diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 6cb0b587fbd4..b16119f4858c 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -169,7 +169,7 @@ char *qmp_human_monitor_command(const char *command_lin= e, bool has_cpu_index, MonitorHMP *hmp =3D MONITOR_HMP(object_new(TYPE_MONITOR_HMP)); =20 if (has_cpu_index) { - int ret =3D monitor_set_cpu(&hmp->parent_obj, cpu_index); + int ret =3D monitor_hmp_set_cpu(hmp, cpu_index); if (ret < 0) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number"); diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index f280ad8c4314..cd1f1deb58bc 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -226,7 +226,7 @@ void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict) filter =3D stats_filter(target, names, -1, provider); break; case STATS_TARGET_VCPU: {} - int cpu_index =3D monitor_get_cpu_index(mon); + int cpu_index =3D monitor_hmp_get_cpu_index(hmp); filter =3D stats_filter(target, names, cpu_index, provider); break; case STATS_TARGET_CRYPTODEV: diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 2cb3147837d1..3ae20f004b64 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -93,7 +93,7 @@ void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qd= ict) cpu_synchronize_state(cs); } } else { - cs =3D mon_get_cpu(mon); + cs =3D monitor_hmp_get_cpu(hmp); } =20 =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e5ffb10d1565..f0687b5c482d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10853,10 +10853,10 @@ static const Property x86_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY =20 -static int64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md, +static int64_t monitor_get_pc(MonitorHMP *hmp, const struct MonitorDef *md, int offset) { - CPUArchState *env =3D mon_get_cpu_env(mon); + CPUArchState *env =3D monitor_hmp_get_cpu_env(hmp); int64_t ret =3D env->eip + env->segs[R_CS].base; =20 if (!(env->hflags & HF_CS64_MASK)) { diff --git a/target/i386/monitor.c b/target/i386/monitor.c index f68dd38ac225..72bcab131f77 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -215,7 +215,7 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) CPUArchState *env; AddressSpace *as; =20 - env =3D mon_get_cpu_env(mon); + env =3D monitor_hmp_get_cpu_env(hmp); if (!env) { monitor_printf(mon, "No CPU available\n"); return; @@ -542,7 +542,7 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) CPUArchState *env; AddressSpace *as; =20 - env =3D mon_get_cpu_env(mon); + env =3D monitor_hmp_get_cpu_env(hmp); if (!env) { monitor_printf(mon, "No CPU available\n"); return; diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 0414474f2ffb..5645a5d4d4f5 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -13,7 +13,7 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); - CPUArchState *env1 =3D mon_get_cpu_env(mon); + CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { monitor_printf(mon, "No CPU available\n"); diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 99eda7351877..5769829bdd7e 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -14,7 +14,7 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); - CPUArchState *env1 =3D mon_get_cpu_env(mon); + CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { monitor_printf(mon, "No CPU available\n"); diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 496d519c978d..4c9c0c793b36 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -220,7 +220,7 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) Monitor *mon =3D MONITOR(hmp); CPUArchState *env; =20 - env =3D mon_get_cpu_env(mon); + env =3D monitor_hmp_get_cpu_env(hmp); if (!env) { monitor_printf(mon, "No CPU available\n"); return; diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 50da650b2e04..4e443152bf56 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -41,7 +41,7 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); - CPUArchState *env =3D mon_get_cpu_env(mon); + CPUArchState *env =3D monitor_hmp_get_cpu_env(hmp); int i; =20 if (!env) { diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 09a15b821a1a..e826e584a918 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -30,7 +30,7 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); - CPUArchState *env1 =3D mon_get_cpu_env(mon); + CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { monitor_printf(mon, "No CPU available\n"); diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index a1082c44e11c..b7b7387706f3 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -29,7 +29,7 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); - CPUArchState *env1 =3D mon_get_cpu_env(mon); + CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { monitor_printf(mon, "No CPU available\n"); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907749; cv=none; d=zohomail.com; s=zohoarc; b=QzhmyfJ1bCqfVe6LQmmQfY5mCye8JoQqvIu3vfFON+zHJuenzE9xnLCn9PGm6+2+I2jGuR/5Vz9fw7+tFtc4a/B/7SIMyNeF0N53j2GZ+iDTXJUN2KV9UZ2/gulR7hkN5VBZgrviUJAQi+mpCXe51B7qCKbP67SMQCDea/lhnW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907749; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nhcs5kFxRmDDBHARyXBJo1YaXoZWDvdCjupeG2jyQsc=; b=BIm98F7tYmtZymHjKyDM+2DJbtMRAw9vVT0cqWHVOcj+2FhwQtZtO7uQLxkqYX4BaebgqlIzdvOiK3ZL7xiHIaoHloP882RaE4PDNmfV7ZTBfL38k6Rv46hIgbBIlgflTH6IgGitcRarKOu54BOXqlYcYizWr8BhW0vi/5x6SlE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1786907749014527.8404266317541; Sun, 16 Aug 2026 12:15:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1392348.1631349 (Exim 4.92) (envelope-from ) id 1wvgKV-0002Te-AI; Sun, 16 Aug 2026 19:15:35 +0000 Received: by outflank-mailman (output) from mailman id 1392348.1631349; Sun, 16 Aug 2026 19:15:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wvgKV-0002TX-72; Sun, 16 Aug 2026 19:15:35 +0000 Received: by outflank-mailman (input) for mailman id 1392348; Sun, 16 Aug 2026 19:15:33 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wvgKT-0002T4-Fi for xen-devel@lists.xenproject.org; Sun, 16 Aug 2026 19:15:33 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wvgKS-003gUE-SZ for xen-devel@lists.xenproject.org; Sun, 16 Aug 2026 21:15:32 +0200 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a820c1c-2eae-0a2a0a5409dd-0a2a450bdee2-2 for ; Sun, 16 Aug 2026 21:15:32 +0200 Received: from [170.10.133.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a820c53-b7e8-0a2a450b0019-aa0a857c7edb-3 for ; Sun, 16 Aug 2026 21:15:32 +0200 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-3qm0RnTJOAibztlqk4yKIg-1; Sun, 16 Aug 2026 15:15:27 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EEDD219560A2; Sun, 16 Aug 2026 19:15:20 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A1E0C423; Sun, 16 Aug 2026 19:15:16 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907731; 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=Nhcs5kFxRmDDBHARyXBJo1YaXoZWDvdCjupeG2jyQsc=; b=WPPMmbipsnniT4wubzRYxsvBMWnUUgLVN1NHY761Ijey4y0w0PcTd04dsnzH0h3jQrHc+w UplLf4O+fI66agsHukH9OIu/OIhN4y8eDxG0u+KjOk7iFYPmn8PEXYHlwGWMiJLD5CPJaU p1sCNqbclCafEllrHzu3pOZSrxtruhA= X-MC-Unique: 3qm0RnTJOAibztlqk4yKIg-1 X-Mimecast-MFC-AGG-ID: 3qm0RnTJOAibztlqk4yKIg_1786907721 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:04 +0400 Subject: [PATCH v3 37/49] monitor: tighten monitor_printf*() MIME-Version: 1.0 Message-Id: <20260816-qemu-no-hmp-v3-37-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Gerd Hoffmann , "Gonglei (Arei)" , zhenwei pi , Kevin Wolf , Hanna Reitz , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Ani Sinha , Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , Brian Cain , David Woodhouse , Paul Durrant , Richard Henderson , Marcelo Tosatti , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Halil Pasic , Christian Borntraeger , Jason Herne , Cornelia Huck , Eric Farman , Matthew Rosato , Ilya Leoshkevich , David Hildenbrand , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , "Dr. David Alan Gilbert" , Hyman Huang , Peter Xu , Fabiano Rosas , Samuel Thibault , Stefan Berger , Zhao Liu , Nicholas Piggin , Chinmay Rath , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Artyom Tarasenko , Max Filippov , Stefan Hajnoczi , qemu-block@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=268373; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=1bJXUnQzbOJBHG9RmXY0RR6uArdDrhXQAg5hT70VL4g=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqgguzr4z/HK8VTRbx3wJ52hDUo5iNXjld4+CHK J+43SGMcIOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILswAKCRDa6OEJdZac 5SYgEACmCXFNKzQ26QsynhAa1sJ9/3lt5lC5LRsootO+nBuyusgwU+H6xDCto996tcAvhD+2tdG vdKQl9pAqpe1yY0ER34XZK/mNMJ8gPHnnGLsCSgXMRz+rvgi+Cj8e89WnmIksZ9o72R2+XZR1VN 5n40suQs7qJEYSaEVl5tS87H6i7G57F73uX1YAJr+ChXw1lO5BWGkXj95u0jBnu1xYEWNMV46a7 ktXEJr9b6wOwUsHPgcYBbNzKApLscHHHch8ErcpEX7xdR9H3XfN9EqjQ035mBczVCekkZmm3KEn Ndcz3CyCOmfbX7IXLVcD+V+k8VO0BtJJucTy44WxRTCiaMI4FlAfXN+Xojz5Uvyv8Gb6H6GncWP 7CSVIKGWwB5t+vCrg10/l4hkTMwta8vCFNeBXK/9MlMsAlkbOetoBuOEkdIXFC+0cQQ2CuJEaf8 hWLk/Pk0UYzQ/RxZZfu3aYCPJwaqicVLSZ8iGmFeH9jt4i3MfhqmaH+8gI93cuBd/GpRUnZbOqd Zza8C6wY1pdXgktxEqj7LL+YFWdwCNB/PTyl+iPBQ2ludL8iVPyRmuM0tt+DWWyZ3XAiGXFFbPH FD+yX3wtaG8Xw0LfFFZnZxn7xrcgVTauLwUj9ladCAMNNAK1w6mIVRN4M158ThePSvKBEJQYZdQ piBp+BxADajy/sg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-MFC-PROC-ID: eOv4-GWIQVZG-03GZVXYIkiEYMbsAtRsFssa-Rjezx4_1786907721 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-42698a/1786907732-A84CBA4A-40BD4DDB/0/0 X-purgate-type: clean X-purgate-size: 268375 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907750789158500 Rename monitor_printf->monitor_hmp_printf, monitor_vprintf-> monitor_hmp_vprintf, and monitor_printc->monitor_hmp_printc, changing the first parameter from Monitor * to MonitorHMP * to enforce type safety. The implementation is also simplified: monitor_hmp_vprintf now directly calls g_strdup_vprintf + monitor_puts, removing the virtual dispatch via moncls->vprintf. The dev_print() callbacks are temporarily using the MONITOR_HMP(mon) cast, they are fixed in the following commits. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Jason J. Herne --- audio/audio-hmp-cmds.c | 6 +- backends/cryptodev-hmp-cmds.c | 9 +- block/monitor/block-hmp-cmds.c | 170 +++++++++--------- chardev/char-hmp-cmds.c | 12 +- disas/disas-mon.c | 10 +- docs/devel/style.rst | 2 +- docs/devel/writing-monitor-commands.rst | 8 +- dump/dump-hmp-cmds.c | 5 +- hw/char/virtio-serial-bus.c | 10 +- hw/core/machine-hmp-cmds.c | 213 +++++++++++----------- hw/core/sysbus.c | 5 +- hw/hexagon/hexagon_tlb.c | 44 ++--- hw/i386/kvm/xen-stubs.c | 6 +- hw/i386/kvm/xen_evtchn.c | 21 +-- hw/i386/sgx-hmp-stub.c | 3 +- hw/i386/sgx.c | 29 ++- hw/misc/auxbus.c | 9 +- hw/misc/mos6522-stub.c | 3 +- hw/net/rocker/rocker-hmp-cmds.c | 146 ++++++++------- hw/pci/pci-hmp-cmds.c | 114 ++++++------ hw/pci/pci-stub.c | 3 +- hw/s390x/s390-skeys.c | 9 +- hw/s390x/s390-stattrib.c | 20 +-- hw/uefi/ovmf-log.c | 5 +- hw/usb/bus.c | 11 +- hw/usb/host-libusb.c | 21 ++- hw/virtio/virtio-hmp-cmds.c | 297 +++++++++++++++-------------= --- hw/xen/xen-bus.c | 5 +- include/disas/disas.h | 4 +- include/monitor/hmp.h | 12 +- migration/dirtyrate.c | 46 +++-- migration/migration-hmp-cmds.c | 305 ++++++++++++++++------------= ---- monitor/hmp-cmds.c | 141 +++++++-------- monitor/hmp.c | 143 +++++++-------- monitor/monitor-internal.h | 6 - monitor/monitor.c | 33 ++-- net/net-hmp-cmds.c | 31 ++-- net/slirp.c | 31 ++-- qom/qom-hmp-cmds.c | 27 ++- replay/replay-debugging.c | 5 +- stats/stats-hmp-cmds.c | 57 +++--- stubs/hmp-cmd-info_sev.c | 3 +- stubs/monitor-core.c | 2 +- system/dirtylimit-hmp-cmds.c | 10 +- system/qdev-monitor.c | 19 +- system/runstate-hmp-cmds.c | 16 +- system/tpm-hmp-cmds.c | 29 ++- target/i386/cpu-apic.c | 3 +- target/i386/monitor.c | 152 ++++++++-------- target/i386/sev.c | 35 ++-- target/m68k/monitor.c | 3 +- target/ppc/monitor.c | 3 +- target/riscv/monitor.c | 55 +++--- target/sh4/monitor.c | 29 ++- target/sparc/monitor.c | 3 +- target/xtensa/monitor.c | 3 +- tests/unit/test-util-sockets.c | 2 +- tools/qemu-vnc/clipboard.c | 4 +- tools/qemu-vnc/stubs.c | 2 +- trace/trace-hmp-cmds.c | 12 +- ui/ui-hmp-cmds.c | 115 ++++++------ util/error-report.c | 2 +- util/qemu-print.c | 4 +- 63 files changed, 1214 insertions(+), 1329 deletions(-) diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 4d326ec99fdf..94182fe1d71f 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -34,14 +34,13 @@ static QLIST_HEAD (capture_list_head, CaptureState) cap= ture_head; =20 void hmp_info_capture(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int i; CaptureState *s; =20 warn_report_once("'info capture' is deprecated since v10.2, to be remo= ved"); =20 for (s =3D capture_head.lh_first, i =3D 0; s; s =3D s->entries.le_next= , ++i) { - monitor_printf(mon, "[%d]: ", i); + monitor_hmp_printf(hmp, "[%d]: ", i); s->ops.info (s->opaque); } } @@ -66,7 +65,6 @@ void hmp_stopcapture(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_wavcapture(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_str(qdict, "path"); int freq =3D qdict_get_try_int(qdict, "freq", 44100); int bits =3D qdict_get_try_int(qdict, "bits", 16); @@ -86,7 +84,7 @@ void hmp_wavcapture(MonitorHMP *hmp, const QDict *qdict) s =3D g_malloc0 (sizeof (*s)); =20 if (wav_start_capture(as, s, path, freq, bits, nchannels)) { - monitor_printf(mon, "Failed to add wave capture\n"); + monitor_hmp_printf(hmp, "Failed to add wave capture\n"); g_free (s); return; } diff --git a/backends/cryptodev-hmp-cmds.c b/backends/cryptodev-hmp-cmds.c index fb62428d795a..aafa4b970d24 100644 --- a/backends/cryptodev-hmp-cmds.c +++ b/backends/cryptodev-hmp-cmds.c @@ -19,7 +19,6 @@ =20 void hmp_info_cryptodev(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); QCryptodevInfoList *il; QCryptodevBackendServiceTypeList *sl; QCryptodevBackendClientList *cl; @@ -41,13 +40,13 @@ void hmp_info_cryptodev(MonitorHMP *hmp, const QDict *q= dict) services =3D tmp_services; } } - monitor_printf(mon, "%s: service=3D[%s]\n", info->id, services); + monitor_hmp_printf(hmp, "%s: service=3D[%s]\n", info->id, services= ); =20 for (cl =3D info->client; cl; cl =3D cl->next) { QCryptodevBackendClient *client =3D cl->value; - monitor_printf(mon, " queue %" PRIu32 ": type=3D%s\n", - client->queue, - QCryptodevBackendType_str(client->type)); + monitor_hmp_printf(hmp, " queue %" PRIu32 ": type=3D%s\n", + client->queue, + QCryptodevBackendType_str(client->type)); } } =20 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index a2666e2f1b9b..7bae4d425c6d 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -89,7 +89,6 @@ out: =20 void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; DriveInfo *dinfo; QemuOpts *opts; @@ -119,7 +118,7 @@ void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict) =20 switch (dinfo->type) { case IF_NONE: - monitor_printf(mon, "OK\n"); + monitor_hmp_printf(hmp, "OK\n"); break; default: error_setg(&err, "Can't hot-add drive to type %d", dinfo->type); @@ -552,9 +551,10 @@ void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict) hmp_handle_error(hmp, err); } =20 -static void print_block_info(Monitor *mon, BlockInfo *info, +static void print_block_info(MonitorHMP *hmp, BlockInfo *info, BlockDeviceInfo *inserted, bool verbose) { + Monitor *mon =3D MONITOR(hmp); ImageInfo *image_info; =20 assert(!info || !info->inserted || info->inserted =3D=3D inserted); @@ -562,7 +562,7 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, if (info && *info->device) { monitor_puts(mon, info->device); if (inserted && inserted->node_name) { - monitor_printf(mon, " (%s)", inserted->node_name); + monitor_hmp_printf(hmp, " (%s)", inserted->node_name); } } else { assert(info || inserted); @@ -573,29 +573,29 @@ static void print_block_info(Monitor *mon, BlockInfo = *info, } =20 if (inserted) { - monitor_printf(mon, ": %s (%s%s%s%s)\n", - inserted->file, - inserted->drv, - inserted->ro ? ", read-only" : "", - inserted->encrypted ? ", encrypted" : "", - inserted->active ? "" : ", inactive"); + monitor_hmp_printf(hmp, ": %s (%s%s%s%s)\n", + inserted->file, + inserted->drv, + inserted->ro ? ", read-only" : "", + inserted->encrypted ? ", encrypted" : "", + inserted->active ? "" : ", inactive"); } else { - monitor_printf(mon, ": [not inserted]\n"); + monitor_hmp_printf(hmp, ": [not inserted]\n"); } =20 if (info) { if (info->qdev) { - monitor_printf(mon, " Attached to: %s\n", info->qdev); + monitor_hmp_printf(hmp, " Attached to: %s\n", info->qd= ev); } if (info->has_io_status && info->io_status !=3D BLOCK_DEVICE_IO_ST= ATUS_OK) { - monitor_printf(mon, " I/O status: %s\n", - BlockDeviceIoStatus_str(info->io_status)); + monitor_hmp_printf(hmp, " I/O status: %s\n", + BlockDeviceIoStatus_str(info->io_status)); } =20 if (info->removable) { - monitor_printf(mon, " Removable device: %slocked, tray %s\n= ", - info->locked ? "" : "not ", - info->tray_open ? "open" : "closed"); + monitor_hmp_printf(hmp, " Removable device: %slocked, tray = %s\n", + info->locked ? "" : "not ", + info->tray_open ? "open" : "closed"); } } =20 @@ -604,28 +604,28 @@ static void print_block_info(Monitor *mon, BlockInfo = *info, return; } =20 - monitor_printf(mon, " Cache mode: %s%s%s\n", - inserted->cache->writeback ? "writeback" : "writethroug= h", - inserted->cache->direct ? ", direct" : "", - inserted->cache->no_flush ? ", ignore flushes" : ""); + monitor_hmp_printf(hmp, " Cache mode: %s%s%s\n", + inserted->cache->writeback ? "writeback" : "writeth= rough", + inserted->cache->direct ? ", direct" : "", + inserted->cache->no_flush ? ", ignore flushes" : ""= ); =20 if (inserted->backing_file) { - monitor_printf(mon, - " Backing file: %s " - "(chain depth: %" PRId64 ")\n", - inserted->backing_file, - inserted->backing_file_depth); + monitor_hmp_printf(hmp, + " Backing file: %s " + "(chain depth: %" PRId64 ")\n", + inserted->backing_file, + inserted->backing_file_depth); } =20 if (inserted->detect_zeroes !=3D BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) { - monitor_printf(mon, " Detect zeroes: %s\n", + monitor_hmp_printf(hmp, " Detect zeroes: %s\n", BlockdevDetectZeroesOptions_str(inserted->detect_zeroes)); } =20 if (inserted->bps || inserted->bps_rd || inserted->bps_wr || inserted->iops || inserted->iops_rd || inserted->iops_wr) { - monitor_printf(mon, " I/O throttling: bps=3D%" PRId64 + monitor_hmp_printf(hmp, " I/O throttling: bps=3D%" PRId64 " bps_rd=3D%" PRId64 " bps_wr=3D%" PRId64 " bps_max=3D%" PRId64 " bps_rd_max=3D%" PRId64 @@ -654,7 +654,7 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, } =20 if (verbose) { - monitor_printf(mon, "\nImages:\n"); + monitor_hmp_printf(hmp, "\nImages:\n"); image_info =3D inserted->image; while (1) { bdrv_node_info_dump(qapi_ImageInfo_base(image_info), 0, false); @@ -669,7 +669,6 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, =20 void hmp_info_block(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); BlockInfoList *block_list, *info; BlockDeviceInfoList *blockdev_list, *blockdev; const char *device =3D qdict_get_try_str(qdict, "device"); @@ -690,10 +689,10 @@ void hmp_info_block(MonitorHMP *hmp, const QDict *qdi= ct) } =20 if (info !=3D block_list) { - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 - print_block_info(mon, info->value, info->value->inserted, + print_block_info(hmp, info->value, info->value->inserted, verbose); printed =3D true; } @@ -713,17 +712,16 @@ void hmp_info_block(MonitorHMP *hmp, const QDict *qdi= ct) } =20 if (blockdev !=3D blockdev_list) { - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 - print_block_info(mon, NULL, blockdev->value, verbose); + print_block_info(hmp, NULL, blockdev->value, verbose); } qapi_free_BlockDeviceInfoList(blockdev_list); } =20 void hmp_info_blockstats(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); BlockStatsList *stats_list, *stats; =20 stats_list =3D qmp_query_blockstats(false, false, NULL); @@ -733,28 +731,28 @@ void hmp_info_blockstats(MonitorHMP *hmp, const QDict= *qdict) continue; } =20 - monitor_printf(mon, "%s%s: idle_time_ns=3D%" PRId64 "\n", - stats !=3D stats_list ? "\n" : "", - stats->value->device, - stats->value->stats->idle_time_ns); - monitor_printf(mon, " %24s %16s %24s %10s\n", "bytes", - "operations", "total_time_ns", "merged"); - monitor_printf(mon, "Read: %24" PRId64 " %16" PRId64 " %24" PRId64 - " %10" PRId64 "\n", - stats->value->stats->rd_bytes, - stats->value->stats->rd_operations, - stats->value->stats->rd_total_time_ns, - stats->value->stats->rd_merged); - monitor_printf(mon, "Write: %24" PRId64 " %16" PRId64 " %24" PRId64 - " %10" PRId64 "\n", - stats->value->stats->wr_bytes, - stats->value->stats->wr_operations, - stats->value->stats->wr_total_time_ns, - stats->value->stats->wr_merged); - monitor_printf(mon, "Flush: %24s %16" PRId64 " %24" PRId64 "\n", - "", - stats->value->stats->flush_operations, - stats->value->stats->flush_total_time_ns); + monitor_hmp_printf(hmp, "%s%s: idle_time_ns=3D%" PRId64 "\n", + stats !=3D stats_list ? "\n" : "", + stats->value->device, + stats->value->stats->idle_time_ns); + monitor_hmp_printf(hmp, " %24s %16s %24s %10s\n", "bytes", + "operations", "total_time_ns", "merged"); + monitor_hmp_printf(hmp, "Read: %24" PRId64 " %16" PRId64 " %24" P= RId64 + " %10" PRId64 "\n", + stats->value->stats->rd_bytes, + stats->value->stats->rd_operations, + stats->value->stats->rd_total_time_ns, + stats->value->stats->rd_merged); + monitor_hmp_printf(hmp, "Write: %24" PRId64 " %16" PRId64 " %24" P= RId64 + " %10" PRId64 "\n", + stats->value->stats->wr_bytes, + stats->value->stats->wr_operations, + stats->value->stats->wr_total_time_ns, + stats->value->stats->wr_merged); + monitor_hmp_printf(hmp, "Flush: %24s %16" PRId64 " %24" PRId64 "\n= ", + "", + stats->value->stats->flush_operations, + stats->value->stats->flush_total_time_ns); } =20 qapi_free_BlockStatsList(stats_list); @@ -762,34 +760,33 @@ void hmp_info_blockstats(MonitorHMP *hmp, const QDict= *qdict) =20 void hmp_info_block_jobs(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); BlockJobInfoList *list; =20 list =3D qmp_query_block_jobs(&error_abort); =20 if (!list) { - monitor_printf(mon, "No active jobs\n"); + monitor_hmp_printf(hmp, "No active jobs\n"); return; } =20 while (list) { if (list->value->type =3D=3D JOB_TYPE_STREAM) { - monitor_printf(mon, "Streaming device %s: Completed %" PRId64 - " of %" PRId64 " bytes, speed limit %" PRId64 - " bytes/s\n", - list->value->device, - list->value->offset, - list->value->len, - list->value->speed); + monitor_hmp_printf(hmp, "Streaming device %s: Completed %" PRI= d64 + " of %" PRId64 " bytes, speed limit %" PRId= 64 + " bytes/s\n", + list->value->device, + list->value->offset, + list->value->len, + list->value->speed); } else { - monitor_printf(mon, "Type %s, device %s: Completed %" PRId64 - " of %" PRId64 " bytes, speed limit %" PRId64 - " bytes/s\n", - JobType_str(list->value->type), - list->value->device, - list->value->offset, - list->value->len, - list->value->speed); + monitor_hmp_printf(hmp, "Type %s, device %s: Completed %" PRId= 64 + " of %" PRId64 " bytes, speed limit %" PRId= 64 + " bytes/s\n", + JobType_str(list->value->type), + list->value->device, + list->value->offset, + list->value->len, + list->value->speed); } list =3D list->next; } @@ -799,7 +796,6 @@ void hmp_info_block_jobs(MonitorHMP *hmp, const QDict *= qdict) =20 void hmp_info_snapshots(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); BlockDriverState *bs, *bs1; BdrvNextIterator it1; QEMUSnapshotInfo *sn_tab, *sn; @@ -837,7 +833,7 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict *q= dict) nb_sns =3D bdrv_snapshot_list(bs, &sn_tab); =20 if (nb_sns < 0) { - monitor_printf(mon, "bdrv_snapshot_list: error %d\n", nb_sns); + monitor_hmp_printf(hmp, "bdrv_snapshot_list: error %d\n", nb_sns); return; } =20 @@ -866,7 +862,7 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict *q= dict) } =20 if (no_snapshot) { - monitor_printf(mon, "There is no snapshot available.\n"); + monitor_hmp_printf(hmp, "There is no snapshot available.\n"); return; } =20 @@ -889,11 +885,11 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict = *qdict) } } } - monitor_printf(mon, "List of snapshots present on all disks:\n"); + monitor_hmp_printf(hmp, "List of snapshots present on all disks:\n"); =20 if (total > 0) { bdrv_snapshot_dump(NULL); - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); for (i =3D 0; i < total; i++) { sn =3D &sn_tab[global_snapshots[i]]; /* @@ -902,24 +898,24 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict = *qdict) */ pstrcpy(sn->id_str, sizeof(sn->id_str), "--"); bdrv_snapshot_dump(sn); - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } } else { - monitor_printf(mon, "None\n"); + monitor_hmp_printf(hmp, "None\n"); } =20 QTAILQ_FOREACH(image_entry, &image_list, next) { if (QTAILQ_EMPTY(&image_entry->snapshots)) { continue; } - monitor_printf(mon, - "\nList of partial (non-loadable) snapshots on '%s'= :\n", - image_entry->imagename); + monitor_hmp_printf(hmp, + "\nList of partial (non-loadable) snapshots on = '%s':\n", + image_entry->imagename); bdrv_snapshot_dump(NULL); - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) { bdrv_snapshot_dump(&snapshot_entry->sn); - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } } =20 @@ -935,7 +931,7 @@ void hmp_info_snapshots(MonitorHMP *hmp, const QDict *q= dict) g_free(global_snapshots); } =20 -void hmp_change_medium(Monitor *mon, const char *device, const char *targe= t, +void hmp_change_medium(MonitorHMP *hmp, const char *device, const char *ta= rget, const char *arg, const char *read_only, bool force, Error **errp) { diff --git a/chardev/char-hmp-cmds.c b/chardev/char-hmp-cmds.c index 71017fd2d19e..fb0560054b7b 100644 --- a/chardev/char-hmp-cmds.c +++ b/chardev/char-hmp-cmds.c @@ -26,12 +26,11 @@ =20 void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); ChardevInfoList *char_info, *info; =20 char_info =3D qmp_query_chardev(NULL); for (info =3D char_info; info; info =3D info->next) { - monitor_printf(mon, "%s: filename=3D%s\n", info->value->label, + monitor_hmp_printf(hmp, "%s: filename=3D%s\n", info->value->label, info->value->filename); } =20 @@ -51,7 +50,6 @@ void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdic= t) =20 void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *chardev =3D qdict_get_str(qdict, "device"); char *data; @@ -67,15 +65,15 @@ void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdi= ct) unsigned char ch =3D data[i]; =20 if (ch =3D=3D '\\') { - monitor_printf(mon, "\\\\"); + monitor_hmp_printf(hmp, "\\\\"); } else if ((ch < 0x20 && ch !=3D '\n' && ch !=3D '\t') || ch =3D= =3D 0x7F) { - monitor_printf(mon, "\\u%04X", ch); + monitor_hmp_printf(hmp, "\\u%04X", ch); } else { - monitor_printf(mon, "%c", ch); + monitor_hmp_printf(hmp, "%c", ch); } =20 } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); g_free(data); } =20 diff --git a/disas/disas-mon.c b/disas/disas-mon.c index bc9dec3a7761..32e4220181a8 100644 --- a/disas/disas-mon.c +++ b/disas/disas-mon.c @@ -38,7 +38,7 @@ physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, i= nt length, } =20 /* Disassembler for the monitor. */ -void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, +void monitor_disas(MonitorHMP *hmp, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical) { int count, i; @@ -58,13 +58,13 @@ void monitor_disas(Monitor *mon, CPUState *cpu, uint64_= t pc, s.info.buffer_vma =3D pc; =20 if (s.info.cap_arch >=3D 0 && cap_disas_monitor(&s.info, pc, nb_insn))= { - monitor_puts(mon, ds->str); + monitor_puts(MONITOR(hmp), ds->str); return; } =20 if (!s.info.print_insn) { - monitor_printf(mon, "0x%08" PRIx64 - ": Asm output not supported on this arch\n", pc); + monitor_hmp_printf(hmp, "0x%08" PRIx64 + ": Asm output not supported on this arch\n", pc= ); return; } =20 @@ -78,5 +78,5 @@ void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t = pc, pc +=3D count; } =20 - monitor_puts(mon, ds->str); + monitor_puts(MONITOR(hmp), ds->str); } diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 6c5f94cc5098..6876d3a59ec7 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -754,7 +754,7 @@ Error handling and reporting Reporting errors to the human user ---------------------------------- =20 -Do not use printf(), fprintf() or monitor_printf(). Instead, use +Do not use printf(), fprintf() or monitor_hmp_printf(). Instead, use error_report() or error_vreport() from error-report.h. This ensures the error is reported in the right place (current monitor or stderr), and in a uniform format. diff --git a/docs/devel/writing-monitor-commands.rst b/docs/devel/writing-m= onitor-commands.rst index 7ae7efe32759..baf94cbdefab 100644 --- a/docs/devel/writing-monitor-commands.rst +++ b/docs/devel/writing-monitor-commands.rst @@ -479,7 +479,7 @@ The HMP command =20 Here's the HMP counterpart of the query-option-roms command:: =20 - void hmp_info_option_roms(Monitor *mon, const QDict *qdict) + void hmp_info_option_roms(MonitorHMP *mon, const QDict *qdict) { Error *err =3D NULL; OptionRomInfoList *info_list, *tail; @@ -492,11 +492,11 @@ Here's the HMP counterpart of the query-option-roms c= ommand:: =20 for (tail =3D info_list; tail; tail =3D tail->next) { info =3D tail->value; - monitor_printf(mon, "%s", info->filename); + monitor_hmp_printf(mon, "%s", info->filename); if (info->has_bootindex) { - monitor_printf(mon, " %" PRId64, info->bootindex); + monitor_hmp_printf(mon, " %" PRId64, info->bootindex); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(mon, "\n"); } =20 qapi_free_OptionRomInfoList(info_list); diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c index 104ab5d2a53a..c7045c2d7314 100644 --- a/dump/dump-hmp-cmds.c +++ b/dump/dump-hmp-cmds.c @@ -85,17 +85,16 @@ void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict= *qdict) =20 void hmp_info_dump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); DumpQueryResult *result =3D qmp_query_dump(NULL); =20 assert(result && result->status < DUMP_STATUS__MAX); - monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status)); + monitor_hmp_printf(hmp, "Status: %s\n", DumpStatus_str(result->status)= ); =20 if (result->status =3D=3D DUMP_STATUS_ACTIVE) { float percent =3D 0; assert(result->total !=3D 0); percent =3D 100.0 * result->completed / result->total; - monitor_printf(mon, "Finished: %.2f %%\n", percent); + monitor_hmp_printf(hmp, "Finished: %.2f %%\n", percent); } =20 qapi_free_DumpQueryResult(result); diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 02604740f86a..33fdc0846ac3 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -838,11 +838,11 @@ static void virtser_bus_dev_print(Monitor *mon, Devic= eState *qdev, int indent) { VirtIOSerialPort *port =3D VIRTIO_SERIAL_PORT(qdev); =20 - monitor_printf(mon, "%*sport %d, guest %s, host %s, throttle %s\n", - indent, "", port->id, - port->guest_connected ? "on" : "off", - port->host_connected ? "on" : "off", - port->throttled ? "on" : "off"); + monitor_hmp_printf(MONITOR_HMP(mon), "%*sport %d, guest %s, host %s, t= hrottle %s\n", + indent, "", port->id, + port->guest_connected ? "on" : "off", + port->host_connected ? "on" : "off", + port->throttled ? "on" : "off"); } =20 /* This function is only used if a port id is not provided by the user */ diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 702c798ccc56..10a633af0780 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -27,7 +27,6 @@ =20 void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CpuInfoFastList *cpu_list, *cpu; =20 cpu_list =3D qmp_query_cpus_fast(NULL); @@ -40,10 +39,10 @@ void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) active =3D '*'; } =20 - monitor_printf(mon, "%c CPU #%" PRId64 ":", active, - cpu->value->cpu_index); - monitor_printf(mon, " thread_id=3D%" PRId64 " model=3D%s\n", - cpu->value->thread_id, cpu_model); + monitor_hmp_printf(hmp, "%c CPU #%" PRId64 ":", active, + cpu->value->cpu_index); + monitor_hmp_printf(hmp, " thread_id=3D%" PRId64 " model=3D%s\n", + cpu->value->thread_id, cpu_model); } =20 qapi_free_CpuInfoFastList(cpu_list); @@ -51,7 +50,6 @@ void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; HotpluggableCPUList *l =3D qmp_query_hotpluggable_cpus(&err); HotpluggableCPUList *saved =3D l; @@ -61,45 +59,45 @@ void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict= *qdict) return; } =20 - monitor_printf(mon, "Hotpluggable CPUs:\n"); + monitor_hmp_printf(hmp, "Hotpluggable CPUs:\n"); while (l) { - monitor_printf(mon, " type: \"%s\"\n", l->value->type); - monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n", - l->value->vcpus_count); + monitor_hmp_printf(hmp, " type: \"%s\"\n", l->value->type); + monitor_hmp_printf(hmp, " vcpus_count: \"%" PRIu64 "\"\n", + l->value->vcpus_count); if (l->value->qom_path) { - monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path= ); + monitor_hmp_printf(hmp, " qom_path: \"%s\"\n", l->value->qom_= path); } =20 c =3D l->value->props; - monitor_printf(mon, " CPUInstance Properties:\n"); + monitor_hmp_printf(hmp, " CPUInstance Properties:\n"); if (c->has_node_id) { - monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_= id); + monitor_hmp_printf(hmp, " node-id: \"%" PRIu64 "\"\n", c->n= ode_id); } if (c->has_drawer_id) { - monitor_printf(mon, " drawer-id: \"%" PRIu64 "\"\n", c->dra= wer_id); + monitor_hmp_printf(hmp, " drawer-id: \"%" PRIu64 "\"\n", c-= >drawer_id); } if (c->has_book_id) { - monitor_printf(mon, " book-id: \"%" PRIu64 "\"\n", c->book_= id); + monitor_hmp_printf(hmp, " book-id: \"%" PRIu64 "\"\n", c->b= ook_id); } if (c->has_socket_id) { - monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->soc= ket_id); + monitor_hmp_printf(hmp, " socket-id: \"%" PRIu64 "\"\n", c-= >socket_id); } if (c->has_die_id) { - monitor_printf(mon, " die-id: \"%" PRIu64 "\"\n", c->die_id= ); + monitor_hmp_printf(hmp, " die-id: \"%" PRIu64 "\"\n", c->di= e_id); } if (c->has_cluster_id) { - monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n", - c->cluster_id); + monitor_hmp_printf(hmp, " cluster-id: \"%" PRIu64 "\"\n", + c->cluster_id); } if (c->has_module_id) { - monitor_printf(mon, " module-id: \"%" PRIu64 "\"\n", - c->module_id); + monitor_hmp_printf(hmp, " module-id: \"%" PRIu64 "\"\n", + c->module_id); } if (c->has_core_id) { - monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_= id); + monitor_hmp_printf(hmp, " core-id: \"%" PRIu64 "\"\n", c->c= ore_id); } if (c->has_thread_id) { - monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thr= ead_id); + monitor_hmp_printf(hmp, " thread-id: \"%" PRIu64 "\"\n", c-= >thread_id); } =20 l =3D l->next; @@ -110,7 +108,6 @@ void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict= *qdict) =20 void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemdevList *memdev_list =3D qmp_query_memdev(&err); MemdevList *m =3D memdev_list; @@ -120,31 +117,31 @@ void hmp_info_memdev(MonitorHMP *hmp, const QDict *qd= ict) while (m) { v =3D string_output_visitor_new(false, &str); visit_type_uint16List(v, NULL, &m->value->host_nodes, &error_abort= ); - monitor_printf(mon, "memory backend: %s\n", m->value->id); - monitor_printf(mon, " size: %" PRId64 "\n", m->value->size); - monitor_printf(mon, " merge: %s\n", - m->value->merge ? "true" : "false"); - monitor_printf(mon, " dump: %s\n", - m->value->dump ? "true" : "false"); - monitor_printf(mon, " prealloc: %s\n", - m->value->prealloc ? "true" : "false"); - monitor_printf(mon, " share: %s\n", - m->value->share ? "true" : "false"); + monitor_hmp_printf(hmp, "memory backend: %s\n", m->value->id); + monitor_hmp_printf(hmp, " size: %" PRId64 "\n", m->value->size); + monitor_hmp_printf(hmp, " merge: %s\n", + m->value->merge ? "true" : "false"); + monitor_hmp_printf(hmp, " dump: %s\n", + m->value->dump ? "true" : "false"); + monitor_hmp_printf(hmp, " prealloc: %s\n", + m->value->prealloc ? "true" : "false"); + monitor_hmp_printf(hmp, " share: %s\n", + m->value->share ? "true" : "false"); if (m->value->has_reserve) { - monitor_printf(mon, " reserve: %s\n", - m->value->reserve ? "true" : "false"); + monitor_hmp_printf(hmp, " reserve: %s\n", + m->value->reserve ? "true" : "false"); } - monitor_printf(mon, " policy: %s\n", - HostMemPolicy_str(m->value->policy)); + monitor_hmp_printf(hmp, " policy: %s\n", + HostMemPolicy_str(m->value->policy)); visit_complete(v, &str); - monitor_printf(mon, " host nodes: %s\n", str); + monitor_hmp_printf(hmp, " host nodes: %s\n", str); =20 g_free(str); visit_free(v); m =3D m->next; } =20 - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); =20 qapi_free_MemdevList(memdev_list); hmp_handle_error(hmp, err); @@ -152,15 +149,14 @@ void hmp_info_memdev(MonitorHMP *hmp, const QDict *qd= ict) =20 void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); KvmInfo *info; =20 info =3D qmp_query_kvm(NULL); - monitor_printf(mon, "kvm support: "); + monitor_hmp_printf(hmp, "kvm support: "); if (info->present) { - monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled"= ); + monitor_hmp_printf(hmp, "%s\n", info->enabled ? "enabled" : "disab= led"); } else { - monitor_printf(mon, "not compiled\n"); + monitor_hmp_printf(hmp, "not compiled\n"); } =20 qapi_free_KvmInfo(info); @@ -168,7 +164,6 @@ void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_info_accelerators(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); AcceleratorInfo *info; AcceleratorList *accel; =20 @@ -176,9 +171,9 @@ void hmp_info_accelerators(MonitorHMP *hmp, const QDict= *qdict) for (accel =3D info->present; accel; accel =3D accel->next) { char trail =3D accel->next ? ' ' : '\n'; if (info->enabled =3D=3D accel->value) { - monitor_printf(mon, "[%s]%c", Accelerator_str(accel->value), t= rail); + monitor_hmp_printf(hmp, "[%s]%c", Accelerator_str(accel->value= ), trail); } else { - monitor_printf(mon, "%s%c", Accelerator_str(accel->value), tra= il); + monitor_hmp_printf(hmp, "%s%c", Accelerator_str(accel->value),= trail); } } =20 @@ -187,17 +182,15 @@ void hmp_info_accelerators(MonitorHMP *hmp, const QDi= ct *qdict) =20 void hmp_info_uuid(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); UuidInfo *info; =20 info =3D qmp_query_uuid(NULL); - monitor_printf(mon, "%s\n", info->UUID); + monitor_hmp_printf(hmp, "%s\n", info->UUID); qapi_free_UuidInfo(info); } =20 void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); BalloonInfo *info; Error *err =3D NULL; =20 @@ -206,7 +199,7 @@ void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdi= ct) return; } =20 - monitor_printf(mon, "balloon: actual=3D%" PRId64 "\n", info->actual >>= 20); + monitor_hmp_printf(hmp, "balloon: actual=3D%" PRId64 "\n", info->actua= l >> 20); =20 qapi_free_BalloonInfo(info); } @@ -223,7 +216,6 @@ void hmp_system_powerdown(MonitorHMP *hmp, const QDict = *qdict) =20 void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); @@ -231,7 +223,7 @@ void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) int cpu_index =3D monitor_hmp_get_cpu_index(hmp); =20 if (cpu_index < 0) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } =20 @@ -277,7 +269,6 @@ void hmp_balloon(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemoryDeviceInfoList *info_list =3D qmp_query_memory_devices(&err); MemoryDeviceInfoList *info; @@ -298,76 +289,76 @@ void hmp_info_memory_devices(MonitorHMP *hmp, const Q= Dict *qdict) case MEMORY_DEVICE_INFO_KIND_NVDIMM: di =3D value->type =3D=3D MEMORY_DEVICE_INFO_KIND_DIMM ? value->u.dimm.data : value->u.nvdimm.data; - monitor_printf(mon, "Memory device [%s]: \"%s\"\n", - MemoryDeviceInfoKind_str(value->type), - di->id ? di->id : ""); - monitor_printf(mon, " addr: 0x%" PRIx64 "\n", di->addr); - monitor_printf(mon, " slot: %" PRId64 "\n", di->slot); - monitor_printf(mon, " node: %" PRId64 "\n", di->node); - monitor_printf(mon, " size: %" PRIu64 "\n", di->size); - monitor_printf(mon, " memdev: %s\n", di->memdev); - monitor_printf(mon, " hotplugged: %s\n", - di->hotplugged ? "true" : "false"); - monitor_printf(mon, " hotpluggable: %s\n", - di->hotpluggable ? "true" : "false"); + monitor_hmp_printf(hmp, "Memory device [%s]: \"%s\"\n", + MemoryDeviceInfoKind_str(value->type), + di->id ? di->id : ""); + monitor_hmp_printf(hmp, " addr: 0x%" PRIx64 "\n", di->add= r); + monitor_hmp_printf(hmp, " slot: %" PRId64 "\n", di->slot); + monitor_hmp_printf(hmp, " node: %" PRId64 "\n", di->node); + monitor_hmp_printf(hmp, " size: %" PRIu64 "\n", di->size); + monitor_hmp_printf(hmp, " memdev: %s\n", di->memdev); + monitor_hmp_printf(hmp, " hotplugged: %s\n", + di->hotplugged ? "true" : "false"); + monitor_hmp_printf(hmp, " hotpluggable: %s\n", + di->hotpluggable ? "true" : "false"); break; case MEMORY_DEVICE_INFO_KIND_VIRTIO_PMEM: vpi =3D value->u.virtio_pmem.data; - monitor_printf(mon, "Memory device [%s]: \"%s\"\n", - MemoryDeviceInfoKind_str(value->type), - vpi->id ? vpi->id : ""); - monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", vpi->mem= addr); - monitor_printf(mon, " size: %" PRIu64 "\n", vpi->size); - monitor_printf(mon, " memdev: %s\n", vpi->memdev); + monitor_hmp_printf(hmp, "Memory device [%s]: \"%s\"\n", + MemoryDeviceInfoKind_str(value->type), + vpi->id ? vpi->id : ""); + monitor_hmp_printf(hmp, " memaddr: 0x%" PRIx64 "\n", vpi-= >memaddr); + monitor_hmp_printf(hmp, " size: %" PRIu64 "\n", vpi->size= ); + monitor_hmp_printf(hmp, " memdev: %s\n", vpi->memdev); break; case MEMORY_DEVICE_INFO_KIND_VIRTIO_MEM: vmi =3D value->u.virtio_mem.data; - monitor_printf(mon, "Memory device [%s]: \"%s\"\n", - MemoryDeviceInfoKind_str(value->type), - vmi->id ? vmi->id : ""); - monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", vmi->mem= addr); - monitor_printf(mon, " node: %" PRId64 "\n", vmi->node); - monitor_printf(mon, " requested-size: %" PRIu64 "\n", - vmi->requested_size); - monitor_printf(mon, " size: %" PRIu64 "\n", vmi->size); - monitor_printf(mon, " max-size: %" PRIu64 "\n", vmi->max_= size); - monitor_printf(mon, " block-size: %" PRIu64 "\n", - vmi->block_size); - monitor_printf(mon, " memdev: %s\n", vmi->memdev); + monitor_hmp_printf(hmp, "Memory device [%s]: \"%s\"\n", + MemoryDeviceInfoKind_str(value->type), + vmi->id ? vmi->id : ""); + monitor_hmp_printf(hmp, " memaddr: 0x%" PRIx64 "\n", vmi-= >memaddr); + monitor_hmp_printf(hmp, " node: %" PRId64 "\n", vmi->node= ); + monitor_hmp_printf(hmp, " requested-size: %" PRIu64 "\n", + vmi->requested_size); + monitor_hmp_printf(hmp, " size: %" PRIu64 "\n", vmi->size= ); + monitor_hmp_printf(hmp, " max-size: %" PRIu64 "\n", vmi->= max_size); + monitor_hmp_printf(hmp, " block-size: %" PRIu64 "\n", + vmi->block_size); + monitor_hmp_printf(hmp, " memdev: %s\n", vmi->memdev); break; case MEMORY_DEVICE_INFO_KIND_SGX_EPC: se =3D value->u.sgx_epc.data; - monitor_printf(mon, "Memory device [%s]: \"%s\"\n", - MemoryDeviceInfoKind_str(value->type), - se->id ? se->id : ""); - monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", se->mema= ddr); - monitor_printf(mon, " size: %" PRIu64 "\n", se->size); - monitor_printf(mon, " node: %" PRId64 "\n", se->node); - monitor_printf(mon, " memdev: %s\n", se->memdev); + monitor_hmp_printf(hmp, "Memory device [%s]: \"%s\"\n", + MemoryDeviceInfoKind_str(value->type), + se->id ? se->id : ""); + monitor_hmp_printf(hmp, " memaddr: 0x%" PRIx64 "\n", se->= memaddr); + monitor_hmp_printf(hmp, " size: %" PRIu64 "\n", se->size); + monitor_hmp_printf(hmp, " node: %" PRId64 "\n", se->node); + monitor_hmp_printf(hmp, " memdev: %s\n", se->memdev); break; case MEMORY_DEVICE_INFO_KIND_HV_BALLOON: hi =3D value->u.hv_balloon.data; - monitor_printf(mon, "Memory device [%s]: \"%s\"\n", - MemoryDeviceInfoKind_str(value->type), - hi->id ? hi->id : ""); + monitor_hmp_printf(hmp, "Memory device [%s]: \"%s\"\n", + MemoryDeviceInfoKind_str(value->type), + hi->id ? hi->id : ""); if (hi->has_memaddr) { - monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", - hi->memaddr); + monitor_hmp_printf(hmp, " memaddr: 0x%" PRIx64 "\n", + hi->memaddr); } - monitor_printf(mon, " max-size: %" PRIu64 "\n", hi->max_s= ize); + monitor_hmp_printf(hmp, " max-size: %" PRIu64 "\n", hi->m= ax_size); if (hi->memdev) { - monitor_printf(mon, " memdev: %s\n", hi->memdev); + monitor_hmp_printf(hmp, " memdev: %s\n", hi->memdev); } break; case MEMORY_DEVICE_INFO_KIND_SP_MEM: spmi =3D value->u.sp_mem.data; - monitor_printf(mon, "Memory device [%s]: \"%s\"\n", - MemoryDeviceInfoKind_str(value->type), - spmi->id ? spmi->id : ""); - monitor_printf(mon, " addr: 0x%" PRIx64 "\n", spmi->addr); - monitor_printf(mon, " node: %" PRId64 "\n", spmi->node); - monitor_printf(mon, " size: %" PRIu64 "\n", spmi->size); - monitor_printf(mon, " memdev: %s\n", spmi->memdev); + monitor_hmp_printf(hmp, "Memory device [%s]: \"%s\"\n", + MemoryDeviceInfoKind_str(value->type), + spmi->id ? spmi->id : ""); + monitor_hmp_printf(hmp, " addr: 0x%" PRIx64 "\n", spmi->a= ddr); + monitor_hmp_printf(hmp, " node: %" PRId64 "\n", spmi->nod= e); + monitor_hmp_printf(hmp, " size: %" PRIu64 "\n", spmi->siz= e); + monitor_hmp_printf(hmp, " memdev: %s\n", spmi->memdev); break; default: g_assert_not_reached(); @@ -381,11 +372,10 @@ void hmp_info_memory_devices(MonitorHMP *hmp, const Q= Dict *qdict) =20 void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; GuidInfo *info =3D qmp_query_vm_generation_id(&err); if (info) { - monitor_printf(mon, "%s\n", info->guid); + monitor_hmp_printf(hmp, "%s\n", info->guid); } hmp_handle_error(hmp, err); qapi_free_GuidInfo(info); @@ -393,16 +383,15 @@ void hmp_info_vm_generation_id(MonitorHMP *hmp, const= QDict *qdict) =20 void hmp_info_memory_size_summary(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemoryInfo *info =3D qmp_query_memory_size_summary(&err); if (info) { - monitor_printf(mon, "base memory: %" PRIu64 "\n", - info->base_memory); + monitor_hmp_printf(hmp, "base memory: %" PRIu64 "\n", + info->base_memory); =20 if (info->has_plugged_memory) { - monitor_printf(mon, "plugged memory: %" PRIu64 "\n", - info->plugged_memory); + monitor_hmp_printf(hmp, "plugged memory: %" PRIu64 "\n", + info->plugged_memory); } =20 qapi_free_MemoryInfo(info); diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 13df7cbafe10..82130ba04698 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -252,13 +252,14 @@ bool sysbus_realize_and_unref(SysBusDevice *dev, Erro= r **errp) static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent) { SysBusDevice *s =3D SYS_BUS_DEVICE(dev); + MonitorHMP *hmp =3D MONITOR_HMP(mon); hwaddr size; int i; =20 for (i =3D 0; i < s->num_mmio; i++) { size =3D memory_region_size(s->mmio[i].memory); - monitor_printf(mon, "%*smmio " HWADDR_FMT_plx "/" HWADDR_FMT_plx "= \n", - indent, "", s->mmio[i].addr, size); + monitor_hmp_printf(hmp, "%*smmio " HWADDR_FMT_plx "/" HWADDR_FMT_p= lx "\n", + indent, "", s->mmio[i].addr, size); } } =20 diff --git a/hw/hexagon/hexagon_tlb.c b/hw/hexagon/hexagon_tlb.c index 2d878cee736d..576929ff224b 100644 --- a/hw/hexagon/hexagon_tlb.c +++ b/hw/hexagon/hexagon_tlb.c @@ -124,30 +124,32 @@ static inline uint64_t hex_tlb_virt_addr(uint64_t ent= ry) =20 bool hexagon_tlb_dump_entry(Monitor *mon, uint64_t entry) { + MonitorHMP *hmp =3D MONITOR_HMP(mon); + if (GET_PTE_V(entry)) { uint64_t PA =3D hex_tlb_phys_addr(entry); uint64_t VA =3D hex_tlb_virt_addr(entry); - monitor_printf(mon, "0x%016" PRIx64 ": ", entry); - monitor_printf(mon, "V:%" PRId64 " G:%" PRId64 - " A1:%" PRId64 " A0:%" PRId64, - GET_PTE_V(entry), - GET_PTE_G(entry), - GET_PTE_ATR1(entry), - GET_PTE_ATR0(entry)); - monitor_printf(mon, " ASID:0x%02" PRIx64 " VA:0x%08" PRIx64, - GET_PTE_ASID(entry), VA); - monitor_printf(mon, - " X:%" PRId64 " W:%" PRId64 " R:%" PRId64 - " U:%" PRId64 " C:%" PRId64, - GET_PTE_X(entry), - GET_PTE_W(entry), - GET_PTE_R(entry), - GET_PTE_U(entry), - GET_PTE_C(entry)); - monitor_printf(mon, " PA:0x%09" PRIx64 " SZ:%s (0x%" PRIx64 ")", - PA, pgsize_str[hex_tlb_pgsize_type(entry)], - hex_tlb_page_size_bytes(entry)); - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "0x%016" PRIx64 ": ", entry); + monitor_hmp_printf(hmp, "V:%" PRId64 " G:%" PRId64 + " A1:%" PRId64 " A0:%" PRId64, + GET_PTE_V(entry), + GET_PTE_G(entry), + GET_PTE_ATR1(entry), + GET_PTE_ATR0(entry)); + monitor_hmp_printf(hmp, " ASID:0x%02" PRIx64 " VA:0x%08" PRIx64, + GET_PTE_ASID(entry), VA); + monitor_hmp_printf(hmp, + " X:%" PRId64 " W:%" PRId64 " R:%" PRId64 + " U:%" PRId64 " C:%" PRId64, + GET_PTE_X(entry), + GET_PTE_W(entry), + GET_PTE_R(entry), + GET_PTE_U(entry), + GET_PTE_C(entry)); + monitor_hmp_printf(hmp, " PA:0x%09" PRIx64 " SZ:%s (0x%" PRIx64 ")= ", + PA, pgsize_str[hex_tlb_pgsize_type(entry)], + hex_tlb_page_size_bytes(entry)); + monitor_hmp_printf(hmp, "\n"); return true; } =20 diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c index ab1eb14f99e0..5ed71583281a 100644 --- a/hw/i386/kvm/xen-stubs.c +++ b/hw/i386/kvm/xen-stubs.c @@ -42,12 +42,10 @@ void xen_primary_console_set_be_port(uint16_t port) =20 void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); + monitor_hmp_printf(hmp, "XEN emulation is not available in this QEMU\n= "); } =20 void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); + monitor_hmp_printf(hmp, "XEN emulation is not available in this QEMU\n= "); } diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 00dff6ee8760..b2135020f27f 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -2346,7 +2346,6 @@ void qmp_xen_event_inject(uint32_t port, Error **errp) =20 void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); EvtchnInfoList *iter, *info_list; Error *err =3D NULL; =20 @@ -2359,22 +2358,22 @@ void hmp_xen_event_list(MonitorHMP *hmp, const QDic= t *qdict) for (iter =3D info_list; iter; iter =3D iter->next) { EvtchnInfo *info =3D iter->value; =20 - monitor_printf(mon, "port %4u: vcpu: %d %s", info->port, info->vcp= u, - EvtchnPortType_str(info->type)); + monitor_hmp_printf(hmp, "port %4u: vcpu: %d %s", info->port, info-= >vcpu, + EvtchnPortType_str(info->type)); if (info->type !=3D EVTCHN_PORT_TYPE_IPI) { - monitor_printf(mon, "("); + monitor_hmp_printf(hmp, "("); if (info->remote_domain) { - monitor_printf(mon, "%s:", info->remote_domain); + monitor_hmp_printf(hmp, "%s:", info->remote_domain); } - monitor_printf(mon, "%d)", info->target); + monitor_hmp_printf(hmp, "%d)", info->target); } if (info->pending) { - monitor_printf(mon, " PENDING"); + monitor_hmp_printf(hmp, " PENDING"); } if (info->masked) { - monitor_printf(mon, " MASKED"); + monitor_hmp_printf(hmp, " MASKED"); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 qapi_free_EvtchnInfoList(info_list); @@ -2382,7 +2381,6 @@ void hmp_xen_event_list(MonitorHMP *hmp, const QDict = *qdict) =20 void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int port =3D qdict_get_int(qdict, "port"); Error *err =3D NULL; =20 @@ -2390,7 +2388,6 @@ void hmp_xen_event_inject(MonitorHMP *hmp, const QDic= t *qdict) if (err) { hmp_handle_error(hmp, err); } else { - monitor_printf(mon, "Delivered port %d\n", port); + monitor_hmp_printf(hmp, "Delivered port %d\n", port); } } - diff --git a/hw/i386/sgx-hmp-stub.c b/hw/i386/sgx-hmp-stub.c index a4848ae1d1a7..b7afb26886a8 100644 --- a/hw/i386/sgx-hmp-stub.c +++ b/hw/i386/sgx-hmp-stub.c @@ -12,6 +12,5 @@ =20 void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - monitor_printf(mon, "SGX is not available in this QEMU\n"); + monitor_hmp_printf(hmp, "SGX is not available in this QEMU\n"); } diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 77b41d234c9f..634e33e819ce 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -236,7 +236,6 @@ SgxInfo *qmp_query_sgx(Error **errp) =20 void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; SgxEpcSectionList *section_list, *section; g_autoptr(SgxInfo) info =3D qmp_query_sgx(&err); @@ -246,25 +245,25 @@ void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) error_report_err(err); return; } - monitor_printf(mon, "SGX support: %s\n", - info->sgx ? "enabled" : "disabled"); - monitor_printf(mon, "SGX1 support: %s\n", - info->sgx1 ? "enabled" : "disabled"); - monitor_printf(mon, "SGX2 support: %s\n", - info->sgx2 ? "enabled" : "disabled"); - monitor_printf(mon, "FLC support: %s\n", - info->flc ? "enabled" : "disabled"); + monitor_hmp_printf(hmp, "SGX support: %s\n", + info->sgx ? "enabled" : "disabled"); + monitor_hmp_printf(hmp, "SGX1 support: %s\n", + info->sgx1 ? "enabled" : "disabled"); + monitor_hmp_printf(hmp, "SGX2 support: %s\n", + info->sgx2 ? "enabled" : "disabled"); + monitor_hmp_printf(hmp, "FLC support: %s\n", + info->flc ? "enabled" : "disabled"); =20 section_list =3D info->sections; for (section =3D section_list; section; section =3D section->next) { - monitor_printf(mon, "NUMA node #%" PRId64 ": ", - section->value->node); - monitor_printf(mon, "size=3D%" PRIu64 "\n", - section->value->size); + monitor_hmp_printf(hmp, "NUMA node #%" PRId64 ": ", + section->value->node); + monitor_hmp_printf(hmp, "size=3D%" PRIu64 "\n", + section->value->size); size +=3D section->value->size; } - monitor_printf(mon, "total size=3D%" PRIu64 "\n", - size); + monitor_hmp_printf(hmp, "total size=3D%" PRIu64 "\n", + size); } =20 bool check_sgx_support(void) diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index ac2525b90fec..ffa76f83016b 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -300,10 +300,11 @@ static void aux_slave_dev_print(Monitor *mon, DeviceS= tate *dev, int indent) =20 s =3D AUX_SLAVE(dev); =20 - monitor_printf(mon, "%*smemory " HWADDR_FMT_plx "/" HWADDR_FMT_plx "\n= ", - indent, "", - object_property_get_uint(OBJECT(s->mmio), "addr", NULL), - memory_region_size(s->mmio)); + monitor_hmp_printf(MONITOR_HMP(mon), + "%*smemory " HWADDR_FMT_plx "/" HWADDR_FMT_plx "\n", + indent, "", + object_property_get_uint(OBJECT(s->mmio), "addr", N= ULL), + memory_region_size(s->mmio)); } =20 void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio) diff --git a/hw/misc/mos6522-stub.c b/hw/misc/mos6522-stub.c index 6a7d76292f00..154cd32ed88b 100644 --- a/hw/misc/mos6522-stub.c +++ b/hw/misc/mos6522-stub.c @@ -12,6 +12,5 @@ =20 void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - monitor_printf(mon, "MOS6522 VIA is not available in this QEMU\n"); + monitor_hmp_printf(hmp, "MOS6522 VIA is not available in this QEMU\n"); } diff --git a/hw/net/rocker/rocker-hmp-cmds.c b/hw/net/rocker/rocker-hmp-cmd= s.c index 6405ce26dd65..5099d59cc620 100644 --- a/hw/net/rocker/rocker-hmp-cmds.c +++ b/hw/net/rocker/rocker-hmp-cmds.c @@ -22,7 +22,6 @@ =20 void hmp_rocker(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); RockerSwitch *rocker; Error *err =3D NULL; @@ -32,16 +31,15 @@ void hmp_rocker(MonitorHMP *hmp, const QDict *qdict) return; } =20 - monitor_printf(mon, "name: %s\n", rocker->name); - monitor_printf(mon, "id: 0x%" PRIx64 "\n", rocker->id); - monitor_printf(mon, "ports: %d\n", rocker->ports); + monitor_hmp_printf(hmp, "name: %s\n", rocker->name); + monitor_hmp_printf(hmp, "id: 0x%" PRIx64 "\n", rocker->id); + monitor_hmp_printf(hmp, "ports: %d\n", rocker->ports); =20 qapi_free_RockerSwitch(rocker); } =20 void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); RockerPortList *list, *port; const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; @@ -51,17 +49,17 @@ void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdi= ct) return; } =20 - monitor_printf(mon, " ena/ speed/ auto\n"); - monitor_printf(mon, " port link duplex neg?\n"); + monitor_hmp_printf(hmp, " ena/ speed/ auto\n"); + monitor_hmp_printf(hmp, " port link duplex neg?\n"); =20 for (port =3D list; port; port =3D port->next) { - monitor_printf(mon, "%10s %-4s %-3s %2s %s\n", - port->value->name, - port->value->enabled ? port->value->link_up ? - "up" : "down" : "!ena", - port->value->speed =3D=3D 10000 ? "10G" : "??", - port->value->duplex ? "FD" : "HD", - port->value->autoneg ? "Yes" : "No"); + monitor_hmp_printf(hmp, "%10s %-4s %-3s %2s %s\n", + port->value->name, + port->value->enabled ? port->value->link_up ? + "up" : "down" : "!ena", + port->value->speed =3D=3D 10000 ? "10G" : "??", + port->value->duplex ? "FD" : "HD", + port->value->autoneg ? "Yes" : "No"); } =20 qapi_free_RockerPortList(list); @@ -69,7 +67,6 @@ void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); RockerOfDpaFlowList *list, *info; const char *name =3D qdict_get_str(qdict, "name"); uint32_t tbl_id =3D qdict_get_try_int(qdict, "tbl_id", -1); @@ -80,7 +77,7 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict= *qdict) return; } =20 - monitor_printf(mon, "prio tbl hits key(mask) --> actions\n"); + monitor_hmp_printf(hmp, "prio tbl hits key(mask) --> actions\n"); =20 for (info =3D list; info; info =3D info->next) { RockerOfDpaFlow *flow =3D info->value; @@ -89,54 +86,54 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDi= ct *qdict) RockerOfDpaFlowAction *action =3D flow->action; =20 if (flow->hits) { - monitor_printf(mon, "%-4d %-3d %-4" PRIu64, - key->priority, key->tbl_id, flow->hits); + monitor_hmp_printf(hmp, "%-4d %-3d %-4" PRIu64, + key->priority, key->tbl_id, flow->hits); } else { - monitor_printf(mon, "%-4d %-3d ", - key->priority, key->tbl_id); + monitor_hmp_printf(hmp, "%-4d %-3d ", + key->priority, key->tbl_id); } =20 if (key->has_in_pport) { - monitor_printf(mon, " pport %d", key->in_pport); + monitor_hmp_printf(hmp, " pport %d", key->in_pport); if (mask->has_in_pport) { - monitor_printf(mon, "(0x%x)", mask->in_pport); + monitor_hmp_printf(hmp, "(0x%x)", mask->in_pport); } } =20 if (key->has_vlan_id) { - monitor_printf(mon, " vlan %d", - key->vlan_id & VLAN_VID_MASK); + monitor_hmp_printf(hmp, " vlan %d", + key->vlan_id & VLAN_VID_MASK); if (mask->has_vlan_id) { - monitor_printf(mon, "(0x%x)", mask->vlan_id); + monitor_hmp_printf(hmp, "(0x%x)", mask->vlan_id); } } =20 if (key->has_tunnel_id) { - monitor_printf(mon, " tunnel %d", key->tunnel_id); + monitor_hmp_printf(hmp, " tunnel %d", key->tunnel_id); if (mask->has_tunnel_id) { - monitor_printf(mon, "(0x%x)", mask->tunnel_id); + monitor_hmp_printf(hmp, "(0x%x)", mask->tunnel_id); } } =20 if (key->has_eth_type) { switch (key->eth_type) { case 0x0806: - monitor_printf(mon, " ARP"); + monitor_hmp_printf(hmp, " ARP"); break; case 0x0800: - monitor_printf(mon, " IP"); + monitor_hmp_printf(hmp, " IP"); break; case 0x86dd: - monitor_printf(mon, " IPv6"); + monitor_hmp_printf(hmp, " IPv6"); break; case 0x8809: - monitor_printf(mon, " LACP"); + monitor_hmp_printf(hmp, " LACP"); break; case 0x88cc: - monitor_printf(mon, " LLDP"); + monitor_hmp_printf(hmp, " LLDP"); break; default: - monitor_printf(mon, " eth type 0x%04x", key->eth_type); + monitor_hmp_printf(hmp, " eth type 0x%04x", key->eth_type); break; } } @@ -145,15 +142,15 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const Q= Dict *qdict) if ((strcmp(key->eth_src, "01:00:00:00:00:00") =3D=3D 0) && mask->eth_src && (strcmp(mask->eth_src, "01:00:00:00:00:00") =3D=3D 0)) { - monitor_printf(mon, " src "); + monitor_hmp_printf(hmp, " src "); } else if ((strcmp(key->eth_src, "00:00:00:00:00:00") =3D=3D 0= ) && mask->eth_src && (strcmp(mask->eth_src, "01:00:00:00:00:00") =3D=3D 0)) { - monitor_printf(mon, " src "); + monitor_hmp_printf(hmp, " src "); } else { - monitor_printf(mon, " src %s", key->eth_src); + monitor_hmp_printf(hmp, " src %s", key->eth_src); if (mask->eth_src) { - monitor_printf(mon, "(%s)", mask->eth_src); + monitor_hmp_printf(hmp, "(%s)", mask->eth_src); } } } @@ -162,56 +159,56 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const Q= Dict *qdict) if ((strcmp(key->eth_dst, "01:00:00:00:00:00") =3D=3D 0) && mask->eth_dst && (strcmp(mask->eth_dst, "01:00:00:00:00:00") =3D=3D 0)) { - monitor_printf(mon, " dst "); + monitor_hmp_printf(hmp, " dst "); } else if ((strcmp(key->eth_dst, "00:00:00:00:00:00") =3D=3D 0= ) && mask->eth_dst && (strcmp(mask->eth_dst, "01:00:00:00:00:00") =3D=3D 0)) { - monitor_printf(mon, " dst "); + monitor_hmp_printf(hmp, " dst "); } else { - monitor_printf(mon, " dst %s", key->eth_dst); + monitor_hmp_printf(hmp, " dst %s", key->eth_dst); if (mask->eth_dst) { - monitor_printf(mon, "(%s)", mask->eth_dst); + monitor_hmp_printf(hmp, "(%s)", mask->eth_dst); } } } =20 if (key->has_ip_proto) { - monitor_printf(mon, " proto %d", key->ip_proto); + monitor_hmp_printf(hmp, " proto %d", key->ip_proto); if (mask->has_ip_proto) { - monitor_printf(mon, "(0x%x)", mask->ip_proto); + monitor_hmp_printf(hmp, "(0x%x)", mask->ip_proto); } } =20 if (key->has_ip_tos) { - monitor_printf(mon, " TOS %d", key->ip_tos); + monitor_hmp_printf(hmp, " TOS %d", key->ip_tos); if (mask->has_ip_tos) { - monitor_printf(mon, "(0x%x)", mask->ip_tos); + monitor_hmp_printf(hmp, "(0x%x)", mask->ip_tos); } } =20 if (key->ip_dst) { - monitor_printf(mon, " dst %s", key->ip_dst); + monitor_hmp_printf(hmp, " dst %s", key->ip_dst); } =20 if (action->has_goto_tbl || action->has_group_id || action->has_new_vlan_id) { - monitor_printf(mon, " -->"); + monitor_hmp_printf(hmp, " -->"); } =20 if (action->has_new_vlan_id) { - monitor_printf(mon, " apply new vlan %d", - ntohs(action->new_vlan_id)); + monitor_hmp_printf(hmp, " apply new vlan %d", + ntohs(action->new_vlan_id)); } =20 if (action->has_group_id) { - monitor_printf(mon, " write group 0x%08x", action->group_id); + monitor_hmp_printf(hmp, " write group 0x%08x", action->group_i= d); } =20 if (action->has_goto_tbl) { - monitor_printf(mon, " goto tbl %d", action->goto_tbl); + monitor_hmp_printf(hmp, " goto tbl %d", action->goto_tbl); } =20 - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 qapi_free_RockerOfDpaFlowList(list); @@ -219,7 +216,6 @@ void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDi= ct *qdict) =20 void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); RockerOfDpaGroupList *list, *g; const char *name =3D qdict_get_str(qdict, "name"); uint8_t type =3D qdict_get_try_int(qdict, "type", 9); @@ -230,15 +226,15 @@ void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const = QDict *qdict) return; } =20 - monitor_printf(mon, "id (decode) --> buckets\n"); + monitor_hmp_printf(hmp, "id (decode) --> buckets\n"); =20 for (g =3D list; g; g =3D g->next) { RockerOfDpaGroup *group =3D g->value; bool set =3D false; =20 - monitor_printf(mon, "0x%08x", group->id); + monitor_hmp_printf(hmp, "0x%08x", group->id); =20 - monitor_printf(mon, " (type %s", group->type =3D=3D 0 ? "L2 interf= ace" : + monitor_hmp_printf(hmp, " (type %s", group->type =3D=3D 0 ? "L2 in= terface" : group->type =3D=3D 1 ? "L2 rewrit= e" : group->type =3D=3D 2 ? "L3 unicas= t" : group->type =3D=3D 3 ? "L2 multic= ast" : @@ -250,70 +246,70 @@ void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const = QDict *qdict) "unknown"); =20 if (group->has_vlan_id) { - monitor_printf(mon, " vlan %d", group->vlan_id); + monitor_hmp_printf(hmp, " vlan %d", group->vlan_id); } =20 if (group->has_pport) { - monitor_printf(mon, " pport %d", group->pport); + monitor_hmp_printf(hmp, " pport %d", group->pport); } =20 if (group->has_index) { - monitor_printf(mon, " index %d", group->index); + monitor_hmp_printf(hmp, " index %d", group->index); } =20 - monitor_printf(mon, ") -->"); + monitor_hmp_printf(hmp, ") -->"); =20 if (group->has_set_vlan_id && group->set_vlan_id) { set =3D true; - monitor_printf(mon, " set vlan %d", - group->set_vlan_id & VLAN_VID_MASK); + monitor_hmp_printf(hmp, " set vlan %d", + group->set_vlan_id & VLAN_VID_MASK); } =20 if (group->set_eth_src) { if (!set) { set =3D true; - monitor_printf(mon, " set"); + monitor_hmp_printf(hmp, " set"); } - monitor_printf(mon, " src %s", group->set_eth_src); + monitor_hmp_printf(hmp, " src %s", group->set_eth_src); } =20 if (group->set_eth_dst) { if (!set) { - monitor_printf(mon, " set"); + monitor_hmp_printf(hmp, " set"); } - monitor_printf(mon, " dst %s", group->set_eth_dst); + monitor_hmp_printf(hmp, " dst %s", group->set_eth_dst); } =20 if (group->has_ttl_check && group->ttl_check) { - monitor_printf(mon, " check TTL"); + monitor_hmp_printf(hmp, " check TTL"); } =20 if (group->has_group_id && group->group_id) { - monitor_printf(mon, " group id 0x%08x", group->group_id); + monitor_hmp_printf(hmp, " group id 0x%08x", group->group_id); } =20 if (group->has_pop_vlan && group->pop_vlan) { - monitor_printf(mon, " pop vlan"); + monitor_hmp_printf(hmp, " pop vlan"); } =20 if (group->has_out_pport) { - monitor_printf(mon, " out pport %d", group->out_pport); + monitor_hmp_printf(hmp, " out pport %d", group->out_pport); } =20 if (group->has_group_ids) { struct uint32List *id; =20 - monitor_printf(mon, " groups ["); + monitor_hmp_printf(hmp, " groups ["); for (id =3D group->group_ids; id; id =3D id->next) { - monitor_printf(mon, "0x%08x", id->value); + monitor_hmp_printf(hmp, "0x%08x", id->value); if (id->next) { - monitor_printf(mon, ","); + monitor_hmp_printf(hmp, ","); } } - monitor_printf(mon, "]"); + monitor_hmp_printf(hmp, "]"); } =20 - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 qapi_free_RockerOfDpaGroupList(list); diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index 51d95d76620e..500f821246a9 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -24,54 +24,55 @@ #include "qapi/qapi-commands-pci.h" #include "qemu/cutils.h" =20 -static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev) +static void hmp_info_pci_device(MonitorHMP *hmp, const PciDeviceInfo *dev) { + Monitor *mon =3D MONITOR(hmp); PciMemoryRegionList *region; =20 - monitor_printf(mon, " Bus %2" PRId64 ", ", dev->bus); - monitor_printf(mon, "device %3" PRId64 ", function %" PRId64 ":\n", - dev->slot, dev->function); - monitor_printf(mon, " "); + monitor_hmp_printf(hmp, " Bus %2" PRId64 ", ", dev->bus); + monitor_hmp_printf(hmp, "device %3" PRId64 ", function %" PRId64 ":\n", + dev->slot, dev->function); + monitor_hmp_printf(hmp, " "); =20 if (dev->class_info->desc) { monitor_puts(mon, dev->class_info->desc); } else { - monitor_printf(mon, "Class %04" PRId64, dev->class_info->q_class); + monitor_hmp_printf(hmp, "Class %04" PRId64, dev->class_info->q_cla= ss); } =20 - monitor_printf(mon, ": PCI device %04" PRIx64 ":%04" PRIx64 "\n", - dev->id->vendor, dev->id->device); + monitor_hmp_printf(hmp, ": PCI device %04" PRIx64 ":%04" PRIx64 "\n", + dev->id->vendor, dev->id->device); if (dev->id->has_subsystem_vendor && dev->id->has_subsystem) { - monitor_printf(mon, " PCI subsystem %04" PRIx64 ":%04" PRIx64= "\n", - dev->id->subsystem_vendor, dev->id->subsystem); + monitor_hmp_printf(hmp, " PCI subsystem %04" PRIx64 ":%04" PR= Ix64 "\n", + dev->id->subsystem_vendor, dev->id->subsystem); } =20 if (dev->has_irq) { - monitor_printf(mon, " IRQ %" PRId64 ", pin %c\n", - dev->irq, (char)('A' + dev->irq_pin - 1)); + monitor_hmp_printf(hmp, " IRQ %" PRId64 ", pin %c\n", + dev->irq, (char)('A' + dev->irq_pin - 1)); } =20 if (dev->pci_bridge) { - monitor_printf(mon, " BUS %" PRId64 ".\n", - dev->pci_bridge->bus->number); - monitor_printf(mon, " secondary bus %" PRId64 ".\n", - dev->pci_bridge->bus->secondary); - monitor_printf(mon, " subordinate bus %" PRId64 ".\n", - dev->pci_bridge->bus->subordinate); + monitor_hmp_printf(hmp, " BUS %" PRId64 ".\n", + dev->pci_bridge->bus->number); + monitor_hmp_printf(hmp, " secondary bus %" PRId64 ".\n", + dev->pci_bridge->bus->secondary); + monitor_hmp_printf(hmp, " subordinate bus %" PRId64 ".\n", + dev->pci_bridge->bus->subordinate); =20 - monitor_printf(mon, " IO range [0x%04"PRIx64", 0x%04"PRIx64"]= \n", - dev->pci_bridge->bus->io_range->base, - dev->pci_bridge->bus->io_range->limit); + monitor_hmp_printf(hmp, " IO range [0x%04"PRIx64", 0x%04"PRIx= 64"]\n", + dev->pci_bridge->bus->io_range->base, + dev->pci_bridge->bus->io_range->limit); =20 - monitor_printf(mon, - " memory range [0x%08"PRIx64", 0x%08"PRIx64"]\= n", - dev->pci_bridge->bus->memory_range->base, - dev->pci_bridge->bus->memory_range->limit); + monitor_hmp_printf(hmp, + " memory range [0x%08"PRIx64", 0x%08"PRIx6= 4"]\n", + dev->pci_bridge->bus->memory_range->base, + dev->pci_bridge->bus->memory_range->limit); =20 - monitor_printf(mon, " prefetchable memory range " - "[0x%08"PRIx64", 0x%08"PRIx64"]\n", - dev->pci_bridge->bus->prefetchable_range->base, - dev->pci_bridge->bus->prefetchable_range->limit); + monitor_hmp_printf(hmp, " prefetchable memory range " + "[0x%08"PRIx64", 0x%08"PRIx64"]\n", + dev->pci_bridge->bus->prefetchable_range->base, + dev->pci_bridge->bus->prefetchable_range->limit= ); } =20 for (region =3D dev->regions; region; region =3D region->next) { @@ -80,38 +81,38 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) addr =3D region->value->address; size =3D region->value->size; =20 - monitor_printf(mon, " BAR%" PRId64 ": ", region->value->bar); + monitor_hmp_printf(hmp, " BAR%" PRId64 ": ", region->value->b= ar); =20 if (!strcmp(region->value->type, "io")) { if (addr !=3D PCI_BAR_UNMAPPED) { - monitor_printf(mon, "I/O at 0x%04" PRIx64 + monitor_hmp_printf(hmp, "I/O at 0x%04" PRIx64 " [0x%04" PRIx64 "]\n", addr, addr + size - 1); } else { - monitor_printf(mon, "I/O (not mapped)\n"); + monitor_hmp_printf(hmp, "I/O (not mapped)\n"); } } else { if (addr !=3D PCI_BAR_UNMAPPED) { - monitor_printf(mon, "%d bit%s memory at 0x%08" PRIx64 + monitor_hmp_printf(hmp, "%d bit%s memory at 0x%08" PRIx64 " [0x%08" PRIx64 "]\n", region->value->mem_type_64 ? 64 : 32, region->value->prefetch ? " prefetchable" := "", addr, addr + size - 1); } else { - monitor_printf(mon, "%d bit%s memory (not mapped)\n", - region->value->mem_type_64 ? 64 : 32, - region->value->prefetch ? " prefetchable" := ""); + monitor_hmp_printf(hmp, "%d bit%s memory (not mapped)\n", + region->value->mem_type_64 ? 64 : 32, + region->value->prefetch ? " prefetchabl= e" : ""); } } } =20 - monitor_printf(mon, " id \"%s\"\n", dev->qdev_id); + monitor_hmp_printf(hmp, " id \"%s\"\n", dev->qdev_id); =20 if (dev->pci_bridge) { if (dev->pci_bridge->has_devices) { PciDeviceInfoList *cdev; for (cdev =3D dev->pci_bridge->devices; cdev; cdev =3D cdev->n= ext) { - hmp_info_pci_device(mon, cdev->value); + hmp_info_pci_device(hmp, cdev->value); } } } @@ -119,7 +120,6 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) =20 void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); PciInfoList *info_list, *info; =20 info_list =3D qmp_query_pci(&error_abort); @@ -128,7 +128,7 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) PciDeviceInfoList *dev; =20 for (dev =3D info->value->devices; dev; dev =3D dev->next) { - hmp_info_pci_device(mon, dev->value); + hmp_info_pci_device(hmp, dev->value); } } =20 @@ -137,6 +137,7 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) =20 void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) { + MonitorHMP *hmp =3D MONITOR_HMP(mon); PCIDevice *d =3D (PCIDevice *)dev; int class =3D pci_get_word(d->config + PCI_CLASS_DEVICE); const pci_class_desc *desc =3D get_class_desc(class); @@ -150,30 +151,29 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev,= int indent) snprintf(ctxt, sizeof(ctxt), "Class %04x", class); } =20 - monitor_printf(mon, "%*sclass %s, addr %02x:%02x.%x, " - "pci id %04x:%04x (sub %04x:%04x)\n", - indent, "", ctxt, pci_dev_bus_num(d), - PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), - pci_get_word(d->config + PCI_VENDOR_ID), - pci_get_word(d->config + PCI_DEVICE_ID), - pci_get_word(d->config + PCI_SUBSYSTEM_VENDOR_ID), - pci_get_word(d->config + PCI_SUBSYSTEM_ID)); + monitor_hmp_printf(hmp, "%*sclass %s, addr %02x:%02x.%x, " + "pci id %04x:%04x (sub %04x:%04x)\n", + indent, "", ctxt, pci_dev_bus_num(d), + PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), + pci_get_word(d->config + PCI_VENDOR_ID), + pci_get_word(d->config + PCI_DEVICE_ID), + pci_get_word(d->config + PCI_SUBSYSTEM_VENDOR_ID), + pci_get_word(d->config + PCI_SUBSYSTEM_ID)); for (i =3D 0; i < PCI_NUM_REGIONS; i++) { r =3D &d->io_regions[i]; if (!r->size) { continue; } - monitor_printf(mon, "%*sbar %d: %s at 0x%"FMT_PCIBUS - " [0x%"FMT_PCIBUS"]\n", - indent, "", - i, r->type & PCI_BASE_ADDRESS_SPACE_IO ? "i/o" : "m= em", - r->addr, r->addr + r->size - 1); + monitor_hmp_printf(hmp, "%*sbar %d: %s at 0x%"FMT_PCIBUS + " [0x%"FMT_PCIBUS"]\n", + indent, "", + i, r->type & PCI_BASE_ADDRESS_SPACE_IO ? "i/o" = : "mem", + r->addr, r->addr + r->size - 1); } } =20 void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *id =3D qdict_get_str(qdict, "id"); const char *error_name; @@ -242,9 +242,9 @@ void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const Q= Dict *qdict) } =20 =20 - monitor_printf(mon, "OK id: %s root bus: %s, bus: %x devfn: %x.%x\n", - id, pci_root_bus_path(dev), pci_dev_bus_num(dev), - PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); + monitor_hmp_printf(hmp, "OK id: %s root bus: %s, bus: %x devfn: %x.%x\= n", + id, pci_root_bus_path(dev), pci_dev_bus_num(dev), + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); =20 out: hmp_handle_error(hmp, err); diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index a80e34175462..7e2797300ba0 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -40,8 +40,7 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - monitor_printf(mon, "PCI devices not supported\n"); + monitor_hmp_printf(hmp, "PCI devices not supported\n"); } =20 /* kvm-all wants this */ diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index d8afaf730639..b5e56a16cce1 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -106,7 +106,6 @@ static void write_keys(FILE *f, uint8_t *keys, uint64_t= startgfn, =20 void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); S390SKeysState *ss =3D s390_get_skeys_device(); S390SKeysClass *skeyclass =3D S390_SKEYS_GET_CLASS(ss); uint64_t addr =3D qdict_get_int(qdict, "addr"); @@ -115,24 +114,24 @@ void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdi= ct) =20 /* Quick check to see if guest is using storage keys*/ if (!skeyclass->skeys_are_enabled(ss)) { - monitor_printf(mon, "Error: This guest is not using storage keys\n= "); + monitor_hmp_printf(hmp, "Error: This guest is not using storage ke= ys\n"); return; } =20 if (!address_space_access_valid(&address_space_memory, addr & TARGET_PAGE_MASK, TARGET_PAGE_S= IZE, false, MEMTXATTRS_UNSPECIFIED)) { - monitor_printf(mon, "Error: The given address is not valid\n"); + monitor_hmp_printf(hmp, "Error: The given address is not valid\n"); return; } =20 r =3D skeyclass->get_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); if (r < 0) { - monitor_printf(mon, "Error: %s\n", strerror(-r)); + monitor_hmp_printf(hmp, "Error: %s\n", strerror(-r)); return; } =20 - monitor_printf(mon, " key: 0x%X\n", key); + monitor_hmp_printf(hmp, " key: 0x%X\n", key); } =20 void hmp_dump_skeys(MonitorHMP *hmp, const QDict *qdict) diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index b4a405455901..644298f7f0b2 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -61,7 +61,6 @@ void s390_stattrib_init(void) =20 void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); S390StAttribState *sas =3D s390_get_stattrib_device(); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint64_t what =3D qdict_get_int(qdict, "mode"); @@ -70,14 +69,13 @@ void hmp_migrationmode(MonitorHMP *hmp, const QDict *qd= ict) =20 r =3D sac->set_migrationmode(sas, what, &local_err); if (r < 0) { - monitor_printf(mon, "Error: %s", error_get_pretty(local_err)); + monitor_hmp_printf(hmp, "Error: %s", error_get_pretty(local_err)); error_free(local_err); } } =20 void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); S390StAttribState *sas =3D s390_get_stattrib_device(); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint64_t addr =3D qdict_get_int(qdict, "addr"); @@ -87,27 +85,27 @@ void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict) =20 vals =3D g_try_malloc(buflen); if (!vals) { - monitor_printf(mon, "Error: %s\n", strerror(errno)); + monitor_hmp_printf(hmp, "Error: %s\n", strerror(errno)); return; } =20 len =3D sac->peek_stattr(sas, addr / TARGET_PAGE_SIZE, buflen, vals); if (len < 0) { - monitor_printf(mon, "Error: %s", strerror(-len)); + monitor_hmp_printf(hmp, "Error: %s", strerror(-len)); goto out; } =20 - monitor_printf(mon, " CMMA attributes, " - "pages %" PRIu64 "+%d (0x%" PRIx64 "):\n", - addr / TARGET_PAGE_SIZE, len, addr & ~TARGET_PAGE_MASK); + monitor_hmp_printf(hmp, " CMMA attributes, " + "pages %" PRIu64 "+%d (0x%" PRIx64 "):\n", + addr / TARGET_PAGE_SIZE, len, addr & ~TARGET_PAGE_M= ASK); for (cx =3D 0; cx < len; cx++) { if (cx % 8 =3D=3D 7) { - monitor_printf(mon, "%02x\n", vals[cx]); + monitor_hmp_printf(hmp, "%02x\n", vals[cx]); } else { - monitor_printf(mon, "%02x", vals[cx]); + monitor_hmp_printf(hmp, "%02x", vals[cx]); } } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); =20 out: g_free(vals); diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 0d59a74ad60e..0249eea2cfe9 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -258,7 +258,6 @@ FirmwareLog *qmp_query_firmware_log(bool have_max_size,= uint64_t max_size, =20 void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); g_autofree gchar *log_esc =3D NULL; g_autofree guchar *log_out =3D NULL; Error *err =3D NULL; @@ -278,10 +277,10 @@ void hmp_info_firmware_log(MonitorHMP *hmp, const QDi= ct *qdict) =20 if (log->version) { g_autofree gchar *esc =3D g_strescape(log->version, NULL); - monitor_printf(mon, "[ firmware version: %s ]\n", esc); + monitor_hmp_printf(hmp, "[ firmware version: %s ]\n", esc); } =20 log_out =3D g_base64_decode(log->log, &log_len); log_esc =3D g_strescape((gchar *)log_out, "\r\n"); - monitor_printf(mon, "%s\n", log_esc); + monitor_hmp_printf(hmp, "%s\n", log_esc); } diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 9b9b2e7c2f8f..fe3dbfa2227c 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -546,14 +546,15 @@ static const char *usb_speed(unsigned int speed) =20 static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) { + MonitorHMP *hmp =3D MONITOR_HMP(mon); USBDevice *dev =3D USB_DEVICE(qdev); USBBus *bus =3D usb_bus_from_device(dev); =20 - monitor_printf(mon, "%*saddr %d.%d, port %s, speed %s, name %s%s\n", - indent, "", bus->busnr, dev->addr, - dev->port ? dev->port->path : "-", - usb_speed(dev->speed), dev->product_desc, - dev->attached ? ", attached" : ""); + monitor_hmp_printf(hmp, "%*saddr %d.%d, port %s, speed %s, name %s%s\n= ", + indent, "", bus->busnr, dev->addr, + dev->port ? dev->port->path : "-", + usb_speed(dev->speed), dev->product_desc, + dev->attached ? ", attached" : ""); } =20 static char *usb_get_dev_path(DeviceState *qdev) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index c02343d3a655..9b9f26a1078e 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1922,7 +1922,6 @@ static void usb_host_auto_check(void *unused) =20 void hmp_info_usbhost(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); libusb_device **devs =3D NULL; struct libusb_device_descriptor ddesc; char port[16]; @@ -1941,14 +1940,14 @@ void hmp_info_usbhost(MonitorHMP *hmp, const QDict = *qdict) continue; } usb_host_get_port(devs[i], port, sizeof(port)); - monitor_printf(mon, " Bus %d, Addr %d, Port %s, Speed %s Mb/s\n", - libusb_get_bus_number(devs[i]), - libusb_get_device_address(devs[i]), - port, - speed_name[libusb_get_device_speed(devs[i])]); - monitor_printf(mon, " Class %02x:", ddesc.bDeviceClass); - monitor_printf(mon, " USB device %04x:%04x", - ddesc.idVendor, ddesc.idProduct); + monitor_hmp_printf(hmp, " Bus %d, Addr %d, Port %s, Speed %s Mb/s= \n", + libusb_get_bus_number(devs[i]), + libusb_get_device_address(devs[i]), + port, + speed_name[libusb_get_device_speed(devs[i])]); + monitor_hmp_printf(hmp, " Class %02x:", ddesc.bDeviceClass); + monitor_hmp_printf(hmp, " USB device %04x:%04x", + ddesc.idVendor, ddesc.idProduct); if (ddesc.iProduct) { libusb_device_handle *handle; if (libusb_open(devs[i], &handle) =3D=3D 0) { @@ -1957,10 +1956,10 @@ void hmp_info_usbhost(MonitorHMP *hmp, const QDict = *qdict) ddesc.iProduct, name, sizeof(name)); libusb_close(handle); - monitor_printf(mon, ", %s", name); + monitor_hmp_printf(hmp, ", %s", name); } } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } libusb_free_device_list(devs, 1); } diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c index fb36c8b9274c..e5da6f00699d 100644 --- a/hw/virtio/virtio-hmp-cmds.c +++ b/hw/virtio/virtio-hmp-cmds.c @@ -12,77 +12,76 @@ #include "qobject/qdict.h" =20 =20 -static void hmp_virtio_dump_protocols(Monitor *mon, +static void hmp_virtio_dump_protocols(MonitorHMP *hmp, VhostDeviceProtocols *pcol) { strList *pcol_list =3D pcol->protocols; while (pcol_list) { - monitor_printf(mon, "\t%s", pcol_list->value); + monitor_hmp_printf(hmp, "\t%s", pcol_list->value); pcol_list =3D pcol_list->next; if (pcol_list !=3D NULL) { - monitor_printf(mon, ",\n"); + monitor_hmp_printf(hmp, ",\n"); } } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); if (pcol->has_unknown_protocols) { - monitor_printf(mon, " unknown-protocols(0x%016"PRIx64")\n", - pcol->unknown_protocols); + monitor_hmp_printf(hmp, " unknown-protocols(0x%016"PRIx64")\n", + pcol->unknown_protocols); } } =20 -static void hmp_virtio_dump_status(Monitor *mon, +static void hmp_virtio_dump_status(MonitorHMP *hmp, VirtioDeviceStatus *status) { strList *status_list =3D status->statuses; while (status_list) { - monitor_printf(mon, "\t%s", status_list->value); + monitor_hmp_printf(hmp, "\t%s", status_list->value); status_list =3D status_list->next; if (status_list !=3D NULL) { - monitor_printf(mon, ",\n"); + monitor_hmp_printf(hmp, ",\n"); } } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); if (status->has_unknown_statuses) { - monitor_printf(mon, " unknown-statuses(0x%016"PRIx32")\n", - status->unknown_statuses); + monitor_hmp_printf(hmp, " unknown-statuses(0x%016"PRIx32")\n", + status->unknown_statuses); } } =20 -static void hmp_virtio_dump_features(Monitor *mon, +static void hmp_virtio_dump_features(MonitorHMP *hmp, VirtioDeviceFeatures *features) { strList *transport_list =3D features->transports; while (transport_list) { - monitor_printf(mon, "\t%s", transport_list->value); + monitor_hmp_printf(hmp, "\t%s", transport_list->value); transport_list =3D transport_list->next; if (transport_list !=3D NULL) { - monitor_printf(mon, ",\n"); + monitor_hmp_printf(hmp, ",\n"); } } =20 - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); strList *list =3D features->dev_features; if (list) { while (list) { - monitor_printf(mon, "\t%s", list->value); + monitor_hmp_printf(hmp, "\t%s", list->value); list =3D list->next; if (list !=3D NULL) { - monitor_printf(mon, ",\n"); + monitor_hmp_printf(hmp, ",\n"); } } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 if (features->has_unknown_dev_features) { - monitor_printf(mon, " unknown-features(0x%016"PRIx64"%016"PRIx64"= )\n", - features->unknown_dev_features2, - features->unknown_dev_features); + monitor_hmp_printf(hmp, " unknown-features(0x%016"PRIx64"%016"PRI= x64")\n", + features->unknown_dev_features2, + features->unknown_dev_features); } } =20 void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; VirtioInfoList *list =3D qmp_x_query_virtio(&err); VirtioInfoList *node; @@ -93,14 +92,14 @@ void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdi= ct) } =20 if (list =3D=3D NULL) { - monitor_printf(mon, "No VirtIO devices\n"); + monitor_hmp_printf(hmp, "No VirtIO devices\n"); return; } =20 node =3D list; while (node) { - monitor_printf(mon, "%s [%s]\n", node->value->path, - node->value->name); + monitor_hmp_printf(hmp, "%s [%s]\n", node->value->path, + node->value->name); node =3D node->next; } qapi_free_VirtioInfoList(list); @@ -108,7 +107,6 @@ void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_virtio_status(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); VirtioStatus *s =3D qmp_x_query_virtio_status(path, &err); @@ -118,68 +116,68 @@ void hmp_virtio_status(MonitorHMP *hmp, const QDict *= qdict) return; } =20 - monitor_printf(mon, "%s:\n", path); - monitor_printf(mon, " device_name: %s %s\n", - s->name, s->vhost_dev ? "(vhost)" : ""); - monitor_printf(mon, " device_id: %d\n", s->device_id); - monitor_printf(mon, " vhost_started: %s\n", - s->vhost_started ? "true" : "false"); - monitor_printf(mon, " bus_name: %s\n", s->bus_name); - monitor_printf(mon, " broken: %s\n", - s->broken ? "true" : "false"); - monitor_printf(mon, " disabled: %s\n", - s->disabled ? "true" : "false"); - monitor_printf(mon, " disable_legacy_check: %s\n", - s->disable_legacy_check ? "true" : "false"); - monitor_printf(mon, " started: %s\n", - s->started ? "true" : "false"); - monitor_printf(mon, " use_started: %s\n", - s->use_started ? "true" : "false"); - monitor_printf(mon, " start_on_kick: %s\n", - s->start_on_kick ? "true" : "false"); - monitor_printf(mon, " use_guest_notifier_mask: %s\n", - s->use_guest_notifier_mask ? "true" : "false"); - monitor_printf(mon, " vm_running: %s\n", - s->vm_running ? "true" : "false"); - monitor_printf(mon, " num_vqs: %"PRId64"\n", s->num_v= qs); - monitor_printf(mon, " queue_sel: %d\n", - s->queue_sel); - monitor_printf(mon, " isr: %d\n", s->isr); - monitor_printf(mon, " endianness: %s\n", - s->device_endian); - monitor_printf(mon, " status:\n"); - hmp_virtio_dump_status(mon, s->status); - monitor_printf(mon, " Guest features:\n"); - hmp_virtio_dump_features(mon, s->guest_features); - monitor_printf(mon, " Host features:\n"); - hmp_virtio_dump_features(mon, s->host_features); - monitor_printf(mon, " Backend features:\n"); - hmp_virtio_dump_features(mon, s->backend_features); + monitor_hmp_printf(hmp, "%s:\n", path); + monitor_hmp_printf(hmp, " device_name: %s %s\n", + s->name, s->vhost_dev ? "(vhost)" : ""); + monitor_hmp_printf(hmp, " device_id: %d\n", s->device_i= d); + monitor_hmp_printf(hmp, " vhost_started: %s\n", + s->vhost_started ? "true" : "false"); + monitor_hmp_printf(hmp, " bus_name: %s\n", s->bus_name= ); + monitor_hmp_printf(hmp, " broken: %s\n", + s->broken ? "true" : "false"); + monitor_hmp_printf(hmp, " disabled: %s\n", + s->disabled ? "true" : "false"); + monitor_hmp_printf(hmp, " disable_legacy_check: %s\n", + s->disable_legacy_check ? "true" : "false"); + monitor_hmp_printf(hmp, " started: %s\n", + s->started ? "true" : "false"); + monitor_hmp_printf(hmp, " use_started: %s\n", + s->use_started ? "true" : "false"); + monitor_hmp_printf(hmp, " start_on_kick: %s\n", + s->start_on_kick ? "true" : "false"); + monitor_hmp_printf(hmp, " use_guest_notifier_mask: %s\n", + s->use_guest_notifier_mask ? "true" : "false"); + monitor_hmp_printf(hmp, " vm_running: %s\n", + s->vm_running ? "true" : "false"); + monitor_hmp_printf(hmp, " num_vqs: %"PRId64"\n", s->n= um_vqs); + monitor_hmp_printf(hmp, " queue_sel: %d\n", + s->queue_sel); + monitor_hmp_printf(hmp, " isr: %d\n", s->isr); + monitor_hmp_printf(hmp, " endianness: %s\n", + s->device_endian); + monitor_hmp_printf(hmp, " status:\n"); + hmp_virtio_dump_status(hmp, s->status); + monitor_hmp_printf(hmp, " Guest features:\n"); + hmp_virtio_dump_features(hmp, s->guest_features); + monitor_hmp_printf(hmp, " Host features:\n"); + hmp_virtio_dump_features(hmp, s->host_features); + monitor_hmp_printf(hmp, " Backend features:\n"); + hmp_virtio_dump_features(hmp, s->backend_features); =20 if (s->vhost_dev) { - monitor_printf(mon, " VHost:\n"); - monitor_printf(mon, " nvqs: %d\n", - s->vhost_dev->nvqs); - monitor_printf(mon, " vq_index: %"PRId64"\n", - s->vhost_dev->vq_index); - monitor_printf(mon, " max_queues: %"PRId64"\n", - s->vhost_dev->max_queues); - monitor_printf(mon, " n_mem_sections: %"PRId64"\n", - s->vhost_dev->n_mem_sections); - monitor_printf(mon, " n_tmp_sections: %"PRId64"\n", - s->vhost_dev->n_tmp_sections); - monitor_printf(mon, " backend_cap: %"PRId64"\n", - s->vhost_dev->backend_cap); - monitor_printf(mon, " log_enabled: %s\n", - s->vhost_dev->log_enabled ? "true" : "false"); - monitor_printf(mon, " log_size: %"PRId64"\n", - s->vhost_dev->log_size); - monitor_printf(mon, " Features:\n"); - hmp_virtio_dump_features(mon, s->vhost_dev->features); - monitor_printf(mon, " Acked features:\n"); - hmp_virtio_dump_features(mon, s->vhost_dev->acked_features); - monitor_printf(mon, " Protocol features:\n"); - hmp_virtio_dump_protocols(mon, s->vhost_dev->protocol_features); + monitor_hmp_printf(hmp, " VHost:\n"); + monitor_hmp_printf(hmp, " nvqs: %d\n", + s->vhost_dev->nvqs); + monitor_hmp_printf(hmp, " vq_index: %"PRId64"\n", + s->vhost_dev->vq_index); + monitor_hmp_printf(hmp, " max_queues: %"PRId64"\n", + s->vhost_dev->max_queues); + monitor_hmp_printf(hmp, " n_mem_sections: %"PRId64"\n", + s->vhost_dev->n_mem_sections); + monitor_hmp_printf(hmp, " n_tmp_sections: %"PRId64"\n", + s->vhost_dev->n_tmp_sections); + monitor_hmp_printf(hmp, " backend_cap: %"PRId64"\n", + s->vhost_dev->backend_cap); + monitor_hmp_printf(hmp, " log_enabled: %s\n", + s->vhost_dev->log_enabled ? "true" : "false"); + monitor_hmp_printf(hmp, " log_size: %"PRId64"\n", + s->vhost_dev->log_size); + monitor_hmp_printf(hmp, " Features:\n"); + hmp_virtio_dump_features(hmp, s->vhost_dev->features); + monitor_hmp_printf(hmp, " Acked features:\n"); + hmp_virtio_dump_features(hmp, s->vhost_dev->acked_features); + monitor_hmp_printf(hmp, " Protocol features:\n"); + hmp_virtio_dump_protocols(hmp, s->vhost_dev->protocol_features); } =20 qapi_free_VirtioStatus(s); @@ -187,7 +185,6 @@ void hmp_virtio_status(MonitorHMP *hmp, const QDict *qd= ict) =20 void hmp_vhost_queue_status(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -199,29 +196,28 @@ void hmp_vhost_queue_status(MonitorHMP *hmp, const QD= ict *qdict) return; } =20 - monitor_printf(mon, "%s:\n", path); - monitor_printf(mon, " device_name: %s (vhost)\n", - s->name); - monitor_printf(mon, " kick: %"PRId64"\n", s->kick); - monitor_printf(mon, " call: %"PRId64"\n", s->call); - monitor_printf(mon, " VRing:\n"); - monitor_printf(mon, " num: %"PRId64"\n", s->num); - monitor_printf(mon, " desc_phys: 0x%016"PRIx64"\n", - s->desc_phys); - monitor_printf(mon, " desc_size: %"PRId32"\n", s->desc_size); - monitor_printf(mon, " avail_phys: 0x%016"PRIx64"\n", - s->avail_phys); - monitor_printf(mon, " avail_size: %"PRId32"\n", s->avail_size); - monitor_printf(mon, " used_phys: 0x%016"PRIx64"\n", - s->used_phys); - monitor_printf(mon, " used_size: %"PRId32"\n", s->used_size); + monitor_hmp_printf(hmp, "%s:\n", path); + monitor_hmp_printf(hmp, " device_name: %s (vhost)\n", + s->name); + monitor_hmp_printf(hmp, " kick: %"PRId64"\n", s->kick= ); + monitor_hmp_printf(hmp, " call: %"PRId64"\n", s->call= ); + monitor_hmp_printf(hmp, " VRing:\n"); + monitor_hmp_printf(hmp, " num: %"PRId64"\n", s->num); + monitor_hmp_printf(hmp, " desc_phys: 0x%016"PRIx64"\n", + s->desc_phys); + monitor_hmp_printf(hmp, " desc_size: %"PRId32"\n", s->desc_size); + monitor_hmp_printf(hmp, " avail_phys: 0x%016"PRIx64"\n", + s->avail_phys); + monitor_hmp_printf(hmp, " avail_size: %"PRId32"\n", s->avail_size); + monitor_hmp_printf(hmp, " used_phys: 0x%016"PRIx64"\n", + s->used_phys); + monitor_hmp_printf(hmp, " used_size: %"PRId32"\n", s->used_size); =20 qapi_free_VirtVhostQueueStatus(s); } =20 void hmp_virtio_queue_status(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -232,42 +228,41 @@ void hmp_virtio_queue_status(MonitorHMP *hmp, const Q= Dict *qdict) return; } =20 - monitor_printf(mon, "%s:\n", path); - monitor_printf(mon, " device_name: %s\n", s->name); - monitor_printf(mon, " queue_index: %d\n", s->queue_index); - monitor_printf(mon, " inuse: %d\n", s->inuse); - monitor_printf(mon, " used_idx: %d\n", s->used_idx); - monitor_printf(mon, " signalled_used: %d\n", - s->signalled_used); - monitor_printf(mon, " signalled_used_valid: %s\n", - s->signalled_used_valid ? "true" : "false"); + monitor_hmp_printf(hmp, "%s:\n", path); + monitor_hmp_printf(hmp, " device_name: %s\n", s->name); + monitor_hmp_printf(hmp, " queue_index: %d\n", s->queue_index= ); + monitor_hmp_printf(hmp, " inuse: %d\n", s->inuse); + monitor_hmp_printf(hmp, " used_idx: %d\n", s->used_idx); + monitor_hmp_printf(hmp, " signalled_used: %d\n", + s->signalled_used); + monitor_hmp_printf(hmp, " signalled_used_valid: %s\n", + s->signalled_used_valid ? "true" : "false"); if (s->has_last_avail_idx) { - monitor_printf(mon, " last_avail_idx: %d\n", - s->last_avail_idx); + monitor_hmp_printf(hmp, " last_avail_idx: %d\n", + s->last_avail_idx); } if (s->has_shadow_avail_idx) { - monitor_printf(mon, " shadow_avail_idx: %d\n", - s->shadow_avail_idx); + monitor_hmp_printf(hmp, " shadow_avail_idx: %d\n", + s->shadow_avail_idx); } - monitor_printf(mon, " VRing:\n"); - monitor_printf(mon, " num: %"PRId32"\n", s->vring_num); - monitor_printf(mon, " num_default: %"PRId32"\n", - s->vring_num_default); - monitor_printf(mon, " align: %"PRId32"\n", - s->vring_align); - monitor_printf(mon, " desc: 0x%016"PRIx64"\n", - s->vring_desc); - monitor_printf(mon, " avail: 0x%016"PRIx64"\n", - s->vring_avail); - monitor_printf(mon, " used: 0x%016"PRIx64"\n", - s->vring_used); + monitor_hmp_printf(hmp, " VRing:\n"); + monitor_hmp_printf(hmp, " num: %"PRId32"\n", s->vring_num); + monitor_hmp_printf(hmp, " num_default: %"PRId32"\n", + s->vring_num_default); + monitor_hmp_printf(hmp, " align: %"PRId32"\n", + s->vring_align); + monitor_hmp_printf(hmp, " desc: 0x%016"PRIx64"\n", + s->vring_desc); + monitor_hmp_printf(hmp, " avail: 0x%016"PRIx64"\n", + s->vring_avail); + monitor_hmp_printf(hmp, " used: 0x%016"PRIx64"\n", + s->vring_used); =20 qapi_free_VirtQueueStatus(s); } =20 void hmp_virtio_queue_element(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -282,41 +277,41 @@ void hmp_virtio_queue_element(MonitorHMP *hmp, const = QDict *qdict) return; } =20 - monitor_printf(mon, "%s:\n", path); - monitor_printf(mon, " device_name: %s\n", e->name); - monitor_printf(mon, " index: %d\n", e->index); - monitor_printf(mon, " desc:\n"); - monitor_printf(mon, " descs:\n"); + monitor_hmp_printf(hmp, "%s:\n", path); + monitor_hmp_printf(hmp, " device_name: %s\n", e->name); + monitor_hmp_printf(hmp, " index: %d\n", e->index); + monitor_hmp_printf(hmp, " desc:\n"); + monitor_hmp_printf(hmp, " descs:\n"); =20 list =3D e->descs; while (list) { - monitor_printf(mon, " addr 0x%"PRIx64" len %d", - list->value->addr, list->value->len); + monitor_hmp_printf(hmp, " addr 0x%"PRIx64" len %d", + list->value->addr, list->value->len); if (list->value->flags) { strList *flag =3D list->value->flags; - monitor_printf(mon, " ("); + monitor_hmp_printf(hmp, " ("); while (flag) { - monitor_printf(mon, "%s", flag->value); + monitor_hmp_printf(hmp, "%s", flag->value); flag =3D flag->next; if (flag) { - monitor_printf(mon, ", "); + monitor_hmp_printf(hmp, ", "); } } - monitor_printf(mon, ")"); + monitor_hmp_printf(hmp, ")"); } list =3D list->next; if (list) { - monitor_printf(mon, ",\n"); + monitor_hmp_printf(hmp, ",\n"); } } - monitor_printf(mon, "\n"); - monitor_printf(mon, " avail:\n"); - monitor_printf(mon, " flags: %d\n", e->avail->flags); - monitor_printf(mon, " idx: %d\n", e->avail->idx); - monitor_printf(mon, " ring: %d\n", e->avail->ring); - monitor_printf(mon, " used:\n"); - monitor_printf(mon, " flags: %d\n", e->used->flags); - monitor_printf(mon, " idx: %d\n", e->used->idx); + monitor_hmp_printf(hmp, "\n"); + monitor_hmp_printf(hmp, " avail:\n"); + monitor_hmp_printf(hmp, " flags: %d\n", e->avail->flags); + monitor_hmp_printf(hmp, " idx: %d\n", e->avail->idx); + monitor_hmp_printf(hmp, " ring: %d\n", e->avail->ring); + monitor_hmp_printf(hmp, " used:\n"); + monitor_hmp_printf(hmp, " flags: %d\n", e->used->flags); + monitor_hmp_printf(hmp, " idx: %d\n", e->used->idx); =20 qapi_free_VirtioQueueElement(e); } diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index a563f6066bb4..4075b5b001ae 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -103,10 +103,11 @@ abort: =20 static void xen_bus_print_dev(Monitor *mon, DeviceState *dev, int indent) { + MonitorHMP *hmp =3D MONITOR_HMP(mon); XenDevice *xendev =3D XEN_DEVICE(dev); =20 - monitor_printf(mon, "%*sname =3D '%s' frontend_id =3D %u\n", - indent, "", xendev->name, xendev->frontend_id); + monitor_hmp_printf(hmp, "%*sname =3D '%s' frontend_id =3D %u\n", + indent, "", xendev->name, xendev->frontend_id); } =20 static char *xen_bus_get_dev_path(DeviceState *dev) diff --git a/include/disas/disas.h b/include/disas/disas.h index c702b1effc1c..47daa9b4d2df 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -1,13 +1,15 @@ #ifndef QEMU_DISAS_H #define QEMU_DISAS_H =20 +#include "monitor/hmp.h" + /* Disassemble this for me please... (debugging). */ #ifdef CONFIG_TCG void disas(FILE *out, const void *code, size_t size); void target_disas(FILE *out, CPUState *cpu, const DisasContextBase *db); #endif =20 -void monitor_disas(Monitor *mon, CPUState *cpu, uint64_t pc, +void monitor_disas(MonitorHMP *hmp, CPUState *cpu, uint64_t pc, int nb_insn, bool is_physical); =20 #ifdef CONFIG_PLUGIN diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 3fd17048b319..f10bf83df86d 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -38,10 +38,10 @@ void monitor_new_hmp(const char *id, const char *charde= v_id, =20 MonitorHMP *monitor_cur_hmp(void); =20 -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); -int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3); -void monitor_printc(Monitor *mon, int ch); +int monitor_hmp_printf(MonitorHMP *mon, const char *fmt, ...) G_GNUC_PRINT= F(2, 3); +void monitor_hmp_printc(MonitorHMP *mon, int ch); =20 void monitor_hmp_read_command(MonitorHMP *hmp, int show_prompt); int monitor_hmp_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, @@ -58,7 +58,7 @@ CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp); int monitor_hmp_get_cpu_index(MonitorHMP *hmp); =20 bool hmp_handle_error(MonitorHMP *hmp, Error *err); -void hmp_help_cmd(Monitor *mon, const char *name); +void hmp_help_cmd(MonitorHMP *hmp, const char *name); strList *hmp_split_at_comma(const char *str); =20 void hmp_info_name(MonitorHMP *hmp, const QDict *qdict); @@ -114,11 +114,11 @@ void hmp_set_password(MonitorHMP *hmp, const QDict *q= dict); void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict); void hmp_change(MonitorHMP *hmp, const QDict *qdict); #ifdef CONFIG_VNC -void hmp_change_vnc(Monitor *mon, const char *device, const char *target, +void hmp_change_vnc(MonitorHMP *hmp, const char *device, const char *targe= t, const char *arg, const char *read_only, bool force, Error **errp); #endif -void hmp_change_medium(Monitor *mon, const char *device, const char *targe= t, +void hmp_change_medium(MonitorHMP *hmp, const char *device, const char *ta= rget, const char *arg, const char *read_only, bool force, Error **errp); void hmp_migrate(MonitorHMP *hmp, const QDict *qdict); diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 3c0931796ce2..bdbb2aaa99db 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -858,34 +858,33 @@ struct DirtyRateInfo *qmp_query_dirty_rate(bool has_c= alc_time_unit, =20 void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); DirtyRateInfo *info =3D query_dirty_rate_info(TIME_UNIT_SECOND); =20 - monitor_printf(mon, "Status: %s\n", - DirtyRateStatus_str(info->status)); - monitor_printf(mon, "Start Time: %"PRIi64" (ms)\n", - info->start_time); + monitor_hmp_printf(hmp, "Status: %s\n", + DirtyRateStatus_str(info->status)); + monitor_hmp_printf(hmp, "Start Time: %"PRIi64" (ms)\n", + info->start_time); if (info->mode =3D=3D DIRTY_RATE_MEASURE_MODE_PAGE_SAMPLING) { - monitor_printf(mon, "Sample Pages: %"PRIu64" (per GB)\n", - info->sample_pages); + monitor_hmp_printf(hmp, "Sample Pages: %"PRIu64" (per GB)\n", + info->sample_pages); } - monitor_printf(mon, "Period: %"PRIi64" (sec)\n", - info->calc_time); - monitor_printf(mon, "Mode: %s\n", - DirtyRateMeasureMode_str(info->mode)); - monitor_printf(mon, "Dirty rate: "); + monitor_hmp_printf(hmp, "Period: %"PRIi64" (sec)\n", + info->calc_time); + monitor_hmp_printf(hmp, "Mode: %s\n", + DirtyRateMeasureMode_str(info->mode)); + monitor_hmp_printf(hmp, "Dirty rate: "); if (info->has_dirty_rate) { - monitor_printf(mon, "%"PRIi64" (MB/s)\n", info->dirty_rate); + monitor_hmp_printf(hmp, "%"PRIi64" (MB/s)\n", info->dirty_rate); if (info->has_vcpu_dirty_rate) { DirtyRateVcpuList *rate, *head =3D info->vcpu_dirty_rate; for (rate =3D head; rate !=3D NULL; rate =3D rate->next) { - monitor_printf(mon, "vcpu[%"PRIi64"], Dirty rate: %"PRIi64 - " (MB/s)\n", rate->value->id, - rate->value->dirty_rate); + monitor_hmp_printf(hmp, "vcpu[%"PRIi64"], Dirty rate: %"PR= Ii64 + " (MB/s)\n", rate->value->id, + rate->value->dirty_rate); } } } else { - monitor_printf(mon, "(not ready)\n"); + monitor_hmp_printf(hmp, "(not ready)\n"); } =20 qapi_free_DirtyRateVcpuList(info->vcpu_dirty_rate); @@ -894,7 +893,6 @@ void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *= qdict) =20 void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int64_t sec =3D qdict_get_try_int(qdict, "second", 0); int64_t sample_pages =3D qdict_get_try_int(qdict, "sample_pages_per_GB= ", -1); bool has_sample_pages =3D (sample_pages !=3D -1); @@ -904,13 +902,13 @@ void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict= *qdict) Error *err =3D NULL; =20 if (!sec) { - monitor_printf(mon, "Incorrect period length specified!\n"); + monitor_hmp_printf(hmp, "Incorrect period length specified!\n"); return; } =20 if (dirty_ring && dirty_bitmap) { - monitor_printf(mon, "Either dirty ring or dirty bitmap " - "can be specified!\n"); + monitor_hmp_printf(hmp, "Either dirty ring or dirty bitmap " + "can be specified!\n"); return; } =20 @@ -930,7 +928,7 @@ void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *= qdict) return; } =20 - monitor_printf(mon, "Starting dirty rate measurement with period %"PRI= i64 - " seconds\n", sec); - monitor_printf(mon, "[Please use 'info dirty_rate' to check results]\n= "); + monitor_hmp_printf(hmp, "Starting dirty rate measurement with period %= "PRIi64 + " seconds\n", sec); + monitor_hmp_printf(hmp, "[Please use 'info dirty_rate' to check result= s]\n"); } diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 73a974259478..6fe189471899 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -36,23 +36,23 @@ #include "options.h" #include "migration.h" =20 -static void migration_global_dump(Monitor *mon) +static void migration_global_dump(MonitorHMP *hmp) { MigrationState *ms =3D migrate_get_current(); =20 - monitor_printf(mon, "Globals:\n"); - monitor_printf(mon, " store-global-state: %s\n", - ms->store_global_state ? "on" : "off"); - monitor_printf(mon, " only-migratable: %s\n", - only_migratable ? "on" : "off"); - monitor_printf(mon, " send-configuration: %s\n", - ms->send_configuration ? "on" : "off"); - monitor_printf(mon, " send-section-footer: %s\n", - ms->send_section_footer ? "on" : "off"); - monitor_printf(mon, " send-switchover-start: %s\n", - ms->send_switchover_start ? "on" : "off"); - monitor_printf(mon, " clear-bitmap-shift: %u\n", - ms->clear_bitmap_shift); + monitor_hmp_printf(hmp, "Globals:\n"); + monitor_hmp_printf(hmp, " store-global-state: %s\n", + ms->store_global_state ? "on" : "off"); + monitor_hmp_printf(hmp, " only-migratable: %s\n", + only_migratable ? "on" : "off"); + monitor_hmp_printf(hmp, " send-configuration: %s\n", + ms->send_configuration ? "on" : "off"); + monitor_hmp_printf(hmp, " send-section-footer: %s\n", + ms->send_section_footer ? "on" : "off"); + monitor_hmp_printf(hmp, " send-switchover-start: %s\n", + ms->send_switchover_start ? "on" : "off"); + monitor_hmp_printf(hmp, " clear-bitmap-shift: %u\n", + ms->clear_bitmap_shift); } =20 static const gchar *format_time_str(uint64_t us) @@ -68,11 +68,11 @@ static const gchar *format_time_str(uint64_t us) return g_strdup_printf("%"PRIu64" %s", us, units[index]); } =20 -static void migration_dump_blocktime(Monitor *mon, MigrationInfo *info) +static void migration_dump_blocktime(MonitorHMP *hmp, MigrationInfo *info) { if (info->has_postcopy_blocktime) { - monitor_printf(mon, "Postcopy Blocktime (ms): %" PRIu32 "\n", - info->postcopy_blocktime); + monitor_hmp_printf(hmp, "Postcopy Blocktime (ms): %" PRIu32 "\n", + info->postcopy_blocktime); } =20 if (info->has_postcopy_vcpu_blocktime) { @@ -80,25 +80,25 @@ static void migration_dump_blocktime(Monitor *mon, Migr= ationInfo *info) const char *sep =3D ""; int count =3D 0; =20 - monitor_printf(mon, "Postcopy vCPU Blocktime (ms):\n ["); + monitor_hmp_printf(hmp, "Postcopy vCPU Blocktime (ms):\n ["); =20 while (item) { - monitor_printf(mon, "%s%"PRIu32, sep, item->value); + monitor_hmp_printf(hmp, "%s%"PRIu32, sep, item->value); item =3D item->next; /* Each line 10 vcpu results, newline if there's more */ sep =3D ((++count % 10 =3D=3D 0) && item) ? ",\n " : ", "; } - monitor_printf(mon, "]\n"); + monitor_hmp_printf(hmp, "]\n"); } =20 if (info->has_postcopy_latency) { - monitor_printf(mon, "Postcopy Latency (ns): %" PRIu64 "\n", - info->postcopy_latency); + monitor_hmp_printf(hmp, "Postcopy Latency (ns): %" PRIu64 "\n", + info->postcopy_latency); } =20 if (info->has_postcopy_non_vcpu_latency) { - monitor_printf(mon, "Postcopy non-vCPU Latency (ns): %" PRIu64 "\n= ", - info->postcopy_non_vcpu_latency); + monitor_hmp_printf(hmp, "Postcopy non-vCPU Latency (ns): %" PRIu64= "\n", + info->postcopy_non_vcpu_latency); } =20 if (info->has_postcopy_vcpu_latency) { @@ -106,29 +106,29 @@ static void migration_dump_blocktime(Monitor *mon, Mi= grationInfo *info) const char *sep =3D ""; int count =3D 0; =20 - monitor_printf(mon, "Postcopy vCPU Latencies (ns):\n ["); + monitor_hmp_printf(hmp, "Postcopy vCPU Latencies (ns):\n ["); =20 while (item) { - monitor_printf(mon, "%s%"PRIu64, sep, item->value); + monitor_hmp_printf(hmp, "%s%"PRIu64, sep, item->value); item =3D item->next; /* Each line 10 vcpu results, newline if there's more */ sep =3D ((++count % 10 =3D=3D 0) && item) ? ",\n " : ", "; } - monitor_printf(mon, "]\n"); + monitor_hmp_printf(hmp, "]\n"); } =20 if (info->has_postcopy_latency_dist) { uint64List *item =3D info->postcopy_latency_dist; int count =3D 0; =20 - monitor_printf(mon, "Postcopy Latency Distribution:\n"); + monitor_hmp_printf(hmp, "Postcopy Latency Distribution:\n"); =20 while (item) { g_autofree const gchar *from =3D format_time_str(1UL << count); g_autofree const gchar *to =3D format_time_str(1UL << (count += 1)); =20 - monitor_printf(mon, " [ %8s - %8s ]: %10"PRIu64"\n", - from, to, item->value); + monitor_hmp_printf(hmp, " [ %8s - %8s ]: %10"PRIu64"\n", + from, to, item->value); item =3D item->next; count++; } @@ -137,7 +137,6 @@ static void migration_dump_blocktime(Monitor *mon, Migr= ationInfo *info) =20 void hmp_info_migrate(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); bool show_all =3D qdict_get_try_bool(qdict, "all", false); MigrationInfo *info; =20 @@ -145,59 +144,59 @@ void hmp_info_migrate(MonitorHMP *hmp, const QDict *q= dict) =20 if (info->blocked_reasons) { strList *reasons =3D info->blocked_reasons; - monitor_printf(mon, "Outgoing migration blocked:\n"); + monitor_hmp_printf(hmp, "Outgoing migration blocked:\n"); while (reasons) { - monitor_printf(mon, " %s\n", reasons->value); + monitor_hmp_printf(hmp, " %s\n", reasons->value); reasons =3D reasons->next; } } =20 if (info->has_status) { - monitor_printf(mon, "Status: \t\t%s", - MigrationStatus_str(info->status)); + monitor_hmp_printf(hmp, "Status: \t\t%s", + MigrationStatus_str(info->status)); if ((info->status =3D=3D MIGRATION_STATUS_FAILED || info->status =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED) && info->error_desc) { - monitor_printf(mon, " (%s)\n", info->error_desc); + monitor_hmp_printf(hmp, " (%s)\n", info->error_desc); } else { - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 if (info->total_time) { - monitor_printf(mon, "Time (ms): \t\ttotal=3D%" PRIu64, - info->total_time); + monitor_hmp_printf(hmp, "Time (ms): \t\ttotal=3D%" PRIu64, + info->total_time); if (info->has_setup_time) { - monitor_printf(mon, ", setup=3D%" PRIu64, - info->setup_time); + monitor_hmp_printf(hmp, ", setup=3D%" PRIu64, + info->setup_time); } if (info->has_expected_downtime) { - monitor_printf(mon, ", exp_down=3D%" PRIu64, - info->expected_downtime); + monitor_hmp_printf(hmp, ", exp_down=3D%" PRIu64, + info->expected_downtime); } if (info->has_downtime) { - monitor_printf(mon, ", down=3D%" PRIu64, - info->downtime); + monitor_hmp_printf(hmp, ", down=3D%" PRIu64, + info->downtime); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } } =20 if (info->has_remaining) { g_autofree char *remaining =3D size_to_str(info->remaining); - monitor_printf(mon, "Remaining: \t\t%s\n", remaining); + monitor_hmp_printf(hmp, "Remaining: \t\t%s\n", remaining); } =20 if (info->has_socket_address) { SocketAddressList *addr; =20 - monitor_printf(mon, "Sockets: [\n"); + monitor_hmp_printf(hmp, "Sockets: [\n"); =20 for (addr =3D info->socket_address; addr; addr =3D addr->next) { char *s =3D socket_uri(addr->value); - monitor_printf(mon, "\t%s\n", s); + monitor_hmp_printf(hmp, "\t%s\n", s); g_free(s); } - monitor_printf(mon, "]\n"); + monitor_hmp_printf(hmp, "]\n"); } =20 if (info->ram) { @@ -209,219 +208,217 @@ void hmp_info_migrate(MonitorHMP *hmp, const QDict = *qdict) g_autofree char *str_multifd =3D size_to_str(info->ram->multifd_by= tes); g_autofree char *str_postcopy =3D size_to_str(info->ram->postcopy_= bytes); =20 - monitor_printf(mon, "RAM info:\n"); - monitor_printf(mon, " Throughput (Mbps): \t%0.2f\n", - info->ram->mbps); - monitor_printf(mon, " Sizes: \t\tpagesize=3D%s, total=3D%s\n", - str_psize, str_total); - monitor_printf(mon, " Transfers: \t\ttransferred=3D%s, remain=3D%= s\n", - str_transferred, str_remaining); - monitor_printf(mon, " Channels: \t\tprecopy=3D%s, " - "multifd=3D%s, postcopy=3D%s", - str_precopy, str_multifd, str_postcopy); + monitor_hmp_printf(hmp, "RAM info:\n"); + monitor_hmp_printf(hmp, " Throughput (Mbps): \t%0.2f\n", + info->ram->mbps); + monitor_hmp_printf(hmp, " Sizes: \t\tpagesize=3D%s, total=3D%s\n", + str_psize, str_total); + monitor_hmp_printf(hmp, " Transfers: \t\ttransferred=3D%s, remain= =3D%s\n", + str_transferred, str_remaining); + monitor_hmp_printf(hmp, " Channels: \t\tprecopy=3D%s, " + "multifd=3D%s, postcopy=3D%s", + str_precopy, str_multifd, str_postcopy); =20 if (info->vfio) { g_autofree char *str_vfio =3D size_to_str(info->vfio->transfer= red); =20 - monitor_printf(mon, ", vfio=3D%s", str_vfio); + monitor_hmp_printf(hmp, ", vfio=3D%s", str_vfio); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); =20 - monitor_printf(mon, " Page Types: \tnormal=3D%" PRIu64 - ", zero=3D%" PRIu64 "\n", - info->ram->normal, info->ram->duplicate); - monitor_printf(mon, " Page Rates (pps): \ttransfer=3D%" PRIu64, - info->ram->pages_per_second); + monitor_hmp_printf(hmp, " Page Types: \tnormal=3D%" PRIu64 + ", zero=3D%" PRIu64 "\n", + info->ram->normal, info->ram->duplicate); + monitor_hmp_printf(hmp, " Page Rates (pps): \ttransfer=3D%" PRIu6= 4, + info->ram->pages_per_second); if (info->ram->dirty_pages_rate) { - monitor_printf(mon, ", dirty=3D%" PRIu64, - info->ram->dirty_pages_rate); + monitor_hmp_printf(hmp, ", dirty=3D%" PRIu64, + info->ram->dirty_pages_rate); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); =20 - monitor_printf(mon, " Others: \t\tdirty_syncs=3D%" PRIu64, - info->ram->dirty_sync_count); + monitor_hmp_printf(hmp, " Others: \t\tdirty_syncs=3D%" PRIu64, + info->ram->dirty_sync_count); if (info->ram->postcopy_requests) { - monitor_printf(mon, ", postcopy_req=3D%" PRIu64, - info->ram->postcopy_requests); + monitor_hmp_printf(hmp, ", postcopy_req=3D%" PRIu64, + info->ram->postcopy_requests); } if (info->ram->downtime_bytes) { - monitor_printf(mon, ", downtime_bytes=3D%" PRIu64, - info->ram->downtime_bytes); + monitor_hmp_printf(hmp, ", downtime_bytes=3D%" PRIu64, + info->ram->downtime_bytes); } if (info->ram->dirty_sync_missed_zero_copy) { - monitor_printf(mon, ", zerocopy_fallbacks=3D%" PRIu64, - info->ram->dirty_sync_missed_zero_copy); + monitor_hmp_printf(hmp, ", zerocopy_fallbacks=3D%" PRIu64, + info->ram->dirty_sync_missed_zero_copy); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 if (!show_all) { goto out; } =20 - migration_global_dump(mon); + migration_global_dump(hmp); =20 if (info->xbzrle_cache) { - monitor_printf(mon, "XBZRLE: size=3D%" PRIu64 - ", transferred=3D%" PRIu64 - ", pages=3D%" PRIu64 - ", miss=3D%" PRIu64 "\n" - " miss_rate=3D%0.2f" - ", encode_rate=3D%0.2f" - ", overflow=3D%" PRIu64 "\n", - info->xbzrle_cache->cache_size, - info->xbzrle_cache->bytes, - info->xbzrle_cache->pages, - info->xbzrle_cache->cache_miss, - info->xbzrle_cache->cache_miss_rate, - info->xbzrle_cache->encoding_rate, - info->xbzrle_cache->overflow); + monitor_hmp_printf(hmp, "XBZRLE: size=3D%" PRIu64 + ", transferred=3D%" PRIu64 + ", pages=3D%" PRIu64 + ", miss=3D%" PRIu64 "\n" + " miss_rate=3D%0.2f" + ", encode_rate=3D%0.2f" + ", overflow=3D%" PRIu64 "\n", + info->xbzrle_cache->cache_size, + info->xbzrle_cache->bytes, + info->xbzrle_cache->pages, + info->xbzrle_cache->cache_miss, + info->xbzrle_cache->cache_miss_rate, + info->xbzrle_cache->encoding_rate, + info->xbzrle_cache->overflow); } =20 if (info->has_cpu_throttle_percentage) { - monitor_printf(mon, "CPU Throttle (%%): %" PRIu64 "\n", - info->cpu_throttle_percentage); + monitor_hmp_printf(hmp, "CPU Throttle (%%): %" PRIu64 "\n", + info->cpu_throttle_percentage); } =20 if (info->has_dirty_limit_throttle_time_per_round) { - monitor_printf(mon, "Dirty-limit Throttle (us): %" PRIu64 "\n", - info->dirty_limit_throttle_time_per_round); + monitor_hmp_printf(hmp, "Dirty-limit Throttle (us): %" PRIu64 "\n", + info->dirty_limit_throttle_time_per_round); } =20 if (info->has_dirty_limit_ring_full_time) { - monitor_printf(mon, "Dirty-limit Ring Full (us): %" PRIu64 "\n", - info->dirty_limit_ring_full_time); + monitor_hmp_printf(hmp, "Dirty-limit Ring Full (us): %" PRIu64 "\n= ", + info->dirty_limit_ring_full_time); } =20 - migration_dump_blocktime(mon, info); + migration_dump_blocktime(hmp, info); out: qapi_free_MigrationInfo(info); } =20 void hmp_info_migrate_capabilities(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); MigrationCapabilityStatusList *caps, *cap; =20 caps =3D qmp_query_migrate_capabilities(NULL); =20 if (caps) { for (cap =3D caps; cap; cap =3D cap->next) { - monitor_printf(mon, "%s: %s\n", - MigrationCapability_str(cap->value->capability), - cap->value->state ? "on" : "off"); + monitor_hmp_printf(hmp, "%s: %s\n", + MigrationCapability_str(cap->value->capabil= ity), + cap->value->state ? "on" : "off"); } } =20 qapi_free_MigrationCapabilityStatusList(caps); } =20 -static void monitor_print_cpr_exec_command(Monitor *mon, strList *args) +static void monitor_print_cpr_exec_command(MonitorHMP *hmp, strList *args) { - monitor_printf(mon, "%s:", + monitor_hmp_printf(hmp, "%s:", MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_COMMAND)); =20 while (args) { - monitor_printf(mon, " %s", args->value); + monitor_hmp_printf(hmp, " %s", args->value); args =3D args->next; } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); MigrationParameters *params; MigrationState *s =3D migrate_get_current(); =20 params =3D qmp_query_migrate_parameters(NULL); =20 if (params) { - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), params->announce_initial); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_MAX), params->announce_max); - monitor_printf(mon, "%s: %" PRIu64 "\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_ROUNDS), params->announce_rounds); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), params->announce_step); assert(params->has_throttle_trigger_threshold); - monitor_printf(mon, "%s: %u\n", + monitor_hmp_printf(hmp, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_THROTTLE_TRIGGER_TH= RESHOLD), params->throttle_trigger_threshold); assert(params->has_cpu_throttle_initial); - monitor_printf(mon, "%s: %u\n", + monitor_hmp_printf(hmp, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIA= L), params->cpu_throttle_initial); assert(params->has_cpu_throttle_increment); - monitor_printf(mon, "%s: %u\n", + monitor_hmp_printf(hmp, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREM= ENT), params->cpu_throttle_increment); assert(params->has_cpu_throttle_tailslow); - monitor_printf(mon, "%s: %s\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_TAILSL= OW), params->cpu_throttle_tailslow ? "on" : "off"); assert(params->has_max_cpu_throttle); - monitor_printf(mon, "%s: %u\n", + monitor_hmp_printf(hmp, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), params->max_cpu_throttle); assert(params->tls_creds); - monitor_printf(mon, "%s: '%s'\n", + monitor_hmp_printf(hmp, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), params->tls_creds->u.s); assert(params->tls_hostname); - monitor_printf(mon, "%s: '%s'\n", + monitor_hmp_printf(hmp, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), params->tls_hostname->u.s); assert(params->tls_authz); - monitor_printf(mon, "%s: '%s'\n", + monitor_hmp_printf(hmp, "%s: '%s'\n", MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), params->tls_authz->u.s); assert(params->has_max_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), params->max_bandwidth); assert(params->has_avail_switchover_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BA= NDWIDTH), params->avail_switchover_bandwidth); assert(params->has_max_postcopy_bandwidth); - monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), params->max_postcopy_bandwidth); assert(params->has_downtime_limit); - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), params->downtime_limit); assert(params->has_x_checkpoint_delay); - monitor_printf(mon, "%s: %u ms\n", + monitor_hmp_printf(hmp, "%s: %u ms\n", MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), params->x_checkpoint_delay); - monitor_printf(mon, "%s: %u\n", + monitor_hmp_printf(hmp, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), params->multifd_channels); - monitor_printf(mon, "%s: %s\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION= ), MultiFDCompression_str(params->multifd_compression)); assert(params->has_zero_page_detection); - monitor_printf(mon, "%s: %s\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION= ), qapi_enum_lookup(&ZeroPageDetection_lookup, params->zero_page_detection)); - monitor_printf(mon, "%s: %" PRIu64 " bytes\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); =20 if (s->has_block_bitmap_mapping) { const BitmapMigrationNodeAliasList *bmnal; =20 - monitor_printf(mon, "%s:\n", - MigrationParameter_str( - MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); + monitor_hmp_printf(hmp, "%s:\n", + MigrationParameter_str( + MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPIN= G)); =20 for (bmnal =3D params->block_bitmap_mapping; bmnal; @@ -430,47 +427,47 @@ void hmp_info_migrate_parameters(MonitorHMP *hmp, con= st QDict *qdict) const BitmapMigrationNodeAlias *bmna =3D bmnal->value; const BitmapMigrationBitmapAliasList *bmbal; =20 - monitor_printf(mon, " '%s' -> '%s'\n", - bmna->node_name, bmna->alias); + monitor_hmp_printf(hmp, " '%s' -> '%s'\n", + bmna->node_name, bmna->alias); =20 for (bmbal =3D bmna->bitmaps; bmbal; bmbal =3D bmbal->next= ) { const BitmapMigrationBitmapAlias *bmba =3D bmbal->valu= e; =20 - monitor_printf(mon, " '%s' -> '%s'\n", - bmba->name, bmba->alias); + monitor_hmp_printf(hmp, " '%s' -> '%s'\n", + bmba->name, bmba->alias); } } } =20 - monitor_printf(mon, "%s: %" PRIu64 " ms\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), params->x_vcpu_dirty_limit_period); =20 - monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", + monitor_hmp_printf(hmp, "%s: %" PRIu64 " MB/s\n", MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), params->vcpu_dirty_limit); =20 assert(params->has_mode); - monitor_printf(mon, "%s: %s\n", + monitor_hmp_printf(hmp, "%s: %s\n", MigrationParameter_str(MIGRATION_PARAMETER_MODE), qapi_enum_lookup(&MigMode_lookup, params->mode)); =20 if (params->has_direct_io) { - monitor_printf(mon, "%s: %s\n", - MigrationParameter_str( - MIGRATION_PARAMETER_DIRECT_IO), - params->direct_io ? "on" : "off"); + monitor_hmp_printf(hmp, "%s: %s\n", + MigrationParameter_str( + MIGRATION_PARAMETER_DIRECT_IO), + params->direct_io ? "on" : "off"); } =20 if (params->has_x_rdma_chunk_size) { - monitor_printf(mon, "%s: %" PRIu64 " bytes\n", - MigrationParameter_str( - MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), - params->x_rdma_chunk_size); + monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes\n", + MigrationParameter_str( + MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), + params->x_rdma_chunk_size); } =20 assert(params->has_cpr_exec_command); - monitor_print_cpr_exec_command(mon, params->cpr_exec_command); + monitor_print_cpr_exec_command(hmp, params->cpr_exec_command); } =20 qapi_free_MigrationParameters(params); @@ -857,12 +854,12 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) if (uri_cpr) { if (migrate_mode() !=3D MIG_MODE_CPR_TRANSFER) { error_setg(&err, "-c can only be used in cpr-transfer mode"); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 if (!migrate_uri_parse(uri_cpr, &channel_cpr, &err)) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -879,8 +876,8 @@ void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) HMPMigrationStatus *status; =20 if (!hmp->use_readline) { - monitor_printf(mon, "terminal does not allow synchronous " - "migration, continuing detached\n"); + monitor_hmp_printf(hmp, "terminal does not allow synchronous " + "migration, continuing detached\n"); return; } monitor_suspend(mon); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 89cc19c2431d..1834e3c1f697 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -105,26 +105,24 @@ strList *hmp_split_at_comma(const char *str) =20 void hmp_info_name(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); NameInfo *info; =20 info =3D qmp_query_name(NULL); if (info->name) { - monitor_printf(mon, "%s\n", info->name); + monitor_hmp_printf(hmp, "%s\n", info->name); } qapi_free_NameInfo(info); } =20 void hmp_info_version(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); VersionInfo *info; =20 info =3D qmp_query_version(NULL); =20 - monitor_printf(mon, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n", - info->qemu->major, info->qemu->minor, info->qemu->micro, - info->package); + monitor_hmp_printf(hmp, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n", + info->qemu->major, info->qemu->minor, info->qemu->m= icro, + info->package); =20 qapi_free_VersionInfo(info); } @@ -145,13 +143,12 @@ void hmp_stop(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_sync_profile(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *op =3D qdict_get_try_str(qdict, "op"); =20 if (op =3D=3D NULL) { bool on =3D qsp_is_enabled(); =20 - monitor_printf(mon, "sync-profile is %s\n", on ? "on" : "off"); + monitor_hmp_printf(hmp, "sync-profile is %s\n", on ? "on" : "off"); return; } if (!strcmp(op, "on")) { @@ -179,14 +176,13 @@ void hmp_exit_preconfig(MonitorHMP *hmp, const QDict = *qdict) =20 void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int64_t cpu_index; =20 /* XXX: drop the monitor_hmp_set_cpu() usage when all HMP commands that use it are converted to the QAPI */ cpu_index =3D qdict_get_int(qdict, "index"); if (monitor_hmp_set_cpu(hmp, cpu_index) < 0) { - monitor_printf(mon, "invalid CPU index\n"); + monitor_hmp_printf(hmp, "invalid CPU index\n"); } } =20 @@ -200,7 +196,6 @@ void hmp_cont(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_change(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *target =3D qdict_get_str(qdict, "target"); const char *arg =3D qdict_get_try_str(qdict, "arg"); @@ -210,11 +205,11 @@ void hmp_change(MonitorHMP *hmp, const QDict *qdict) =20 #ifdef CONFIG_VNC if (strcmp(device, "vnc") =3D=3D 0) { - hmp_change_vnc(mon, device, target, arg, read_only, force, &err); + hmp_change_vnc(hmp, device, target, arg, read_only, force, &err); } else #endif { - hmp_change_medium(mon, device, target, arg, read_only, force, &err= ); + hmp_change_medium(hmp, device, target, arg, read_only, force, &err= ); } =20 hmp_handle_error(hmp, err); @@ -242,21 +237,20 @@ void hmp_closefd(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); IOThreadInfoList *info_list =3D qmp_query_iothreads(NULL); IOThreadInfoList *info; IOThreadInfo *value; =20 for (info =3D info_list; info; info =3D info->next) { value =3D info->value; - monitor_printf(mon, "%s:\n", value->id); - monitor_printf(mon, " thread_id=3D%" PRId64 "\n", value->thread_i= d); - monitor_printf(mon, " poll-max-ns=3D%" PRId64 "\n", value->poll_m= ax_ns); - monitor_printf(mon, " poll-grow=3D%" PRId64 "\n", value->poll_gro= w); - monitor_printf(mon, " poll-shrink=3D%" PRId64 "\n", value->poll_s= hrink); - monitor_printf(mon, " poll-weight=3D%" PRId64 "\n", value->poll_w= eight); - monitor_printf(mon, " aio-max-batch=3D%" PRId64 "\n", - value->aio_max_batch); + monitor_hmp_printf(hmp, "%s:\n", value->id); + monitor_hmp_printf(hmp, " thread_id=3D%" PRId64 "\n", value->thre= ad_id); + monitor_hmp_printf(hmp, " poll-max-ns=3D%" PRId64 "\n", value->po= ll_max_ns); + monitor_hmp_printf(hmp, " poll-grow=3D%" PRId64 "\n", value->poll= _grow); + monitor_hmp_printf(hmp, " poll-shrink=3D%" PRId64 "\n", value->po= ll_shrink); + monitor_hmp_printf(hmp, " poll-weight=3D%" PRId64 "\n", value->po= ll_weight); + monitor_hmp_printf(hmp, " aio-max-batch=3D%" PRId64 "\n", + value->aio_max_batch); } =20 qapi_free_IOThreadInfoList(info_list); @@ -264,26 +258,23 @@ void hmp_info_iothreads(MonitorHMP *hmp, const QDict = *qdict) =20 void hmp_help(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - hmp_help_cmd(mon, qdict_get_try_str(qdict, "name")); + hmp_help_cmd(hmp, qdict_get_try_str(qdict, "name")); } =20 void hmp_clear(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); /* * Send an ANSI escape sequence: * "\x1b[H" - move cursor to top-left * "\x1b[2J" - clear visible screen * "\x1b[3J" - clear scrollback */ - monitor_printf(mon, "\x1b[H\x1b[2J\x1b[3J"); + monitor_hmp_printf(hmp, "\x1b[H\x1b[2J\x1b[3J"); } =20 void hmp_info_help(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - hmp_help_cmd(mon, "info"); + hmp_help_cmd(hmp, "info"); } =20 void hmp_info_sync_profile(MonitorHMP *hmp, const QDict *qdict) @@ -299,7 +290,6 @@ void hmp_info_sync_profile(MonitorHMP *hmp, const QDict= *qdict) =20 void hmp_info_history(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int i; const char *str; =20 @@ -312,7 +302,7 @@ void hmp_info_history(MonitorHMP *hmp, const QDict *qdi= ct) if (!str) { break; } - monitor_printf(mon, "%d: '%s'\n", i, str); + monitor_hmp_printf(hmp, "%d: '%s'\n", i, str); i++; } } @@ -328,7 +318,6 @@ void hmp_logfile(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_log(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int mask; const char *items =3D qdict_get_str(qdict, "items"); Error *err =3D NULL; @@ -338,7 +327,7 @@ void hmp_log(MonitorHMP *hmp, const QDict *qdict) } else { mask =3D qemu_str_to_log_mask(items); if (!mask) { - hmp_help_cmd(mon, "log"); + hmp_help_cmd(hmp, "log"); return; } } @@ -350,7 +339,6 @@ void hmp_log(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_gdbserver(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *device =3D qdict_get_try_str(qdict, "device"); =20 @@ -361,43 +349,41 @@ void hmp_gdbserver(MonitorHMP *hmp, const QDict *qdic= t) if (!gdbserver_start(device, &err)) { error_report_err(err); } else if (strcmp(device, "none") =3D=3D 0) { - monitor_printf(mon, "Disabled gdbserver\n"); + monitor_hmp_printf(hmp, "Disabled gdbserver\n"); } else { - monitor_printf(mon, "Waiting for gdb connection on device '%s'\n", - device); + monitor_hmp_printf(hmp, "Waiting for gdb connection on device '%s'= \n", + device); } } =20 void hmp_print(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int format =3D qdict_get_int(qdict, "format"); hwaddr val =3D qdict_get_int(qdict, "val"); =20 switch(format) { case 'o': - monitor_printf(mon, "%#" HWADDR_PRIo, val); + monitor_hmp_printf(hmp, "0x%" HWADDR_PRIo, val); break; case 'x': - monitor_printf(mon, "%#" HWADDR_PRIx, val); + monitor_hmp_printf(hmp, "0x%" HWADDR_PRIx, val); break; case 'u': - monitor_printf(mon, "%" HWADDR_PRIu, val); + monitor_hmp_printf(hmp, "%" HWADDR_PRIu, val); break; default: case 'd': - monitor_printf(mon, "%" HWADDR_PRId, val); + monitor_hmp_printf(hmp, "%" HWADDR_PRId, val); break; case 'c': - monitor_printc(mon, val); + monitor_hmp_printc(hmp, val); break; } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } =20 void hmp_sum(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); uint32_t addr; uint16_t sum; uint32_t start =3D qdict_get_int(qdict, "start"); @@ -411,12 +397,11 @@ void hmp_sum(MonitorHMP *hmp, const QDict *qdict) sum =3D (sum >> 1) | (sum << 15); sum +=3D val; } - monitor_printf(mon, "%05d\n", sum); + monitor_hmp_printf(hmp, "%05d\n", sum); } =20 void hmp_ioport_read(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int size =3D qdict_get_int(qdict, "size"); int addr =3D qdict_get_int(qdict, "addr"); int has_index =3D qdict_haskey(qdict, "index"); @@ -445,8 +430,8 @@ void hmp_ioport_read(MonitorHMP *hmp, const QDict *qdic= t) suffix =3D 'l'; break; } - monitor_printf(mon, "port%c[0x%04x] =3D 0x%0*x\n", - suffix, addr, size * 2, val); + monitor_hmp_printf(hmp, "port%c[0x%04x] =3D 0x%0*x\n", + suffix, addr, size * 2, val); } =20 void hmp_ioport_write(MonitorHMP *hmp, const QDict *qdict) @@ -473,7 +458,6 @@ void hmp_ioport_write(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_boot_set(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; const char *bootdevice =3D qdict_get_str(qdict, "bootdevice"); =20 @@ -481,7 +465,7 @@ void hmp_boot_set(MonitorHMP *hmp, const QDict *qdict) if (local_err) { error_report_err(local_err); } else { - monitor_printf(mon, "boot device list now set to %s\n", bootdevice= ); + monitor_hmp_printf(hmp, "boot device list now set to %s\n", bootde= vice); } } =20 @@ -507,7 +491,7 @@ void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) return; } =20 - monitor_printf(MONITOR(hmp), "DTB dumped to '%s'\n", filename); + monitor_hmp_printf(hmp, "DTB dumped to '%s'\n", filename); } #endif =20 @@ -573,14 +557,13 @@ int monitor_hmp_get_cpu_index(MonitorHMP *hmp) =20 void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); bool all_cpus =3D qdict_get_try_bool(qdict, "cpustate_all", false); int vcpu =3D qdict_get_try_int(qdict, "vcpu", -1); CPUState *cs; =20 if (all_cpus) { CPU_FOREACH(cs) { - monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index); + monitor_hmp_printf(hmp, "\nCPU#%d\n", cs->cpu_index); cpu_dump_state(cs, NULL, CPU_DUMP_FPU | CPU_DUMP_VPU); } } else { @@ -588,14 +571,14 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict = *qdict) =20 if (!cs) { if (vcpu >=3D 0) { - monitor_printf(mon, "CPU#%d not available\n", vcpu); + monitor_hmp_printf(hmp, "CPU#%d not available\n", vcpu); } else { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); } return; } =20 - monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index); + monitor_hmp_printf(hmp, "\nCPU#%d\n", cs->cpu_index); cpu_dump_state(cs, NULL, CPU_DUMP_FPU | CPU_DUMP_VPU); } } @@ -603,7 +586,6 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict *q= dict) static void memory_dump(MonitorHMP *hmp, int count, int format, int wsize, uint64_t addr, bool is_physical) { - Monitor *mon =3D MONITOR(hmp); int l, line_size, i, max_digits, len; uint8_t buf[16]; uint64_t v; @@ -612,12 +594,12 @@ static void memory_dump(MonitorHMP *hmp, int count, i= nt format, int wsize, const bool big_endian =3D target_big_endian(); =20 if (!cs && (format =3D=3D 'i' || !is_physical)) { - monitor_printf(mon, "Can not dump without CPU\n"); + monitor_hmp_printf(hmp, "Can not dump without CPU\n"); return; } =20 if (format =3D=3D 'i') { - monitor_disas(mon, cs, addr, count, is_physical); + monitor_disas(hmp, cs, addr, count, is_physical); return; } =20 @@ -647,7 +629,7 @@ static void memory_dump(MonitorHMP *hmp, int count, int= format, int wsize, } =20 while (len > 0) { - monitor_printf(mon, "%0*" PRIx64 ":", addr_width, addr); + monitor_hmp_printf(hmp, "%0*" PRIx64 ":", addr_width, addr); l =3D len; if (l > line_size) { l =3D line_size; @@ -657,12 +639,12 @@ static void memory_dump(MonitorHMP *hmp, int count, i= nt format, int wsize, MemTxResult r =3D address_space_read(as, addr, MEMTXATTRS_UNSPECIFIED, buf= , l); if (r !=3D MEMTX_OK) { - monitor_printf(mon, " Cannot access memory\n"); + monitor_hmp_printf(hmp, " Cannot access memory\n"); break; } } else { if (cpu_memory_rw_debug(cs, addr, buf, l, 0) < 0) { - monitor_printf(mon, " Cannot access memory\n"); + monitor_hmp_printf(hmp, " Cannot access memory\n"); break; } } @@ -683,27 +665,27 @@ static void memory_dump(MonitorHMP *hmp, int count, i= nt format, int wsize, v =3D (big_endian ? ldq_be_p : ldq_le_p)(buf + i); break; } - monitor_printf(mon, " "); + monitor_hmp_printf(hmp, " "); switch (format) { case 'o': - monitor_printf(mon, "0%*" PRIo64, max_digits, v); + monitor_hmp_printf(hmp, "0%*" PRIo64, max_digits, v); break; case 'x': - monitor_printf(mon, "0x%0*" PRIx64, max_digits, v); + monitor_hmp_printf(hmp, "0x%0*" PRIx64, max_digits, v); break; case 'u': - monitor_printf(mon, "%*" PRIu64, max_digits, v); + monitor_hmp_printf(hmp, "%*" PRIu64, max_digits, v); break; case 'd': - monitor_printf(mon, "%*" PRId64, max_digits, v); + monitor_hmp_printf(hmp, "%*" PRId64, max_digits, v); break; case 'c': - monitor_printc(mon, v); + monitor_hmp_printc(hmp, v); break; } i +=3D wsize; } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); addr +=3D l; len -=3D l; } @@ -731,7 +713,6 @@ void hmp_physical_memory_dump(MonitorHMP *hmp, const QD= ict *qdict) =20 void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); hwaddr addr =3D qdict_get_int(qdict, "addr"); Error *local_err =3D NULL; MemoryRegion *mr =3D NULL; @@ -743,29 +724,28 @@ void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict) return; } =20 - monitor_printf(mon, "Host virtual address for 0x%" HWADDR_PRIx - " (%s) is %p\n", - addr, mr->name, ptr); + monitor_hmp_printf(hmp, "Host virtual address for 0x%" HWADDR_PRIx + " (%s) is %p\n", + addr, mr->name, ptr); =20 memory_region_unref(mr); } =20 void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); vaddr addr =3D qdict_get_int(qdict, "addr"); CPUState *cs =3D monitor_hmp_get_cpu(hmp); TranslateForDebugResult tres; =20 if (!cs) { - monitor_printf(mon, "No cpu\n"); + monitor_hmp_printf(hmp, "No cpu\n"); return; } =20 if (!cpu_translate_for_debug(cs, addr, &tres)) { - monitor_printf(mon, "Unmapped\n"); + monitor_hmp_printf(hmp, "Unmapped\n"); } else { - monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n", tres.physaddr); + monitor_hmp_printf(hmp, "gpa: 0x%" HWADDR_PRIx "\n", tres.physaddr= ); } } =20 @@ -806,7 +786,6 @@ out: =20 void hmp_gpa2hpa(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); hwaddr addr =3D qdict_get_int(qdict, "addr"); Error *local_err =3D NULL; MemoryRegion *mr =3D NULL; @@ -823,9 +802,9 @@ void hmp_gpa2hpa(MonitorHMP *hmp, const QDict *qdict) if (local_err) { error_report_err(local_err); } else { - monitor_printf(mon, "Host physical address for 0x%" HWADDR_PRIx - " (%s) is 0x%" PRIx64 "\n", - addr, mr->name, (uint64_t) physaddr); + monitor_hmp_printf(hmp, "Host physical address for 0x%" HWADDR_PRIx + " (%s) is 0x%" PRIx64 "\n", + addr, mr->name, (uint64_t) physaddr); } =20 memory_region_unref(mr); diff --git a/monitor/hmp.c b/monitor/hmp.c index 2484a2310dff..e5f8b9c576e0 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -80,8 +80,6 @@ static void monitor_hmp_set_readline(Object *obj, bool va= l, Error **errp) hmp->use_readline =3D val; } =20 -int monitor_hmp_vprintf(Monitor *mon, const char *fmt, va_list ap) - G_GNUC_PRINTF(2, 0); static void monitor_hmp_accept_input(Monitor *mon); static void monitor_hmp_complete(UserCreatable *uc, Error **errp); static bool monitor_hmp_prepare_delete(UserCreatable *uc, Error **errp); @@ -95,7 +93,6 @@ static void monitor_hmp_class_init(ObjectClass *cls, cons= t void *data) monitor_hmp_get_readline, monitor_hmp_set_readline); =20 - moncls->vprintf =3D monitor_hmp_vprintf; moncls->accept_input =3D monitor_hmp_accept_input; =20 ucc->complete =3D monitor_hmp_complete; @@ -114,12 +111,6 @@ static void monitor_hmp_init(Object *obj) hmp->use_readline =3D true; } =20 -int monitor_hmp_vprintf(Monitor *mon, const char *fmt, va_list ap) -{ - g_autofree char *buf =3D g_strdup_vprintf(fmt, ap); - return monitor_puts(mon, buf); -} - static void monitor_hmp_accept_input(Monitor *mon) { qemu_mutex_lock(&mon->mon_lock); @@ -166,8 +157,7 @@ int monitor_hmp_read_password(MonitorHMP *hmp, ReadLine= Func *readline_func, /* prompt is printed on return from the command handler */ return 0; } else { - monitor_printf(&hmp->parent_obj, - "terminal does not support password prompting\n"); + monitor_hmp_printf(hmp, "terminal does not support password prompt= ing\n"); return -ENOTTY; } } @@ -319,7 +309,7 @@ static bool cmd_available(const HMPCommand *cmd) return phase_check(PHASE_MACHINE_READY) || cmd_can_preconfig(cmd); } =20 -static void help_cmd_dump_one(Monitor *mon, +static void help_cmd_dump_one(MonitorHMP *mon, const HMPCommand *cmd, char **prefix_args, int prefix_args_nb) @@ -331,13 +321,13 @@ static void help_cmd_dump_one(Monitor *mon, } =20 for (i =3D 0; i < prefix_args_nb; i++) { - monitor_printf(mon, "%s ", prefix_args[i]); + monitor_hmp_printf(mon, "%s ", prefix_args[i]); } - monitor_printf(mon, "%s %s -- %s\n", cmd->name, cmd->params, cmd->help= ); + monitor_hmp_printf(mon, "%s %s -- %s\n", cmd->name, cmd->params, cmd->= help); } =20 /* @args[@arg_index] is the valid command need to find in @cmds */ -static void help_cmd_dump(Monitor *mon, const HMPCommand *cmds, +static void help_cmd_dump(MonitorHMP *mon, const HMPCommand *cmds, char **args, int nb_args, int arg_index) { const HMPCommand *cmd; @@ -367,13 +357,13 @@ static void help_cmd_dump(Monitor *mon, const HMPComm= and *cmds, } =20 /* Command not found */ - monitor_printf(mon, "unknown command: '"); + monitor_hmp_printf(mon, "unknown command: '"); for (i =3D 0; i <=3D arg_index; i++) { - monitor_printf(mon, "%s%s", args[i], i =3D=3D arg_index ? "'\n" : = " "); + monitor_hmp_printf(mon, "%s%s", args[i], i =3D=3D arg_index ? "'\n= " : " "); } } =20 -void hmp_help_cmd(Monitor *mon, const char *name) +void hmp_help_cmd(MonitorHMP *mon, const char *name) { char *args[MAX_ARGS]; int nb_args =3D 0; @@ -383,15 +373,15 @@ void hmp_help_cmd(Monitor *mon, const char *name) /* special case for log, directly dump and return */ if (!strcmp(name, "log")) { const QEMULogItem *item; - monitor_printf(mon, "Log items (comma separated):\n"); - monitor_printf(mon, "%-15s %s\n", "none", "remove all logs"); + monitor_hmp_printf(mon, "Log items (comma separated):\n"); + monitor_hmp_printf(mon, "%-15s %s\n", "none", "remove all logs= "); for (item =3D qemu_log_items; item->mask !=3D 0; item++) { - monitor_printf(mon, "%-15s %s\n", item->name, item->help); + monitor_hmp_printf(mon, "%-15s %s\n", item->name, item->he= lp); } #ifdef CONFIG_TRACE_LOG - monitor_printf(mon, "trace:PATTERN enable trace events\n"); - monitor_printf(mon, "\nUse \"log trace:help\" to get a list of= " - "trace events.\n\n"); + monitor_hmp_printf(mon, "trace:PATTERN enable trace events\n= "); + monitor_hmp_printf(mon, "\nUse \"log trace:help\" to get a lis= t of " + "trace events.\n\n"); #endif return; } @@ -455,12 +445,12 @@ static sigjmp_buf expr_env; static int get_monitor_def(MonitorHMP *mon, int64_t *pval, const char *nam= e); =20 static G_NORETURN G_GNUC_PRINTF(2, 3) -void expr_error(Monitor *mon, const char *fmt, ...) +void expr_error(MonitorHMP *mon, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - monitor_vprintf(mon, fmt, ap); - monitor_printf(mon, "\n"); + monitor_hmp_vprintf(mon, fmt, ap); + monitor_hmp_printf(mon, "\n"); va_end(ap); siglongjmp(expr_env, 1); } @@ -475,9 +465,9 @@ static void next(void) } } =20 -static int64_t expr_sum(Monitor *mon); +static int64_t expr_sum(MonitorHMP *mon); =20 -static int64_t expr_unary(Monitor *mon) +static int64_t expr_unary(MonitorHMP *mon) { int64_t n; char *p; @@ -535,8 +525,8 @@ static int64_t expr_unary(Monitor *mon) pch++; } *q =3D 0; - if (!gdb_get_register(MONITOR_HMP(mon), ®, buf) - && get_monitor_def(MONITOR_HMP(mon), ®, buf) < 0) { + if (!gdb_get_register(mon, ®, buf) + && get_monitor_def(mon, ®, buf) < 0) { expr_error(mon, "unknown register"); } n =3D reg; @@ -564,7 +554,7 @@ static int64_t expr_unary(Monitor *mon) return n; } =20 -static int64_t expr_prod(Monitor *mon) +static int64_t expr_prod(MonitorHMP *mon) { int64_t val, val2; int op; @@ -598,7 +588,7 @@ static int64_t expr_prod(Monitor *mon) return val; } =20 -static int64_t expr_logic(Monitor *mon) +static int64_t expr_logic(MonitorHMP *mon) { int64_t val, val2; int op; @@ -627,7 +617,7 @@ static int64_t expr_logic(Monitor *mon) return val; } =20 -static int64_t expr_sum(Monitor *mon) +static int64_t expr_sum(MonitorHMP *mon) { int64_t val, val2; int op; @@ -649,7 +639,7 @@ static int64_t expr_sum(Monitor *mon) return val; } =20 -static int get_expr(Monitor *mon, int64_t *pval, const char **pp) +static int get_expr(MonitorHMP *mon, int64_t *pval, const char **pp) { pch =3D *pp; if (sigsetjmp(expr_env, 0)) { @@ -664,7 +654,7 @@ static int get_expr(Monitor *mon, int64_t *pval, const = char **pp) return 0; } =20 -static int get_double(Monitor *mon, double *pval, const char **pp) +static int get_double(MonitorHMP *mon, double *pval, const char **pp) { const char *p =3D *pp; char *tailp; @@ -672,12 +662,12 @@ static int get_double(Monitor *mon, double *pval, con= st char **pp) =20 d =3D strtod(p, &tailp); if (tailp =3D=3D p) { - monitor_printf(mon, "Number expected\n"); + monitor_hmp_printf(mon, "Number expected\n"); return -1; } if (d !=3D d || d - d !=3D 0) { /* NaN or infinity */ - monitor_printf(mon, "Bad number\n"); + monitor_hmp_printf(mon, "Bad number\n"); return -1; } *pval =3D d; @@ -788,7 +778,6 @@ static const HMPCommand *monitor_parse_command(MonitorH= MP *hmp, const char **cmdp, HMPCommand *table) { - Monitor *mon =3D &hmp->parent_obj; const char *p; const HMPCommand *cmd; char cmdname[256]; @@ -801,14 +790,14 @@ static const HMPCommand *monitor_parse_command(Monito= rHMP *hmp, =20 cmd =3D search_dispatch_table(table, cmdname); if (!cmd) { - monitor_printf(mon, "unknown command: '%.*s'\n", - (int)(p - cmdp_start), cmdp_start); + monitor_hmp_printf(hmp, "unknown command: '%.*s'\n", + (int)(p - cmdp_start), cmdp_start); return NULL; } if (!cmd_available(cmd)) { - monitor_printf(mon, "Command '%.*s' not available " - "until machine initialization has completed.\n= ", - (int)(p - cmdp_start), cmdp_start); + monitor_hmp_printf(hmp, "Command '%.*s' not available " + "until machine initialization has completed.\n", + (int)(p - cmdp_start), cmdp_start); return NULL; } =20 @@ -832,7 +821,7 @@ static const HMPCommand *monitor_parse_command(MonitorH= MP *hmp, * Else, insert command arguments into a QDict, and return it. * Note: On success, caller has to free the QDict structure. */ -static QDict *monitor_parse_arguments(Monitor *mon, +static QDict *monitor_parse_arguments(MonitorHMP *mon, const char **endp, const HMPCommand *cmd) { @@ -873,15 +862,15 @@ static QDict *monitor_parse_arguments(Monitor *mon, if (ret < 0) { switch (c) { case 'F': - monitor_printf(mon, "%s: filename expected\n", - cmd->name); + monitor_hmp_printf(mon, "%s: filename expected\n", + cmd->name); break; case 'B': - monitor_printf(mon, "%s: block device name expecte= d\n", - cmd->name); + monitor_hmp_printf(mon, "%s: block device name exp= ected\n", + cmd->name); break; default: - monitor_printf(mon, "%s: string expected\n", cmd->= name); + monitor_hmp_printf(mon, "%s: string expected\n", c= md->name); break; } goto fail; @@ -968,8 +957,8 @@ static QDict *monitor_parse_arguments(Monitor *mon, } next: if (*p !=3D '\0' && !qemu_isspace(*p)) { - monitor_printf(mon, "invalid char in format: '%c'\= n", - *p); + monitor_hmp_printf(mon, "invalid char in format: '= %c'\n", + *p); goto fail; } if (format < 0) { @@ -1030,12 +1019,12 @@ static QDict *monitor_parse_arguments(Monitor *mon, } /* Check if 'i' is greater than 32-bit */ if ((c =3D=3D 'i') && ((val >> 32) & 0xffffffff)) { - monitor_printf(mon, "\'%s\' has failed: ", cmd->name); - monitor_printf(mon, "integer is for 32-bit values\n"); + monitor_hmp_printf(mon, "\'%s\' has failed: ", cmd->na= me); + monitor_hmp_printf(mon, "integer is for 32-bit values\= n"); goto fail; } else if (c =3D=3D 'M') { if (val < 0) { - monitor_printf(mon, "enter a positive value\n"); + monitor_hmp_printf(mon, "enter a positive value\n"= ); goto fail; } val *=3D MiB; @@ -1060,7 +1049,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, } ret =3D qemu_strtosz_MiB(p, &end, &val); if (ret < 0 || val > INT64_MAX) { - monitor_printf(mon, "invalid size\n"); + monitor_hmp_printf(mon, "invalid size\n"); goto fail; } qdict_put_int(qdict, key, val); @@ -1094,7 +1083,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, } } if (*p && !qemu_isspace(*p)) { - monitor_printf(mon, "Unknown unit suffix\n"); + monitor_hmp_printf(mon, "Unknown unit suffix\n"); goto fail; } qdict_put(qdict, key, qnum_from_double(val)); @@ -1117,7 +1106,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, } else if (p - beg =3D=3D 3 && !memcmp(beg, "off", p - beg= )) { val =3D false; } else { - monitor_printf(mon, "Expected 'on' or 'off'\n"); + monitor_hmp_printf(mon, "Expected 'on' or 'off'\n"); goto fail; } qdict_put_bool(qdict, key, val); @@ -1141,8 +1130,8 @@ static QDict *monitor_parse_arguments(Monitor *mon, p++; if (c !=3D *p) { if (!is_valid_option(p, typestr)) { - monitor_printf(mon, "%s: unsupported option -%= c\n", - cmd->name, *p); + monitor_hmp_printf(mon, "%s: unsupported optio= n -%c\n", + cmd->name, *p); goto fail; } else { skip_key =3D 1; @@ -1159,8 +1148,8 @@ static QDict *monitor_parse_arguments(Monitor *mon, } ret =3D get_str(buf, sizeof(buf), &p); if (ret < 0) { - monitor_printf(mon, "%s: value expected for -%= c\n", - cmd->name, *tmp); + monitor_hmp_printf(mon, "%s: value expected fo= r -%c\n", + cmd->name, *tmp); goto fail; } qdict_put_str(qdict, key, buf); @@ -1191,8 +1180,8 @@ static QDict *monitor_parse_arguments(Monitor *mon, } len =3D strlen(p); if (len <=3D 0) { - monitor_printf(mon, "%s: string expected\n", - cmd->name); + monitor_hmp_printf(mon, "%s: string expected\n", + cmd->name); goto fail; } qdict_put_str(qdict, key, p); @@ -1201,7 +1190,7 @@ static QDict *monitor_parse_arguments(Monitor *mon, break; default: bad_type: - monitor_printf(mon, "%s: unknown type '%c'\n", cmd->name, c); + monitor_hmp_printf(mon, "%s: unknown type '%c'\n", cmd->name, = c); goto fail; } g_free(key); @@ -1212,8 +1201,8 @@ static QDict *monitor_parse_arguments(Monitor *mon, p++; } if (*p !=3D '\0') { - monitor_printf(mon, "%s: extraneous characters at the end of line\= n", - cmd->name); + monitor_hmp_printf(mon, "%s: extraneous characters at the end of l= ine\n", + cmd->name); goto fail; } =20 @@ -1281,19 +1270,19 @@ void handle_hmp_command(MonitorHMP *hmp, const char= *cmdline) =20 if (!cmd->cmd && !cmd->cmd_info_hrt) { /* FIXME: is it useful to try autoload modules here ??? */ - monitor_printf(&hmp->parent_obj, "Command \"%.*s\" is not availabl= e.\n", - (int)(cmdline - cmd_start), cmd_start); + monitor_hmp_printf(hmp, "Command \"%.*s\" is not available.\n", + (int)(cmdline - cmd_start), cmd_start); return; } =20 - qdict =3D monitor_parse_arguments(&hmp->parent_obj, &cmdline, cmd); + qdict =3D monitor_parse_arguments(hmp, &cmdline, cmd); if (!qdict) { while (cmdline > cmd_start && qemu_isspace(cmdline[-1])) { cmdline--; } - monitor_printf(&hmp->parent_obj, - "Try \"help %.*s\" for more information\n", - (int)(cmdline - cmd_start), cmd_start); + monitor_hmp_printf(hmp, + "Try \"help %.*s\" for more information\n", + (int)(cmdline - cmd_start), cmd_start); return; } =20 @@ -1539,7 +1528,7 @@ static void monitor_read(void *opaque, const uint8_t = *buf, int size) } } else { if (size =3D=3D 0 || buf[size - 1] !=3D 0) { - monitor_printf(&hmp->parent_obj, "corrupted command\n"); + monitor_hmp_printf(hmp, "corrupted command\n"); } else { handle_hmp_command(hmp, (char *)buf); } @@ -1580,8 +1569,8 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) break; =20 case CHR_EVENT_OPENED: - monitor_printf(mon, "QEMU %s monitor - type 'help' for more " - "information\n", QEMU_VERSION); + monitor_hmp_printf(hmp, "QEMU %s monitor - type 'help' for more " + "information\n", QEMU_VERSION); qemu_mutex_lock(&mon->mon_lock); hmp->reset_seen =3D 1; if (!mon->mux_out && hmp->use_readline) { @@ -1613,7 +1602,7 @@ static void G_GNUC_PRINTF(2, 3) monitor_readline_prin= tf(void *opaque, MonitorHMP *hmp =3D opaque; va_list ap; va_start(ap, fmt); - monitor_vprintf(&hmp->parent_obj, fmt, ap); + monitor_hmp_vprintf(hmp, fmt, ap); va_end(ap); } =20 diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index afdda1386080..c198c12eaa00 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -108,12 +108,6 @@ typedef struct HMPCommand { struct MonitorClass { ObjectClass parent_class; =20 - /* - * If non-NULL, the monitor is able to print messages - * for attention of the client user - */ - int (*vprintf)(Monitor *mon, const char *fmt, va_list ap) - G_GNUC_PRINTF(2, 0); /* * If non-NULL, the monitor is able to send event * notifications back to the client diff --git a/monitor/monitor.c b/monitor/monitor.c index 8528af6f79b8..da76e6e4ac19 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -272,58 +272,53 @@ int monitor_puts(Monitor *mon, const char *str) return monitor_puts_locked(mon, str); } =20 -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { - MonitorClass *moncls; + g_autofree char *buf =3D g_strdup_vprintf(fmt, ap); =20 if (!mon) { return -1; } =20 - moncls =3D MONITOR_GET_CLASS(mon); - if (!moncls->vprintf) { - return -1; - } - - return moncls->vprintf(mon, fmt, ap); + return monitor_puts(MONITOR(mon), buf); } =20 -int monitor_printf(Monitor *mon, const char *fmt, ...) +int monitor_hmp_printf(MonitorHMP *mon, const char *fmt, ...) { int ret; =20 va_list ap; va_start(ap, fmt); - ret =3D monitor_vprintf(mon, fmt, ap); + ret =3D monitor_hmp_vprintf(mon, fmt, ap); va_end(ap); return ret; } =20 -void monitor_printc(Monitor *mon, int c) +void monitor_hmp_printc(MonitorHMP *mon, int c) { - monitor_printf(mon, "'"); + monitor_hmp_printf(mon, "'"); switch(c) { case '\'': - monitor_printf(mon, "\\'"); + monitor_hmp_printf(mon, "\\'"); break; case '\\': - monitor_printf(mon, "\\\\"); + monitor_hmp_printf(mon, "\\\\"); break; case '\n': - monitor_printf(mon, "\\n"); + monitor_hmp_printf(mon, "\\n"); break; case '\r': - monitor_printf(mon, "\\r"); + monitor_hmp_printf(mon, "\\r"); break; default: if (c >=3D 32 && c <=3D 126) { - monitor_printf(mon, "%c", c); + monitor_hmp_printf(mon, "%c", c); } else { - monitor_printf(mon, "\\x%02x", c); + monitor_hmp_printf(mon, "\\x%02x", c); } break; } - monitor_printf(mon, "'"); + monitor_hmp_printf(mon, "'"); } =20 static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 5b1c678f5d89..0d718d78aef9 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -28,26 +28,25 @@ #include "qemu/help_option.h" #include "qemu/option.h" =20 -static void hmp_print_client_info(Monitor *mon, NetworkClientInfo *ci) +static void hmp_print_client_info(MonitorHMP *hmp, NetworkClientInfo *ci) { NetFilterInfoList *f; =20 - monitor_printf(mon, "%s: index=3D%" PRIu32 ",type=3D%s,%s\n", - ci->name, ci->queue_index, - NetClientDriver_str(ci->type), ci->info_str); + monitor_hmp_printf(hmp, "%s: index=3D%" PRIu32 ",type=3D%s,%s\n", + ci->name, ci->queue_index, + NetClientDriver_str(ci->type), ci->info_str); if (ci->filters) { - monitor_printf(mon, "filters:\n"); + monitor_hmp_printf(hmp, "filters:\n"); for (f =3D ci->filters; f; f =3D f->next) { - monitor_printf(mon, " - %s: type=3D%s%s%s\n", - f->value->name, f->value->type, - f->value->info[0] ? "," : "", f->value->info); + monitor_hmp_printf(hmp, " - %s: type=3D%s%s%s\n", + f->value->name, f->value->type, + f->value->info[0] ? "," : "", f->value->inf= o); } } } =20 void hmp_info_network(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; g_autoptr(NetworkInfo) info =3D qmp_x_query_network(&err); NetHubInfoList *h; @@ -60,13 +59,13 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdi= ct) for (h =3D info->hubs; h; h =3D h->next) { NetHubPortInfoList *p; =20 - monitor_printf(mon, "hub %d\n", (int)h->value->id); + monitor_hmp_printf(hmp, "hub %d\n", (int)h->value->id); for (p =3D h->value->ports; p; p =3D p->next) { if (p->value->peer) { - monitor_printf(mon, " \\ %s: ", p->value->name); - hmp_print_client_info(mon, p->value->peer); + monitor_hmp_printf(hmp, " \\ %s: ", p->value->name); + hmp_print_client_info(hmp, p->value->peer); } else { - monitor_printf(mon, " \\ %s\n", p->value->name); + monitor_hmp_printf(hmp, " \\ %s\n", p->value->name); } } } @@ -75,11 +74,11 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdi= ct) NetworkClientInfo *ci =3D entry->value; =20 if (!ci->peer || ci->type =3D=3D NET_CLIENT_DRIVER_NIC) { - hmp_print_client_info(mon, ci); + hmp_print_client_info(hmp, ci); } /* else it's a netdev connected to a NIC, printed with the NIC */ if (ci->peer && ci->type =3D=3D NET_CLIENT_DRIVER_NIC) { - monitor_printf(mon, " \\ "); - hmp_print_client_info(mon, ci->peer); + monitor_hmp_printf(hmp, " \\ "); + hmp_print_client_info(hmp, ci->peer); } } } diff --git a/net/slirp.c b/net/slirp.c index d5c190b48b76..6fbefa9ed1d7 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -711,22 +711,22 @@ error: return -1; } =20 -static SlirpState *slirp_lookup(Monitor *mon, const char *id) +static SlirpState *slirp_lookup(MonitorHMP *hmp, const char *id) { if (id) { NetClientState *nc =3D qemu_find_netdev(id); if (!nc) { - monitor_printf(mon, "unrecognized netdev id '%s'\n", id); + monitor_hmp_printf(hmp, "unrecognized netdev id '%s'\n", id); return NULL; } if (strcmp(nc->model, "user")) { - monitor_printf(mon, "invalid device specified\n"); + monitor_hmp_printf(hmp, "invalid device specified\n"); return NULL; } return DO_UPCAST(SlirpState, nc, nc); } else { if (QTAILQ_EMPTY(&slirp_stacks)) { - monitor_printf(mon, "user mode network stack not in use\n"); + monitor_hmp_printf(hmp, "user mode network stack not in use\n"= ); return NULL; } return QTAILQ_FIRST(&slirp_stacks); @@ -735,7 +735,6 @@ static SlirpState *slirp_lookup(Monitor *mon, const cha= r *id) =20 void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); /* TODO: support removing unix fwd */ struct sockaddr_in host_addr =3D { .sin_family =3D AF_INET, @@ -753,10 +752,10 @@ void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict = *qdict) const char *arg2 =3D qdict_get_try_str(qdict, "arg2"); =20 if (arg2) { - s =3D slirp_lookup(mon, arg1); + s =3D slirp_lookup(hmp, arg1); src_str =3D arg2; } else { - s =3D slirp_lookup(mon, NULL); + s =3D slirp_lookup(hmp, NULL); src_str =3D arg1; } if (!s) { @@ -795,12 +794,12 @@ void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict = *qdict) err =3D slirp_remove_hostfwd(s->slirp, is_udp, host_addr.sin_addr, hos= t_port); #endif =20 - monitor_printf(mon, "host forwarding rule for %s %s\n", src_str, - err ? "not found" : "removed"); + monitor_hmp_printf(hmp, "host forwarding rule for %s %s\n", src_str, + err ? "not found" : "removed"); return; =20 fail_syntax: - monitor_printf(mon, "invalid format\n"); + monitor_hmp_printf(hmp, "invalid format\n"); } =20 static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **err= p) @@ -960,17 +959,16 @@ static int slirp_hostfwd(SlirpState *s, const char *r= edir_str, Error **errp) =20 void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *redir_str; SlirpState *s; const char *arg1 =3D qdict_get_str(qdict, "arg1"); const char *arg2 =3D qdict_get_try_str(qdict, "arg2"); =20 if (arg2) { - s =3D slirp_lookup(mon, arg1); + s =3D slirp_lookup(hmp, arg1); redir_str =3D arg2; } else { - s =3D slirp_lookup(mon, NULL); + s =3D slirp_lookup(hmp, NULL); redir_str =3D arg1; } if (s) { @@ -1228,16 +1226,15 @@ UsernetInfoList *qmp_x_query_usernet(Error **errp) =20 void hmp_info_usernet(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); g_autoptr(UsernetInfoList) list =3D NULL; UsernetInfoList *entry; =20 list =3D qmp_x_query_usernet(&error_abort); for (entry =3D list; entry; entry =3D entry->next) { UsernetInfo *ui =3D entry->value; - monitor_printf(mon, "Hub %d (%s):\n%s", - ui->has_hub_id ? (int)ui->hub_id : -1, - ui->hub_name, ui->info); + monitor_hmp_printf(hmp, "Hub %d (%s):\n%s", + ui->has_hub_id ? (int)ui->hub_id : -1, + ui->hub_name, ui->info); } } =20 diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index 2e2eb33371e2..bbf5980332a4 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -20,13 +20,12 @@ =20 void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_try_str(qdict, "path"); ObjectPropertyInfoList *list; Error *err =3D NULL; =20 if (path =3D=3D NULL) { - monitor_printf(mon, "/\n"); + monitor_hmp_printf(hmp, "/\n"); return; } =20 @@ -36,8 +35,8 @@ void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict) while (list !=3D NULL) { ObjectPropertyInfo *value =3D list->value; =20 - monitor_printf(mon, "%s (%s)\n", - value->name, value->type); + monitor_hmp_printf(hmp, "%s (%s)\n", + value->name, value->type); list =3D list->next; } qapi_free_ObjectPropertyInfoList(start); @@ -75,7 +74,6 @@ void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); Error *err =3D NULL; @@ -83,7 +81,7 @@ void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) =20 if (err =3D=3D NULL) { GString *str =3D qobject_to_json_pretty(obj, true); - monitor_printf(mon, "%s\n", str->str); + monitor_hmp_printf(hmp, "%s\n", str->str); g_string_free(str, true); } =20 @@ -96,7 +94,7 @@ typedef struct QOMCompositionState { int indent; } QOMCompositionState; =20 -static void print_qom_composition(Monitor *mon, Object *obj, int indent); +static void print_qom_composition(MonitorHMP *hmp, Object *obj, int indent= ); =20 static int qom_composition_compare(const void *a, const void *b) { @@ -110,7 +108,7 @@ static int insert_qom_composition_child(Object *obj, vo= id *opaque) return 0; } =20 -static void print_qom_composition(Monitor *mon, Object *obj, int indent) +static void print_qom_composition(MonitorHMP *hmp, Object *obj, int indent) { GArray *children =3D g_array_new(false, false, sizeof(Object *)); const char *name; @@ -121,14 +119,14 @@ static void print_qom_composition(Monitor *mon, Objec= t *obj, int indent) } else { name =3D object_get_canonical_path_component(obj); } - monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name, - object_get_typename(obj)); + monitor_hmp_printf(hmp, "%*s/%s (%s)\n", indent, "", name, + object_get_typename(obj)); =20 object_child_foreach(obj, insert_qom_composition_child, children); g_array_sort(children, qom_composition_compare); =20 for (i =3D 0; i < children->len; i++) { - print_qom_composition(mon, g_array_index(children, Object *, i), + print_qom_composition(hmp, g_array_index(children, Object *, i), indent + 2); } g_array_free(children, TRUE); @@ -136,7 +134,6 @@ static void print_qom_composition(Monitor *mon, Object = *obj, int indent) =20 void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *dict) { - Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_try_str(dict, "path"); Object *obj; bool ambiguous =3D false; @@ -144,17 +141,17 @@ void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *= dict) if (path) { obj =3D object_resolve_path(path, &ambiguous); if (!obj) { - monitor_printf(mon, "Path '%s' could not be resolved.\n", path= ); + monitor_hmp_printf(hmp, "Path '%s' could not be resolved.\n", = path); return; } if (ambiguous) { - monitor_printf(mon, "Warning: Path '%s' is ambiguous.\n", path= ); + monitor_hmp_printf(hmp, "Warning: Path '%s' is ambiguous.\n", = path); return; } } else { obj =3D qdev_get_machine(); } - print_qom_composition(mon, obj, 0); + print_qom_composition(hmp, obj, 0); } =20 void hmp_object_add(MonitorHMP *hmp, const QDict *qdict) diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index ef69d23ff507..965565715ef2 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -33,11 +33,10 @@ bool replay_running_debug(void) =20 void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); if (replay_mode =3D=3D REPLAY_MODE_NONE) { - monitor_printf(mon, "Record/replay is not active\n"); + monitor_hmp_printf(hmp, "Record/replay is not active\n"); } else { - monitor_printf(mon, + monitor_hmp_printf(hmp, "%s execution '%s': instruction count =3D %"PRId64"\n", replay_mode =3D=3D REPLAY_MODE_RECORD ? "Recording" : "Replayi= ng", replay_get_filename(), replay_get_current_icount()); diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index cd1f1deb58bc..3d556c745d61 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -14,11 +14,11 @@ #include "qobject/qdict.h" #include "qapi/error.h" =20 -static void print_stats_schema_value(Monitor *mon, StatsSchemaValue *value) +static void print_stats_schema_value(MonitorHMP *hmp, StatsSchemaValue *va= lue) { const char *unit =3D NULL; - monitor_printf(mon, " %s (%s%s", value->name, StatsType_str(value->= type), - value->has_unit || value->exponent ? ", " : ""); + monitor_hmp_printf(hmp, " %s (%s%s", value->name, StatsType_str(val= ue->type), + value->has_unit || value->exponent ? ", " : ""); =20 if (value->has_unit) { if (value->unit =3D=3D STATS_UNIT_SECONDS) { @@ -31,29 +31,29 @@ static void print_stats_schema_value(Monitor *mon, Stat= sSchemaValue *value) if (unit && value->base =3D=3D 10 && value->exponent >=3D -18 && value->exponent <=3D 18 && value->exponent % 3 =3D=3D 0) { - monitor_puts(mon, si_prefix(value->exponent)); + monitor_puts(MONITOR(hmp), si_prefix(value->exponent)); } else if (unit && value->base =3D=3D 2 && value->exponent >=3D 0 && value->exponent <=3D 60 && value->exponent % 10 =3D=3D 0) { =20 - monitor_puts(mon, iec_binary_prefix(value->exponent)); + monitor_puts(MONITOR(hmp), iec_binary_prefix(value->exponent)); } else if (value->exponent) { /* Use exponential notation and write the unit's English name */ - monitor_printf(mon, "* %d^%d%s", - value->base, value->exponent, - value->has_unit ? " " : ""); + monitor_hmp_printf(hmp, "* %d^%d%s", + value->base, value->exponent, + value->has_unit ? " " : ""); unit =3D NULL; } =20 if (value->has_unit) { - monitor_puts(mon, unit ? unit : StatsUnit_str(value->unit)); + monitor_puts(MONITOR(hmp), unit ? unit : StatsUnit_str(value->unit= )); } =20 /* Print bucket size for linear histograms */ if (value->type =3D=3D STATS_TYPE_LINEAR_HISTOGRAM && value->has_bucke= t_size) { - monitor_printf(mon, ", bucket size=3D%d", value->bucket_size); + monitor_hmp_printf(hmp, ", bucket size=3D%d", value->bucket_size); } - monitor_printf(mon, ")"); + monitor_hmp_printf(hmp, ")"); } =20 static StatsSchemaValueList *find_schema_value_list( @@ -71,7 +71,7 @@ static StatsSchemaValueList *find_schema_value_list( return NULL; } =20 -static void print_stats_results(Monitor *mon, StatsTarget target, +static void print_stats_results(MonitorHMP *hmp, StatsTarget target, bool show_provider, StatsResult *result, StatsSchemaList *schema) @@ -82,14 +82,14 @@ static void print_stats_results(Monitor *mon, StatsTarg= et target, StatsList *stats_list; =20 if (!schema_value_list) { - monitor_printf(mon, "failed to find schema list for %s\n", - StatsProvider_str(result->provider)); + monitor_hmp_printf(hmp, "failed to find schema list for %s\n", + StatsProvider_str(result->provider)); return; } =20 if (show_provider) { - monitor_printf(mon, "provider: %s\n", - StatsProvider_str(result->provider)); + monitor_hmp_printf(hmp, "provider: %s\n", + StatsProvider_str(result->provider)); } =20 for (stats_list =3D result->stats; stats_list; @@ -103,31 +103,31 @@ static void print_stats_results(Monitor *mon, StatsTa= rget target, /* Find schema entry */ while (!g_str_equal(stats->name, schema_value->name)) { if (!schema_value_list->next) { - monitor_printf(mon, "failed to find schema entry for %s\n", - stats->name); + monitor_hmp_printf(hmp, "failed to find schema entry for %= s\n", + stats->name); return; } schema_value_list =3D schema_value_list->next; schema_value =3D schema_value_list->value; } =20 - print_stats_schema_value(mon, schema_value); + print_stats_schema_value(hmp, schema_value); =20 if (stats_value->type =3D=3D QTYPE_QNUM) { - monitor_printf(mon, ": %" PRId64 "\n", stats_value->u.scalar); + monitor_hmp_printf(hmp, ": %" PRId64 "\n", stats_value->u.scal= ar); } else if (stats_value->type =3D=3D QTYPE_QBOOL) { - monitor_printf(mon, ": %s\n", stats_value->u.boolean ? "yes" := "no"); + monitor_hmp_printf(hmp, ": %s\n", stats_value->u.boolean ? "ye= s" : "no"); } else if (stats_value->type =3D=3D QTYPE_QLIST) { uint64List *list; int i; =20 - monitor_printf(mon, ": "); + monitor_hmp_printf(hmp, ": "); for (list =3D stats_value->u.list, i =3D 1; list; list =3D list->next, i++) { - monitor_printf(mon, "[%d]=3D%" PRId64 " ", i, list->value); + monitor_hmp_printf(hmp, "[%d]=3D%" PRId64 " ", i, list->va= lue); } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); } } } @@ -189,7 +189,6 @@ static StatsFilter *stats_filter(StatsTarget target, co= nst char *names, =20 void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *target_str =3D qdict_get_str(qdict, "target"); const char *provider_str =3D qdict_get_try_str(qdict, "provider"); const char *names =3D qdict_get_try_str(qdict, "names"); @@ -204,13 +203,13 @@ void hmp_info_stats(MonitorHMP *hmp, const QDict *qdi= ct) =20 target =3D qapi_enum_parse(&StatsTarget_lookup, target_str, -1, &err); if (err) { - monitor_printf(mon, "invalid stats target %s\n", target_str); + monitor_hmp_printf(hmp, "invalid stats target %s\n", target_str); goto exit_no_print; } if (provider_str) { provider =3D qapi_enum_parse(&StatsProvider_lookup, provider_str, = -1, &err); if (err) { - monitor_printf(mon, "invalid stats provider %s\n", provider_st= r); + monitor_hmp_printf(hmp, "invalid stats provider %s\n", provide= r_str); goto exit_no_print; } } @@ -241,12 +240,12 @@ void hmp_info_stats(MonitorHMP *hmp, const QDict *qdi= ct) goto exit; } for (entry =3D stats; entry; entry =3D entry->next) { - print_stats_results(mon, target, provider_str =3D=3D NULL, entry->= value, schema); + print_stats_results(hmp, target, provider_str =3D=3D NULL, entry->= value, schema); } =20 exit: if (err) { - monitor_printf(mon, "%s\n", error_get_pretty(err)); + monitor_hmp_printf(hmp, "%s\n", error_get_pretty(err)); } exit_no_print: error_free(err); diff --git a/stubs/hmp-cmd-info_sev.c b/stubs/hmp-cmd-info_sev.c index 6f2b87d1ad10..c9c1d10c165c 100644 --- a/stubs/hmp-cmd-info_sev.c +++ b/stubs/hmp-cmd-info_sev.c @@ -12,6 +12,5 @@ =20 void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); - monitor_printf(mon, "SEV is not available in this QEMU\n"); + monitor_hmp_printf(hmp, "SEV is not available in this QEMU\n"); } diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index b0c7002bd406..094b80721003 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -17,7 +17,7 @@ void qapi_event_emit(QAPIEvent event, QDict *qdict) { } =20 -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { /* * Pretend 'g_test_message' is our monitor console to diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c index 75194add7931..fb9338e9aef6 100644 --- a/system/dirtylimit-hmp-cmds.c +++ b/system/dirtylimit-hmp-cmds.c @@ -17,7 +17,6 @@ =20 void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; =20 @@ -27,8 +26,8 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const Q= Dict *qdict) return; } =20 - monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query " - "dirty limit for virtual CPU]\n"); + monitor_hmp_printf(hmp, "[Please use 'info vcpu_dirty_limit' to query " + "dirty limit for virtual CPU]\n"); } =20 void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) @@ -50,13 +49,12 @@ out: =20 void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); DirtyLimitInfoList *info; g_autoptr(DirtyLimitInfoList) head =3D NULL; Error *err =3D NULL; =20 if (!dirtylimit_in_service()) { - monitor_printf(mon, "Dirty page limit not enabled!\n"); + monitor_hmp_printf(hmp, "Dirty page limit not enabled!\n"); return; } =20 @@ -67,7 +65,7 @@ void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDi= ct *qdict) } =20 for (info =3D head; info !=3D NULL; info =3D info->next) { - monitor_printf(mon, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (MB/s)= ," + monitor_hmp_printf(hmp, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (M= B/s)," " current rate %"PRIi64 " (MB/s)\n", info->value->cpu_index, info->value->limit_rate, diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 5c2de2f53cc9..3860ada2a237 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -763,9 +763,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **e= rrp) return ret; } =20 -#define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", #= # __VA_ARGS__) +#define qdev_printf(fmt, ...) \ + monitor_hmp_printf(hmp, "%*s" fmt, indent, "", ## __VA_ARGS__) =20 -static void qdev_print_props(Monitor *mon, DeviceState *dev, DeviceClass *= dc, +static void qdev_print_props(MonitorHMP *hmp, DeviceState *dev, DeviceClas= s *dc, int indent) { for (int i =3D 0, n =3D dc->props_count_; i < n; ++i) { @@ -798,8 +799,9 @@ static void bus_print_dev(BusState *bus, Monitor *mon, = DeviceState *dev, int ind } } =20 -static void qdev_print(Monitor *mon, DeviceState *dev, int indent) +static void qdev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { + Monitor *mon =3D MONITOR(hmp); ObjectClass *class; NamedGPIOList *ngl; NamedClockList *ncl; @@ -823,13 +825,13 @@ static void qdev_print(Monitor *mon, DeviceState *dev= , int indent) } class =3D object_get_class(OBJECT(dev)); do { - qdev_print_props(mon, dev, DEVICE_CLASS(class), indent); + qdev_print_props(hmp, dev, DEVICE_CLASS(class), indent); class =3D object_class_get_parent(class); } while (class !=3D object_class_by_name(TYPE_DEVICE)); bus_print_dev(dev->parent_bus, mon, dev, indent); } =20 -static void qbus_print(Monitor *mon, BusState *bus, int indent, bool detai= ls) +static void qbus_print(MonitorHMP *hmp, BusState *bus, int indent, bool de= tails) { BusChild *kid; =20 @@ -842,10 +844,10 @@ static void qbus_print(Monitor *mon, BusState *bus, i= nt indent, bool details) qdev_printf("dev: %s, id \"%s\"\n", object_get_typename(OBJECT(dev= )), dev->id ? dev->id : ""); if (details) { - qdev_print(mon, dev, indent + 2); + qdev_print(hmp, dev, indent + 2); } QLIST_FOREACH(child_bus, &dev->child_bus, sibling) { - qbus_print(mon, child_bus, indent + 2, details); + qbus_print(hmp, child_bus, indent + 2, details); } } } @@ -853,11 +855,10 @@ static void qbus_print(Monitor *mon, BusState *bus, i= nt indent, bool details) =20 void hmp_info_qtree(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); bool details =3D !qdict_get_try_bool(qdict, "brief", false); =20 if (sysbus_get_default()) { - qbus_print(mon, sysbus_get_default(), 0, details); + qbus_print(hmp, sysbus_get_default(), 0, details); } } =20 diff --git a/system/runstate-hmp-cmds.c b/system/runstate-hmp-cmds.c index 051ee45ee74c..ad70b53f8abf 100644 --- a/system/runstate-hmp-cmds.c +++ b/system/runstate-hmp-cmds.c @@ -25,33 +25,31 @@ =20 void hmp_info_status(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); StatusInfo *info; =20 info =3D qmp_query_status(NULL); =20 - monitor_printf(mon, "VM status: %s", - info->running ? "running" : "paused"); + monitor_hmp_printf(hmp, "VM status: %s", + info->running ? "running" : "paused"); =20 if (!info->running && info->status !=3D RUN_STATE_PAUSED) { - monitor_printf(mon, " (%s)", RunState_str(info->status)); + monitor_hmp_printf(hmp, " (%s)", RunState_str(info->status)); } =20 - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); =20 qapi_free_StatusInfo(info); } =20 void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *option =3D qdict_get_try_str(qdict, "option"); AccelState *accel =3D current_accel(); bool newval; =20 if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) { - monitor_printf(mon, - "This accelerator does not support setting one-insn= -per-tb\n"); + monitor_hmp_printf(hmp, + "This accelerator does not support setting one-= insn-per-tb\n"); return; } =20 @@ -60,7 +58,7 @@ void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qd= ict) } else if (!strcmp(option, "off")) { newval =3D false; } else { - monitor_printf(mon, "unexpected option %s\n", option); + monitor_hmp_printf(hmp, "unexpected option %s\n", option); return; } /* If the property exists then setting it can never fail */ diff --git a/system/tpm-hmp-cmds.c b/system/tpm-hmp-cmds.c index 094c3f16cf50..35406e24d2c3 100644 --- a/system/tpm-hmp-cmds.c +++ b/system/tpm-hmp-cmds.c @@ -13,7 +13,6 @@ =20 void hmp_info_tpm(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); #ifdef CONFIG_TPM TPMInfoList *info_list, *info; Error *err =3D NULL; @@ -23,44 +22,44 @@ void hmp_info_tpm(MonitorHMP *hmp, const QDict *qdict) =20 info_list =3D qmp_query_tpm(&err); if (err) { - monitor_printf(mon, "TPM device not supported\n"); + monitor_hmp_printf(hmp, "TPM device not supported\n"); error_free(err); return; } =20 if (info_list) { - monitor_printf(mon, "TPM device:\n"); + monitor_hmp_printf(hmp, "TPM device:\n"); } =20 for (info =3D info_list; info; info =3D info->next) { TPMInfo *ti =3D info->value; - monitor_printf(mon, " tpm%d: model=3D%s\n", - c, TpmModel_str(ti->model)); + monitor_hmp_printf(hmp, " tpm%d: model=3D%s\n", + c, TpmModel_str(ti->model)); =20 - monitor_printf(mon, " \\ %s: type=3D%s", - ti->id, TpmType_str(ti->options->type)); + monitor_hmp_printf(hmp, " \\ %s: type=3D%s", + ti->id, TpmType_str(ti->options->type)); =20 switch (ti->options->type) { case TPM_TYPE_PASSTHROUGH: tpo =3D ti->options->u.passthrough.data; - monitor_printf(mon, "%s%s%s%s", - tpo->path ? ",path=3D" : "", - tpo->path ?: "", - tpo->cancel_path ? ",cancel-path=3D" : "", - tpo->cancel_path ?: ""); + monitor_hmp_printf(hmp, "%s%s%s%s", + tpo->path ? ",path=3D" : "", + tpo->path ?: "", + tpo->cancel_path ? ",cancel-path=3D" : "", + tpo->cancel_path ?: ""); break; case TPM_TYPE_EMULATOR: teo =3D ti->options->u.emulator.data; - monitor_printf(mon, ",chardev=3D%s", teo->chardev); + monitor_hmp_printf(hmp, ",chardev=3D%s", teo->chardev); break; case TPM_TYPE__MAX: break; } - monitor_printf(mon, "\n"); + monitor_hmp_printf(hmp, "\n"); c++; } qapi_free_TPMInfoList(info_list); #else - monitor_printf(mon, "TPM device not supported\n"); + monitor_hmp_printf(hmp, "TPM device not supported\n"); #endif /* CONFIG_TPM */ } diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 3ae20f004b64..5d69ece15034 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -82,7 +82,6 @@ void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) =20 void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUState *cs; =20 if (qdict_haskey(qdict, "apic-id")) { @@ -98,7 +97,7 @@ void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qd= ict) =20 =20 if (!cs) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 72bcab131f77..46762540ba65 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -48,27 +48,27 @@ static hwaddr addr_canonical(CPUArchState *env, hwaddr = addr) return addr; } =20 -static void print_pte(Monitor *mon, CPUArchState *env, hwaddr addr, +static void print_pte(MonitorHMP *hmp, CPUArchState *env, hwaddr addr, hwaddr pte, hwaddr mask) { addr =3D addr_canonical(env, addr); =20 - monitor_printf(mon, HWADDR_FMT_plx ": " HWADDR_FMT_plx - " %c%c%c%c%c%c%c%c%c\n", - addr, - pte & mask, - pte & PG_NX_MASK ? 'X' : '-', - pte & PG_GLOBAL_MASK ? 'G' : '-', - pte & PG_PSE_MASK ? 'P' : '-', - pte & PG_DIRTY_MASK ? 'D' : '-', - pte & PG_ACCESSED_MASK ? 'A' : '-', - pte & PG_PCD_MASK ? 'C' : '-', - pte & PG_PWT_MASK ? 'T' : '-', - pte & PG_USER_MASK ? 'U' : '-', - pte & PG_RW_MASK ? 'W' : '-'); + monitor_hmp_printf(hmp, HWADDR_FMT_plx ": " HWADDR_FMT_plx + " %c%c%c%c%c%c%c%c%c\n", + addr, + pte & mask, + pte & PG_NX_MASK ? 'X' : '-', + pte & PG_GLOBAL_MASK ? 'G' : '-', + pte & PG_PSE_MASK ? 'P' : '-', + pte & PG_DIRTY_MASK ? 'D' : '-', + pte & PG_ACCESSED_MASK ? 'A' : '-', + pte & PG_PCD_MASK ? 'C' : '-', + pte & PG_PWT_MASK ? 'T' : '-', + pte & PG_USER_MASK ? 'U' : '-', + pte & PG_RW_MASK ? 'W' : '-'); } =20 -static void tlb_info_32(Monitor *mon, CPUArchState *env, AddressSpace *as) +static void tlb_info_32(MonitorHMP *hmp, CPUArchState *env, AddressSpace *= as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; unsigned int l1, l2; @@ -80,13 +80,13 @@ static void tlb_info_32(Monitor *mon, CPUArchState *env= , AddressSpace *as) if (pde & PG_PRESENT_MASK) { if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { /* 4M pages */ - print_pte(mon, env, (l1 << 22), pde, ~((1 << 21) - 1)); + print_pte(hmp, env, (l1 << 22), pde, ~((1 << 21) - 1)); } else { for(l2 =3D 0; l2 < 1024; l2++) { pte =3D address_space_ldl_le(as, (pde & ~0xfff) + l2 *= 4, attrs, NULL); if (pte & PG_PRESENT_MASK) { - print_pte(mon, env, (l1 << 22) + (l2 << 12), + print_pte(hmp, env, (l1 << 22) + (l2 << 12), pte & ~PG_PSE_MASK, ~0xfff); } @@ -96,7 +96,7 @@ static void tlb_info_32(Monitor *mon, CPUArchState *env, = AddressSpace *as) } } =20 -static void tlb_info_pae32(Monitor *mon, CPUArchState *env, AddressSpace *= as) +static void tlb_info_pae32(MonitorHMP *hmp, CPUArchState *env, AddressSpac= e *as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; unsigned int l1, l2, l3; @@ -113,7 +113,7 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *= env, AddressSpace *as) if (pde & PG_PRESENT_MASK) { if (pde & PG_PSE_MASK) { /* 2M pages with PAE, CR4.PSE is ignored */ - print_pte(mon, env, (l1 << 30) + (l2 << 21), pde, + print_pte(hmp, env, (l1 << 30) + (l2 << 21), pde, ~((hwaddr)(1 << 20) - 1)); } else { pt_addr =3D pde & 0x3fffffffff000ULL; @@ -121,7 +121,7 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *= env, AddressSpace *as) pte =3D address_space_ldq_le(as, pt_addr + l3 = * 8, attrs, NULL); if (pte & PG_PRESENT_MASK) { - print_pte(mon, env, (l1 << 30) + (l2 << 21) + print_pte(hmp, env, (l1 << 30) + (l2 << 21) + (l3 << 12), pte & ~PG_PSE_MASK, ~(hwaddr)0xfff); @@ -135,7 +135,7 @@ static void tlb_info_pae32(Monitor *mon, CPUArchState *= env, AddressSpace *as) } =20 #ifdef TARGET_X86_64 -static void tlb_info_la48(Monitor *mon, CPUArchState *env, AddressSpace *a= s, +static void tlb_info_la48(MonitorHMP *hmp, CPUArchState *env, AddressSpace= *as, uint64_t l0, uint64_t pml4_addr) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; @@ -158,7 +158,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *e= nv, AddressSpace *as, =20 if (pdpe & PG_PSE_MASK) { /* 1G pages, CR4.PSE is ignored */ - print_pte(mon, env, (l0 << 48) + (l1 << 39) + (l2 << 30), + print_pte(hmp, env, (l0 << 48) + (l1 << 39) + (l2 << 30), pdpe, 0x3ffffc0000000ULL); continue; } @@ -172,7 +172,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *e= nv, AddressSpace *as, =20 if (pde & PG_PSE_MASK) { /* 2M pages, CR4.PSE is ignored */ - print_pte(mon, env, (l0 << 48) + (l1 << 39) + (l2 << 3= 0) + + print_pte(hmp, env, (l0 << 48) + (l1 << 39) + (l2 << 3= 0) + (l3 << 21), pde, 0x3ffffffe00000ULL); continue; } @@ -182,7 +182,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *e= nv, AddressSpace *as, pte =3D address_space_ldq_le(as, pt_addr + l4 * 8, attrs, NULL); if (pte & PG_PRESENT_MASK) { - print_pte(mon, env, (l0 << 48) + (l1 << 39) + + print_pte(hmp, env, (l0 << 48) + (l1 << 39) + (l2 << 30) + (l3 << 21) + (l4 << 12), pte & ~PG_PSE_MASK, 0x3fffffffff000ULL); } @@ -192,7 +192,7 @@ static void tlb_info_la48(Monitor *mon, CPUArchState *e= nv, AddressSpace *as, } } =20 -static void tlb_info_la57(Monitor *mon, CPUArchState *env, AddressSpace *a= s) +static void tlb_info_la57(MonitorHMP *hmp, CPUArchState *env, AddressSpace= *as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; uint64_t l0; @@ -203,7 +203,7 @@ static void tlb_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) for (l0 =3D 0; l0 < 512; l0++) { pml5e =3D address_space_ldq_le(as, pml5_addr + l0 * 8, attrs, NULL= ); if (pml5e & PG_PRESENT_MASK) { - tlb_info_la48(mon, env, as, l0, pml5e & 0x3fffffffff000ULL); + tlb_info_la48(hmp, env, as, l0, pml5e & 0x3fffffffff000ULL); } } } @@ -211,18 +211,17 @@ static void tlb_info_la57(Monitor *mon, CPUArchState = *env, AddressSpace *as) =20 void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env; AddressSpace *as; =20 env =3D monitor_hmp_get_cpu_env(hmp); if (!env) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } =20 if (!(env->cr[0] & CR0_PG_MASK)) { - monitor_printf(mon, "PG disabled\n"); + monitor_hmp_printf(hmp, "PG disabled\n"); return; } as =3D cpu_get_address_space(env_cpu(env), X86ASIdx_MEM); @@ -230,21 +229,21 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { if (env->cr[4] & CR4_LA57_MASK) { - tlb_info_la57(mon, env, as); + tlb_info_la57(hmp, env, as); } else { - tlb_info_la48(mon, env, as, 0, env->cr[3] & 0x3fffffffff00= 0ULL); + tlb_info_la48(hmp, env, as, 0, env->cr[3] & 0x3fffffffff00= 0ULL); } } else #endif { - tlb_info_pae32(mon, env, as); + tlb_info_pae32(hmp, env, as); } } else { - tlb_info_32(mon, env, as); + tlb_info_32(hmp, env, as); } } =20 -static void mem_print(Monitor *mon, CPUArchState *env, +static void mem_print(MonitorHMP *hmp, CPUArchState *env, hwaddr *pstart, int *plast_prot, hwaddr end, int prot) { @@ -252,14 +251,14 @@ static void mem_print(Monitor *mon, CPUArchState *env, prot1 =3D *plast_prot; if (prot !=3D prot1) { if (*pstart !=3D -1) { - monitor_printf(mon, HWADDR_FMT_plx "-" HWADDR_FMT_plx " " - HWADDR_FMT_plx " %c%c%c\n", - addr_canonical(env, *pstart), - addr_canonical(env, end), - addr_canonical(env, end - *pstart), - prot1 & PG_USER_MASK ? 'u' : '-', - 'r', - prot1 & PG_RW_MASK ? 'w' : '-'); + monitor_hmp_printf(hmp, HWADDR_FMT_plx "-" HWADDR_FMT_plx " " + HWADDR_FMT_plx " %c%c%c\n", + addr_canonical(env, *pstart), + addr_canonical(env, end), + addr_canonical(env, end - *pstart), + prot1 & PG_USER_MASK ? 'u' : '-', + 'r', + prot1 & PG_RW_MASK ? 'w' : '-'); } if (prot !=3D 0) *pstart =3D end; @@ -269,7 +268,7 @@ static void mem_print(Monitor *mon, CPUArchState *env, } } =20 -static void mem_info_32(Monitor *mon, CPUArchState *env, AddressSpace *as) +static void mem_info_32(MonitorHMP *hmp, CPUArchState *env, AddressSpace *= as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; unsigned int l1, l2; @@ -286,7 +285,7 @@ static void mem_info_32(Monitor *mon, CPUArchState *env= , AddressSpace *as) if (pde & PG_PRESENT_MASK) { if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { prot =3D pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MAS= K); - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } else { for(l2 =3D 0; l2 < 1024; l2++) { pte =3D address_space_ldl_le(as, (pde & ~0xfff) + l2 *= 4, @@ -298,19 +297,19 @@ static void mem_info_32(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) } else { prot =3D 0; } - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } } else { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } /* Flush last range */ - mem_print(mon, env, &start, &last_prot, (hwaddr)1 << 32, 0); + mem_print(hmp, env, &start, &last_prot, (hwaddr)1 << 32, 0); } =20 -static void mem_info_pae32(Monitor *mon, CPUArchState *env, AddressSpace *= as) +static void mem_info_pae32(MonitorHMP *hmp, CPUArchState *env, AddressSpac= e *as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; unsigned int l1, l2, l3; @@ -334,7 +333,7 @@ static void mem_info_pae32(Monitor *mon, CPUArchState *= env, AddressSpace *as) if (pde & PG_PSE_MASK) { prot =3D pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } else { pt_addr =3D pde & 0x3fffffffff000ULL; for (l3 =3D 0; l3 < 512; l3++) { @@ -347,26 +346,26 @@ static void mem_info_pae32(Monitor *mon, CPUArchState= *env, AddressSpace *as) } else { prot =3D 0; } - mem_print(mon, env, &start, &last_prot, end, p= rot); + mem_print(hmp, env, &start, &last_prot, end, p= rot); } } } else { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } } else { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } /* Flush last range */ - mem_print(mon, env, &start, &last_prot, (hwaddr)1 << 32, 0); + mem_print(hmp, env, &start, &last_prot, (hwaddr)1 << 32, 0); } =20 =20 #ifdef TARGET_X86_64 -static void mem_info_la48(Monitor *mon, CPUArchState *env, AddressSpace *a= s) +static void mem_info_la48(MonitorHMP *hmp, CPUArchState *env, AddressSpace= *as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; int prot, last_prot; @@ -390,7 +389,7 @@ static void mem_info_la48(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) prot =3D pdpe & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); prot &=3D pml4e; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } else { pd_addr =3D pdpe & 0x3fffffffff000ULL; for (l3 =3D 0; l3 < 512; l3++) { @@ -402,7 +401,7 @@ static void mem_info_la48(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) prot =3D pde & (PG_USER_MASK | PG_RW_M= ASK | PG_PRESENT_MASK); prot &=3D pml4e & pdpe; - mem_print(mon, env, &start, + mem_print(hmp, env, &start, &last_prot, end, prot); } else { pt_addr =3D pde & 0x3fffffffff000ULL; @@ -420,32 +419,32 @@ static void mem_info_la48(Monitor *mon, CPUArchState = *env, AddressSpace *as) } else { prot =3D 0; } - mem_print(mon, env, &start, + mem_print(hmp, env, &start, &last_prot, end, prot); } } } else { prot =3D 0; - mem_print(mon, env, &start, + mem_print(hmp, env, &start, &last_prot, end, prot); } } } } else { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } } else { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } /* Flush last range */ - mem_print(mon, env, &start, &last_prot, (hwaddr)1 << 48, 0); + mem_print(hmp, env, &start, &last_prot, (hwaddr)1 << 48, 0); } =20 -static void mem_info_la57(Monitor *mon, CPUArchState *env, AddressSpace *a= s) +static void mem_info_la57(MonitorHMP *hmp, CPUArchState *env, AddressSpace= *as) { const MemTxAttrs attrs =3D MEMTXATTRS_UNSPECIFIED; int prot, last_prot; @@ -461,7 +460,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) end =3D l0 << 48; if (!(pml5e & PG_PRESENT_MASK)) { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); continue; } =20 @@ -471,7 +470,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) end =3D (l0 << 48) + (l1 << 39); if (!(pml4e & PG_PRESENT_MASK)) { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); continue; } =20 @@ -481,7 +480,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) end =3D (l0 << 48) + (l1 << 39) + (l2 << 30); if (pdpe & PG_PRESENT_MASK) { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); continue; } =20 @@ -489,7 +488,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) prot =3D pdpe & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); prot &=3D pml5e & pml4e; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); continue; } =20 @@ -500,7 +499,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) end =3D (l0 << 48) + (l1 << 39) + (l2 << 30) + (l3 << = 21); if (pde & PG_PRESENT_MASK) { prot =3D 0; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); continue; } =20 @@ -508,7 +507,7 @@ static void mem_info_la57(Monitor *mon, CPUArchState *e= nv, AddressSpace *as) prot =3D pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK); prot &=3D pml5e & pml4e & pdpe; - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); continue; } =20 @@ -525,31 +524,30 @@ static void mem_info_la57(Monitor *mon, CPUArchState = *env, AddressSpace *as) } else { prot =3D 0; } - mem_print(mon, env, &start, &last_prot, end, prot); + mem_print(hmp, env, &start, &last_prot, end, prot); } } } } } /* Flush last range */ - mem_print(mon, env, &start, &last_prot, (hwaddr)1 << 57, 0); + mem_print(hmp, env, &start, &last_prot, (hwaddr)1 << 57, 0); } #endif /* TARGET_X86_64 */ =20 void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env; AddressSpace *as; =20 env =3D monitor_hmp_get_cpu_env(hmp); if (!env) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } =20 if (!(env->cr[0] & CR0_PG_MASK)) { - monitor_printf(mon, "PG disabled\n"); + monitor_hmp_printf(hmp, "PG disabled\n"); return; } as =3D cpu_get_address_space(env_cpu(env), X86ASIdx_MEM); @@ -557,17 +555,17 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { if (env->cr[4] & CR4_LA57_MASK) { - mem_info_la57(mon, env, as); + mem_info_la57(hmp, env, as); } else { - mem_info_la48(mon, env, as); + mem_info_la48(hmp, env, as); } } else #endif { - mem_info_pae32(mon, env, as); + mem_info_pae32(hmp, env, as); } } else { - mem_info_32(mon, env, as); + mem_info_32(hmp, env, as); } } =20 diff --git a/target/i386/sev.c b/target/i386/sev.c index 4473d02981ff..36a62e58be95 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -756,33 +756,32 @@ SevInfo *qmp_query_sev(Error **errp) =20 void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); SevInfo *info =3D sev_get_info(); =20 if (!info || !info->enabled) { - monitor_printf(mon, "SEV is not enabled\n"); + monitor_hmp_printf(hmp, "SEV is not enabled\n"); goto out; } =20 - monitor_printf(mon, "SEV type: %s\n", SevGuestType_str(info->sev_type)= ); - monitor_printf(mon, "state: %s\n", SevState_str(info->state)); - monitor_printf(mon, "build: %d\n", info->build_id); - monitor_printf(mon, "api version: %d.%d\n", info->api_major, - info->api_minor); + monitor_hmp_printf(hmp, "SEV type: %s\n", SevGuestType_str(info->sev_t= ype)); + monitor_hmp_printf(hmp, "state: %s\n", SevState_str(info->state)); + monitor_hmp_printf(hmp, "build: %d\n", info->build_id); + monitor_hmp_printf(hmp, "api version: %d.%d\n", info->api_major, + info->api_minor); =20 if (sev_snp_enabled()) { - monitor_printf(mon, "debug: %s\n", - info->u.sev_snp.snp_policy & SEV_SNP_POLICY_DBG ? "= on" - : "= off"); - monitor_printf(mon, "SMT allowed: %s\n", - info->u.sev_snp.snp_policy & SEV_SNP_POLICY_SMT ? "= on" - : "= off"); + monitor_hmp_printf(hmp, "debug: %s\n", + info->u.sev_snp.snp_policy & SEV_SNP_POLICY_DBG= ? "on" + = : "off"); + monitor_hmp_printf(hmp, "SMT allowed: %s\n", + info->u.sev_snp.snp_policy & SEV_SNP_POLICY_SMT= ? "on" + = : "off"); } else { - monitor_printf(mon, "handle: %d\n", info->u.sev.handle); - monitor_printf(mon, "debug: %s\n", - info->u.sev.policy & SEV_POLICY_NODBG ? "off" : "on= "); - monitor_printf(mon, "key-sharing: %s\n", - info->u.sev.policy & SEV_POLICY_NOKS ? "off" : "on"= ); + monitor_hmp_printf(hmp, "handle: %d\n", info->u.sev.handle); + monitor_hmp_printf(hmp, "debug: %s\n", + info->u.sev.policy & SEV_POLICY_NODBG ? "off" := "on"); + monitor_hmp_printf(hmp, "key-sharing: %s\n", + info->u.sev.policy & SEV_POLICY_NOKS ? "off" : = "on"); } =20 out: diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 5645a5d4d4f5..23c25283b27a 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -12,11 +12,10 @@ =20 void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } =20 diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 5769829bdd7e..6e8a075f5a41 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -13,11 +13,10 @@ =20 void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } dump_mmu(env1); diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 4c9c0c793b36..59cc04b3d0fb 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -51,13 +51,13 @@ static target_ulong addr_canonical(int va_bits, target_= ulong addr) return addr; } =20 -static void print_pte_header(Monitor *mon) +static void print_pte_header(MonitorHMP *hmp) { - monitor_printf(mon, PTE_HEADER_FIELDS); - monitor_printf(mon, PTE_HEADER_DELIMITER); + monitor_hmp_printf(hmp, PTE_HEADER_FIELDS); + monitor_hmp_printf(hmp, PTE_HEADER_DELIMITER); } =20 -static void print_pte(Monitor *mon, int va_bits, target_ulong vaddr, +static void print_pte(MonitorHMP *hmp, int va_bits, target_ulong vaddr, hwaddr paddr, target_ulong size, int attr) { /* sanity check on vaddr */ @@ -69,20 +69,20 @@ static void print_pte(Monitor *mon, int va_bits, target= _ulong vaddr, return; } =20 - monitor_printf(mon, TARGET_FMT_lx " " HWADDR_FMT_plx " " TARGET_FMT_lx - " %c%c%c%c%c%c%c\n", - addr_canonical(va_bits, vaddr), - paddr, size, - attr & PTE_R ? 'r' : '-', - attr & PTE_W ? 'w' : '-', - attr & PTE_X ? 'x' : '-', - attr & PTE_U ? 'u' : '-', - attr & PTE_G ? 'g' : '-', - attr & PTE_A ? 'a' : '-', - attr & PTE_D ? 'd' : '-'); + monitor_hmp_printf(hmp, TARGET_FMT_lx " " HWADDR_FMT_plx " " TARGET_FM= T_lx + " %c%c%c%c%c%c%c\n", + addr_canonical(va_bits, vaddr), + paddr, size, + attr & PTE_R ? 'r' : '-', + attr & PTE_W ? 'w' : '-', + attr & PTE_X ? 'x' : '-', + attr & PTE_U ? 'u' : '-', + attr & PTE_G ? 'g' : '-', + attr & PTE_A ? 'a' : '-', + attr & PTE_D ? 'd' : '-'); } =20 -static void walk_pte(Monitor *mon, AddressSpace *as, +static void walk_pte(MonitorHMP *hmp, AddressSpace *as, hwaddr base, target_ulong start, int level, int ptidxbits, int ptesize, int va_bits, target_ulong *vbase, hwaddr *pbase, hwaddr *last_padd= r, @@ -126,7 +126,7 @@ static void walk_pte(Monitor *mon, AddressSpace *as, if ((*last_attr !=3D attr) || (*last_paddr + *last_size !=3D paddr) || (last_start + *last_size !=3D start)) { - print_pte(mon, va_bits, *vbase, *pbase, + print_pte(hmp, va_bits, *vbase, *pbase, *last_paddr + *last_size - *pbase, *last_att= r); =20 *vbase =3D start; @@ -139,7 +139,7 @@ static void walk_pte(Monitor *mon, AddressSpace *as, *last_size =3D pgsize; } else { /* pointer to the next level of the page table */ - walk_pte(mon, as, paddr, start, level - 1, ptidxbits, ptes= ize, + walk_pte(hmp, as, paddr, start, level - 1, ptidxbits, ptes= ize, va_bits, vbase, pbase, last_paddr, last_size, last_attr); } @@ -150,7 +150,7 @@ static void walk_pte(Monitor *mon, AddressSpace *as, =20 } =20 -static void mem_info_svxx(Monitor *mon, CPUArchState *env) +static void mem_info_svxx(MonitorHMP *hmp, CPUArchState *env) { AddressSpace *as =3D env_cpu(env)->as; int levels, ptidxbits, ptesize, vm, va_bits; @@ -198,7 +198,7 @@ static void mem_info_svxx(Monitor *mon, CPUArchState *e= nv) va_bits =3D PGSHIFT + levels * ptidxbits; =20 /* print header */ - print_pte_header(mon); + print_pte_header(hmp); =20 vbase =3D -1; pbase =3D -1; @@ -207,43 +207,42 @@ static void mem_info_svxx(Monitor *mon, CPUArchState = *env) last_attr =3D 0; =20 /* walk page tables, starting from address 0 */ - walk_pte(mon, as, base, 0, levels - 1, ptidxbits, ptesize, va_bits, + walk_pte(hmp, as, base, 0, levels - 1, ptidxbits, ptesize, va_bits, &vbase, &pbase, &last_paddr, &last_size, &last_attr); =20 /* don't forget the last one */ - print_pte(mon, va_bits, vbase, pbase, + print_pte(hmp, va_bits, vbase, pbase, last_paddr + last_size - pbase, last_attr); } =20 void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env; =20 env =3D monitor_hmp_get_cpu_env(hmp); if (!env) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } =20 if (!riscv_cpu_cfg(env)->mmu) { - monitor_printf(mon, "S-mode MMU unavailable\n"); + monitor_hmp_printf(hmp, "S-mode MMU unavailable\n"); return; } =20 if (riscv_cpu_mxl(env) =3D=3D MXL_RV32) { if (!(env->satp & SATP32_MODE)) { - monitor_printf(mon, "No translation or protection\n"); + monitor_hmp_printf(hmp, "No translation or protection\n"); return; } } else { if (!(env->satp & SATP64_MODE)) { - monitor_printf(mon, "No translation or protection\n"); + monitor_hmp_printf(hmp, "No translation or protection\n"); return; } } =20 - mem_info_svxx(mon, env); + mem_info_svxx(hmp, env); } =20 #ifdef CONFIG_TCG diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 4e443152bf56..62998a9a57cb 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -26,33 +26,32 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 -static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) +static void print_tlb(MonitorHMP *hmp, int idx, tlb_t *tlb) { - monitor_printf(mon, " tlb%i:\t" - "asid=3D%hhu vpn=3D%x\tppn=3D%x\tsz=3D%hhu size=3D%u\t" - "v=3D%hhu shared=3D%hhu cached=3D%hhu prot=3D%hhu " - "dirty=3D%hhu writethrough=3D%hhu\n", - idx, - tlb->asid, tlb->vpn, tlb->ppn, tlb->sz, tlb->size, - tlb->v, tlb->sh, tlb->c, tlb->pr, - tlb->d, tlb->wt); + monitor_hmp_printf(hmp, " tlb%i:\t" + "asid=3D%hhu vpn=3D%x\tppn=3D%x\tsz=3D%hhu size=3D%= u\t" + "v=3D%hhu shared=3D%hhu cached=3D%hhu prot=3D%hhu " + "dirty=3D%hhu writethrough=3D%hhu\n", + idx, + tlb->asid, tlb->vpn, tlb->ppn, tlb->sz, tlb->size, + tlb->v, tlb->sh, tlb->c, tlb->pr, + tlb->d, tlb->wt); } =20 void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env =3D monitor_hmp_get_cpu_env(hmp); int i; =20 if (!env) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } =20 - monitor_printf (mon, "ITLB:\n"); + monitor_hmp_printf(hmp, "ITLB:\n"); for (i =3D 0 ; i < ITLB_SIZE ; i++) - print_tlb (mon, i, &env->itlb[i]); - monitor_printf (mon, "UTLB:\n"); + print_tlb(hmp, i, &env->itlb[i]); + monitor_hmp_printf(hmp, "UTLB:\n"); for (i =3D 0 ; i < UTLB_SIZE ; i++) - print_tlb (mon, i, &env->utlb[i]); + print_tlb(hmp, i, &env->utlb[i]); } diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index e826e584a918..36f109cbb568 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -29,11 +29,10 @@ =20 void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } dump_mmu(env1); diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index b7b7387706f3..b9c4089b0fb1 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -28,11 +28,10 @@ =20 void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); =20 if (!env1) { - monitor_printf(mon, "No CPU available\n"); + monitor_hmp_printf(hmp, "No CPU available\n"); return; } dump_mmu(env1); diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index b2a884529598..530a3fee3c13 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -75,7 +75,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Erro= r **errp) */ Monitor *monitor_cur(void) { return cur_mon; } Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } +int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { ab= ort(); } =20 #ifndef _WIN32 static void test_socket_fd_pass_name_good(void) diff --git a/tools/qemu-vnc/clipboard.c b/tools/qemu-vnc/clipboard.c index f62b2f294952..81a09ec5adfa 100644 --- a/tools/qemu-vnc/clipboard.c +++ b/tools/qemu-vnc/clipboard.c @@ -62,7 +62,7 @@ vnc_dbus_clipboard_request_cancelled(VncDBusClipboardRequ= est *req) "Cancelled clipboard request"); =20 g_clear_object(&req->invocation); - g_clear_handle_id(&req->timeout_id, g_source_remove);; + g_clear_handle_id(&req->timeout_id, g_source_remove); } =20 static gboolean @@ -137,7 +137,7 @@ vnc_dbus_clipboard_update_info(QemuClipboardInfo *info) vnc_dbus_clipboard_complete_request( req->invocation, info, req->type); g_clear_object(&req->invocation); - g_clear_handle_id(&req->timeout_id, g_source_remove);; + g_clear_handle_id(&req->timeout_id, g_source_remove); return; } =20 diff --git a/tools/qemu-vnc/stubs.c b/tools/qemu-vnc/stubs.c index 26597fefaa99..0aa50a901d37 100644 --- a/tools/qemu-vnc/stubs.c +++ b/tools/qemu-vnc/stubs.c @@ -42,7 +42,7 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) return NULL; } =20 -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { return -1; } diff --git a/trace/trace-hmp-cmds.c b/trace/trace-hmp-cmds.c index 5a8158f4f4b6..a68f5b900d7c 100644 --- a/trace/trace-hmp-cmds.c +++ b/trace/trace-hmp-cmds.c @@ -49,7 +49,6 @@ void hmp_trace_event(MonitorHMP *hmp, const QDict *qdict) #ifdef CONFIG_TRACE_SIMPLE void hmp_trace_file(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *op =3D qdict_get_try_str(qdict, "op"); const char *arg =3D qdict_get_try_str(qdict, "arg"); =20 @@ -66,15 +65,14 @@ void hmp_trace_file(MonitorHMP *hmp, const QDict *qdict) st_set_trace_file(arg); } } else { - monitor_printf(mon, "unexpected argument \"%s\"\n", op); - hmp_help_cmd(mon, "trace-file"); + monitor_hmp_printf(hmp, "unexpected argument \"%s\"\n", op); + hmp_help_cmd(hmp, "trace-file"); } } #endif =20 void hmp_info_trace_events(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_try_str(qdict, "name"); TraceEventInfoList *events; TraceEventInfoList *elem; @@ -91,9 +89,9 @@ void hmp_info_trace_events(MonitorHMP *hmp, const QDict *= qdict) } =20 for (elem =3D events; elem !=3D NULL; elem =3D elem->next) { - monitor_printf(mon, "%s : state %u\n", - elem->value->name, - elem->value->state =3D=3D TRACE_EVENT_STATE_ENABLED= ? 1 : 0); + monitor_hmp_printf(hmp, "%s : state %u\n", + elem->value->name, + elem->value->state =3D=3D TRACE_EVENT_STATE_ENA= BLED ? 1 : 0); } qapi_free_TraceEventInfoList(events); } diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 186209fd0234..f611dd7ee457 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -81,20 +81,19 @@ void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); MouseInfoList *mice_list, *mouse; =20 mice_list =3D qmp_query_mice(NULL); if (!mice_list) { - monitor_printf(mon, "No mouse devices connected\n"); + monitor_hmp_printf(hmp, "No mouse devices connected\n"); return; } =20 for (mouse =3D mice_list; mouse; mouse =3D mouse->next) { - monitor_printf(mon, "%c Mouse #%" PRId64 ": %s%s\n", - mouse->value->current ? '*' : ' ', - mouse->value->index, mouse->value->name, - mouse->value->absolute ? " (absolute)" : ""); + monitor_hmp_printf(hmp, "%c Mouse #%" PRId64 ": %s%s\n", + mouse->value->current ? '*' : ' ', + mouse->value->index, mouse->value->name, + mouse->value->absolute ? " (absolute)" : ""); } =20 qapi_free_MouseInfoList(mice_list); @@ -102,48 +101,48 @@ void hmp_info_mice(MonitorHMP *hmp, const QDict *qdic= t) =20 #ifdef CONFIG_VNC /* Helper for hmp_info_vnc_clients, _servers */ -static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info, +static void hmp_info_VncBasicInfo(MonitorHMP *hmp, VncBasicInfo *info, const char *name) { - monitor_printf(mon, " %s: %s:%s (%s%s)\n", - name, - info->host, - info->service, - NetworkAddressFamily_str(info->family), - info->websocket ? " (Websocket)" : ""); + monitor_hmp_printf(hmp, " %s: %s:%s (%s%s)\n", + name, + info->host, + info->service, + NetworkAddressFamily_str(info->family), + info->websocket ? " (Websocket)" : ""); } =20 /* Helper displaying and auth and crypt info */ -static void hmp_info_vnc_authcrypt(Monitor *mon, const char *indent, +static void hmp_info_vnc_authcrypt(MonitorHMP *hmp, const char *indent, VncPrimaryAuth auth, VncVencryptSubAuth *vencrypt) { - monitor_printf(mon, "%sAuth: %s (Sub: %s)\n", indent, - VncPrimaryAuth_str(auth), - vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "none"); + monitor_hmp_printf(hmp, "%sAuth: %s (Sub: %s)\n", indent, + VncPrimaryAuth_str(auth), + vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "non= e"); } =20 -static void hmp_info_vnc_clients(Monitor *mon, VncClientInfoList *client) +static void hmp_info_vnc_clients(MonitorHMP *hmp, VncClientInfoList *clien= t) { while (client) { VncClientInfo *cinfo =3D client->value; =20 - hmp_info_VncBasicInfo(mon, qapi_VncClientInfo_base(cinfo), "Client= "); - monitor_printf(mon, " x509_dname: %s\n", - cinfo->x509_dname ?: "none"); - monitor_printf(mon, " sasl_username: %s\n", - cinfo->sasl_username ?: "none"); + hmp_info_VncBasicInfo(hmp, qapi_VncClientInfo_base(cinfo), "Client= "); + monitor_hmp_printf(hmp, " x509_dname: %s\n", + cinfo->x509_dname ?: "none"); + monitor_hmp_printf(hmp, " sasl_username: %s\n", + cinfo->sasl_username ?: "none"); =20 client =3D client->next; } } =20 -static void hmp_info_vnc_servers(Monitor *mon, VncServerInfo2List *server) +static void hmp_info_vnc_servers(MonitorHMP *hmp, VncServerInfo2List *serv= er) { while (server) { VncServerInfo2 *sinfo =3D server->value; - hmp_info_VncBasicInfo(mon, qapi_VncServerInfo2_base(sinfo), "Serve= r"); - hmp_info_vnc_authcrypt(mon, " ", sinfo->auth, + hmp_info_VncBasicInfo(hmp, qapi_VncServerInfo2_base(sinfo), "Serve= r"); + hmp_info_vnc_authcrypt(hmp, " ", sinfo->auth, sinfo->has_vencrypt ? &sinfo->vencrypt : NU= LL); server =3D server->next; } @@ -151,7 +150,6 @@ static void hmp_info_vnc_servers(Monitor *mon, VncServe= rInfo2List *server) =20 void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); VncInfo2List *info2l, *info2l_head; Error *err =3D NULL; =20 @@ -161,26 +159,26 @@ void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict) return; } if (!info2l) { - monitor_printf(mon, "None\n"); + monitor_hmp_printf(hmp, "None\n"); return; } =20 while (info2l) { VncInfo2 *info =3D info2l->value; - monitor_printf(mon, "%s:\n", info->id); - hmp_info_vnc_servers(mon, info->server); - hmp_info_vnc_clients(mon, info->clients); + monitor_hmp_printf(hmp, "%s:\n", info->id); + hmp_info_vnc_servers(hmp, info->server); + hmp_info_vnc_clients(hmp, info->clients); if (!info->server) { /* * The server entry displays its auth, we only need to * display in the case of 'reverse' connections where * there's no server. */ - hmp_info_vnc_authcrypt(mon, " ", info->auth, + hmp_info_vnc_authcrypt(hmp, " ", info->auth, info->has_vencrypt ? &info->vencrypt : NULL= ); } if (info->display) { - monitor_printf(mon, " Display: %s\n", info->display); + monitor_hmp_printf(hmp, " Display: %s\n", info->display); } info2l =3D info2l->next; } @@ -193,7 +191,6 @@ void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict) #ifdef CONFIG_SPICE void hmp_info_spice(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); SpiceChannelList *chan; SpiceInfo *info; const char *channel_name; @@ -214,38 +211,38 @@ void hmp_info_spice(MonitorHMP *hmp, const QDict *qdi= ct) info =3D qmp_query_spice(NULL); =20 if (!info->enabled) { - monitor_printf(mon, "Server: disabled\n"); + monitor_hmp_printf(hmp, "Server: disabled\n"); goto out; } =20 - monitor_printf(mon, "Server:\n"); + monitor_hmp_printf(hmp, "Server:\n"); if (info->has_port) { - monitor_printf(mon, " address: %s:%" PRId64 "\n", - info->host, info->port); + monitor_hmp_printf(hmp, " address: %s:%" PRId64 "\n", + info->host, info->port); } if (info->has_tls_port) { - monitor_printf(mon, " address: %s:%" PRId64 " [tls]\n", - info->host, info->tls_port); + monitor_hmp_printf(hmp, " address: %s:%" PRId64 " [tls]\n", + info->host, info->tls_port); } - monitor_printf(mon, " migrated: %s\n", - info->migrated ? "true" : "false"); - monitor_printf(mon, " auth: %s\n", info->auth); - monitor_printf(mon, " compiled: %s\n", info->compiled_version); - monitor_printf(mon, " mouse-mode: %s\n", - SpiceQueryMouseMode_str(info->mouse_mode)); + monitor_hmp_printf(hmp, " migrated: %s\n", + info->migrated ? "true" : "false"); + monitor_hmp_printf(hmp, " auth: %s\n", info->auth); + monitor_hmp_printf(hmp, " compiled: %s\n", info->compiled_version); + monitor_hmp_printf(hmp, " mouse-mode: %s\n", + SpiceQueryMouseMode_str(info->mouse_mode)); =20 if (!info->has_channels || info->channels =3D=3D NULL) { - monitor_printf(mon, "Channels: none\n"); + monitor_hmp_printf(hmp, "Channels: none\n"); } else { for (chan =3D info->channels; chan; chan =3D chan->next) { - monitor_printf(mon, "Channel:\n"); - monitor_printf(mon, " address: %s:%s%s\n", - chan->value->host, chan->value->port, - chan->value->tls ? " [tls]" : ""); - monitor_printf(mon, " session: %" PRId64 "\n", - chan->value->connection_id); - monitor_printf(mon, " channel: %" PRId64 ":%" PRId64 "\n", - chan->value->channel_type, chan->value->channel= _id); + monitor_hmp_printf(hmp, "Channel:\n"); + monitor_hmp_printf(hmp, " address: %s:%s%s\n", + chan->value->host, chan->value->port, + chan->value->tls ? " [tls]" : ""); + monitor_hmp_printf(hmp, " session: %" PRId64 "\n", + chan->value->connection_id); + monitor_hmp_printf(hmp, " channel: %" PRId64 ":%" PRId64 "= \n", + chan->value->channel_type, chan->value->cha= nnel_id); =20 channel_name =3D "unknown"; if (chan->value->channel_type > 0 && @@ -254,7 +251,7 @@ void hmp_info_spice(MonitorHMP *hmp, const QDict *qdict) channel_name =3D channel_names[chan->value->channel_type]; } =20 - monitor_printf(mon, " channel name: %s\n", channel_name); + monitor_hmp_printf(hmp, " channel name: %s\n", channel_nam= e); } } =20 @@ -333,7 +330,7 @@ static void hmp_change_read_arg(void *opaque, const cha= r *password, monitor_hmp_read_command(opaque, 1); } =20 -void hmp_change_vnc(Monitor *mon, const char *device, const char *target, +void hmp_change_vnc(MonitorHMP *hmp, const char *device, const char *targe= t, const char *arg, const char *read_only, bool force, Error **errp) { @@ -346,7 +343,6 @@ void hmp_change_vnc(Monitor *mon, const char *device, c= onst char *target, return; } if (!arg) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); monitor_hmp_read_password(hmp, hmp_change_read_arg, NULL); } else { qmp_change_vnc_password(arg, errp); @@ -371,7 +367,6 @@ static int index_from_key(const char *key, size_t key_l= ength) =20 void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *keys =3D qdict_get_str(qdict, "keys"); KeyValue *v =3D NULL; KeyValueList *head =3D NULL, **tail =3D &head; @@ -432,7 +427,7 @@ out: return; =20 err_out: - monitor_printf(mon, "invalid parameter: %.*s\n", keyname_len, keys); + monitor_hmp_printf(hmp, "invalid parameter: %.*s\n", keyname_len, keys= ); goto out; } =20 diff --git a/util/error-report.c b/util/error-report.c index 70cbd174ffae..c20e157780fa 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -38,7 +38,7 @@ error_vprintf_mon(const char *fmt, va_list ap) MonitorHMP *hmp =3D monitor_cur_hmp(); =20 if (hmp) { - return monitor_vprintf(MONITOR(hmp), fmt, ap); + return monitor_hmp_vprintf(hmp, fmt, ap); } =20 return vfprintf(stderr, fmt, ap); diff --git a/util/qemu-print.c b/util/qemu-print.c index 0eecc05b0330..aabe670fda01 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -23,7 +23,7 @@ int qemu_vprintf(const char *fmt, va_list ap) { MonitorHMP *hmp =3D monitor_cur_hmp(); if (hmp) { - return monitor_vprintf(MONITOR(hmp), fmt, ap); + return monitor_hmp_vprintf(hmp, fmt, ap); } return vprintf(fmt, ap); } @@ -54,7 +54,7 @@ int qemu_vfprintf(FILE *stream, const char *fmt, va_list = ap) { if (!stream) { MonitorHMP *hmp =3D monitor_cur_hmp(); - return hmp ? monitor_vprintf(MONITOR(hmp), fmt, ap) : -1; + return hmp ? monitor_hmp_vprintf(hmp, fmt, ap) : -1; } return vfprintf(stream, fmt, ap); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907870; cv=none; d=zohomail.com; s=zohoarc; b=d+ubyosAt3ZoqUB6q7ct1r7nsmXzzFh+assJ5DM+DU47lsaMUp16CQvU03tARSMjjw/FvNsdI47h3xqZ54M+bmj6Woif1tCTo0oh9oL6WXS7X4MabcwNeoi2ourDDUbgWIqexMPIvYj+dFeXR9gAzJF3Aj5u08tFdCtvTx/U5zk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907870; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4Ib8GFKgRPHa2J2wi8wsfneryahd28MzV2n2AJnszyk=; b=TC+xFbfpUcJRa9Dvt35f+12g9BY0VROGPL06KIOAZNL1c1qKSF900/ZYwJqcy1Y4AW6zw4Xm4Nm6ACm46p1qytZ2OwfZ7NzoHuGIEzqHL4rekXElx9x0GLbZcR0Ci2JfhKF08pe0ds6WInz53G1vUNcMP9vvLID2jTmO7X8Kc20= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907870389397.3624949086691; Sun, 16 Aug 2026 12:17:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKk-0008Dy-SV; Sun, 16 Aug 2026 15:15:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKY-0007vq-Cb for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKW-0008Lk-2h for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:38 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-8liOX4BaMqqrZSTIDwDIWA-1; Sun, 16 Aug 2026 15:15:25 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6F29019560BB; Sun, 16 Aug 2026 19:15:24 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 88885422; Sun, 16 Aug 2026 19:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907735; 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=4Ib8GFKgRPHa2J2wi8wsfneryahd28MzV2n2AJnszyk=; b=gbQB09yRXvAB4i5ptKJREAIN5FeFju7ZlITHy/ghZAzw6aZCZYSv+Uv3UA9YEo1xQw9hv2 FCEVMk/fS5rQSoDE2p1tjixy0qO/lY1OZIxWX53EKq8zVbIg7FrRz64Cx3iZLZF1ojr9Zc Z4DxYv5/OOQSPUQUf9P5HCaZbyi8HR8= X-MC-Unique: 8liOX4BaMqqrZSTIDwDIWA-1 X-Mimecast-MFC-AGG-ID: 8liOX4BaMqqrZSTIDwDIWA_1786907724 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:05 +0400 Subject: [PATCH v3 38/49] hexagon: make dump_mmu() take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-38-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Brian Cain , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=3982; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zy1e6hPdeLtmGJwllF+MCr8YtA/my6B2mWltzdsS2WY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0qVJsnwDvHBXAZi2amlwV3R97e5ak0XhEW VKFKx8f9vWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5Z1GD/9sjAWHhTKFKFYhMhaqLj8KRxhLQ1RycgK/p9ZZuT71PK7C0SidSTzrae9goqtaj7qNDsr RtK7eNzcuos62PALhBwe3bYnrBreLN6dVj2QOEvOUXFjAmTBSY9kcDTih8xLxDxoX8530+SAN1/ hPnfSwwVxQuqJm7c63jgqCrEEcBHfUg3diLmUQMUcSjdrDkvpK9eKfMERTpRa0sopaTuz+jyJ/M NTsU5VMDpN+Wb7894SyTcOgv7bhQqdlyvrhNfqO1JNhwErW1LVnpKNSpw+s6PPaOt0ptPiW/fSR yTq19MyD57MAF8E/oRhb0YKJyCNE1QtBPsFqKvjAjNKgLyzWcczlRFz8BJtYn6Q6EG4stcRVa+e St1nuidfHKJBVNrDxqls0Y4krmdSpTy3cxFw4k2nE6sC935W3k2lyXioHl2FPEcPxkiZbH6EnQE BCLwyKVEFxYSIARySffemZ/l769ZeQ9H+LGfzNM7Tra2OTunPmZL7nCRnCHQexcKYroGi0Dmuhv GlcsPr7uf0sD2nq5Hj08PS2Fa13e4FeA2yFQ9D+h3UGpVbz084fekBoKGyef7LvD+c3a5m6ZO7z xdZOvwewK3gUunU7rpDBLdBahSsn5Qwy3DZkan1dQkD3lhMXB6ukrrtZe5uZpAAbl7N0VJ9xNeN pN4eIBXgex/9yTw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907870676158500 Avoid unsafe MONITOR_HMP() casts. The function has no caller since its introduction and could be dropped if it is not wired to a HMP command. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Brian Cain Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/hexagon/hexagon_tlb.c | 8 +++----- include/hw/hexagon/hexagon_tlb.h | 5 +++-- target/hexagon/hex_mmu.c | 4 ++-- target/hexagon/hex_mmu.h | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/hexagon/hexagon_tlb.c b/hw/hexagon/hexagon_tlb.c index 576929ff224b..584c606a22c5 100644 --- a/hw/hexagon/hexagon_tlb.c +++ b/hw/hexagon/hexagon_tlb.c @@ -122,10 +122,8 @@ static inline uint64_t hex_tlb_virt_addr(uint64_t entr= y) return (uint64_t)GET_PTE_VPN(entry) << qemu_target_page_bits(); } =20 -bool hexagon_tlb_dump_entry(Monitor *mon, uint64_t entry) +bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t entry) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); - if (GET_PTE_V(entry)) { uint64_t PA =3D hex_tlb_phys_addr(entry); uint64_t VA =3D hex_tlb_virt_addr(entry); @@ -379,10 +377,10 @@ int hexagon_tlb_check_overlap(HexagonTLBState *tlb, u= int64_t entry, return -1; } =20 -void hexagon_tlb_dump(Monitor *mon, HexagonTLBState *tlb) +void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb) { for (uint32_t i =3D 0; i < tlb->num_entries; i++) { - hexagon_tlb_dump_entry(mon, tlb->entries[i]); + hexagon_tlb_dump_entry(hmp, tlb->entries[i]); } } =20 diff --git a/include/hw/hexagon/hexagon_tlb.h b/include/hw/hexagon/hexagon_= tlb.h index 760dc1ea811b..c3f0fc599fdd 100644 --- a/include/hw/hexagon/hexagon_tlb.h +++ b/include/hw/hexagon/hexagon_tlb.h @@ -12,6 +12,7 @@ #include "qom/object.h" #include "exec/hwaddr.h" #include "exec/mmu-access-type.h" +#include "monitor/hmp.h" =20 #define TYPE_HEXAGON_TLB "hexagon-tlb" OBJECT_DECLARE_SIMPLE_TYPE(HexagonTLBState, HEXAGON_TLB) @@ -37,9 +38,9 @@ uint32_t hexagon_tlb_lookup(HexagonTLBState *tlb, uint32_= t asid, int hexagon_tlb_check_overlap(HexagonTLBState *tlb, uint64_t entry, uint64_t index); =20 -void hexagon_tlb_dump(Monitor *mon, HexagonTLBState *tlb); +void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb); =20 -bool hexagon_tlb_dump_entry(Monitor *mon, uint64_t entry); +bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t entry); =20 uint32_t hexagon_tlb_get_num_entries(HexagonTLBState *tlb); =20 diff --git a/target/hexagon/hex_mmu.c b/target/hexagon/hex_mmu.c index 81d64a6146cc..242de06eaad2 100644 --- a/target/hexagon/hex_mmu.c +++ b/target/hexagon/hex_mmu.c @@ -107,10 +107,10 @@ int hex_tlb_check_overlap(CPUHexagonState *env, uint6= 4_t entry, uint64_t index) return hexagon_tlb_check_overlap(cpu->tlb, entry, index); } =20 -void dump_mmu(Monitor *mon, CPUHexagonState *env) +void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env) { HexagonCPU *cpu =3D env_archcpu(env); - hexagon_tlb_dump(mon, cpu->tlb); + hexagon_tlb_dump(hmp, cpu->tlb); } =20 static inline void print_thread(const char *str, CPUState *cs) diff --git a/target/hexagon/hex_mmu.h b/target/hexagon/hex_mmu.h index 6aa450b94136..56b2c4a89d0c 100644 --- a/target/hexagon/hex_mmu.h +++ b/target/hexagon/hex_mmu.h @@ -10,6 +10,7 @@ #include "exec/hwaddr.h" #include "exec/mmu-access-type.h" #include "cpu.h" +#include "monitor/hmp.h" =20 extern void hex_tlbw(CPUHexagonState *env, uint32_t index, uint64_t value); extern uint32_t hex_tlb_lookup(CPUHexagonState *env, uint32_t ssr, uint32_= t VA); @@ -23,5 +24,5 @@ extern int hex_tlb_check_overlap(CPUHexagonState *env, ui= nt64_t entry, uint64_t index); extern void hex_tlb_lock(CPUHexagonState *env); extern void hex_tlb_unlock(CPUHexagonState *env); -void dump_mmu(Monitor *mon, CPUHexagonState *env); +void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env); #endif --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907754; cv=none; d=zohomail.com; s=zohoarc; b=bA/JRFUyZbBJkpSKeIZNa9xC3T9kDYo9U8KUHGQMctgs0HD2LM0O1gcrvdi2Qlu2/CL5NG2vjcXmcOU6XclHNV1b12W+LS5YCEoD6NGHO8TGILpPGvcRQTQBfXydca5/rg3DHAXrFvS6VLL1cFJSI7X/M21z8s1/L+hhzN8dfpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907754; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g46sAmq3ha3DYCK2UfYcBYOEhlaJmE0VJpMuNI3hBc0=; b=BczAlpnOqcQXeWoKiugA3s3e10pgIHdXE+MHUc49ZW881yI42OP3tFMS7du0bD+gpTzbeNB6u9ZUSz1oviFJ2NsB/gKt5Wab9HMqy+27oDDWROE0vnXjfBgPRfSkIkZk6MGVEEBSw1harYH8jYY0F8EsVVPiHJ/95kKtJbDN3RA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1786907754302175.024750484597; Sun, 16 Aug 2026 12:15:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1392351.1631357 (Exim 4.92) (envelope-from ) id 1wvgKb-0002lZ-Td; Sun, 16 Aug 2026 19:15:41 +0000 Received: by outflank-mailman (output) from mailman id 1392351.1631357; Sun, 16 Aug 2026 19:15:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wvgKb-0002lS-Qe; Sun, 16 Aug 2026 19:15:41 +0000 Received: by outflank-mailman (input) for mailman id 1392351; Sun, 16 Aug 2026 19:15:40 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wvgKa-0002kn-38 for xen-devel@lists.xenproject.org; Sun, 16 Aug 2026 19:15:40 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wvgKZ-000W25-GT for xen-devel@lists.xenproject.org; Sun, 16 Aug 2026 21:15:39 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a820c12-8faa-0a2a0a5109dd-0a2a450cc58a-16 for ; Sun, 16 Aug 2026 21:15:39 +0200 Received: from [170.10.133.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a820c5a-f479-0a2a450c0019-aa0a857cbbb1-3 for ; Sun, 16 Aug 2026 21:15:39 +0200 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-318-7f96DjF8Pgm4b6YL4EVX9A-1; Sun, 16 Aug 2026 15:15:29 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F308118009B9; Sun, 16 Aug 2026 19:15:27 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AB84B195608A; Sun, 16 Aug 2026 19:15:26 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907738; 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=g46sAmq3ha3DYCK2UfYcBYOEhlaJmE0VJpMuNI3hBc0=; b=Vw3Z6FAf3eVfYKpXnnE3ry9w0YTXPiFb+W7ArswLWqoXh0jxmk8pQog7hRoCrl8nvPFa5M Gmoc8+B94ixGC25HkdVuMeQgg9wWyHHbq8UB8HZuRbXOdI6RS6pWVzb/vGLtF1ATJY9dhN M3nCxdDEgDWGrG9MbSoV0789aHbqjHQ= X-MC-Unique: 7f96DjF8Pgm4b6YL4EVX9A-1 X-Mimecast-MFC-AGG-ID: 7f96DjF8Pgm4b6YL4EVX9A_1786907728 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:06 +0400 Subject: [PATCH v3 39/49] qdev-monitor: make print_dev() callback take MonitorHMP MIME-Version: 1.0 Message-Id: <20260816-qemu-no-hmp-v3-39-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Michael S. Tsirkin" , Laurent Vivier , Amit Shah , Paolo Bonzini , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8734; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=cx2OSLe23AC3qAPOuez5hwYS/HxH2LycawW7o4xWb/s=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0colGAL5Urj3/4h6eSdW96XE2/1InxU1CL lbwnRPnuiKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5YsCD/9d6LecLqyFpUAiOjySTCaIn4pgwvHvAM5YCSI7WTFHDMhzfyNfks15weyh5Q2vcwxXdBe ApjrTS4/4pAayYDBCw37akCTxBfLuu8hH7gPzsM/miXzSxmITm3z51cd8IGDwNKX2WP1xXWYgRr uW3+prn7q7hA/f6+fiVSjUS8btJgFfzKzQ5DnB7xtSxMHvI6JZI7gkcSzqtJ4wWWz9Oz733x9VS upQplMPXLnncEnxxiTgyzY6iQWicVnr8gLJ9hq5tAjVw+0FRYTL4K75OjssHbREjjPqhA6cCQfG puHlPZ+p4HDk5BOb9/DKbiQG2gRvjvv/ZMJLK130EPMPaK4wZpEuNdmYYXzoxWr8ogUbhuR3tyt v1qj7Al73J7oi0mXTJTTV4r4JWwtwbiOFmVpYZkPACHEjQ2cwwEqzfCgNjoCQ9LlEQuFDO9MyLF y5EF3lYu1yINwa72YD6Jc39Az7QNelcnOehkOVLNNgN590FuvP8diG/9FH97fJonwp/8dPbkyog zV0evM9ui0n1lFFvPOnNtBz4mnH7DeXpMtt/SjYUpzSgOBnDZigqBzGBoWE8vbPeGJvWIGiaMmS A4XaQ8Zt+1/tSbZeEkTMx4/oRrPz3RSQsDnRDG3uSlZIo0VRRwWL4LxI46Zfdwdv5nlenC9N9Wg FrEHvaJmEMecCyA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-MFC-PROC-ID: UPaWkOcRGBCD-CdOiAYDmozhIUVnst6SrkkDj9QKZH4_1786907728 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1786907739-024DFA5B-CE964D28/0/0 X-purgate-type: clean X-purgate-size: 8736 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907756528158500 The callback is specific to HMP context, avoid unsafe MONITOR_HMP() cast. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/virtio-serial-bus.c | 6 +++--- hw/core/sysbus.c | 5 ++--- hw/misc/auxbus.c | 7 +++---- hw/pci/pci-hmp-cmds.c | 3 +-- hw/pci/pci-internal.h | 2 +- hw/usb/bus.c | 5 ++--- hw/xen/xen-bus.c | 3 +-- include/hw/core/qdev.h | 3 ++- system/qdev-monitor.c | 7 +++---- 9 files changed, 18 insertions(+), 23 deletions(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 33fdc0846ac3..4dcc4516e45e 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -814,7 +814,7 @@ static int virtio_serial_load_device(VirtIODevice *vdev= , QEMUFile *f, return 0; } =20 -static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int ind= ent); +static void virtser_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int = indent); =20 static const Property virtser_props[] =3D { DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID), @@ -834,11 +834,11 @@ static const TypeInfo virtser_bus_info =3D { .class_init =3D virtser_bus_class_init, }; =20 -static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int ind= ent) +static void virtser_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int = indent) { VirtIOSerialPort *port =3D VIRTIO_SERIAL_PORT(qdev); =20 - monitor_hmp_printf(MONITOR_HMP(mon), "%*sport %d, guest %s, host %s, t= hrottle %s\n", + monitor_hmp_printf(hmp, "%*sport %d, guest %s, host %s, throttle %s\n", indent, "", port->id, port->guest_connected ? "on" : "off", port->host_connected ? "on" : "off", diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 82130ba04698..31c4fdf79d48 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -24,7 +24,7 @@ #include "monitor/hmp.h" #include "system/address-spaces.h" =20 -static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); +static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent= ); static char *sysbus_get_fw_dev_path(DeviceState *dev); =20 typedef struct SysBusFind { @@ -249,10 +249,9 @@ bool sysbus_realize_and_unref(SysBusDevice *dev, Error= **errp) return qdev_realize_and_unref(DEVICE(dev), sysbus_get_default(), errp); } =20 -static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent) +static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { SysBusDevice *s =3D SYS_BUS_DEVICE(dev); - MonitorHMP *hmp =3D MONITOR_HMP(mon); hwaddr size; int i; =20 diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index ffa76f83016b..0bb89c5a60ab 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -47,7 +47,7 @@ } while (0) =20 =20 -static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent= ); +static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int ind= ent); static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge); =20 /* aux-bus implementation (internal not public) */ @@ -288,7 +288,7 @@ static const TypeInfo aux_to_i2c_type_info =3D { }; =20 /* aux-slave implementation */ -static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent) +static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int ind= ent) { AUXBus *bus =3D AUX_BUS(qdev_get_parent_bus(dev)); AUXSlave *s; @@ -300,8 +300,7 @@ static void aux_slave_dev_print(Monitor *mon, DeviceSta= te *dev, int indent) =20 s =3D AUX_SLAVE(dev); =20 - monitor_hmp_printf(MONITOR_HMP(mon), - "%*smemory " HWADDR_FMT_plx "/" HWADDR_FMT_plx "\n", + monitor_hmp_printf(hmp, "%*smemory " HWADDR_FMT_plx "/" HWADDR_FMT_plx= "\n", indent, "", object_property_get_uint(OBJECT(s->mmio), "addr", N= ULL), memory_region_size(s->mmio)); diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index 500f821246a9..bcccfaf07f4d 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -135,9 +135,8 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) qapi_free_PciInfoList(info_list); } =20 -void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) +void pcibus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); PCIDevice *d =3D (PCIDevice *)dev; int class =3D pci_get_word(d->config + PCI_CLASS_DEVICE); const pci_class_desc *desc =3D get_class_desc(class); diff --git a/hw/pci/pci-internal.h b/hw/pci/pci-internal.h index a7d6d8a7324e..b7231fab5dc9 100644 --- a/hw/pci/pci-internal.h +++ b/hw/pci/pci-internal.h @@ -16,7 +16,7 @@ extern PCIHostStateList pci_host_bridges; =20 const pci_class_desc *get_class_desc(int class); PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num); -void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent); +void pcibus_dev_print(MonitorHMP *mon, DeviceState *dev, int indent); =20 int pcie_aer_parse_error_string(const char *error_name, uint32_t *status, bool *correctable); diff --git a/hw/usb/bus.c b/hw/usb/bus.c index fe3dbfa2227c..8bd25a9d872a 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -13,7 +13,7 @@ #include "trace.h" #include "qemu/cutils.h" =20 -static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); +static void usb_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int inde= nt); =20 static char *usb_get_dev_path(DeviceState *dev); static char *usb_get_fw_dev_path(DeviceState *qdev); @@ -544,9 +544,8 @@ static const char *usb_speed(unsigned int speed) return txt[speed]; } =20 -static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) +static void usb_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int inde= nt) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); USBDevice *dev =3D USB_DEVICE(qdev); USBBus *bus =3D usb_bus_from_device(dev); =20 diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 4075b5b001ae..b81a067e7753 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -101,9 +101,8 @@ abort: qemu_xen_xs_transaction_end(xenbus->xsh, tid, true); } =20 -static void xen_bus_print_dev(Monitor *mon, DeviceState *dev, int indent) +static void xen_bus_print_dev(MonitorHMP *hmp, DeviceState *dev, int inden= t) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); XenDevice *xendev =3D XEN_DEVICE(dev); =20 monitor_hmp_printf(hmp, "%*sname =3D '%s' frontend_id =3D %u\n", diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index 37f7d3355193..1391dc060caf 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -10,6 +10,7 @@ #include "qom/object.h" #include "hw/core/hotplug.h" #include "hw/core/resettable.h" +#include "monitor/hmp.h" =20 /** * DOC: The QEMU Device API @@ -323,7 +324,7 @@ struct BusClass { ObjectClass parent_class; =20 /* FIXME first arg should be BusState */ - void (*print_dev)(Monitor *mon, DeviceState *dev, int indent); + void (*print_dev)(MonitorHMP *mon, DeviceState *dev, int indent); /* * Return a newly allocated string containing the path of the * device on this bus. diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 3860ada2a237..13ac9f8f3be1 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -790,18 +790,17 @@ static void qdev_print_props(MonitorHMP *hmp, DeviceS= tate *dev, DeviceClass *dc, } } =20 -static void bus_print_dev(BusState *bus, Monitor *mon, DeviceState *dev, i= nt indent) +static void bus_print_dev(BusState *bus, MonitorHMP *hmp, DeviceState *dev= , int indent) { BusClass *bc =3D BUS_GET_CLASS(bus); =20 if (bc->print_dev) { - bc->print_dev(mon, dev, indent); + bc->print_dev(hmp, dev, indent); } } =20 static void qdev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { - Monitor *mon =3D MONITOR(hmp); ObjectClass *class; NamedGPIOList *ngl; NamedClockList *ncl; @@ -828,7 +827,7 @@ static void qdev_print(MonitorHMP *hmp, DeviceState *de= v, int indent) qdev_print_props(hmp, dev, DEVICE_CLASS(class), indent); class =3D object_class_get_parent(class); } while (class !=3D object_class_by_name(TYPE_DEVICE)); - bus_print_dev(dev->parent_bus, mon, dev, indent); + bus_print_dev(dev->parent_bus, hmp, dev, indent); } =20 static void qbus_print(MonitorHMP *hmp, BusState *bus, int indent, bool de= tails) --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907944; cv=none; d=zohomail.com; s=zohoarc; b=Iczk2ivjk698Beqp24vKeGSqVPZRrqlt32T4JrIdyrKe5IgSUdNu3ULd7GDagYbJfM/xP+s6Vr9M+lpu6wHNm0VK09RC2UqgpIexMLquYxljLgleMSWMJ0CKhwyQgTxO7M0ER04f+bj+MRizQkfsoFuSmM406ZuHZolXIEWz4n4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907944; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GVgf88yxf4OiR3btXpgx8RuP28ErYGVixAx6FRNWd/w=; b=Bz0SVKgCfJM9HVclUiQN4Y7ecqrBtkE5gu30A5hfrSvPYrXTMj9rzk2HUqzigwcD2jGX0qaGk5t2bZdF9UJTN7OQRn40JZ/JO6qD8jj4QEO9s1sIr6U5qYMlfKarXMsaOcMrsfNpEYk7XrQEXIbrhJcHxi23vS/3Mni+jVl+Hsk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907944427752.6173243879159; Sun, 16 Aug 2026 12:19:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKo-00009N-Jk; Sun, 16 Aug 2026 15:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKb-0007yh-MR for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKZ-0008My-TH for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:41 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-253-DDIgMlasNvaONFEdV4qiFw-1; Sun, 16 Aug 2026 15:15:32 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 699F31956096; Sun, 16 Aug 2026 19:15:31 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8F9A8195DF93; Sun, 16 Aug 2026 19:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907738; 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=GVgf88yxf4OiR3btXpgx8RuP28ErYGVixAx6FRNWd/w=; b=gZvvmwZEhBfth2fuPS8AQDtldRp/2/eho+eBn5fxdTn+JYIw0Dvqpw7A+wdkpTToQQnbxi RKTlHXS4w4/q8MMhJ1x+0j1bQtwgr6Da3hmy0ThGjJCCiznk6QwJPs9F4K/i3BtnGtDXPF jgY3XLY78YQmK2dJbpIol9H3zBmJ9uE= X-MC-Unique: DDIgMlasNvaONFEdV4qiFw-1 X-Mimecast-MFC-AGG-ID: DDIgMlasNvaONFEdV4qiFw_1786907731 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:07 +0400 Subject: [PATCH v3 40/49] qapi: make HMP-specific schema entries conditional on CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-40-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=2918; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=p2oNQmnbGN2ePnZJfFBD36d0h/cN/EbTAaiQ9LpY6Uk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0ZZivjQl3TY9MKieBpx7DXsZvWbrTFB6Yk yXDX8fwCkiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5ZsbD/9SsTIB0RL5KKiabvswCfCYJLv0DrhMLlGyvfnRf2U3mR7GP06Tznn9fIhSVFsgvCcBITI YbzxMsVrBmlDJa1zYDDJXfZVC4/TOYqEEJS05t2yEj0u6DPahYw/lUjS5B8+fF1XXFtcJMvS/DE cl601ImAlBEjHZjqxg1ElMzpowPq2NcW8ixglRKzQWrKnYzA2vaaGNPJCuLYucxPcyoj0yARYUk jCgcWb/KNNmByJ5yeA4jRNI5wX1TiwIy7cJs5oOW5EvcWZQ26ZzPANttvNdkavUU48kCwe0KcFl CeJPJ2Ovp2T/oXk7M0Sb2QBKaXSCKT31+J/aTObpzghAt4cthAEXpRJHUpzArALGmZpyQwV33Xx zovF+8FISwaHq2SDZKMDmKd8Hbfw/Ey4mc0YIsi+qpL7CPGztamODafugwsdbc188Or1bzG2XT5 SsBuH4LC0AXdz8xfpNpKk52xNlOVtJMVk1k9c5Pah22WxgaLL/8oPP4f9ucdjqnvfubcoqpN2vv rwNbkskbP1Qd2t2eEOU1xiApwHA4nzyt0BSCRHevYYoT8RujMKg8/KWMKM032qrmaexr0FbXuWJ D6eOCYVRONrzTpduDM+4o1pHgb4j+HmY5GNoY3cBZ3hjO9wevIBDccrIDUEUzp81U6J/Ih/wPa1 XS/cI+EVY2DZ30Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907945142158500 Make the 'readline' value of MonitorMode and the 'human-monitor-command' command conditional on CONFIG_HMP, so they are only available when HMP support is compiled in. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Dr. David Alan Gilbert --- monitor/monitor.c | 8 +++++++- monitor/qmp-cmds.c | 2 ++ qapi/control.json | 4 +++- qapi/misc.json | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/monitor/monitor.c b/monitor/monitor.c index da76e6e4ac19..da0c8eda86b0 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -740,13 +740,18 @@ int monitor_new(MonitorOptions *opts, bool allow_hmp,= Error **errp) ERRP_GUARD(); =20 if (!opts->has_mode) { - opts->mode =3D allow_hmp ? MONITOR_MODE_READLINE : MONITOR_MODE_CO= NTROL; + opts->mode =3D +#ifdef CONFIG_HMP + allow_hmp ? MONITOR_MODE_READLINE : +#endif + MONITOR_MODE_CONTROL; } =20 switch (opts->mode) { case MONITOR_MODE_CONTROL: monitor_new_qmp(opts->id, opts->chardev, opts->pretty, errp); break; +#ifdef CONFIG_HMP case MONITOR_MODE_READLINE: if (!allow_hmp) { error_setg(errp, "Only QMP is supported"); @@ -758,6 +763,7 @@ int monitor_new(MonitorOptions *opts, bool allow_hmp, E= rror **errp) } monitor_new_hmp(opts->id, opts->chardev, true, errp); break; +#endif /* CONFIG_HMP */ default: g_assert_not_reached(); } diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index b16119f4858c..c9f24febdc96 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -162,6 +162,7 @@ void qmp_add_client(const char *protocol, const char *f= dname, } } =20 +#ifdef CONFIG_HMP char *qmp_human_monitor_command(const char *command_line, bool has_cpu_ind= ex, int64_t cpu_index, Error **errp) { @@ -187,6 +188,7 @@ out: object_unref(hmp); return output; } +#endif /* CONFIG_HMP */ =20 static void __attribute__((__constructor__)) monitor_init_qmp_commands(voi= d) { diff --git a/qapi/control.json b/qapi/control.json index 9a5302193d67..9898552814b1 100644 --- a/qapi/control.json +++ b/qapi/control.json @@ -186,7 +186,9 @@ # # Since: 5.0 ## -{ 'enum': 'MonitorMode', 'data': [ 'readline', 'control' ] } +{ 'enum': 'MonitorMode', 'data': [ + { 'name': 'readline', 'if': 'CONFIG_HMP' }, + 'control' ] } =20 ## # @MonitorOptions: diff --git a/qapi/misc.json b/qapi/misc.json index 22b7afed9f65..a21ba61b96e0 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -247,7 +247,8 @@ { 'command': 'human-monitor-command', 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str', - 'features': [ 'savevm-monitor-nodes' ] } + 'features': [ 'savevm-monitor-nodes' ], + 'if': 'CONFIG_HMP' } =20 ## # @getfd: --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907998; cv=none; d=zohomail.com; s=zohoarc; b=fIS2vpXWiNC9vmc5kVHVaK0ZJ+04U8/74ESMgb+lO3eyADPyKxXW1IddKYBdX0KfPqkXKKiGiivjWPtzjakyrNI2RtGZ71wZtVn4OqoCl2UOG69+OqhU4HYYUxd7SCDNC72Qhc+Cn9IG5FPNYwt/RUdd77VXoo8S1SZ3AHDjqgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907998; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p62GCegeiAbN8avbY+rYDFyGzkNBZgUvUaLFnpCm4zk=; b=hq9OBrrNFDtn+aUcoulDG9zMPEvli/BIKKRd0da/QqUGnfMeh8DyuTvxsYWcGyaDgK+H/ReFhnWWHDVTDmRRUpsG0Fzue+gjfKQwmqQ6KTNw/L6zDTfsg9tRMTVTQ/bTYsgBFY42sUZTC7sjPjr1n7g8jyKlL03dtcMqeA5ok14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907998316856.9585754689914; Sun, 16 Aug 2026 12:19:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKm-0008NL-F5; Sun, 16 Aug 2026 15:15:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKi-00086J-M4 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKf-0008Pd-1b for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:48 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-572-RoaN7fViPqi2ip21ij3Dxg-1; Sun, 16 Aug 2026 15:15:40 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B75DD19560A6; Sun, 16 Aug 2026 19:15:35 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4A28818005BB; Sun, 16 Aug 2026 19:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907744; 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=p62GCegeiAbN8avbY+rYDFyGzkNBZgUvUaLFnpCm4zk=; b=RS6xT9hZTUel3dveQuUqCLG8blv9Adsglv/ORHobtnB3w7bgm42g5V/3pl98EpLgPMpoCI 7jQidC6JM+k8xTB9U/PfoSvjhtTmUKkZUM/YVFagJbVC+Qx/KeSx65utYF9csX8O6Fwh5d 0WyZBUsv2RjInail4Zm/BRPLF8gySRk= X-MC-Unique: RoaN7fViPqi2ip21ij3Dxg-1 X-Mimecast-MFC-AGG-ID: RoaN7fViPqi2ip21ij3Dxg_1786907736 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:08 +0400 Subject: [PATCH v3 41/49] Guard HMP command implementations with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-41-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Richard Henderson , Paolo Bonzini , David Woodhouse , Paul Durrant , "Michael S. Tsirkin" , Marcelo Tosatti , Mark Cave-Ayland , Halil Pasic , Christian Borntraeger , Jason Herne , Eric Farman , Matthew Rosato , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Gerd Hoffmann , Hyman Huang , Peter Xu , Fabiano Rosas , "Dr. David Alan Gilbert" , Samuel Thibault , Jason Wang , =?utf-8?q?Alex_Benn=C3=A9e?= , Zhao Liu , Laurent Vivier , Nicholas Piggin , Chinmay Rath , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Artyom Tarasenko , Max Filippov , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=20643; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Ib6IfJ0HEinibhIBSyX2zg3ClEePEgT13ZARpoCDBaQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0jdPYRUG1PHQ7Aba9yeCjPknjKg2WvKulU hxRfFOJEhyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5RZwD/9LL5Sl4mdrZrNjtVdu/w2gAa9YGZ4NV7H98Rv78ROfgaZGNhOblRkLPbXJbOaX81y0W6K /G0cdPkozuTPYOFnhektogGlXlruev94HiFu0uwyeBFmP+VpREwWxwdW/cwBGG+LuRRW7Qq855F 4mXUNSLPA9NKr6BDli+Pj/zAHbhdVp38E6zel1x339SuByhfIe17MQTWL6UN/pPIZvO8flCzFcA NNHQlB5YTgcpgpEBIkFa4yI0+WUWer3eKLbTh40YZVTILIsYi6u2JB9KIbhXBBALdCmpkUvED+j NydM+3+wxV23rW0YH/rf7vUkxZdVwuNL4o0i3qWQEohFFSwiHvCFU5pgUPfgZ+lVGFWIKhYNBvy gWjrjGy/b6g3mweMuLi1aDsV/LGo6nlvbTuUnNXqudeA2620Eb3z+NIJ42FCUMvvNIpRvppwM1I B/xGJPRgZi2emhFJ4pRWtD6BW/gKAsnu1ZLG+5RTVhYPVKTwICw7NyE0I/9+fdvuzsbUooAbor+ t106GT+4KB3Go2gfyxJ5TQWu6LKXPvib0f+fOx5kLqr+hgIcVI9aInnTdRBhTYClB+/RZlBNiRw HOCnRQ4qUJ31qIPHoJVC8V6NsdTJ+aOaXgbAgeI84FEWw5atYIESPEcXCy9vBJOVtDux63cwuNz qwIldCUOayI7F9g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907999182158500 Add #ifdef CONFIG_HMP around all hmp_* function implementations and their HMP-only helpers across subsystems. This covers monitor_register_hmp* callers, hmp_info_* handlers, and HMP-only helper functions like slirp_lookup. To link succesfully, use empty cmds tables in hmp-cmds.c (to be removed once meson build-sys is updated with !hmp support later in the series) Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Jason J. Herne --- accel/accel-system.c | 2 ++ accel/tcg/monitor.c | 2 ++ hw/i386/kvm/xen-stubs.c | 2 ++ hw/i386/kvm/xen_evtchn.c | 3 +++ hw/i386/sgx.c | 2 ++ hw/misc/mos6522-stub.c | 2 ++ hw/misc/mos6522.c | 2 ++ hw/pci/pci-stub.c | 2 ++ hw/s390x/s390-skeys.c | 2 ++ hw/s390x/s390-stattrib.c | 4 ++++ hw/uefi/ovmf-log.c | 2 ++ hw/usb/host-libusb.c | 6 ++++++ migration/dirtyrate.c | 2 ++ monitor/hmp-cmds.c | 5 +++++ net/slirp.c | 7 ++++++- replay/replay-debugging.c | 8 ++++++++ replay/stubs-system.c | 6 ++++++ system/qdev-monitor.c | 4 ++++ target/i386/cpu-apic.c | 2 ++ target/i386/monitor.c | 3 +++ target/i386/sev.c | 2 ++ target/m68k/monitor.c | 2 ++ target/ppc/monitor.c | 2 ++ target/riscv/monitor.c | 3 +++ target/sh4/monitor.c | 2 ++ target/sparc/monitor.c | 2 ++ target/xtensa/monitor.c | 2 ++ 27 files changed, 82 insertions(+), 1 deletion(-) diff --git a/accel/accel-system.c b/accel/accel-system.c index 977804c4048a..1325b23864c8 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -109,7 +109,9 @@ void accel_init_ops_interfaces(AccelClass *ac) =20 static void accel_ops_class_init(ObjectClass *oc, const void *data) { +#ifdef CONFIG_HMP monitor_register_hmp_info_hrt("accel", qmp_x_accel_stats); +#endif } =20 static const TypeInfo accel_ops_type_info =3D { diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c index 74170ddef708..5570d60753d6 100644 --- a/accel/tcg/monitor.c +++ b/accel/tcg/monitor.c @@ -30,9 +30,11 @@ HumanReadableText *qmp_x_query_jit(Error **errp) return human_readable_text_from_str(buf); } =20 +#ifdef CONFIG_HMP static void hmp_tcg_register(void) { monitor_register_hmp_info_hrt("jit", qmp_x_query_jit); } =20 type_init(hmp_tcg_register); +#endif diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c index 5ed71583281a..a68c739a9496 100644 --- a/hw/i386/kvm/xen-stubs.c +++ b/hw/i386/kvm/xen-stubs.c @@ -40,6 +40,7 @@ void xen_primary_console_set_be_port(uint16_t port) { } =20 +#ifdef CONFIG_HMP void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { monitor_hmp_printf(hmp, "XEN emulation is not available in this QEMU\n= "); @@ -49,3 +50,4 @@ void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *q= dict) { monitor_hmp_printf(hmp, "XEN emulation is not available in this QEMU\n= "); } +#endif diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index b2135020f27f..9379383e5325 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -2344,6 +2344,7 @@ void qmp_xen_event_inject(uint32_t port, Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { EvtchnInfoList *iter, *info_list; @@ -2391,3 +2392,5 @@ void hmp_xen_event_inject(MonitorHMP *hmp, const QDic= t *qdict) monitor_hmp_printf(hmp, "Delivered port %d\n", port); } } + +#endif diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 634e33e819ce..11bcc7ad9a5a 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -234,6 +234,7 @@ SgxInfo *qmp_query_sgx(Error **errp) return info; } =20 +#ifdef CONFIG_HMP void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; @@ -265,6 +266,7 @@ void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) monitor_hmp_printf(hmp, "total size=3D%" PRIu64 "\n", size); } +#endif =20 bool check_sgx_support(void) { diff --git a/hw/misc/mos6522-stub.c b/hw/misc/mos6522-stub.c index 154cd32ed88b..d1c141450e67 100644 --- a/hw/misc/mos6522-stub.c +++ b/hw/misc/mos6522-stub.c @@ -10,7 +10,9 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) { monitor_hmp_printf(hmp, "MOS6522 VIA is not available in this QEMU\n"); } +#endif diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 1c20c7582c34..3135761a0f7b 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -497,6 +497,7 @@ void mos6522_write(void *opaque, hwaddr addr, uint64_t = val, unsigned size) } } =20 +#ifdef CONFIG_HMP static int qmp_x_query_via_foreach(Object *obj, void *opaque) { GString *buf =3D opaque; @@ -597,6 +598,7 @@ void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) } monitor_puts(mon, info->human_readable_text); } +#endif /* CONFIG_HMP */ =20 static const MemoryRegionOps mos6522_ops =3D { .read =3D mos6522_read, diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index 7e2797300ba0..5fc3322627e3 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -34,6 +34,7 @@ PciInfoList *qmp_query_pci(Error **errp) return NULL; } =20 +#ifdef CONFIG_HMP void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) { } @@ -42,6 +43,7 @@ void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDi= ct *qdict) { monitor_hmp_printf(hmp, "PCI devices not supported\n"); } +#endif =20 /* kvm-all wants this */ MSIMessage pci_get_msi_message(PCIDevice *dev, int vector) diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index b5e56a16cce1..c615c9dbc8a1 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -104,6 +104,7 @@ static void write_keys(FILE *f, uint8_t *keys, uint64_t= startgfn, } } =20 +#ifdef CONFIG_HMP void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict) { S390SKeysState *ss =3D s390_get_skeys_device(); @@ -144,6 +145,7 @@ void hmp_dump_skeys(MonitorHMP *hmp, const QDict *qdict) error_report_err(err); } } +#endif =20 void s390_qmp_dump_skeys(const char *filename, Error **errp) { diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index 644298f7f0b2..e47a8ea36597 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -32,6 +32,7 @@ #define STATTR_FLAG_ERROR 0x04ULL #define STATTR_FLAG_DONE 0x08ULL =20 +#ifdef CONFIG_HMP static S390StAttribState *s390_get_stattrib_device(void) { S390StAttribState *sas; @@ -40,6 +41,7 @@ static S390StAttribState *s390_get_stattrib_device(void) assert(sas); return sas; } +#endif =20 void s390_stattrib_init(void) { @@ -59,6 +61,7 @@ void s390_stattrib_init(void) =20 /* Console commands: */ =20 +#ifdef CONFIG_HMP void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict) { S390StAttribState *sas =3D s390_get_stattrib_device(); @@ -110,6 +113,7 @@ void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict) out: g_free(vals); } +#endif =20 /* Migration support: */ =20 diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 0249eea2cfe9..c4e6a5064106 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -256,6 +256,7 @@ FirmwareLog *qmp_query_firmware_log(bool have_max_size,= uint64_t max_size, return ret; } =20 +#ifdef CONFIG_HMP void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict) { g_autofree gchar *log_esc =3D NULL; @@ -284,3 +285,4 @@ void hmp_info_firmware_log(MonitorHMP *hmp, const QDict= *qdict) log_esc =3D g_strescape((gchar *)log_out, "\r\n"); monitor_hmp_printf(hmp, "%s\n", log_esc); } +#endif diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 9b9f26a1078e..564fe9a54795 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -184,6 +184,7 @@ static void usb_host_attach_kernel(USBHostDevice *s); # define HAVE_SUPER_PLUS 1 #endif =20 +#ifdef CONFIG_HMP static const char *speed_name[] =3D { [LIBUSB_SPEED_UNKNOWN] =3D "?", [LIBUSB_SPEED_LOW] =3D "1.5", @@ -194,6 +195,7 @@ static const char *speed_name[] =3D { [LIBUSB_SPEED_SUPER_PLUS] =3D "5000+", #endif }; +#endif =20 static const unsigned int speed_map[] =3D { [LIBUSB_SPEED_LOW] =3D USB_SPEED_LOW, @@ -1815,7 +1817,9 @@ module_kconfig(USB); static void usb_host_register_types(void) { type_register_static(&usb_host_dev_info); +#ifdef CONFIG_HMP monitor_register_hmp("usbhost", true, hmp_info_usbhost); +#endif } =20 type_init(usb_host_register_types) @@ -1920,6 +1924,7 @@ static void usb_host_auto_check(void *unused) timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 200= 0); } =20 +#ifdef CONFIG_HMP void hmp_info_usbhost(MonitorHMP *hmp, const QDict *qdict) { libusb_device **devs =3D NULL; @@ -1963,3 +1968,4 @@ void hmp_info_usbhost(MonitorHMP *hmp, const QDict *q= dict) } libusb_free_device_list(devs, 1); } +#endif diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index bdbb2aaa99db..776611fef79c 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -856,6 +856,7 @@ struct DirtyRateInfo *qmp_query_dirty_rate(bool has_cal= c_time_unit, has_calc_time_unit ? calc_time_unit : TIME_UNIT_SECOND); } =20 +#ifdef CONFIG_HMP void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { DirtyRateInfo *info =3D query_dirty_rate_info(TIME_UNIT_SECOND); @@ -932,3 +933,4 @@ void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *= qdict) " seconds\n", sec); monitor_hmp_printf(hmp, "[Please use 'info dirty_rate' to check result= s]\n"); } +#endif diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 1834e3c1f697..3ac70c3f1123 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -42,6 +42,7 @@ #include "disas/disas.h" =20 /* Please update hmp-commands.hx when adding or changing commands */ +#ifdef CONFIG_HMP static HMPCommand hmp_info_cmds[] =3D { #include "hmp-commands-info.h" { NULL, NULL, }, @@ -52,6 +53,10 @@ static HMPCommand hmp_cmds[] =3D { #include "hmp-commands.h" { NULL, NULL, }, }; +#else +static HMPCommand hmp_info_cmds[] =3D { { NULL, NULL, }, }; +static HMPCommand hmp_cmds[] =3D { { NULL, NULL, }, }; +#endif =20 HMPCommand *hmp_cmds_for_target(bool info_command) { diff --git a/net/slirp.c b/net/slirp.c index 6fbefa9ed1d7..451c0fd1ba4a 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -711,6 +711,7 @@ error: return -1; } =20 +#ifdef CONFIG_HMP static SlirpState *slirp_lookup(MonitorHMP *hmp, const char *id) { if (id) { @@ -801,6 +802,7 @@ void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict *q= dict) fail_syntax: monitor_hmp_printf(hmp, "invalid format\n"); } +#endif =20 static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **err= p) { @@ -957,6 +959,7 @@ static int slirp_hostfwd(SlirpState *s, const char *red= ir_str, Error **errp) return -1; } =20 +#ifdef CONFIG_HMP void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdict) { const char *redir_str; @@ -977,8 +980,8 @@ void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdic= t) error_report_err(err); } } - } +#endif =20 #if defined(CONFIG_SMBD_COMMAND) =20 @@ -1224,6 +1227,7 @@ UsernetInfoList *qmp_x_query_usernet(Error **errp) return head; } =20 +#ifdef CONFIG_HMP void hmp_info_usernet(MonitorHMP *hmp, const QDict *qdict) { g_autoptr(UsernetInfoList) list =3D NULL; @@ -1237,6 +1241,7 @@ void hmp_info_usernet(MonitorHMP *hmp, const QDict *q= dict) ui->hub_name, ui->info); } } +#endif =20 static void net_init_slirp_configs_host(const NetdevUserHostForwardList *fwd) diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index 965565715ef2..4b741ea1027b 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -31,6 +31,7 @@ bool replay_running_debug(void) return replay_is_debugging; } =20 +#ifdef CONFIG_HMP void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { if (replay_mode =3D=3D REPLAY_MODE_NONE) { @@ -42,6 +43,7 @@ void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) replay_get_filename(), replay_get_current_icount()); } } +#endif =20 ReplayInfo *qmp_query_replay(Error **errp) { @@ -103,6 +105,7 @@ void qmp_replay_break(int64_t icount, Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); @@ -114,6 +117,7 @@ void hmp_replay_break(MonitorHMP *hmp, const QDict *qdi= ct) return; } } +#endif =20 void qmp_replay_delete_break(Error **errp) { @@ -124,6 +128,7 @@ void qmp_replay_delete_break(Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; @@ -134,6 +139,7 @@ void hmp_replay_delete_break(MonitorHMP *hmp, const QDi= ct *qdict) return; } } +#endif =20 static char *replay_find_nearest_snapshot(int64_t icount, int64_t *snapshot_icount) @@ -209,6 +215,7 @@ void qmp_replay_seek(int64_t icount, Error **errp) replay_seek(icount, replay_stop_vm, errp); } =20 +#ifdef CONFIG_HMP void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); @@ -220,6 +227,7 @@ void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdic= t) return; } } +#endif =20 static void replay_stop_vm_debug(void *opaque) { diff --git a/replay/stubs-system.c b/replay/stubs-system.c index 15e7411591ab..70eaf1834032 100644 --- a/replay/stubs-system.c +++ b/replay/stubs-system.c @@ -63,22 +63,28 @@ void replay_vmstate_init(void) #include "qapi/error.h" #include "qemu/error-report.h" =20 +#ifdef CONFIG_HMP void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } + void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } + void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } + void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } +#endif + ReplayInfo *qmp_query_replay(Error **errp) { error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 13ac9f8f3be1..5c87fda50939 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -763,6 +763,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **er= rp) return ret; } =20 +#ifdef CONFIG_HMP #define qdev_printf(fmt, ...) \ monitor_hmp_printf(hmp, "%*s" fmt, indent, "", ## __VA_ARGS__) =20 @@ -865,6 +866,7 @@ void hmp_info_qdm(MonitorHMP *hmp, const QDict *qdict) { qdev_print_devinfos(true); } +#endif /* CONFIG_HMP */ =20 void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) { @@ -1002,6 +1004,7 @@ void qmp_device_sync_config(const char *id, Error **e= rrp) qdev_sync_config(dev, errp); } =20 +#ifdef CONFIG_HMP void hmp_device_add(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; @@ -1044,6 +1047,7 @@ void hmp_device_del(MonitorHMP *hmp, const QDict *qdi= ct) qmp_device_del(id, &err); hmp_handle_error(hmp, err); } +#endif =20 void device_add_completion(ReadLineState *rs, int nb_args, const char *str) { diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 5d69ece15034..b6ddb5e268de 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -80,6 +80,7 @@ void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qdict) { CPUState *cs; @@ -102,3 +103,4 @@ void hmp_info_local_apic(MonitorHMP *hmp, const QDict *= qdict) } x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU); } +#endif diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 46762540ba65..ce61132e0f53 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -31,6 +31,8 @@ #include "qapi/qapi-commands-misc.h" #include "system/memory.h" =20 +#ifdef CONFIG_HMP + /* Perform linear address sign extension */ static hwaddr addr_canonical(CPUArchState *env, hwaddr addr) { @@ -595,3 +597,4 @@ void hmp_mce(MonitorHMP *hmp, const QDict *qdict) } hmp_handle_error(hmp, err); } +#endif diff --git a/target/i386/sev.c b/target/i386/sev.c index 36a62e58be95..3c6a19b79784 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -754,6 +754,7 @@ SevInfo *qmp_query_sev(Error **errp) return info; } =20 +#ifdef CONFIG_HMP void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) { SevInfo *info =3D sev_get_info(); @@ -787,6 +788,7 @@ void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) out: qapi_free_SevInfo(info); } +#endif =20 static int sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chai= n, diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 23c25283b27a..e8b1b25a43c4 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -10,6 +10,7 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 +#ifdef CONFIG_HMP void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); @@ -21,3 +22,4 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) =20 dump_mmu(env1); } +#endif diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 6e8a075f5a41..5a21c01593b9 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -11,6 +11,7 @@ #include "monitor/hmp.h" #include "cpu.h" =20 +#ifdef CONFIG_HMP void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); @@ -21,3 +22,4 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) } dump_mmu(env1); } +#endif diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 59cc04b3d0fb..7e61ae2a4717 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -39,6 +39,8 @@ #define PTE_HEADER_DELIMITER "-------- ---------------- -------- ------= -\n" #endif =20 +#ifdef CONFIG_HMP + /* Perform linear address sign extension */ static target_ulong addr_canonical(int va_bits, target_ulong addr) { @@ -244,6 +246,7 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) =20 mem_info_svxx(hmp, env); } +#endif /* CONFIG_HMP */ =20 #ifdef CONFIG_TCG static bool reg_is_ulong_integer(CPURISCVState *env, const char *name, diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 62998a9a57cb..14261c059706 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -26,6 +26,7 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP static void print_tlb(MonitorHMP *hmp, int idx, tlb_t *tlb) { monitor_hmp_printf(hmp, " tlb%i:\t" @@ -55,3 +56,4 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) for (i =3D 0 ; i < UTLB_SIZE ; i++) print_tlb(hmp, i, &env->utlb[i]); } +#endif diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 36f109cbb568..ed1e76fe73f8 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -27,6 +27,7 @@ #include "monitor/hmp.h" =20 =20 +#ifdef CONFIG_HMP void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); @@ -37,3 +38,4 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) } dump_mmu(env1); } +#endif diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index b9c4089b0fb1..e0fcac8565dc 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -26,6 +26,7 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) { CPUArchState *env1 =3D monitor_hmp_get_cpu_env(hmp); @@ -36,3 +37,4 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict) } dump_mmu(env1); } +#endif --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907857; cv=none; d=zohomail.com; s=zohoarc; b=KTiS0lh3qEzyqiUVLjwThQ1uZlVpzUtfRc7lvF8oD7qG2LX9Ynu7fWOiRPQQugAfdma9tgTPFRK6fzy03fGcn8eJOCbbX8hHONa67JCxTjB8yAsIVJTgj+PhmnlziasE84/a4vFzLPyhlRTsL31bRoV1gvPGGzTvsdprg5OC6Es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907857; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8HaEyNXB0qSnMx4k2VRgXbY/jwtfrkq9X/04xldHvec=; b=iZlw3z2lge4oBSndplAkJP8MZbLb3TBPjmbF2YYo4SKKtYH1ND5796UVM2P3f+Ayzfmdbxa94j8mXLcgrUzSWOEAoDNGSSstk0q2jrDbRL3CgzGiYGD8ymi/Y5++P+v3SUzosztGPfJtThIWOKjscS+dadtptsF/pRBkTlUbnXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907857559586.7831931548076; Sun, 16 Aug 2026 12:17:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKo-00005u-63; Sun, 16 Aug 2026 15:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKe-000823-I6 for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKc-0008Oj-SV for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:44 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-o5utE6VEPpOi7PpIEYOjNw-1; Sun, 16 Aug 2026 15:15:40 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6ED191800344; Sun, 16 Aug 2026 19:15:39 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 559BF1956041; Sun, 16 Aug 2026 19:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907742; 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=8HaEyNXB0qSnMx4k2VRgXbY/jwtfrkq9X/04xldHvec=; b=XeNeXjFXhvAvFX1Tci0lPK+rfTonIn4smVNnr/2N9TJRLbVZsgHCfwCpS8Uyxq5F9GgZdX IL2UaBzQWukbEfelegexGHdr4gj2Q4PlIo66mxIXG7PsJjPPJmrZUPY8Qx8isRVFbk9Lfx it4TSqsrqZpbgnhhHAM6H1ci8U3Xckw= X-MC-Unique: o5utE6VEPpOi7PpIEYOjNw-1 X-Mimecast-MFC-AGG-ID: o5utE6VEPpOi7PpIEYOjNw_1786907739 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:09 +0400 Subject: [PATCH v3 42/49] target: guard MonitorDef tables with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-42-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini , Zhao Liu , Laurent Vivier , Mark Cave-Ayland , Artyom Tarasenko X-Developer-Signature: v=1; a=openpgp-sha256; l=4543; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=a2CAPWNLyN2I8KF8hmrre4KD8lqPdChd4IBTVlywrdo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0lz+qE4RQ6LlYvCJpu7FSiEcSsBDBzVZyt PEWwfpKrgmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5flWD/4pvBDgRxQJnQbgYx3MNM8wpEFOW4V6kkUD+CP+3lOMgrW1ZI81yoVSZBzt/AIarRjar/H MQQLH0VBM5o0DDdOVpckBuCmvRJdy7wlCi99HC3G4SFIt4RLoFxvgB9OWINkAIHhmMhehB+vblw 0gMopFXFsaw7WG+UsLwhRlUmS5KMhtLF/hFb8Cqs+LC+flAfjc+QQIbbVmG/fgHiKA7zaBEN8MX +SlXXhPijnOsGN034aIKwQw/qRPY2bG2X6iA9av/NO+780RzCPbEKzO2FxSz6+MCTB3s9amA+Up f4iAQRP/GOc/XDb/yO4AJ1X6/lND7oVf2itolBZ9CYnBVt5QodI22pjxuJzTbQ+GluCOToffrW4 zm2JwLFwNhahuI58Kd4P0Lvm9L7eT624fcQuOU5vgkqJqQ3xveQcI3h903M9bw7Y9oLd5wRu7SJ 6JPu4ObEhmraWb4pvot6euyhoFTRQFvLPmyplFuGZQ97e9UgvHOVx+TnU/8Dl/4p9wGYuuLdIzu 5xIZNbQv9+wcIyGowQ8/ZJzxvTWwB3ViKDw0pzgxmDiEMWw1/MMdRSehIjhp7jl1pKipenlk3iS qZgtErr7GQ95hjNdz5bwn1tO5VraF/7MfPRinG5FyTHoVYgSUdeNFJ++ZjardPkuYctn3KzBgYz VWefAzQr2ykBfKw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907858702158500 Guard SysemuCPUOps::monitor_defs field and the per-target MonitorDef arrays with CONFIG_HMP. These tables are only used by HMP 'print' and 'info registers' commands. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/sysemu-cpu-ops.h | 2 ++ monitor/hmp.c | 4 +++- target/i386/cpu.c | 4 ++++ target/m68k/cpu.c | 4 ++++ target/sparc/cpu.c | 5 +++-- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 9a45596169a3..e56eea18b785 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -109,11 +109,13 @@ typedef struct SysemuCPUOps { */ int (*monitor_get_register)(CPUState *cs, const char *name, int64_t *p= val); =20 +#ifdef CONFIG_HMP /** * @monitor_defs: Array of MonitorDef entries. This field is legacy, * use @gdb_core_xml_file to dump registers instead. */ const MonitorDef *monitor_defs; +#endif =20 /** * @legacy_vmsd: Legacy state for migration. diff --git a/monitor/hmp.c b/monitor/hmp.c index e5f8b9c576e0..3c70adcd35bb 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1725,13 +1725,15 @@ void monitor_register_hmp_info_hrt(const char *name, static int get_monitor_def(MonitorHMP *hmp, int64_t *pval, const char *nam= e) { CPUState *cs =3D monitor_hmp_get_cpu(hmp); - const MonitorDef *md; + const MonitorDef *md =3D NULL; void *ptr; =20 if (cs =3D=3D NULL) { return -1; } +#ifdef CONFIG_HMP md =3D cs->cc->sysemu_ops->monitor_defs; +#endif if (md =3D=3D NULL) { return -1; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index f0687b5c482d..84e805ee85e2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10853,6 +10853,7 @@ static const Property x86_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY =20 +#ifdef CONFIG_HMP static int64_t monitor_get_pc(MonitorHMP *hmp, const struct MonitorDef *md, int offset) { @@ -10878,6 +10879,7 @@ static const MonitorDef x86_monitor_defs[] =3D { { NULL }, #undef SEG }; +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 @@ -10892,7 +10894,9 @@ static const struct SysemuCPUOps i386_sysemu_ops = =3D { .write_elf64_note =3D x86_cpu_write_elf64_note, .write_elf32_qemunote =3D x86_cpu_write_elf32_qemunote, .write_elf64_qemunote =3D x86_cpu_write_elf64_qemunote, +#ifdef CONFIG_HMP .monitor_defs =3D x86_monitor_defs, +#endif .legacy_vmsd =3D &vmstate_x86_cpu, }; #endif diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index ce2707dee5aa..aafcca3489b3 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -603,6 +603,7 @@ static const VMStateDescription vmstate_m68k_cpu =3D { }, }; =20 +#ifdef CONFIG_HMP static const MonitorDef m68k_monitor_defs[] =3D { { "ssp", offsetof(CPUM68KState, sp[0]) }, { "usp", offsetof(CPUM68KState, sp[1]) }, @@ -618,13 +619,16 @@ static const MonitorDef m68k_monitor_defs[] =3D { { "mmusr", offsetof(CPUM68KState, mmu.mmusr) }, { NULL }, }; +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps m68k_sysemu_ops =3D { .has_work =3D m68k_cpu_has_work, .get_phys_addr_debug =3D m68k_cpu_get_phys_addr_debug, +#ifdef CONFIG_HMP .monitor_defs =3D m68k_monitor_defs, +#endif }; #endif /* !CONFIG_USER_ONLY */ =20 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 1bc14b586bb9..ae9bdca9df82 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -997,7 +997,7 @@ static const Property sparc_cpu_properties[] =3D { =20 #ifdef TARGET_SPARC64 #include "monitor/hmp.h" - +#ifdef CONFIG_HMP static const MonitorDef sparc64_monitor_defs[] =3D { { "asi", offsetof(CPUSPARCState, asi) }, { "pstate", offsetof(CPUSPARCState, pstate) }, @@ -1009,6 +1009,7 @@ static const MonitorDef sparc64_monitor_defs[] =3D { { NULL }, }; #endif +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 @@ -1016,7 +1017,7 @@ static const struct SysemuCPUOps sparc_sysemu_ops =3D= { .has_work =3D sparc_cpu_has_work, .get_phys_addr_debug =3D sparc_cpu_get_phys_addr_debug, .legacy_vmsd =3D &vmstate_sparc_cpu, -#if defined(TARGET_SPARC64) +#if defined(TARGET_SPARC64) && defined(CONFIG_HMP) .monitor_defs =3D sparc64_monitor_defs, #endif }; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907983; cv=none; d=zohomail.com; s=zohoarc; b=kXw+a/KvmYlwZ+MJmJTiinjfsu6qu+ckHAJBUv4/kOK56pbHtIF3FXtJ+Z/tlBd5yHTlgJ8HXnuN1vZhlPxblS1KcT80vpn34SrRXcdK1KwTOpWuHD+cZTs6adT1DuN7fuZ2ZhTy2DCSZqTdWfm1X7VCsfjprieCzZpn1teOS28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907983; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S+aPoqqisu2J1a6Pr1LukLQArfAFqh3ZKUjQId9ja9Q=; b=Sfz+7p6u0OPzB4is8dLKH7QzyTm9y3S7k/uuetPlSAgbKIuK8HxR+7GdIsUTyz4hrxrcUOfeQW5Y8KFwmWtAtPx7vz327L1wyapKFZChNvGq2bjnnMKIlknMwffga2TYC58wzBdKJbEwVi3vgCGNUwIMKRLvkP7RC4Y1YBxvwX0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907982874366.5681607652168; Sun, 16 Aug 2026 12:19:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKp-0000Jy-Sc; Sun, 16 Aug 2026 15:15:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKk-0008F7-NK for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKi-0008Qx-0D for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:50 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-488-gT1D9E1CPqyZIVbIv-Pseg-1; Sun, 16 Aug 2026 15:15:44 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A4EE4180035C; Sun, 16 Aug 2026 19:15:42 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C118418005BB; Sun, 16 Aug 2026 19:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907747; 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=S+aPoqqisu2J1a6Pr1LukLQArfAFqh3ZKUjQId9ja9Q=; b=AbFcKZ7QUA/Sjp5Y8Qvj0mXu5cYOlJ7B+kXbWhMaPSZII8pDwwQjXrZn0EuI8PgJCsomei EeZV5kiLRukpqNBWBFIsPCQMQnAMKEUFjhZSj/Plc3rtTd+dMRQHZ5UARB3HvF3Nah+jmh yZSdVBQ5o4LbvrpAiU6ZhOg1Lpn/Mv0= X-MC-Unique: gT1D9E1CPqyZIVbIv-Pseg-1 X-Mimecast-MFC-AGG-ID: gT1D9E1CPqyZIVbIv-Pseg_1786907742 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:10 +0400 Subject: [PATCH v3 43/49] hw: guard BusClass::print_dev with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-43-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , Paolo Bonzini , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=9448; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DXclgUj/8CLlvYxtSJ1BdyFBBPgVkYBaEJYVSnhsRxE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu03GEqM9u1lu43NiKgaNHGoOA1go7taxyi+ dqIU23XHySJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5Sz4D/0RiBypoUdxuRw/F+B/mUi+BaEAu4ujWxKKO6MUcbPkirsbNSwCHAYGgpuZpp3mIDw5TS4 ICozSRXzzE8xjNBngzE+E0wfpzKNovACKPeNZSYVDlLdlrhp1Ebbydh6EU8ygmH4PM8kQl4xsRf ZmF8o4m/5U/1K6d7xXByF/Zzpa6g7iYG62HjEcRsrZD4PN/eCzXfZpZD/VQ1fx9zv3R0pmr5Bor aRzxXCSussVZ/HOcHNbyZC1zqPeRSmsbscVqWgoem8Zio9t7pAjXuZKSIO8548w3C1XssvCf7iF 8Z4aFNKgKKawTRlOP4386LspSUzJYP/KHHIb8pA31a0nAkUSy2oVB5pCVa1mhS5SEUff+wsGBlA GaDwAuxUmA9ux4o4vL2+kBXAZWgBZISP7PqGeDGNxU3xfd7NxxvAoJybJpUDs6cu6ztGEaz9jyH UHmFUtiQVcacC0ovMccHPchRYr5u+7aXB8xyMDzLfQx/0Ej21HwJ1rQahlShNmdUIyutLWjXbwQ 9Fq9IAJVrAwFFjzdNrGtGTdUYECO4iTMXC/BypTDFo8q+jx9lWrboDLdrjfCExFPay389rXDQSq 2E2k6TKfyPvTIx8/NXx5gKsWEsGyZYrvtVAYXMa0deMTVkxpRL0+Z3UczA4vspHv8ZMqtIKbH75 4CgqI1VyIH7zdvg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907985251158500 The print_dev callback is only used by HMP 'info qtree'. Guard the field in BusClass, all implementations, and the caller with CONFIG_HMP. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/char/virtio-serial-bus.c | 6 ++++++ hw/core/sysbus.c | 6 ++++++ hw/misc/auxbus.c | 16 +++++++++++----- hw/pci/pci-hmp-cmds.c | 2 ++ hw/pci/pci.c | 2 ++ hw/usb/bus.c | 6 ++++++ hw/xen/xen-bus.c | 4 ++++ include/hw/core/qdev.h | 2 ++ 8 files changed, 39 insertions(+), 5 deletions(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 4dcc4516e45e..83a033ce8555 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -814,7 +814,9 @@ static int virtio_serial_load_device(VirtIODevice *vdev= , QEMUFile *f, return 0; } =20 +#ifdef CONFIG_HMP static void virtser_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int = indent); +#endif =20 static const Property virtser_props[] =3D { DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID), @@ -823,8 +825,10 @@ static const Property virtser_props[] =3D { =20 static void virtser_bus_class_init(ObjectClass *klass, const void *data) { +#ifdef CONFIG_HMP BusClass *k =3D BUS_CLASS(klass); k->print_dev =3D virtser_bus_dev_print; +#endif } =20 static const TypeInfo virtser_bus_info =3D { @@ -834,6 +838,7 @@ static const TypeInfo virtser_bus_info =3D { .class_init =3D virtser_bus_class_init, }; =20 +#ifdef CONFIG_HMP static void virtser_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int = indent) { VirtIOSerialPort *port =3D VIRTIO_SERIAL_PORT(qdev); @@ -844,6 +849,7 @@ static void virtser_bus_dev_print(MonitorHMP *hmp, Devi= ceState *qdev, int indent port->host_connected ? "on" : "off", port->throttled ? "on" : "off"); } +#endif =20 /* This function is only used if a port id is not provided by the user */ static uint32_t find_free_port_id(VirtIOSerial *vser) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 31c4fdf79d48..fe8f867a8d9c 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -24,7 +24,9 @@ #include "monitor/hmp.h" #include "system/address-spaces.h" =20 +#ifdef CONFIG_HMP static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent= ); +#endif static char *sysbus_get_fw_dev_path(DeviceState *dev); =20 typedef struct SysBusFind { @@ -76,7 +78,9 @@ static void system_bus_class_init(ObjectClass *klass, con= st void *data) { BusClass *k =3D BUS_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D sysbus_dev_print; +#endif k->get_fw_dev_path =3D sysbus_get_fw_dev_path; } =20 @@ -249,6 +253,7 @@ bool sysbus_realize_and_unref(SysBusDevice *dev, Error = **errp) return qdev_realize_and_unref(DEVICE(dev), sysbus_get_default(), errp); } =20 +#ifdef CONFIG_HMP static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { SysBusDevice *s =3D SYS_BUS_DEVICE(dev); @@ -261,6 +266,7 @@ static void sysbus_dev_print(MonitorHMP *hmp, DeviceSta= te *dev, int indent) indent, "", s->mmio[i].addr, size); } } +#endif =20 static char *sysbus_get_fw_dev_path(DeviceState *dev) { diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index 0bb89c5a60ab..3f17784d9b8a 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -47,18 +47,22 @@ } while (0) =20 =20 +#ifdef CONFIG_HMP static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int ind= ent); +#endif static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge); =20 /* aux-bus implementation (internal not public) */ static void aux_bus_class_init(ObjectClass *klass, const void *data) { +#ifdef CONFIG_HMP BusClass *k =3D BUS_CLASS(klass); =20 /* AUXSlave has an MMIO so we need to change the way we print informat= ion * in monitor. */ k->print_dev =3D aux_slave_dev_print; +#endif } =20 AUXBus *aux_bus_init(DeviceState *parent, const char *name) @@ -91,11 +95,6 @@ void aux_map_slave(AUXSlave *aux_dev, hwaddr addr) memory_region_add_subregion(bus->aux_io, addr, aux_dev->mmio); } =20 -static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) -{ - return (dev =3D=3D DEVICE(bus->bridge)); -} - I2CBus *aux_get_i2c_bus(AUXBus *bus) { return aux_bridge_get_i2c_bus(bus->bridge); @@ -288,6 +287,12 @@ static const TypeInfo aux_to_i2c_type_info =3D { }; =20 /* aux-slave implementation */ +#ifdef CONFIG_HMP +static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) +{ + return (dev =3D=3D DEVICE(bus->bridge)); +} + static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int ind= ent) { AUXBus *bus =3D AUX_BUS(qdev_get_parent_bus(dev)); @@ -305,6 +310,7 @@ static void aux_slave_dev_print(MonitorHMP *hmp, Device= State *dev, int indent) object_property_get_uint(OBJECT(s->mmio), "addr", N= ULL), memory_region_size(s->mmio)); } +#endif =20 void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio) { diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index bcccfaf07f4d..879011da1384 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -135,6 +135,7 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) qapi_free_PciInfoList(info_list); } =20 +#ifdef CONFIG_HMP void pcibus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { PCIDevice *d =3D (PCIDevice *)dev; @@ -170,6 +171,7 @@ void pcibus_dev_print(MonitorHMP *hmp, DeviceState *dev= , int indent) r->addr, r->addr + r->size - 1); } } +#endif =20 void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d3191609e283..9e5db9529379 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -290,7 +290,9 @@ static void pci_bus_class_init(ObjectClass *klass, cons= t void *data) ResettableClass *rc =3D RESETTABLE_CLASS(klass); FWCfgDataGeneratorClass *fwgc =3D FW_CFG_DATA_GENERATOR_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D pcibus_dev_print; +#endif k->get_dev_path =3D pcibus_get_dev_path; k->get_fw_dev_path =3D pcibus_get_fw_dev_path; k->realize =3D pci_bus_realize; diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 8bd25a9d872a..5cc5ffec33a1 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -13,7 +13,9 @@ #include "trace.h" #include "qemu/cutils.h" =20 +#ifdef CONFIG_HMP static void usb_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int inde= nt); +#endif =20 static char *usb_get_dev_path(DeviceState *dev); static char *usb_get_fw_dev_path(DeviceState *qdev); @@ -32,7 +34,9 @@ static void usb_bus_class_init(ObjectClass *klass, const = void *data) BusClass *k =3D BUS_CLASS(klass); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D usb_bus_dev_print; +#endif k->get_dev_path =3D usb_get_dev_path; k->get_fw_dev_path =3D usb_get_fw_dev_path; hc->unplug =3D qdev_simple_device_unplug_cb; @@ -544,6 +548,7 @@ static const char *usb_speed(unsigned int speed) return txt[speed]; } =20 +#ifdef CONFIG_HMP static void usb_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int inde= nt) { USBDevice *dev =3D USB_DEVICE(qdev); @@ -555,6 +560,7 @@ static void usb_bus_dev_print(MonitorHMP *hmp, DeviceSt= ate *qdev, int indent) usb_speed(dev->speed), dev->product_desc, dev->attached ? ", attached" : ""); } +#endif =20 static char *usb_get_dev_path(DeviceState *qdev) { diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index b81a067e7753..1762816bf469 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -101,6 +101,7 @@ abort: qemu_xen_xs_transaction_end(xenbus->xsh, tid, true); } =20 +#ifdef CONFIG_HMP static void xen_bus_print_dev(MonitorHMP *hmp, DeviceState *dev, int inden= t) { XenDevice *xendev =3D XEN_DEVICE(dev); @@ -108,6 +109,7 @@ static void xen_bus_print_dev(MonitorHMP *hmp, DeviceSt= ate *dev, int indent) monitor_hmp_printf(hmp, "%*sname =3D '%s' frontend_id =3D %u\n", indent, "", xendev->name, xendev->frontend_id); } +#endif =20 static char *xen_bus_get_dev_path(DeviceState *dev) { @@ -386,7 +388,9 @@ static void xen_bus_class_init(ObjectClass *class, cons= t void *data) BusClass *bus_class =3D BUS_CLASS(class); HotplugHandlerClass *hotplug_class =3D HOTPLUG_HANDLER_CLASS(class); =20 +#ifdef CONFIG_HMP bus_class->print_dev =3D xen_bus_print_dev; +#endif bus_class->get_dev_path =3D xen_bus_get_dev_path; bus_class->realize =3D xen_bus_realize; bus_class->unrealize =3D xen_bus_unrealize; diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index 1391dc060caf..f054a214fc6a 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -323,8 +323,10 @@ DECLARE_OBJ_CHECKERS(BusState, BusClass, struct BusClass { ObjectClass parent_class; =20 +#ifdef CONFIG_HMP /* FIXME first arg should be BusState */ void (*print_dev)(MonitorHMP *mon, DeviceState *dev, int indent); +#endif /* * Return a newly allocated string containing the path of the * device on this bus. --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907901; cv=none; d=zohomail.com; s=zohoarc; b=QQT5cvKFGRoPabefEI+1vl8fDPAzmyxrgQoWG0ScGMNwsqoE7SIFGFYJDnWQry7LQcn3bzuei3QY9c/oF6dghMEA+OddfQ7cCSIYM5JABlMg33fwtFKYRi01FKNiUeBckBNFHtqXoZ7bIgfNWC0P1g0muD2WXjSeaWXHaea9srs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907901; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=enBUpDOXCwO/sjgii97Ofa4/933mWm4UHlA8clXz7Ho=; b=Ou8isomrflDZ1nmgcafafoD8kE1UH+yJhR1+MpwmzGc99PATnXIPT4bAU8RXdkozUuymYOjCl04ZFbCB23xveV5P6346v16Ar6IGFXMg3VTqO/m5mi8VQ95sYcZvXIsTPHcwNq/d0QvxceksTdapHm5uUM6ENYpYREvt7b8V4B0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178690790143946.71733227638117; Sun, 16 Aug 2026 12:18:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgKq-0000P6-C5; Sun, 16 Aug 2026 15:15:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKn-0008Tp-2Y for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKl-0008Sm-EG for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:15:52 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-693-8NWYe4lRNgWT-v3TuX24Rg-1; Sun, 16 Aug 2026 15:15:47 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B76218004A9; Sun, 16 Aug 2026 19:15:46 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 51DEC422; Sun, 16 Aug 2026 19:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907750; 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=enBUpDOXCwO/sjgii97Ofa4/933mWm4UHlA8clXz7Ho=; b=ZqM692GyE1IVIg6fD3JokDKLUjI+Qog6qfkFD5+8IrCM8BMNfC27SGagFh0SV+ZWCyzm9l n299HXBuIN8NVP7usqfXTPWtsIJuaVG8hN57OMvFXsNKf7vQ3o8aJKVStHbFFZ5oxQpNwY EZyOUG1Kf7ohL6tyJxmBW+YkDyif7eg= X-MC-Unique: 8NWYe4lRNgWT-v3TuX24Rg-1 X-Mimecast-MFC-AGG-ID: 8NWYe4lRNgWT-v3TuX24Rg_1786907746 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:11 +0400 Subject: [PATCH v3 44/49] hexagon: condition HMP-specific code MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-44-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Brian Cain , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=2711; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2OVuVfJBnPkur4+UB4C5BoMGkYchBdx4jr6AjfYDGDg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0pXAobObPC1LRrt4AxqzEQ0j7hSUqtRRol +NmYJ2wX5GJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5bXYD/97ZXg+IIBQJ5cjITaIgfKmI1ItSvcd9Fw5RTIAS/n8CaWxdryRZee7RbU4J3ABaXDJX5J F16gEOYoZSL+grnqf2h84KpvMwRONsvS31yAfOBoFLp2hAycRIWnZOZqMy/WNfMhymaPYiLac4y M5+WgdzD2yqBNiBil84O+8GvbrwRB/M7WDijIxJ6jOLXCqDt0QoJMv6O1ySi0xVszZllb/eJ0VN Cx6Lyyq5fwGvSeZ0Rg+YLwCZIPY65vbNNLQ4VFbpplGb30QrJOvCU4gNqLAZhTp8fkxX/CF9JSc E4HgG1wF2v3cdM6aA5wFJ7jw7IoJ6TTAp69iQT8P+9fPrD5YEefjEwt0a7f46HfGPYjJWo6iesO +TavUxhFRdRJ5qcYnLl6ll3zK+lRJVWNmMDGiEgg3zLNLJsHyIA7D1itzR/axeqnF6dC6YwLYw0 m1OKPRyOps0hBca4Ww3JAFvrI4UpY/kgtiOVvxvAqXb5LJPTPf6/oAXj5YU7ksVxOhz6/MiOuJk IENjComRfn3AGz5zIRDT8S2OkEz6dpffEHP9rDBtHPWSWXl/7jfwHGpB8N4e37+aIIROtKDtjrn gi5R25E4Mj46Hek2tYUEGc+4i5VrizufPhdVLpgJK/Lrm6ulnmJNib1EbPL+vtgm0iSD1cPl9a1 7cy/CB3IfD55CPg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907902812158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Brian Cain Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/hexagon/hexagon_tlb.c | 42 ++++++++++++++++++++++-------------------- target/hexagon/hex_mmu.c | 2 ++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/hw/hexagon/hexagon_tlb.c b/hw/hexagon/hexagon_tlb.c index 584c606a22c5..ed8c0a761228 100644 --- a/hw/hexagon/hexagon_tlb.c +++ b/hw/hexagon/hexagon_tlb.c @@ -57,19 +57,6 @@ typedef enum { =20 #define NUM_PGSIZE_TYPES (PGSIZE_1G + 1) =20 -static const char *pgsize_str[NUM_PGSIZE_TYPES] =3D { - "4K", - "16K", - "64K", - "256K", - "1M", - "4M", - "16M", - "64M", - "256M", - "1G", -}; - #define INVALID_MASK 0xffffffffLL =20 static const uint64_t encmask_2_mask[] =3D { @@ -122,6 +109,20 @@ static inline uint64_t hex_tlb_virt_addr(uint64_t entr= y) return (uint64_t)GET_PTE_VPN(entry) << qemu_target_page_bits(); } =20 +#ifdef CONFIG_HMP +static const char *pgsize_str[NUM_PGSIZE_TYPES] =3D { + "4K", + "16K", + "64K", + "256K", + "1M", + "4M", + "16M", + "64M", + "256M", + "1G", +}; + bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t entry) { if (GET_PTE_V(entry)) { @@ -155,6 +156,14 @@ bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t = entry) return false; } =20 +void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb) +{ + for (uint32_t i =3D 0; i < tlb->num_entries; i++) { + hexagon_tlb_dump_entry(hmp, tlb->entries[i]); + } +} +#endif + static inline bool hex_tlb_entry_match_noperm(uint64_t entry, uint32_t asi= d, uint64_t VA) { @@ -377,13 +386,6 @@ int hexagon_tlb_check_overlap(HexagonTLBState *tlb, ui= nt64_t entry, return -1; } =20 -void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb) -{ - for (uint32_t i =3D 0; i < tlb->num_entries; i++) { - hexagon_tlb_dump_entry(hmp, tlb->entries[i]); - } -} - uint32_t hexagon_tlb_get_num_entries(HexagonTLBState *tlb) { return tlb->num_entries; diff --git a/target/hexagon/hex_mmu.c b/target/hexagon/hex_mmu.c index 242de06eaad2..12bcddd000bf 100644 --- a/target/hexagon/hex_mmu.c +++ b/target/hexagon/hex_mmu.c @@ -107,11 +107,13 @@ int hex_tlb_check_overlap(CPUHexagonState *env, uint6= 4_t entry, uint64_t index) return hexagon_tlb_check_overlap(cpu->tlb, entry, index); } =20 +#ifdef CONFIG_HMP void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env) { HexagonCPU *cpu =3D env_archcpu(env); hexagon_tlb_dump(hmp, cpu->tlb); } +#endif =20 static inline void print_thread(const char *str, CPUState *cs) { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907827; cv=none; d=zohomail.com; s=zohoarc; b=fUQ0cMzqMMi0rlD+go0vSVvOUfiBBsBKuSzYLVutiSJg+zQtR8N94/O7rbJJKIk9Ap89KtjnfCYd6A84e8wIpFyR+Ln4ga75tTH5CF4Ft0LKU97TxKBtw4Ek5PR0F+BHhGycJoBDz8ok5o7yWjQqks1WICWue+aWuPB6FQG8tKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907827; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XFHHFC49LxHjezmRyp2lGkPpsiNGuulJJm9UR6atnL8=; b=AnHn2FLslCUyc5uuMS801RS1d2axgeeve4/IoTV+eCXrwKBQWHEKB+NKDDBqczUNcCSwPjV9FylD9h4l2buh+JNCoeR64vfKHNx0IHw7eXKpx5oeAoIxLP0vW6kUMI+Vq9zCPaxtYhRo5nkfeCE81coBN8YQk4+b/Nwz8rsQPVk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907827008933.3393736628867; Sun, 16 Aug 2026 12:17:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgLF-0000vy-Kd; Sun, 16 Aug 2026 15:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgL1-0000fe-Bi for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKv-0008VP-6b for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:04 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-8NpM777bPlOpQKjBY0iP9Q-1; Sun, 16 Aug 2026 15:15:51 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9604319560A2; Sun, 16 Aug 2026 19:15:50 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9F9FE30001A2; Sun, 16 Aug 2026 19:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907760; 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=XFHHFC49LxHjezmRyp2lGkPpsiNGuulJJm9UR6atnL8=; b=feOCmJwetiw4eqzWb8Ux4SROGvD7Qy5nMrWC3MbKz8EWFGHlD59qr0aieiwIHu60q89znf SQdupft72wea20vV9qYcFT2hOEBezHasLU5ZVOveEF2oA6eYY+PxEx0E/9ezXTm4fWMzzw 0QcfsTSAA3fW+bSo7pgD2vXkOo8Icc0= X-MC-Unique: 8NpM777bPlOpQKjBY0iP9Q-1 X-Mimecast-MFC-AGG-ID: 8NpM777bPlOpQKjBY0iP9Q_1786907750 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:12 +0400 Subject: [PATCH v3 45/49] build-sys: make HMP source files conditional on have_hmp MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-45-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Gerd Hoffmann , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , "Michael S. Tsirkin" , Richard Henderson , Jason Wang , Pierrick Bouvier , Peter Xu , Fabiano Rosas , "Dr. David Alan Gilbert" , Laurent Vivier , Stefan Hajnoczi , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=12922; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=KAwOhO6Ht0qoLbpPq+lQ8H0gvqEc2eImo2afap6ISy8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0n5E/NhEBwcOLmRFWp5nAvGZLHastj4SK9 UBfGV5eDLmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5cdQD/0UOhSiwVYFtN3V4JqUuaDF0FxWDz0+YfzDSOgu+CsaXxRBilsjw+O4KUO1o81nrNhyNXL oaalpY9Pr+mGr3ewPj3E1OZrYggoFqkr4YrZ80nVHBTqz8toNHPKb7q0P3AX4C9OxEoilP6aSZV 9hBemr4SNMkZg8xkdcMRp8TtIi+YrL8+BtMvx9My73+ndGgKmzcBACOAR5SyZyfDeDWSaYPtYg+ fxsBRV1QsI5mP0d+kPAy7V0w4y7wpt1LqsT4FfnGLUsaDVdaKHO6Wpk6TmqODc/4lSba4I0ha/Q YG723K9ByN81HojJ8mcdb9G2kzxwjLcc7o2kM6i2mgoPPOLUyWXrS0mBqO+OLZe/J3QAzKmHasc sqzxaNn5WWRhAK0HksfxxpdIsREOYZoL+cLLpV94UOK82AJel8J5n6PK9RiE66m+hNeIX347se9 QBI+bzEO37AMerDcEmT3Rgmc2/qP6wjD5zboaXp6wmaC5z51+OemVEIWNwT+lhwpywENg204I4D GAAIfpy2Kbr7n0K41nK8tGPkfB470AWLky9PSb8NRmBcdDPyiMnQ5rvSOsQ3K19U9vFKxcDdy2j L6Wu33rAT/li9/iHgBlEXrpQ3QR0DnsYptoaI7iBG2i6Z0jB/SUE51oXKGuXLT3VPlZR6SFY0I/ pVdNkfo5CV/OjtA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907828893158500 Exclude all *-hmp-cmds.c files and HMP-only source files from the build when HMP is disabled. Also conditionalise the hmp-commands.hx header generation and the test-hmp qtest. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Dr. David Alan Gilbert --- audio/meson.build | 4 +++- backends/meson.build | 5 ++++- block/monitor/meson.build | 4 +++- chardev/meson.build | 5 ++++- disas/meson.build | 4 +++- dump/meson.build | 5 ++++- hw/core/meson.build | 5 +++-- hw/i386/meson.build | 4 +++- hw/net/meson.build | 4 +++- hw/pci/meson.build | 4 +++- hw/virtio/meson.build | 4 +++- meson.build | 2 +- migration/meson.build | 4 +++- monitor/hmp.c | 2 -- monitor/meson.build | 9 +++++++-- net/meson.build | 4 +++- qom/meson.build | 4 +++- stats/meson.build | 5 ++++- stubs/meson.build | 12 +++++++----- system/meson.build | 11 ++++++++--- tests/qtest/meson.build | 8 +++++++- trace/meson.build | 5 ++++- ui/meson.build | 4 +++- 23 files changed, 86 insertions(+), 32 deletions(-) diff --git a/audio/meson.build b/audio/meson.build index 0e33b6f9836e..6655f601b115 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -9,7 +9,9 @@ audio_ss.add(files( )) =20 # deprecated since v10.2, to be removed -system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) +if have_hmp + system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) +endif =20 audio_modules =3D {} foreach m : [ diff --git a/backends/meson.build b/backends/meson.build index 8792c58c361f..224e96753527 100644 --- a/backends/meson.build +++ b/backends/meson.build @@ -1,6 +1,5 @@ system_ss.add([files( 'cryptodev-builtin.c', - 'cryptodev-hmp-cmds.c', 'cryptodev.c', 'hostmem-ram.c', 'hostmem.c', @@ -10,6 +9,10 @@ system_ss.add([files( 'confidential-guest-support.c', ), numa]) =20 +if have_hmp + system_ss.add(files('cryptodev-hmp-cmds.c')) +endif + if host_os !=3D 'windows' system_ss.add(files('rng-random.c')) if host_os !=3D 'emscripten' diff --git a/block/monitor/meson.build b/block/monitor/meson.build index 74faced9e17f..2d5c157a7391 100644 --- a/block/monitor/meson.build +++ b/block/monitor/meson.build @@ -1,3 +1,5 @@ -system_ss.add(files('block-hmp-cmds.c')) +if have_hmp + system_ss.add(files('block-hmp-cmds.c')) +endif block_ss.add(files('bitmap-qmp-cmds.c')) system_ss.add(files('qmp-cmds.c')) diff --git a/chardev/meson.build b/chardev/meson.build index 56ee39ac0b01..031b6d7238c1 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -30,11 +30,14 @@ endif chardev_ss =3D chardev_ss.apply({}) =20 system_ss.add(files( - 'char-hmp-cmds.c', 'msmouse.c', 'wctablet.c', 'testdev.c')) =20 +if have_hmp + system_ss.add(files('char-hmp-cmds.c')) +endif + chardev_modules =3D {} =20 if brlapi.found() diff --git a/disas/meson.build b/disas/meson.build index 42977a1f74dd..b382550e41f8 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -20,5 +20,7 @@ common_ss.add(when: 'CONFIG_TCG', if_true: files( 'objdump.c' )) common_ss.add(files('disas-common.c')) -system_ss.add(files('disas-mon.c')) +if have_hmp + system_ss.add(files('disas-mon.c')) +endif specific_ss.add(capstone) diff --git a/dump/meson.build b/dump/meson.build index 26e1561ed486..bef8276aa5ad 100644 --- a/dump/meson.build +++ b/dump/meson.build @@ -1,3 +1,6 @@ -system_ss.add([files('dump.c', 'dump-hmp-cmds.c'), snappy, lzo]) +system_ss.add([files('dump.c'), snappy, lzo]) +if have_hmp + system_ss.add(files('dump-hmp-cmds.c')) +endif specific_ss.add(when: 'CONFIG_WINDUMP', if_true: files('win_dump-x86.c')) system_ss.add(when: 'CONFIG_WINDUMP', if_false: files('win_dump-stubs.c')) diff --git a/hw/core/meson.build b/hw/core/meson.build index 8a96567de8f2..8fe776d2c86b 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -26,13 +26,11 @@ system_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files(= 'split-irq.c')) system_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c')) system_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c')) system_ss.add(when: 'CONFIG_EIF', if_true: [files('eif.c'), zlib, libcbor,= gnutls]) - system_ss.add(files( 'cpu-system.c', 'fw-path-provider.c', 'hotplug.c', 'loader.c', - 'machine-hmp-cmds.c', 'machine-qmp-cmds.c', 'machine.c', 'nmi.c', @@ -46,6 +44,9 @@ system_ss.add(files( 'vm-change-state-handler.c', 'clock-vmstate.c', )) +if have_hmp + system_ss.add(files('machine-hmp-cmds.c')) +endif user_ss.add(files( 'cpu-user.c', 'qdev-user.c', diff --git a/hw/i386/meson.build b/hw/i386/meson.build index b611fbb5a7fb..125f4ce894ca 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -24,7 +24,9 @@ i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iom= mu.c')) i386_ss.add(when: 'CONFIG_VTD_ACCEL', if_true: files('intel_iommu_accel.c'= )) i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'), if_false: files('sgx-stub.c')) -stub_ss.add(files('sgx-hmp-stub.c')) +if have_hmp + stub_ss.add(files('sgx-hmp-stub.c')) +endif =20 i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c')) i386_ss.add(when: 'CONFIG_PC', if_true: files( diff --git a/hw/net/meson.build b/hw/net/meson.build index 84f142df222a..df3373be03bf 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -67,6 +67,8 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files( 'rocker/rocker_world.c', )) stub_ss.add(files('rocker/rocker-stubs.c')) -system_ss.add(files('rocker/rocker-hmp-cmds.c')) +if have_hmp + system_ss.add(files('rocker/rocker-hmp-cmds.c')) +endif =20 subdir('can') diff --git a/hw/pci/meson.build b/hw/pci/meson.build index a6cbd89c0a38..984c7327e5d0 100644 --- a/hw/pci/meson.build +++ b/hw/pci/meson.build @@ -5,12 +5,14 @@ pci_ss.add(files( 'pci.c', 'pci_bridge.c', 'pci_host.c', - 'pci-hmp-cmds.c', 'pci-qmp-cmds.c', 'pcie_sriov.c', 'shpc.c', 'slotid_cap.c' )) +if have_hmp + pci_ss.add(files('pci-hmp-cmds.c')) +endif # The functions in these modules can be used by devices too. Since we # allow plugging PCIe devices into PCI buses, include them even if # CONFIG_PCI_EXPRESS=3Dn. diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 0e023235164b..b59f455a5114 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -100,6 +100,8 @@ stub_ss.add(files('vhost-user-stub.c')) stub_ss.add(files('virtio-stub.c')) stub_ss.add(files('virtio-md-stubs.c')) =20 -system_ss.add(files('virtio-hmp-cmds.c')) +if have_hmp + system_ss.add(files('virtio-hmp-cmds.c')) +endif =20 system_ss.add(when: 'CONFIG_ACPI', if_true: files('virtio-acpi.c')) diff --git a/meson.build b/meson.build index 03b334549f23..8ac35151604b 100644 --- a/meson.build +++ b/meson.build @@ -3549,7 +3549,7 @@ hx_headers =3D [ ['qemu-options.hx', 'qemu-options.def'], ['qemu-img-cmds.hx', 'qemu-img-cmds.h'], ] -if have_system +if have_system and have_hmp hx_headers +=3D [ ['hmp-commands.hx', 'hmp-commands.h'], ['hmp-commands-info.hx', 'hmp-commands-info.h'], diff --git a/migration/meson.build b/migration/meson.build index 0a9a5d0d3746..4ab9d99cea62 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -36,7 +36,9 @@ system_ss.add(files( 'socket.c', 'tls.c', ), gnutls, zlib) -system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice]) +if have_hmp + system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice]) +endif =20 if get_option('replication').allowed() system_ss.add(files('colo-failover.c', 'colo.c', 'multifd-colo.c')) diff --git a/monitor/hmp.c b/monitor/hmp.c index 3c70adcd35bb..10bcbe2a33cb 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1731,9 +1731,7 @@ static int get_monitor_def(MonitorHMP *hmp, int64_t *= pval, const char *name) if (cs =3D=3D NULL) { return -1; } -#ifdef CONFIG_HMP md =3D cs->cc->sysemu_ops->monitor_defs; -#endif if (md =3D=3D NULL) { return -1; } diff --git a/monitor/meson.build b/monitor/meson.build index 4c58dd148c04..f67e0291a42a 100644 --- a/monitor/meson.build +++ b/monitor/meson.build @@ -2,8 +2,13 @@ qmp_ss.add(files('monitor.c', 'qmp.c', 'qmp-cmds-control.c= ')) =20 system_ss.add(files( 'fds.c', - 'hmp-cmds.c', - 'hmp.c', 'qemu-config-qmp.c', 'qmp-cmds.c', )) + +if have_hmp + system_ss.add(files( + 'hmp-cmds.c', + 'hmp.c', + )) +endif diff --git a/net/meson.build b/net/meson.build index 9c8068b06d1f..5bb76d136491 100644 --- a/net/meson.build +++ b/net/meson.build @@ -8,7 +8,6 @@ system_ss.add(files( 'filter-mirror.c', 'filter.c', 'hub.c', - 'net-hmp-cmds.c', 'net.c', 'queue.c', 'socket.c', @@ -16,6 +15,9 @@ system_ss.add(files( 'stream_data.c', 'util.c', )) +if have_hmp + system_ss.add(files('net-hmp-cmds.c')) +endif =20 if get_option('replication').allowed() or \ get_option('colo_proxy').allowed() diff --git a/qom/meson.build b/qom/meson.build index bd6f4aadd78a..022d3ad5c8f1 100644 --- a/qom/meson.build +++ b/qom/meson.build @@ -10,4 +10,6 @@ if have_system endif =20 qmp_ss.add(files('qom-qmp-cmds.c')) -system_ss.add(files('qom-hmp-cmds.c')) +if have_hmp + system_ss.add(files('qom-hmp-cmds.c')) +endif diff --git a/stats/meson.build b/stats/meson.build index 0728dafcd1c7..b5f68a94052e 100644 --- a/stats/meson.build +++ b/stats/meson.build @@ -1 +1,4 @@ -system_ss.add(files('stats-hmp-cmds.c', 'stats-qmp-cmds.c')) +system_ss.add(files('stats-qmp-cmds.c')) +if have_hmp + system_ss.add(files('stats-hmp-cmds.c')) +endif diff --git a/stubs/meson.build b/stubs/meson.build index 7e15687a62b7..93df8ea94f57 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -86,11 +86,13 @@ if have_system stub_ss.add(files('qmp-cpu.c')) stub_ss.add(files('qmp-cpu-s390x.c')) stub_ss.add(files('qmp-cpu-s390x-kvm.c')) - stub_ss.add(files('hmp-cmd-info_mem.c')) - stub_ss.add(files('hmp-cmd-info_sev.c')) - stub_ss.add(files('hmp-cmd-info_tlb.c')) - stub_ss.add(files('hmp-cmds-hw-s390x.c')) - stub_ss.add(files('hmp-cmds-target-i386.c')) + if have_hmp + stub_ss.add(files('hmp-cmd-info_mem.c')) + stub_ss.add(files('hmp-cmd-info_sev.c')) + stub_ss.add(files('hmp-cmd-info_tlb.c')) + stub_ss.add(files('hmp-cmds-hw-s390x.c')) + stub_ss.add(files('hmp-cmds-target-i386.c')) + endif endif =20 if have_system or have_user diff --git a/system/meson.build b/system/meson.build index 64e06e7abcc3..41e2e4a292d1 100644 --- a/system/meson.build +++ b/system/meson.build @@ -9,7 +9,6 @@ system_ss.add(files( 'cpus.c', 'cpu-timers.c', 'dirtylimit.c', - 'dirtylimit-hmp-cmds.c', 'dma-helpers.c', 'exit-with-parent.c', 'globals.c', @@ -24,12 +23,18 @@ system_ss.add(files( 'qtest.c', 'rtc.c', 'runstate-action.c', - 'runstate-hmp-cmds.c', 'runstate.c', - 'tpm-hmp-cmds.c', 'watchpoint.c', )) =20 +if have_hmp + system_ss.add(files( + 'dirtylimit-hmp-cmds.c', + 'runstate-hmp-cmds.c', + 'tpm-hmp-cmds.c', + )) +endif + if have_tpm system_ss.add(files('tpm.c')) endif diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index f7c7d06620ea..4cf4407c2bd0 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -26,7 +26,13 @@ qtests_generic =3D [ 'qmp-test', 'qmp-cmd-test', 'qom-test', - 'test-hmp', +] +if have_hmp + qtests_generic +=3D [ + 'test-hmp', + ] +endif +qtests_generic +=3D [ 'qos-test', 'readconfig-test', 'netdev-socket', diff --git a/trace/meson.build b/trace/meson.build index d89a0db82a14..4e5681c44cae 100644 --- a/trace/meson.build +++ b/trace/meson.build @@ -1,4 +1,7 @@ -system_ss.add(files('control-target.c', 'trace-hmp-cmds.c')) +system_ss.add(files('control-target.c')) +if have_hmp + system_ss.add(files('trace-hmp-cmds.c')) +endif trace_rs_targets =3D [] trace_events_files =3D [] foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events diff --git a/ui/meson.build b/ui/meson.build index d345f6c70d6a..39829a2c6e23 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -56,10 +56,12 @@ system_ss.add(png) system_ss.add(files( 'input-barrier.c', 'input.c', - 'ui-hmp-cmds.c', 'ui-qmp-cmds.c', 'util.c', )) +if have_hmp + system_ss.add(files('ui-hmp-cmds.c')) +endif system_ss.add(ui) system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: file= s('console-vc-stubs.c')) if dbus_display --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907907; cv=none; d=zohomail.com; s=zohoarc; b=bH4TbhvFt2wmHPVwt/CqyG456Y3T4rsje4tfucoPg/xTML6FP3OENqZ55SnGz0c0ggROOG7PW2BJLL8LWY7KlyNrO1rMVI89fhOQ9cfBSXmN2G3Gi1bdrQPNp8IDH9m9OdY0Ek4X+SmSXzkdi9Yu6JasuTdwsMpOo+hCj1QukWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907907; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lEHcK7z4lsrjo+b0nnSXK3UE3eXILpOvD/vKXVIjWIU=; b=RNBzChXQIKoD7mDAb6IDvSvWv3Y2d77d3CE8hWnLZNvog5v62n8G4nVJ3tf990EaUaZzo2y45dmlQq6UsfPV8bYGSgS6MPkR0nlYd5JRlce9q6oG4WrNN7hin0b+onEMLK6ehoTwF0RxqEAew+zSTz57jtxGl9ZZFBYRfagD54s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178690790723296.07897459161438; Sun, 16 Aug 2026 12:18:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgLE-0000oY-Mf; Sun, 16 Aug 2026 15:16:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKw-0000eM-VP for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgKu-0008UX-3T for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:01 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-0D44Qhn8O3iTge3kEqClLg-1; Sun, 16 Aug 2026 15:15:55 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2DBDE19560B5; Sun, 16 Aug 2026 19:15:54 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 34CB2195608A; Sun, 16 Aug 2026 19:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907758; 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=lEHcK7z4lsrjo+b0nnSXK3UE3eXILpOvD/vKXVIjWIU=; b=SvvFiVmcEeJifwheQn+Y2fdC1fhkttsNBiSJxmRTNafPXj9NMHzw13im9LTYxNvkHmpPYN zdfv74vi1PlruZztmPvJBZyg187Qb7AOWHIzF/82dCWj8mXzqKsAq6aFpmVD5N6Vk8eDoS eCHg3OH1ZwSnhRtgKyfgQ5ROTcgt5Ws= X-MC-Unique: 0D44Qhn8O3iTge3kEqClLg-1 X-Mimecast-MFC-AGG-ID: 0D44Qhn8O3iTge3kEqClLg_1786907754 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:13 +0400 Subject: [PATCH v3 46/49] stubs: split monitor-core stubs into separate compilation units MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-46-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2638; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2XvwU4FzVi+iQ75+LAQigV0q9d5xv2A741epbvOZt8c=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu0ygSaq5NDA7ihCFPjDn9Io9xkrDlAPQ/Zm 4WbxPIn8YWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtAAKCRDa6OEJdZac 5ZjhD/94r88iG6jUbs0mQww5+E3lTCc+EfTl3QbQuLV6mFX0cVy/P8LaqyNhObP2n26M2gzd9SJ 8Ntn6EX0NKCsvEcRlLGjmJmQdQR39trC9+/LCO0NlFyBxQ+BEUQ4fFve/CMMdqrw+3dWaAlk2My wU5kqIL/KDgUOtXVfXaLZ9XLfoHtNEMagmtGeLtRCNLj1bYbbZrew3Ygp0VoAbJEzunhQ8oGs7b 7o93TqjW/OQZO0LnLB/iMuwRMdz6V9YMQHsmjiydrJBJmqnB+lHFbrPvdJF/dmmtHhCzXVz++mY ya02DvjojOR+1Imt9lo9vzsTrqVEnIiRd5BG3JrpoyZkLjWZWLdLEGXNE0/iCgHRayIeaLjXvOk sAZ+HqFU304fAZ602Zs6BIo8i0RvQhaDYl8cNuLHTbyJam1dI6eaFvXXT/s87ip+zpfUfNwd4Xx esxdKWGToI4ZrY2bU+51mnxRtbbfsE5j0aA9WmdDT1yQ66/8kZzjzOuntDqhGq4W5ym2QU2xCNh L/Vs1suB9KpZ2+vPABJujPIEIljT67BpIx6coVI4PYgmdqpVPSTxgGKg+T7VVoW4ouGaBN/87ud 8FVSHApnXa+Sixjtx7pFwElcAk3/zaiCB2Ff+L7xDJ94y7sFqe151DCsM8PNVtUpr8C6H4SM5zZ greoKvER7SkXfgw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907908786158500 The wild linker rejects duplicate symbols even from archive members. When qemu-storage-daemon links both libqmp (with monitor/monitor.c) and libqemuutil (with stubs/monitor-core.c), all symbols from the stub .o are pulled in, causing duplicates for monitor_cur, monitor_set_cur, and qapi_event_emit. Split each stub group into its own file so the linker only pulls in archive members whose symbols are actually needed. Signed-off-by: Marc-Andr=C3=A9 Lureau --- stubs/meson.build | 2 ++ stubs/monitor-core.c | 16 ---------------- stubs/monitor-cur.c | 14 ++++++++++++++ stubs/qapi-event-emit.c | 8 ++++++++ 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/stubs/meson.build b/stubs/meson.build index 93df8ea94f57..29b6644b2549 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -7,7 +7,9 @@ stub_ss.add(files('fdset.c')) stub_ss.add(files('iothread-lock.c')) stub_ss.add(files('is-daemonized.c')) stub_ss.add(files('monitor-core.c')) +stub_ss.add(files('monitor-cur.c')) stub_ss.add(files('monitor-hmp.c')) +stub_ss.add(files('qapi-event-emit.c')) stub_ss.add(files('replay-mode.c')) stub_ss.add(files('trace-control.c')) =20 diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index 094b80721003..0e74d78d52e4 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -1,21 +1,5 @@ #include "qemu/osdep.h" -#include "monitor/monitor.h" #include "monitor/hmp.h" -#include "qapi/qapi-emit-events.h" - -Monitor *monitor_cur(void) -{ - return NULL; -} - -Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) -{ - return NULL; -} - -void qapi_event_emit(QAPIEvent event, QDict *qdict) -{ -} =20 int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { diff --git a/stubs/monitor-cur.c b/stubs/monitor-cur.c new file mode 100644 index 000000000000..93966a16b855 --- /dev/null +++ b/stubs/monitor-cur.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "monitor/monitor.h" + +Monitor *monitor_cur(void) +{ + return NULL; +} + +Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) +{ + return NULL; +} diff --git a/stubs/qapi-event-emit.c b/stubs/qapi-event-emit.c new file mode 100644 index 000000000000..70b2719d714b --- /dev/null +++ b/stubs/qapi-event-emit.c @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "qapi/qapi-emit-events.h" + +void qapi_event_emit(QAPIEvent event, QDict *qdict) +{ +} --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907930; cv=none; d=zohomail.com; s=zohoarc; b=joYSR3fB69954pPBrl9NZiuh4yh/DU9Rodj42R6PEb5U/sxuKgNk3zyJsx0Jn2u8/EKVlDpdzeSr17s2qunLCNcf14KdKdhwX7eapi+t7QQ6u1hxu5QC2loObNqG11cQHAwpL5gM7VWmlkYDuR9iIP7xsdYzgVdpTf7kK38Df7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907930; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YJKjhueKFH6fO293pZu/kieeolLZstxWiOEM7pJAUd8=; b=HqCh44PIZytOItVCxKRAhCChf4bsEBmo9xB6p1xu4GcazIm6wZ11SxnDgG/TgpT/x4LavhQ4O7sv7RzkodO1KzlL1oJBlfgFgwvPYpO2gDYPz53LN5ZmPmk332RqP8U8KCeBqNkxDSJlP7FW630sbD9zQxsrTfdXZhXQ08dgOFU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907930730292.30614541591046; Sun, 16 Aug 2026 12:18:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgLH-0001D1-PI; Sun, 16 Aug 2026 15:16:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgLA-0000mK-5x for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgL8-000080-5j for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-7vm2xFJlPByihTKfMluXFQ-1; Sun, 16 Aug 2026 15:15:58 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9602E19560AB; Sun, 16 Aug 2026 19:15:57 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9E66218005BB; Sun, 16 Aug 2026 19:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907773; 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=YJKjhueKFH6fO293pZu/kieeolLZstxWiOEM7pJAUd8=; b=E6ZcyvTeesdFmdXw2GlB8N9NBi9bG2qXI2n4mpnnw0S1oet7nHgec3BbDaIzYY86M+AR1H jw9Is8PVr2DQqFmKJjUyG1QLKcC7LiyKX0X+OrSJlVEHeukajGH3RknxnaskkdFFs1cv0e nF+FihLJvTGlSn/RJfenFHyPTX1YID0= X-MC-Unique: 7vm2xFJlPByihTKfMluXFQ-1 X-Mimecast-MFC-AGG-ID: 7vm2xFJlPByihTKfMluXFQ_1786907757 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:14 +0400 Subject: [PATCH v3 47/49] monitor: move monitor_hmp_print*() functions to hmp.c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-47-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" X-Developer-Signature: v=1; a=openpgp-sha256; l=4855; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=f8oQG0VaVSMSlz37NAD46saX6MrPKO3jars6q2wPBXY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu1AHKyKuL4Kxhx5QK6x5FYxfRZTZtmyvwBh 9Hnl7gSF6iJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtQAKCRDa6OEJdZac 5Z4OD/9t1I00kqSUTmAGYAkmsrbSToRsjr7WkwQ6GrVi/WVBUNkZINshPuCEZtXfX8Gli+VKD4J UOUNAnXo+AbjCPfuj309g3O+gQDiUW8LQUujymlemeADbpFGZpIqnMDZDii9etci8uxqDKfMKMV v/5AtmOYOnU0AcgF/aMNvLxmMi6H+OfE8sTAtv/lzeW/jwEIiJ2Mrl4gwW52a0JkQf/4fpLMf6l SN0UwAaudMT04wrkrQBAwcDjkNgoRKEtDUc4LBMZ71aEJx4Lk9MnCsnSsJSE28pd065cAfp5MRp +FhKjWjwTD80YFLuB5SX4fT7uX37sMLRT3pE+7iHclgFTxyfFI3TcRCgKMNQzo6OtT7HgwYBdlB ATjldOTfJvhdEm3k2X3lB2Nmvk5ox1Rf/8FARLJPgVPfJLxztKTv2UNyuJ29PZ3QHjRk0CIvE+F Ec+CYxtvCoqtNSkbuSO4bG3cS/9cdd1Zl7/USnl9gFbYyRXemUFUw4p5eNguAozX9g7qSnGP6xL ANKdb1qyKFATTwTTDHMfIYswdwrqIa/xu52H6YUyKbjNGC2NUlT7IfZccJczm/fWrqO5UMJkUU7 wvBxeyk/u1r4aFq9W/iQgFuQepjZfOCLQL8XsRUw0Kst0zrnRPs5VC9+Tah1ktqmuQhqLNfUDt8 5anGIWwpl+Hz2GA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907932917158500 Those functions are only used when CONFIG_HMP, compile them out, and add conditions for the calling code. Signed-off-by: Marc-Andr=C3=A9 Lureau # The commit message #2 will be skipped: # fixup! monitor: move monitor_hmp_print*() functions to hmp.c Reviewed-by: Dr. David Alan Gilbert --- monitor/hmp.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ monitor/monitor.c | 49 ------------------------------------------------- util/error-report.c | 3 ++- util/qemu-print.c | 4 ++++ 4 files changed, 55 insertions(+), 50 deletions(-) diff --git a/monitor/hmp.c b/monitor/hmp.c index 10bcbe2a33cb..e3fc05f521a8 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1754,3 +1754,52 @@ static int get_monitor_def(MonitorHMP *hmp, int64_t = *pval, const char *name) } return cs->cc->sysemu_ops->monitor_get_register(cs, name, pval); } + +int monitor_hmp_vprintf(MonitorHMP *hmp, const char *fmt, va_list ap) +{ + g_autofree char *buf =3D g_strdup_vprintf(fmt, ap); + + if (!hmp) { + return -1; + } + + return monitor_puts(MONITOR(hmp), buf); +} + +int monitor_hmp_printf(MonitorHMP *hmp, const char *fmt, ...) +{ + int ret; + + va_list ap; + va_start(ap, fmt); + ret =3D monitor_hmp_vprintf(hmp, fmt, ap); + va_end(ap); + return ret; +} + +void monitor_hmp_printc(MonitorHMP *hmp, int c) +{ + monitor_hmp_printf(hmp, "'"); + switch (c) { + case '\'': + monitor_hmp_printf(hmp, "\\'"); + break; + case '\\': + monitor_hmp_printf(hmp, "\\\\"); + break; + case '\n': + monitor_hmp_printf(hmp, "\\n"); + break; + case '\r': + monitor_hmp_printf(hmp, "\\r"); + break; + default: + if (c >=3D 32 && c <=3D 126) { + monitor_hmp_printf(hmp, "%c", c); + } else { + monitor_hmp_printf(hmp, "\\x%02x", c); + } + break; + } + monitor_hmp_printf(hmp, "'"); +} diff --git a/monitor/monitor.c b/monitor/monitor.c index da0c8eda86b0..7979cd1cbcfd 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -272,55 +272,6 @@ int monitor_puts(Monitor *mon, const char *str) return monitor_puts_locked(mon, str); } =20 -int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) -{ - g_autofree char *buf =3D g_strdup_vprintf(fmt, ap); - - if (!mon) { - return -1; - } - - return monitor_puts(MONITOR(mon), buf); -} - -int monitor_hmp_printf(MonitorHMP *mon, const char *fmt, ...) -{ - int ret; - - va_list ap; - va_start(ap, fmt); - ret =3D monitor_hmp_vprintf(mon, fmt, ap); - va_end(ap); - return ret; -} - -void monitor_hmp_printc(MonitorHMP *mon, int c) -{ - monitor_hmp_printf(mon, "'"); - switch(c) { - case '\'': - monitor_hmp_printf(mon, "\\'"); - break; - case '\\': - monitor_hmp_printf(mon, "\\\\"); - break; - case '\n': - monitor_hmp_printf(mon, "\\n"); - break; - case '\r': - monitor_hmp_printf(mon, "\\r"); - break; - default: - if (c >=3D 32 && c <=3D 126) { - monitor_hmp_printf(mon, "%c", c); - } else { - monitor_hmp_printf(mon, "\\x%02x", c); - } - break; - } - monitor_hmp_printf(mon, "'"); -} - static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { /* Limit guest-triggerable events to 1 per second */ [QAPI_EVENT_RTC_CHANGE] =3D { 1000 * SCALE_MS }, diff --git a/util/error-report.c b/util/error-report.c index c20e157780fa..68471d8055a1 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -35,12 +35,13 @@ const char *error_guest_name; static int G_GNUC_PRINTF(1, 0) error_vprintf_mon(const char *fmt, va_list ap) { +#ifdef CONFIG_HMP MonitorHMP *hmp =3D monitor_cur_hmp(); =20 if (hmp) { return monitor_hmp_vprintf(hmp, fmt, ap); } - +#endif return vfprintf(stderr, fmt, ap); } =20 diff --git a/util/qemu-print.c b/util/qemu-print.c index aabe670fda01..f4a7ce4c0682 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -21,10 +21,12 @@ */ int qemu_vprintf(const char *fmt, va_list ap) { +#ifdef CONFIG_HMP MonitorHMP *hmp =3D monitor_cur_hmp(); if (hmp) { return monitor_hmp_vprintf(hmp, fmt, ap); } +#endif return vprintf(fmt, ap); } =20 @@ -52,10 +54,12 @@ int qemu_printf(const char *fmt, ...) */ int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) { +#ifdef CONFIG_HMP if (!stream) { MonitorHMP *hmp =3D monitor_cur_hmp(); return hmp ? monitor_hmp_vprintf(hmp, fmt, ap) : -1; } +#endif return vfprintf(stream, fmt, ap); } =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907812; cv=none; d=zohomail.com; s=zohoarc; b=fUmziVTlLihLnVVnhPXgqBZ/k14NtGPb399VPHaBy3YqesGI4FpmKPxpARuJYihxHhlTV6b1FyC8y/86npLEIeMVp92X3Y6bimCE98/5CK/HmUNf1G3zgmbU+PvGqX6PY2O/TekMrWkbyanwuF9I9dYU7/U+zMyL7OTLL6tvjvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907812; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FLwgnSlKKMFuHc26/oQfXNw9b6Fj/UncUjHSA7gZHgI=; b=QnO/kk9BGKke4SpOzkR/33kk1OeYq3SN4wIK/D8C6HFfl7DFzKAcvNFh2afIdehlxLoH1TxDLIkn5VLutuouDQyAubCw3L8VTrugQ8V/r8RtrMIFB07X55DyRFB8Bf5JZyUx+zqkL2s+OsNn2MezEGS2izbIYnUEYA033gP2Bqs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907812697127.11836413646097; Sun, 16 Aug 2026 12:16:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgLF-0000yp-QQ; Sun, 16 Aug 2026 15:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgL6-0000im-7e for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgL1-00005J-4Q for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:10 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-278-heZxIm8dM2Cyh_6In4bZ-w-1; Sun, 16 Aug 2026 15:16:02 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B321195606C; Sun, 16 Aug 2026 19:16:01 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 37206197750F; Sun, 16 Aug 2026 19:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907765; 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=FLwgnSlKKMFuHc26/oQfXNw9b6Fj/UncUjHSA7gZHgI=; b=ZrMJzt56tNIHOUEjm60rslB4ZK8zI4TG6l72lQWr8nvv3UwY5AG657yX85t4KKZqJ4Y95j ojYT6yFH5hpP4in7XHreFnEZwrEsvOfrbkDyrVVOzQ3lCu/S0jjICdBVGuobYz7xW3+py9 u5A/R3St08HwJwdsiwcXSoKc1+a7c6E= X-MC-Unique: heZxIm8dM2Cyh_6In4bZ-w-1 X-Mimecast-MFC-AGG-ID: heZxIm8dM2Cyh_6In4bZ-w_1786907761 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:15 +0400 Subject: [PATCH v3 48/49] monitor: move HMP-specific to monitor-hmp-internal.h MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-48-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Dr. David Alan Gilbert" , Peter Xu , Fabiano Rosas , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=15341; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=bzckYqwXk+/d6tgi6ncL6jp0fJlBKKnsXP/akd8yT3A=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu1NZYrLxwDVHCfRM1So+VFV5kHueunI9BfS SYtEm0LyESJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtQAKCRDa6OEJdZac 5dyFD/9vAp5WOAaZEwNp6covCSQUk5PaVtUgp9IOHOw02ckkHtO2ZOfOiOndVaAexDq4WOjqs/t VChw8lZ4iBLPP87HXavy22SF6BRa0dYSBcuku8Lw01cJK6tG5Fri/ke/1bneGLD0YF/fUQynugR FvZkkJ3Qi85ZLvhpszAPlDIRuoPhrYj3Qpu21V5IBbJFYahYH3wOdMrWOR2UrhEq0IyKikSwrtU XMFFj5iKLMJInqSskIzW/CLs365c0rVZRLGrgySx3rciwAFh6rQEWVBgQEZK+BDOsfx388nyKCQ hjLZdq+MMNpfzbHCy6la0Q+5kM7pXk4I1e0L+rGvw9tNyX21tg/64D+042qHVyhPIQxTVtRxo84 hB1ALPEhv4nGtJv3WUyBThVVCrLJXlC03g5vqUhcMRpKl41qJIaiOgEXm2dtHhCXW/V3zWyeqXc dd+SD3q4Mf1RGmdZzv1NBpHz11LikIXnwOBfp1L6ewIvyBFmY7XgSSGQZgqxB3xNh15lqIbOA5N SJMgpFGXYkS+I8Fk7wrAGQW3vuldhiJ5FUpQbTS71o83XhTFIYHs8RMw4la8MGcC3QGKpKUIUej 1zCyJ9x0WXEPvN0CiiVYX94Bv4m0L9IKRWW9cvnvdUrI5j8W43DwHdCHh+UpvjlY/UiZavl77YT ejSTt413eJf1knQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907814623158500 Move HMP-specific declarations to its own CONFIG_HMP guarded header. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Dr. David Alan Gilbert --- include/monitor/hmp.h | 8 +++- migration/migration-hmp-cmds.c | 1 + monitor/hmp-cmds.c | 1 + monitor/hmp.c | 1 + monitor/monitor-hmp-internal.h | 106 +++++++++++++++++++++++++++++++++++++= ++++ monitor/monitor-internal.h | 99 -------------------------------------- monitor/monitor.c | 1 + monitor/qmp-cmds.c | 1 + stubs/monitor-core.c | 2 + stubs/monitor-internal.c | 2 + tests/unit/test-util-sockets.c | 2 - tools/qemu-vnc/stubs.c | 6 --- 12 files changed, 121 insertions(+), 109 deletions(-) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index f10bf83df86d..ef53e87f7608 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -21,6 +21,10 @@ #define TYPE_MONITOR_HMP "monitor-hmp" OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP); =20 +MonitorHMP *monitor_cur_hmp(void); + +#ifdef CONFIG_HMP + #define HMP_STUB(cmd) \ void hmp_##cmd(MonitorHMP *hmp, const QDict *qdict) \ { \ @@ -36,8 +40,6 @@ struct MonitorDef { void monitor_new_hmp(const char *id, const char *chardev_id, bool use_readline, Error **errp); =20 -MonitorHMP *monitor_cur_hmp(void); - int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); int monitor_hmp_printf(MonitorHMP *mon, const char *fmt, ...) G_GNUC_PRINT= F(2, 3); @@ -218,4 +220,6 @@ void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict= ); void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict); void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict); =20 +#endif /* CONFIG_HMP */ + #endif diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 6fe189471899..27b38d0e5f85 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -21,6 +21,7 @@ #include "monitor/hmp-completion.h" #include "monitor/monitor.h" #include "monitor/monitor-internal.h" +#include "monitor/monitor-hmp-internal.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 3ac70c3f1123..91701ddf331b 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -25,6 +25,7 @@ #include "monitor/hmp.h" #include "monitor/hmp-completion.h" #include "monitor/monitor-internal.h" +#include "monitor/monitor-hmp-internal.h" #include "monitor/qdev.h" #include "qapi/error.h" #include "qapi/qapi-commands-control.h" diff --git a/monitor/hmp.c b/monitor/hmp.c index e3fc05f521a8..488ec23937df 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -27,6 +27,7 @@ #include "hw/core/qdev.h" #include "hw/core/sysemu-cpu-ops.h" #include "monitor-internal.h" +#include "monitor-hmp-internal.h" #include "monitor/hmp.h" #include "qobject/qdict.h" #include "qobject/qnum.h" diff --git a/monitor/monitor-hmp-internal.h b/monitor/monitor-hmp-internal.h new file mode 100644 index 000000000000..4e2430551abf --- /dev/null +++ b/monitor/monitor-hmp-internal.h @@ -0,0 +1,106 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef MONITOR_HMP_INTERNAL_H +#define MONITOR_HMP_INTERNAL_H + +#ifdef CONFIG_HMP +#include "monitor/hmp.h" +/* + * Supported types: + * + * 'F' filename + * 'B' block device name + * 's' string (accept optional quote) + * 'S' it just appends the rest of the string (accept optional qu= ote) + * 'O' option string of the form NAME=3DVALUE,... + * parsed according to QemuOptsList given by its name + * Example: 'device:O' uses qemu_device_opts. + * Restriction: only lists with empty desc are supported + * TODO lift the restriction + * 'i' 32 bit integer + * 'l' target long (32 or 64 bit) + * 'M' Non-negative target long (32 or 64 bit), in user mode the + * value is multiplied by 2^20 (think Mebibyte) + * 'o' octets (aka bytes) + * user mode accepts an optional E, e, P, p, T, t, G, g, M, m, + * K, k suffix, which multiplies the value by 2^60 for suffix= es E + * and e, 2^50 for suffixes P and p, 2^40 for suffixes T and = t, + * 2^30 for suffixes G and g, 2^20 for M and m, 2^10 for K an= d k + * 'T' double + * user mode accepts an optional ms, us, ns suffix, + * which divides the value by 1e3, 1e6, 1e9, respectively + * '/' optional gdb-like print format (like "/10x") + * + * '?' optional type (for all types, except '/') + * '.' other form of optional type (for 'i' and 'l') + * 'b' boolean + * user mode accepts "on" or "off" + * '-' optional parameter (eg. '-f'); if followed by a 's', it + * specifies an optional string param (e.g. '-fs' allows '-f = foo') + * + */ + +typedef struct HMPCommand { + const char *name; + const char *args_type; + const char *params; + const char *help; + const char *flags; /* p=3Dpreconfig */ + void (*cmd)(MonitorHMP *hmp, const QDict *qdict); + /* + * If implementing a command that takes no arguments and simply + * prints formatted data, then leave @cmd NULL, and then set + * @cmd_info_hrt to the corresponding QMP handler that returns + * the formatted text. + */ + HumanReadableText *(*cmd_info_hrt)(Error **errp); + /* + * @sub_table is a list of 2nd level of commands. If it does not exist, + * cmd should be used. If it exists, sub_table[?].cmd should be + * used, and cmd of 1st level plays the role of help function. + */ + struct HMPCommand *sub_table; + void (*command_completion)(ReadLineState *rs, int nb_args, const char = *str); + + /* Keep non-pointer data at the end to minimize holes. */ + + /** + * @arch_bitmask: bitmask of QEMU_ARCH_* constants + * Allow to restrict the command for a particular set of + * target architectures. + */ + uint32_t arch_bitmask; + bool coroutine; +} HMPCommand; + +struct MonitorHMPClass { + MonitorClass parent_class; +}; + +struct MonitorHMP { + Monitor parent_obj; + bool use_readline; + /* + * State used only in the thread "owning" the monitor. + * This is currently always the main thread, since + * HMP does not allow use of the I/O thread at this time. + * These members can be safely accessed without locks. + */ + ReadLineState *rs; + char *mon_cpu_path; + int reset_seen; +}; + +int monitor_hmp_set_cpu(MonitorHMP *hmp, int cpu_index); +void handle_hmp_command(MonitorHMP *hmp, const char *cmdline); +int hmp_compare_cmd(const char *name, const char *list); + +/* + * hmp_cmds_for_target: Return array of HMPCommand entries + * + * If @info_command is true, return the particular 'info foo' commands arr= ay. + */ +HMPCommand *hmp_cmds_for_target(bool info_command); + +#endif /* CONFIG_HMP */ +#endif diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index c198c12eaa00..822a66d06d00 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -27,7 +27,6 @@ =20 #include "chardev/char-fe.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" #include "qapi/qapi-emit-events.h" #include "qapi/qapi-types-control.h" #include "qapi/qapi-types-qom.h" @@ -36,75 +35,6 @@ #include "qemu/readline.h" #include "system/iothread.h" =20 -/* - * Supported types: - * - * 'F' filename - * 'B' block device name - * 's' string (accept optional quote) - * 'S' it just appends the rest of the string (accept optional qu= ote) - * 'O' option string of the form NAME=3DVALUE,... - * parsed according to QemuOptsList given by its name - * Example: 'device:O' uses qemu_device_opts. - * Restriction: only lists with empty desc are supported - * TODO lift the restriction - * 'i' 32 bit integer - * 'l' target long (32 or 64 bit) - * 'M' Non-negative target long (32 or 64 bit), in user mode the - * value is multiplied by 2^20 (think Mebibyte) - * 'o' octets (aka bytes) - * user mode accepts an optional E, e, P, p, T, t, G, g, M, m, - * K, k suffix, which multiplies the value by 2^60 for suffix= es E - * and e, 2^50 for suffixes P and p, 2^40 for suffixes T and = t, - * 2^30 for suffixes G and g, 2^20 for M and m, 2^10 for K an= d k - * 'T' double - * user mode accepts an optional ms, us, ns suffix, - * which divides the value by 1e3, 1e6, 1e9, respectively - * '/' optional gdb-like print format (like "/10x") - * - * '?' optional type (for all types, except '/') - * '.' other form of optional type (for 'i' and 'l') - * 'b' boolean - * user mode accepts "on" or "off" - * '-' optional parameter (eg. '-f'); if followed by a 's', it - * specifies an optional string param (e.g. '-fs' allows '-f = foo') - * - */ - -typedef struct HMPCommand { - const char *name; - const char *args_type; - const char *params; - const char *help; - const char *flags; /* p=3Dpreconfig */ - void (*cmd)(MonitorHMP *mon, const QDict *qdict); - /* - * If implementing a command that takes no arguments and simply - * prints formatted data, then leave @cmd NULL, and then set - * @cmd_info_hrt to the corresponding QMP handler that returns - * the formatted text. - */ - HumanReadableText *(*cmd_info_hrt)(Error **errp); - /* - * @sub_table is a list of 2nd level of commands. If it does not exist, - * cmd should be used. If it exists, sub_table[?].cmd should be - * used, and cmd of 1st level plays the role of help function. - */ - struct HMPCommand *sub_table; - void (*command_completion)(ReadLineState *rs, int nb_args, const char = *str); - - /* Keep non-pointer data at the end to minimize holes. */ - - /** - * @arch_bitmask: bitmask of QEMU_ARCH_* constants - * Allow to restrict the command for a particular set of - * target architectures. - */ - uint32_t arch_bitmask; - bool coroutine; -} HMPCommand; - - struct MonitorClass { ObjectClass parent_class; =20 @@ -149,24 +79,6 @@ struct Monitor { int mux_out; }; =20 -struct MonitorHMPClass { - MonitorClass parent_class; -}; - -struct MonitorHMP { - Monitor parent_obj; - bool use_readline; - /* - * State used only in the thread "owning" the monitor. - * This is currently always the main thread, since - * HMP does not allow use of the I/O thread at this time. - * These members can be safely accessed without locks. - */ - ReadLineState *rs; - char *mon_cpu_path; - int reset_seen; -}; - struct MonitorQMPClass { MonitorClass parent_class; }; @@ -209,21 +121,10 @@ int monitor_can_read(void *opaque); void monitor_cancel_out_watch(Monitor *mon); void monitor_list_append(Monitor *mon); void monitor_fdsets_cleanup(void); -int monitor_hmp_set_cpu(MonitorHMP *mon, int cpu_index); =20 void qmp_send_response(MonitorQMP *mon, const QDict *rsp); void monitor_data_destroy_qmp(MonitorQMP *mon); void coroutine_fn monitor_qmp_dispatcher_co(void *data); void qmp_dispatcher_co_wake(void); =20 -void handle_hmp_command(MonitorHMP *hmp, const char *cmdline); -int hmp_compare_cmd(const char *name, const char *list); - -/* - * hmp_cmds_for_target: Return array of HMPCommand entries - * - * If @info_command is true, return the particular 'info foo' commands arr= ay. - */ -HMPCommand *hmp_cmds_for_target(bool info_command); - #endif diff --git a/monitor/monitor.c b/monitor/monitor.c index 7979cd1cbcfd..6ba06280e023 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "monitor-internal.h" +#include "monitor-hmp-internal.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" #include "qapi/qapi-emit-events.h" diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index c9f24febdc96..7525a88e0494 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" #include "qemu/sockets.h" #include "monitor-internal.h" +#include "monitor-hmp-internal.h" #include "monitor/qdev.h" #include "monitor/qmp-helpers.h" #include "system/system.h" diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index 0e74d78d52e4..8dfd46d2a8a3 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { /* @@ -17,3 +18,4 @@ int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt,= va_list ap) } return -1; } +#endif diff --git a/stubs/monitor-internal.c b/stubs/monitor-internal.c index 6f69f1f14ae4..4483ca25557f 100644 --- a/stubs/monitor-internal.c +++ b/stubs/monitor-internal.c @@ -8,8 +8,10 @@ int monitor_get_fd(Monitor *mon, const char *name, Error *= *errp) return -1; } =20 +#ifdef CONFIG_HMP void monitor_new_hmp(const char *id, const char *chardev_id, bool use_readline, Error **errp) { g_assert_not_reached(); } +#endif diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index 530a3fee3c13..006f5e579c6b 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -24,7 +24,6 @@ #include "qapi/error.h" #include "socket-helpers.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" =20 static void test_fd_is_socket_bad(void) { @@ -75,7 +74,6 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Erro= r **errp) */ Monitor *monitor_cur(void) { return cur_mon; } Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } -int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { ab= ort(); } =20 #ifndef _WIN32 static void test_socket_fd_pass_name_good(void) diff --git a/tools/qemu-vnc/stubs.c b/tools/qemu-vnc/stubs.c index 0aa50a901d37..1e4c14913b56 100644 --- a/tools/qemu-vnc/stubs.c +++ b/tools/qemu-vnc/stubs.c @@ -9,7 +9,6 @@ #include "system/runstate.h" #include "hw/core/qdev.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" #include "migration/vmstate.h" =20 bool runstate_is_running(void) @@ -42,11 +41,6 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) return NULL; } =20 -int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) -{ - return -1; -} - /* * Link-time stubs for VMState symbols referenced by VNC code. * The standalone binary never performs migration, so these are --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Mon Sep 28 00:33:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1786907920; cv=none; d=zohomail.com; s=zohoarc; b=OEyTTsvWA6NotoZ2VaDvo/aSGNnME9wFDtw5Hsd0fG00HWFoC4hxmAeJprqpl9obuCQ4kBpIlGz0aFt6urOu3eIA249Sfk0oLdD6/MqLG1bl4GwU260BYI/DQc6GEAbqLBbxwIU73ito8KW1gbf0MdtPE5bhIFD11/fF9LoCblg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786907920; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YAFwmbIv/8Iz1PvzfVdH8TCC2X8FuwRSRiP92lMbPeE=; b=edTiZ4yJDfcc0hk1HL0wefPSR+IQi+A3ZCcAcieANycxXC7TZ2sMNyTYP1WJGvnuvJXRvHIol07b8zb2qrPQss3vNhxbZCxdQQk2cdROQIW2ToHfNyWbMhJvpHkpghDz6+mh52s7MTHzAdncLwJsCvJV1yYC/d947bJpzUNtfGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786907920745696.5173089637112; Sun, 16 Aug 2026 12:18:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wvgLH-00018T-2V; Sun, 16 Aug 2026 15:16:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgL6-0000io-8p for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wvgL3-00006g-Lk for qemu-devel@nongnu.org; Sun, 16 Aug 2026 15:16:10 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-UqelhnB7MxOdD1yXVfcE_g-1; Sun, 16 Aug 2026 15:16:05 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 968761956089; Sun, 16 Aug 2026 19:16:04 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C94C218005BB; Sun, 16 Aug 2026 19:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786907769; 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=YAFwmbIv/8Iz1PvzfVdH8TCC2X8FuwRSRiP92lMbPeE=; b=h6unS1499TH9XzAtJmTFDnzfsxm5ZLu1nYDJ3hly7eyNCbaRJdmvu8PtsV18a8ciPPbvJK inx7u+Xoc8lxnjgUt01onJguyBmILjhckj3kLGyP3sRsU2ibsXPmZPTG+crf5apah+iRsw +m6ML7PxPJCGDArGdaiVln9Re9+itd4= X-MC-Unique: UqelhnB7MxOdD1yXVfcE_g-1 X-Mimecast-MFC-AGG-ID: UqelhnB7MxOdD1yXVfcE_g_1786907764 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sun, 16 Aug 2026 23:13:16 +0400 Subject: [PATCH v3 49/49] gitlab: --disable-hmp in build-without-defaults MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260816-qemu-no-hmp-v3-49-e53fc35bc550@redhat.com> References: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> In-Reply-To: <20260816-qemu-no-hmp-v3-0-e53fc35bc550@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=664; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2PfBfGSrrAVwhOfSkL4rieqVo4dBCVB2xaPbnEs7CSI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqggu1xDxrrCWP3i4FCWHEmtG6XbfTMC/AfE40f Qw45OP9xQGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaoILtQAKCRDa6OEJdZac 5bylD/0dfJVLen+x8Bv/ccYc3Oc3oH557hixw7fsuEM0C6lLcPjz11/tF571ajYvnamTJB/aanO aJTtfsMaZbRTSOgzTDgwD+N4TeIDvxI1X4Z4kucHmzrd+F2TQ2HJOYetfaLyJlab8M2lv849YH2 kfpVKwD/aPcIJsUB0bTSsPLAGq+3ad0kNL6WnFF+IcVhx4QBthtC/MAbQJs4dBaaFL1dQvOHEEK rRR6Sh4nS5g+wJEchu9QNDkf1mnc2bo2UmoHrPcP++6ZEg2AC4/O5SsXY3fDPfSj5BdjCC4iYCO k6bVYhlNflUQwa50/EsGwIhGXmdm77lwPSTUHrZyrFI+3wrJ38CvI56GP6boeNj7i8tNJu+FhnK iohbwGAOB0HGo2rxnkRRKm8wRcocrrqh6oI00laWLrINDO7HufaafR2DcjGOZ3hdGKVWDnnWdow QJZxRWRXuO4jfXqoycjIfwB+uYR2ZwyR8pRXcxVgtRsRtzII0irnVBsqEJCfOcfDKPE3fskywd/ oMeWtknv3RGjlzEWkn31FMUgN8XUzxRkVQ9PJufvwYSemjEx1A4CaDJVyIceaDadTekDDEXbqpn DltpoXKTh0zgyaUml4kpTjmx1kzwk0/f+nVhODvlj1GxspVLT5Hh/AOuHOrAksqJAGqnEZeRyW/ UY2vKLExTb+NOPg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 9 X-Spam_score: 0.9 X-Spam_bar: / X-Spam_report: (0.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.342, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1786907922803158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- .gitlab-ci.d/buildtest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 831d9a267425..5f21703645b3 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -673,6 +673,7 @@ build-without-defaults: --disable-pie --disable-qom-cast-debug --disable-strip + --disable-hmp --target-list-exclude=3Daarch64-softmmu,mips64-softmmu,mipsel-softmm= u,ppc64-softmmu,sh4el-softmmu,xtensa-softmmu,x86_64-softmmu MAKE_CHECK_ARGS: check =20 --=20 2.55.0.543.g5ebe2ebe4ea8