From nobody Sat Sep 26 23:03:02 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=1787949739; cv=none; d=zohomail.com; s=zohoarc; b=i6gRFvkGdQIpqAGYM5XIAO6lAp2qtUnItngelAVmSADc7Hk0eiyzr4GdQkLmsOp8EGjRBjggNoyBRNblAQfTlwWYlkwuZVVehyeTVj29n5gMnF3Xr7ZcI1xIhcd9dQ3AfMKi8vacT8QST1uZCbWGwIL16eg9ieYktAU8P1iukzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949739; 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=38No7Zvu4JWoxS/YQOai+qQNR3oeuIyfmWZ/pcMVApE=; b=OU+lPQkDoesDpFtvdSq+EM2u3HVEfiQQdXNcwC5N/G3yc0+mgsDTDzenUFzS44RZEIjmv/YydRiaw34JX8WrWvl/tyctuqEUlu2OOUzWZ53pAFA2A6V7dU8DlW0JMMjor3A162lmwGEofO0zCLUVqQwnEc7jROPO4GoB4xo0RIU= 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 1787949739501365.8487283360563; Fri, 28 Aug 2026 13:42:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Ow-0004Sx-49; Fri, 28 Aug 2026 16:42: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 1x03Ou-0004Om-8s for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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 1x03Os-0007xt-RF for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:12 -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-665-QIvqBisEMXqVIjDgZqgW0Q-1; Fri, 28 Aug 2026 16:42:06 -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 5DAFD1944F2C; Fri, 28 Aug 2026 20:42:05 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1DC547D9; Fri, 28 Aug 2026 20:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949729; 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=38No7Zvu4JWoxS/YQOai+qQNR3oeuIyfmWZ/pcMVApE=; b=Y33UNEyiXO1zjX3hJc3ripp0hTDBGdGYWIVbzcle0S+7800rjIV/xnqv7QrJvhbwaAo1Y/ aKpFxO7oIBfmVSwQnj8y8QzAqTnZX+QXmS2Recj88GN1SBKmjN4Npb+RYOZJV0oukCXBcQ Kzq5yGXVBSHi57C8oPga1P9xEq4Xg+k= X-MC-Unique: QIvqBisEMXqVIjDgZqgW0Q-1 X-Mimecast-MFC-AGG-ID: QIvqBisEMXqVIjDgZqgW0Q_1787949725 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:40 +0400 Subject: [GIT PULL 01/50] build-sys: introduce CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-1-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=1187; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=BYyQJVJWcRkVuP3sEmH0oMRFSR4xiTQ6caIPo7oXJmM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKT/93uzA8yuBw2zJ39gafvicIDtUpYgaKcD 3LcDmV/3XKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5Y3OD/9VdvpwN8lKMCuRGeytVPD0HxKvsCnK3yKUqbAPyFW/p63jPj2EdpLxKALETvANbDEcRbc jbNAx8mCtwCproXjF5bevTDecHhKuxwH+X32VhhNt6PkG4Gtw/u782nOjp3kOJBt2ENESpZxJ+1 1znTDPWJfKfPWyp4jFIENgnRTcF0cYU11RehUiqYCVHRN1u4TTLTZLmbKAB4unnJfOayFkXzUoU Gya36ATAR1wlFwOJsjkEDz6e6FQNckKFh3LqsTGUBW2t5sid3yI2bMnT2GRm/LcIWAAy6lM2+cR 45U27mtCxpnStpPCUtgT0KhoVckHjq/0SBB7wICEW3eZXtmAlrMdJyRfwnJqBfuxfLZ2X8o68Y7 ebBf8vpaHHr897ASjR8nXSZPGl+D0sM/mdaznQ37XTmymqFoT08sNIPhCh4nm64agFtu3a2fQzJ KeWpXUL+buOlC9nq/oyRqzFF+c1zE3yGJUqSBoekOwHijNViD85OBZvk6a1fWi+K2VYf7P1PImk vsxW9NVKe/tYbnTRq6G02X40urH0AquV5BiQW1vq/n7UKN0ZuzuuZ5t+y1xRNBQVfhqajMH8ia6 1J126qHKa6lv8/wX6EDspgplJPsRfA19SQk1JhTtMOr1vga5KY0eS65NaWp9jxqFWY6K45dQipn NsZuV9yrxq2n9lg== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949741728154100 Introduce a config define to mark regions that should be compiled out or disabeld when CONFIG_HMP is off. The actual meson configuration option is introduced later, as for now, only "true" is supported. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-1-9227de146347@redhat.com> --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 6dcfdceb507d..aca56813ab8c 100644 --- a/meson.build +++ b/meson.build @@ -243,6 +243,7 @@ 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 true have_tools =3D get_option('tools') \ .disable_auto_if(not have_system) \ .allowed() @@ -2266,6 +2267,7 @@ endif =20 config_host_data =3D configuration_data() =20 +config_host_data.set('CONFIG_HMP', have_hmp) config_host_data.set('CONFIG_HAVE_RUST', have_rust) audio_drivers_selected =3D [] if have_system --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 23:03:02 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=1787949744; cv=none; d=zohomail.com; s=zohoarc; b=H7elrHq0vxLUH9VktWnTVFheKxz1x/Btj4Hq/ioByxYL2JvNWaefgV/SMZVZe4DEORi4n/qJBnJZ1Kgz7ZNmm1UH0SIBUFVCkjiNZpG33HzUcHMA6z/ojY0n0Acry+qO1SzyLsw4YqnNEqvO8k2qFGQ2CfMb4Urenx49Ns+7pQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949744; 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=08qxR8qEWvPdNTDRrzBPsumwdfrzNrJ4768tkoehZiM=; b=Vh/sgYd5NIjEKemet05CWKCxL6uJ2VHIww9hZPI3L2UuU+pd2bTfYxDcEGjhAMuxHwa4Dcndvx8H7ogLUvifTsgaWsfC+2BAruFKc0UilscIKIUwfjE3/j9Zs1Es+oe0lvh6dcehEhVASj4HfbxZy3VPx8SFupQFfAAcTVM2kdM= 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 1787949744828209.7451316053315; Fri, 28 Aug 2026 13:42:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03P4-0004c3-ST; Fri, 28 Aug 2026 16:42: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 1x03Ox-0004U5-SZ for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:15 -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 1x03Ow-0007yp-Fz for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:15 -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-621-fzgTAIWVOdCHmtzu4kCj6g-1; Fri, 28 Aug 2026 16:42: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 0638A18C0FB9; Fri, 28 Aug 2026 20:42:09 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 375F140E; Fri, 28 Aug 2026 20:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949733; 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=08qxR8qEWvPdNTDRrzBPsumwdfrzNrJ4768tkoehZiM=; b=Wy4LYDvlCtJ7mJSvF6Rff2SldEfLt7LQu2My7qypTQSqmaIzZFnlgac+OSxecDOnG9ZeXr rZM6sgQzqvwLC3Rd96v+f6GwsaPUns25VPdc7kqrrYoe1WwsaTTeLg3t4aScKU/eFa9wi0 hJqcPonh3l90zB7qoBOelwUHMFkPxLQ= X-MC-Unique: fzgTAIWVOdCHmtzu4kCj6g-1 X-Mimecast-MFC-AGG-ID: fzgTAIWVOdCHmtzu4kCj6g_1787949729 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:41 +0400 Subject: [GIT PULL 02/50] vl: fix -monitor none prefix matching MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-2-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=1002; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ng42cmSmqYMl5lkPkvXmAXL7nRbtrSSPGEtfn8S/2AY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKTxl98m6hyruwo/dM/W1fn7+Jqw93x6fg7U m3LTvTmnFuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5TBmD/9EbVQd2MaqSltLyhXYkwe0L1sHffAUYWs0NkXYlj91i2yjiT3/HjlH5D0TNUFm1YyJmg+ /yO2Kf4yihxMUbr2b/Env4ddDtC/T85ai3g3FT+k51Rjj9hFvUJBIGaJSOOBN3R6+4RC2VTh3vA ZKfmZO3NDTTAqOtyGpgHEpUb0P1DLH/SJBb4A9SvEC4BEge8L57pcMgl6Hk9Bmp8PH0eqTQ6MiC A7+V6nhw1/kVdKAa0P5AhTpb4aQFNDhj1azT0oscmvWCVfOrsRHUXoMYAi0xeFjqmQUX9SbCcyw V5dPOV7xgA7oeYv9unIXdT8uSyogWHt/YDcaRvV+oucUiVA/hoARV+hKDbykYFHAuj9s/EUeG+s 2ZIaj+K5cEclQ65rCLOtBa2UGGZ7AWqNuMeVzWCPpivLLMAI4eD4XGe+60EAN6bSkldqVuZHKrz Ez2M5sF1C6cXM/Su2L3drksfg76TkmyDLgJPOI2MZKqmENAFZDI6IiB8SZjDlV5/pcFAO6G5szc aGByWNxZ6w49wUOjEJASe2cPLXuviiHqULcFqz7RoaSzR0DV3LsAvgHvs7cB0Z2r+/dJw5Smw6C NtacfKt/r0wMgTdtHjrAsGhprB8O5ZtVOqlGUxeTqec5S3rvzXhj75CahjU/B7imWalSV0WRFuK cZia0NvGUKB2XWg== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949747207158501 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 Message-ID: <20260828-qemu-no-hmp-v5-2-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949778; cv=none; d=zohomail.com; s=zohoarc; b=am4OhxTU+4HkFTsH80Qbh4bS+t4Fv2/AiBN4hMbD5EkCYgOOGzB0fPzSYSGO7bvX+kGUYtT85huUVY7C1i11tvzfls71hiQnMJrrJOQjf4O/aC6QMnZ/+MbxEkpaPFZueiMAFAYJN94DDfQt2czFHnpNEqEYpjQ8Rg2D41eNwcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949778; 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=2nPTopix6d5kW8UuI4pehCE3kYuo9r6YvCWI9U0lNcc=; b=DUOg06OU32qS2eDO3IHl+iWlWbAE8DIsj4kImLg3S9/HzvW5EVrjcfnu1MiJnXZlDqyO0TIJHGYBlb67CRfAhMAtNYjSycAhOj5F5osPFWyIlPTN66pBlHUIJ7I8Ui32xww+KjEkwOtBUXtMvvvls+JDdhzwjxivX467+giBUxQ= 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 1787949778509284.13671806770276; Fri, 28 Aug 2026 13:42:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03P8-0004r7-1d; Fri, 28 Aug 2026 16:42: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 1x03P4-0004ZL-0k for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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 1x03P2-0007za-6E for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:21 -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-17mO-0pNObm9LJVZVVTrPw-1; Fri, 28 Aug 2026 16:42:13 -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 5F49518C0FBD; Fri, 28 Aug 2026 20:42:12 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 86C9F1955F0D; Fri, 28 Aug 2026 20:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949738; 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=2nPTopix6d5kW8UuI4pehCE3kYuo9r6YvCWI9U0lNcc=; b=ax90URNkz3FlOnEYKEK6rEWbaS/SSuZR6JfiAKtA1E6B+rAWLOBdMZA+8420QSNzj/YOF0 PDBsYJtTIe94NqkECNQ1S9ykjQ6duIpyNP5IrLX0atFG9CzBvWeM0zOgmCjbuLQMMo24i1 trzXWkZzFO3V2VMwFCzbLv5y/n2QUeA= X-MC-Unique: 17mO-0pNObm9LJVZVVTrPw-1 X-Mimecast-MFC-AGG-ID: 17mO-0pNObm9LJVZVVTrPw_1787949732 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:42 +0400 Subject: [GIT PULL 03/50] 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: <20260829-nohmp-v1-3-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" X-Developer-Signature: v=1; a=openpgp-sha256; l=1878; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=cESNmYJbGu1w48oPJkUcdj5xdrhS7MFa4BAqq2pmWUQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKT29+ZuhMXnKM7AvhSwML0VvK0czU6v6hTu +Z35L/PyVCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5V9PD/9vCq9X5EPQqWH1WcSrAvRvClL+9bzTFZR+jsuufpvOo64xnvxwK1y5FFnIFMaf56G4YgC SOjOG8ELQ2Cj0gTti2JieJMZkQ3JJMckiAPzwSTo4tN1Pr2JP1Gk986pVhNxB6dgJrvugQ/WBMS BjrgId+G3A22fkZn0wipe2gNgwl3hilsz1mTZFHO7r7dLpLIZukTqUrVom7wHlx0rrbxX8opf7B xfs6+hSo0xiM8ANjGwrINWCtxsoq/Kx+5dXiSts9MRVDi0pGIZuyzgQ7Nj+WXCv/Hj48ROuWT03 8gBcsprmbW39w2PqKxUzvCWrOJ0vBIhAybH2Zse5RXuwALnYKoBXJDLXuaSeLgLvejF+C/bcUBq I21iyOrC8t0oUP3+8pbYnB0FY+Zq3vOz8EuDnua7YhpbaZMRCJNKHgQix7ahx6CyjBcYdVpuNcs lRSJTTz9wDwKdpLzhGHPmVPl4eqMlRFzkDbdkQOkgyeQdSHspSYEo9vyL+gOWNlcmiZxMOcwdfB ag159mmAUgj0oHbTwVYF7cSIeqAdHTzlEjqgvgKeW3ZUxtpyAye34EiGN38TG7OzmNbTzgJxQy7 T7NjV86Y72V/0LAY46jqYB/kte2qJlXGMmHePu07C14pos4t1vmUTYoqfMhz6zErq+i5sKS+mMa IDoOq0hBodHNHhA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949779318158500 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 Message-ID: <20260828-qemu-no-hmp-v5-3-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949778; cv=none; d=zohomail.com; s=zohoarc; b=H4S6703cFZTY7yzFhngjL9N/98EPDHzHu20XQSdxl/P64P+KTfPN7/4Dqe+tICBQLpaGIx8Cf6SGGVVGBqVlE+312BKW5MsjuK++B5BwbY/mPFtvlo0cWEWwbg/mcyA0bWmO4jVpn1lRggpA+Crabwuxubm1f/3u3zltMAq3YWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949778; 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=5vRP+Aq6lVWE96YKHRw80RmYs6AY3X3ryNOwxTY68vI=; b=FDEbnvkvOXpGF5KgO9KfV/joykC/v5jarlYkSD9zF6U4hdL+oEx2iMKg5nNzeKpXyf1fSeagUwp+HR7wHd88VjDzonxJ26tguKZXHw4GS6JMOmMVaq4his9aQiBgyWOJs7hMrz2yiKLYHlNVP67w1yJm6thK2zYWzB3VbEjUi2U= 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 1787949778110661.1177245298026; Fri, 28 Aug 2026 13:42:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03P6-0004nO-7p; Fri, 28 Aug 2026 16:42: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 1x03P4-0004ZK-0N for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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 1x03P2-0007zm-67 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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-392-KZsWYxp1N4Oowm-kHbR08A-1; Fri, 28 Aug 2026 16:42:17 -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 062D81953989; Fri, 28 Aug 2026 20:42:16 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1F38F7D9; Fri, 28 Aug 2026 20:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949738; 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=5vRP+Aq6lVWE96YKHRw80RmYs6AY3X3ryNOwxTY68vI=; b=SE/To8ExZElZyncoftOXRmIJoyEZaIK7jpMue6YHXcOZB7hB2NGcaLPzv+Wt1jft20zd5s +iWi+OJxlsC9bCNbMdPJrfT1juStYZ1AiV2AjpydszX1SkTPD7DjLA9jTEF/N6tWnKGV+m 6tq9LYWvyEvymTmksW/8YttSdPU75r4= X-MC-Unique: KZsWYxp1N4Oowm-kHbR08A-1 X-Mimecast-MFC-AGG-ID: KZsWYxp1N4Oowm-kHbR08A_1787949736 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:43 +0400 Subject: [GIT PULL 04/50] hmp: fix snapshot_blkdev argument type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-4-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , "Dr. David Alan Gilbert" , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2401; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2Yl1qvF97VSURfIeX++TpwNxuBv2vtAIEWxtiY2E3oQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKT96N3HRDg8fe9LdoQQ0jk8yOldD5pArHgV G4Tt6sjt2OJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5UmOEACQZfefX7ADaMZeWXY2vQZooOdHf90gmctqzDJkRO5q/CiUnR/rCUmC/Y1wAWhgbZ6F0PE dOn0woLO8+GVj1WegS7ahdEfpLWu7bKR1v2u54LusxqlFwR9dDoxBVX222KOdKBSk5ahMSdpxid RdTH3IDpq64dWXzJOKTcoFEatHoAUNP3lPXwDnx4s+4hh/yFSt79MjteANoO2Dpnp/s5uZAA+Ja hGpZStl8soTVAnAt1PhOLUCKNkiceexYZuHrD47wtgPT3+T6AWBpCBayr6LLmg8XsvYbNFQ8TBN fTSMunOxNidqCvb2sFigD6fhDCM5LBQGh2y4UHQQ3s0zsXvabUfY+0RbpLvAQ9DP+uH2YP5VYYS D1AYKAT7u8ieIFkWIwVcpfe0pkdGcMx7pCFwRc8S+jLdJ7+CFlGdMypsb54lS2b0AroSbMyYJ5m oHdzL5dHQfB0XmiuyAYm1xYGB+dtVmvAJ2k4Vo/9hFd/SIbzqsQ/MczXg281c1PSSkieRPXunMk a4z61vICqZDnSGUAkWnxdLnQyPAVUizqvdaks1Eo77pkYDf9gN2HMmzuE9jmCAXnPZPRW+TdjNu IkR38GTUIQP+sy2mlLmrNbLhHktLuk9nI9oScd5b+x78kQzwawk6pAWwLpn1zo+By9XuP6uyNVp ZG6D/+kZw/KFefw== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949780407154100 The `snapshot-file` argument for `snapshot_blkdev` is mandatory. Correct the `args_type` definition to reflect this. Fixes: 6106e2492fe ("qapi: Convert blockdev_snapshot_sync") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-4-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949779; cv=none; d=zohomail.com; s=zohoarc; b=hhh2g5k7udgUQ8DIZjRpojKIfEASfHL++pokgxAWZ/L02GF5aNtkQlntBExjDGb82vqW2mn4R/p69KC8JtdmRUP3MJo1DXnPd1uEr1glr1g/Z37EprxVGp+TkxEobVGxuw5o89dY4zKycnhm5FS8q3YmuV14+OEyvphWQZPjfhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949779; 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=071kNyikPxcRwXnSO/+N/hrvHwkRoUJmuVL0nivmDSU=; b=dmrP+qK4lOpTYJ4WGgfWrXsONgGsad/ONaaEWta/golJG6yg+AjY82DwY5cK0kO45awvDfZg645UfcATMCl6igwka3stD64oqGeB7N/cOzeAhH16BFRqklFk8JefM+iW2CBxPdNkqmhbFyj0pPcKkjYt3L3txlsSrAn02jwyeAo= 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 1787949779549494.4403490314968; Fri, 28 Aug 2026 13:42:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03PF-00057W-I7; Fri, 28 Aug 2026 16:42: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 1x03PA-0004tU-Uq for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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 1x03P9-00081H-95 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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-400-_N1u2NbIMBG_1pvHkayMzg-1; Fri, 28 Aug 2026 16:42:20 -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 1B71D19560A6; Fri, 28 Aug 2026 20:42:19 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3DEAD1955F0A; Fri, 28 Aug 2026 20:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949745; 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=071kNyikPxcRwXnSO/+N/hrvHwkRoUJmuVL0nivmDSU=; b=a72+KADxArIgzPxcSxvXuPXb22yCwpBPjs9rNW/cyC5cZTl/NszH+biQTlZpXaiYQsjIUi soxNzfPsHWfVZwblB7KEnbn1tg32m8Jx81sDiRQw5NgAe0Bx1mBywl/rFGaiR3lNaUXQ1q vi/xfqoouVApc63MlYXVLVfrkfYQqd8= X-MC-Unique: _N1u2NbIMBG_1pvHkayMzg-1 X-Mimecast-MFC-AGG-ID: _N1u2NbIMBG_1pvHkayMzg_1787949739 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:44 +0400 Subject: [GIT PULL 05/50] 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: <20260829-nohmp-v1-5-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , Zhao Liu , Marcelo Tosatti , kvm@vger.kernel.org X-Developer-Signature: v=1; a=openpgp-sha256; l=7714; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=nOJnOaPsRf5ousxaGgCohTqJztZDbIQcK39+A3eyZAI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKTfp3gaBPNf8K4uLGNwMI8utxrhSHgAC1nJ KxGc6UDeCaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5Qc0D/9zd+I364DVwayu+gr2a07Zg05VOAW4UZImEb1w6D6DMK/XBKjhmjYwgPqOOemaA8w9XSg Zovj1NO4letZ2vsc5h20k6IizyX1l67x/EDPHMKTBhtMjPNLFpYyTLfS0NgqnSlsiQk6dK5J2MU ofqeVc07sM2hVojqk0OR/Koc5ZKFyGkMY3TB05mWfPNAJnbnmof8Lt/pVaC/gub4tNnrEN9cA80 SqogS5i1TTYaHkcZjWl3VINlYLsn8XD/49YUgQwMnM1PGpPFgXTKs8EAO84MkFYG/65qHLBbzS/ V9aVAxhNVB5WsaMsCWCoGnD7B2upgRX1O3TNHatFoCE95yV6K1WdpJ8nlbcMUeTsXhLKb6CdZQq iJJQo96jftTkEwP3Ub95l39xPWeUI26HJ8/xZfciKDj4qxXC2HscsX5PB3DO/bZNpoyI0uEoNi0 QmT5LpkyBbXYCous4QeFywzyP7V6Z/kP/Q/wSVoGt0+Ku1THCiVsaSjPX7L3yBao4H5wLeXV1HU 5zXw4TD8Ubc3GBwqMAHJse2+1lSiZtTxQQUNcP/QY8ntkFxfwkHWWkBQuTnZrMYPxQtfZuzpVMs 1HweKyx1fkPZaKxLTz8sNO3vKAntjwI6jWbhI4wbbaRu3N7gy+0nhrvb3ljjki+diz32LBU2e3Y U2CKxzv/BVVmuXA== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949782131154100 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 Message-ID: <20260828-qemu-no-hmp-v5-5-9227de146347@redhat.com> --- 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 641f3ee5c2fd..dc5047cfb25a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2859,9 +2859,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 Sat Sep 26 23:03:02 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=1787949884; cv=none; d=zohomail.com; s=zohoarc; b=iikfdMa/YofaPEKq34SlBZR2xNoZmLt+c2EtPLv9M6JkZnYeMonU2Pz308Bfl7ARWF5lP4kiJFAiIfnm9cQoQ318sg0LzzSXXmaZHol+ClYU73J9nmy7dN2Pz2C8GKhem/nvczOCr9ntEsP6dtI0WOpHX96D41m6VTm3Iw98hwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949884; 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=BH342i7ovU6fuSWv8VZMyWgs9nCmCum2lZ7GYnWp7ko=; b=ilv1aJ0i6gOQC2x7evT5d1nPPA6qMjVY95aG7RGYnpQJb/Z1a3RJCeNdlaFne9LUrZboDryaOGjxvFTQTvta3rNPo2CLhtn99+5I7SfIXkAV02meEfHas4MibHrB66psg7m9XPU+JDqCcRFsdgbIB+xrowOjPJ2XOrLg5EOOdHM= 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 1787949884010456.94803615909416; Fri, 28 Aug 2026 13:44:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03PE-0004zB-74; Fri, 28 Aug 2026 16:42:32 -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 1x03P9-0004st-Fv for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:27 -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 1x03P7-000817-VL for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:27 -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-632-b-gvuYlqP6uFmS9La_ZU6w-1; Fri, 28 Aug 2026 16:42:23 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8AFE31802579; Fri, 28 Aug 2026 20:42:22 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A65673001D3E; Fri, 28 Aug 2026 20:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949745; 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=BH342i7ovU6fuSWv8VZMyWgs9nCmCum2lZ7GYnWp7ko=; b=a4QYLEuhCGaSGwlyVqrhALkQm20Yi8toj+mExkojvE9czZUSNv3DuTTRTKSavmQh5mkxck Ef3dPTFQpipREvz6vUts4TNpyZ6WjWqUK6ctBnOMEH23k8ConpMP+qz7NRRel3Q9mkz7Ad 8aduTzjVwO0djHYtnHldOwPomZJB1SU= X-MC-Unique: b-gvuYlqP6uFmS9La_ZU6w-1 X-Mimecast-MFC-AGG-ID: b-gvuYlqP6uFmS9La_ZU6w_1787949742 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:45 +0400 Subject: [GIT PULL 06/50] 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: <20260829-nohmp-v1-6-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , Zhao Liu X-Developer-Signature: v=1; a=openpgp-sha256; l=1127; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ri5Qp3clebQ3Ozsg1j2jOh9Qizc+flc2SoDeyDGSLp0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKTf7wih3WGXkDwAGa3nzzjJcmIhfq423VZM 9D3VvD1iIKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5XS3EACgAbHGkHiI0KeQ/vbAwAG3n8bWGi09TwrngWngrO8l6YxSHmvDUEXN2LCwQLVMzEQhqie aeQhT8chNv9TBRQFOTZDXk3LC71Viqf3NOrAhCYHLr52XA9wevB7Yt7alBO/QCPgw2SPYa4XW2Y wssiAcbLlcWDV1DeI8/Erw5j/IG7op2BUUO0QbVZi3qJFOOZ42ASch9DVFFJ+fQYV0bUwZU/P9T oQYdYOh5m64W5JEDM8yrofIgTz/mGeQ4TudUoqAjvs/OMjCWrJgDahcLqCu6sJ4DjpdMjyZTMrE J8FEw/qH8QsbwIIvYht0mcxLpb5GAjJcYYCK9Ux4i6zwplPKU8t+SC8+Mk+WdxY1q9gsSixkntS z+tS4onXtWNvCM3G2mLWQA4yvNPrdH8JMy+L3Yu2B3GwR6EUfEY4dEkanfiervxiM4QhnWw7KIe ToRVqJdAkaJvAAvmzFeyTGZjYYNpUmnLiXQwhUhq/9lZADOD+TYA0F9lyDyfNM5KW7n+wOtDwQA 6NZkU3idFk9DyyEmqbGte56WIMwulZHFpAE6oLqYGncIocgJ/FvaUbqoHW/OG+3zg1cs2eeTvhC emUYTLKN6xnkuCYV4NvcqaAFBHZrr3ajt5jl1lPhNkR8+7jfQ1VEH/kZmivO5Qb28MY3j0SAYFH gl0JzUerB5LTLjw== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949885635154100 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 Message-ID: <20260828-qemu-no-hmp-v5-6-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949904; cv=none; d=zohomail.com; s=zohoarc; b=A1Ej7qMgcpLwShYoM+VG+GoJY2xVetXJrmeHe9fVnabBwe4lfCbM3n4SJ71ndTaJ2beIQ/xHEH2i3ck5Q1FB45cUkX8tVWZTOdGtCYjS00MrrbN/vIl+1d6pWa+ImjbiMH80UhWwJxConBXduAlmVjqP3il4HHrcHit6NwP8+3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949904; 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=gNXmHw6qqtUcApPvaTx2B6czbmK5Ry1pnlYKhRGvUUw=; b=aC5k8WAd8Nq/dx0EXxj3IbOsXss6C1E4lAc6JvZfMNY6NHSc2yjg6a/D2RikW0yZJjcR47GowcuLqvm9w7U7locyZscvYVCG8zUVMiyEPa5ENE41gPWOenftlO7P8Q0dNLMpAwgG8Hweey4Ji1bpbkWW86F0zft/DyNbNlj4++8= 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 1787949904343612.8763331044108; Fri, 28 Aug 2026 13:45:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03PI-0005Qg-Dg; Fri, 28 Aug 2026 16:42:36 -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 1x03PG-0005E0-Gb for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:34 -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 1x03PE-000837-J2 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:34 -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-385-u_QaoOO7PM6t5DCmHUYpKg-1; Fri, 28 Aug 2026 16:42: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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 228FA180AE2E; Fri, 28 Aug 2026 20:42:26 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BD9AC40E; Fri, 28 Aug 2026 20:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949751; 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=gNXmHw6qqtUcApPvaTx2B6czbmK5Ry1pnlYKhRGvUUw=; b=GYTQNesrz5gIM8KlMCXrLkxaiVxfnnU5PEm6wZg3q7kM4pSTGkxW+c7aeKqojD/XlPU44H JACRSzOS01J6mVZo1U4n86yOun0GKFJemukQ79fyaNQ/dXTgMjR+Fbq3dTQ3rcod5nAn6O KTI8tIF9D/2dgWN1yzVZEpJQKuKdwrU= X-MC-Unique: u_QaoOO7PM6t5DCmHUYpKg-1 X-Mimecast-MFC-AGG-ID: u_QaoOO7PM6t5DCmHUYpKg_1787949746 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:46 +0400 Subject: [GIT PULL 07/50] 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: <20260829-nohmp-v1-7-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , Peter Xu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" X-Developer-Signature: v=1; a=openpgp-sha256; l=4441; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=aR6cD4VKrUuZkUdVMPg3oWb5B6elJbVhLs/SMUKaGdM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKTEUVGJPffxtYss6IP4fp5Sos8T4vDP9407 EihHUUxgfyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5U7LD/9F0uig5tSq5OI4DfAoH/P9I1SwS6egMah7lrZCRAnoOVmXxCxN9/J0YcfP0ZsYgNUVaH3 1N+YcGNQ4vYPLTdk40Nl8MiT3j27gkthuSyI1whQQLCaitqS1W21M6HYFLt3jKoUKjyFa6P4pKg t8Y+HOwZBBnp2Q9s9vJjH1Mv7EmD7RimffRCUgpinV5DIrIUtCIDVneFq8IoN5r9ct3mLreksAN tQio1uTyJ/hn7+V/r6qQafuqgnHd3vFuHHpd+/EKoloImBjDPaPle1HZKqW3U/x27IvVuoT3xFS mwpM38r6qqUE+yxix6HGWwyE8yhxyKZSucVj0wdqhlFBOzq4JYasN6d9m9RjN6Cqsj4hz6it22W /WfQrgJcHNQVFZgxCXNX06zrHe16Cf+WeS2/Wu8ky2MGAy7IN7Czwt8vtbuVrFqzcqgohZYf1ur yu0N5nVZL7sTcQQ+dxIzjmfOkALK3+By5aKo67H5cHPv3mS3uGIS+pi1HXs1BNxDWjG19U9k52z SNnqYMe6iS3N3pOhmJ+KpTfVUavOVjoGth8KSNKL9/gq6x0cBFgJVgSOgrIYrJmqhI40oYqKWWj zqG5tXsK2A2x8/sYrPGXlCudfxomdiRAlZ92kCk4GKgPl0FQ8I3AVKJ9jgXmJmceIC3xvjGtigN raT1op+BLJm7NSQ== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949906358154100 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 Message-ID: <20260828-qemu-no-hmp-v5-7-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949786; cv=none; d=zohomail.com; s=zohoarc; b=WxwDxC7tO3MaJjKNOCD9hUyvVtQS4mruI4EmFHBQWHEmpY41Gge58eWoFyKAWGj/XDOblfmtJsu0y9Hhs3DSy3dJas9nxPz4SNqm0d6gRMsoj85Z24p+hh1aHSfnY/PX+GJ0BaP/5jSIxVSDYBnkhYd1URPdH1v99wRj7CrhBZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949786; 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=V4vRxHw1f7w9+JM1uvJJ31mv7W/rLbq3B/JcPH5Qy+A=; b=LYn1lbKkUT9uZiB8OATObqE+ab8wBPLhOMn7RH2afNWh5Ieume3gT3Z6/l+vrOWuYCCZWvuvqgXRj62YJShk7qf8+we8dF3uMwUuH+0lpagI319q0Tz1APs0IezPySsZWjJ1yjSR+nMDdZiWxCzwfGWwO79ACjqRYo8eXsKDMAU= 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 1787949786748245.72081814858007; Fri, 28 Aug 2026 13:43:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03PH-0005MR-NR; Fri, 28 Aug 2026 16:42: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 1x03PG-0005HS-R3 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:34 -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 1x03PE-00083L-Oi for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:34 -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-596-p2cruWQ0OZWusd2KYuLwMQ-1; Fri, 28 Aug 2026 16:42:30 -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 A4B42186A704; Fri, 28 Aug 2026 20:42:29 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C566E7DB; Fri, 28 Aug 2026 20:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949752; 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=V4vRxHw1f7w9+JM1uvJJ31mv7W/rLbq3B/JcPH5Qy+A=; b=H+62i8ADJjcOaYng++yE5KCPe5i1U5VP/WHDBGL/MLlKrTe38npJhgoKtRj/F6Snacvacu yY/USnUou5IA8yaYEXuUyLu6/tUrYxyDIprL4Hgjweoc/vorfiNUMbYO5YEokX/gbkop4Q pivwuWAkIX002+Rd4je7iVPvPJwKo7Y= X-MC-Unique: p2cruWQ0OZWusd2KYuLwMQ-1 X-Mimecast-MFC-AGG-ID: p2cruWQ0OZWusd2KYuLwMQ_1787949749 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:47 +0400 Subject: [GIT PULL 08/50] 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: <20260829-nohmp-v1-8-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=5220; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eRw064TvaxJ/wCeq9d5NMAjc/qrQbnLW4m+gAGzVtxg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKTw/j2Dn8mzMxy2GxwXPhem3bLGybbfRlf+ vFp5kPycS6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHykwAKCRDa6OEJdZac 5apSD/4lTjCk/hxVC66Ri76mcQglFkZ457LhhQF2XODAK7kD87rjNVoYV1lplxoLdrMDKy5PjF2 +sGbbyg791j0/Am0u2Pnl+nOl1STxP8qTUxULjF2RhS3ChKWsXDj3hpgsqy/+p3LsCAR2mNyu6k cqKzTfh6HyScsOgqDJaPcw7InAiFPgKCUOfEEWsGS+5QYPr+3pequSKyrUht90fGGzV7uZxnqRN kk3LRql5JCVbYh2W/fHB4D/ycJ3tKO7wF8GNYpr2eTWkrRLMZEvGTdsSI7Z8ncpfkoknBclrZUz fyyTBLCRt9oGDc+dS4rVw/C6parpzMLSDvwSISyR1N2X3kfQDAqa15xBmzJXlCrk189wjlQeX2P zAEeRlPNsEaQXktu9tvhUHRgLygLYgwFhP1qWmbLKASMOYnK0MvjzlhbICthBQ7Xbeya5KZ+/6Z 1p1MvBVBfwatDJCXDMh5Lni6Mq+YlufYMe/uQ/heFGETYoV0UuSNEGzZwN1rkLwFUCaoJELZNl5 wH8G1sKSgc9VhhlEqcB3V8L/WCE0n5opSZMJNvajKBsvQKke28TN40xyXiaxjoJC9qm6jDfxpl+ A+4NtlBGAbuC4EUQrgzBd7rZftWkJnA6zjgA0xd+2FPa9ELs2NU+0ejuU2fE2hM/sciWQlY2bYj OTZ9G7WQJ6JKHcA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949788299154100 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: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-8-9227de146347@redhat.com> --- 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..7c3fedb91936 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 =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_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) { + MonitorHMP *hmp =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_cpu_path) { + cpu =3D (CPUState *) object_resolve_path_type(hmp->mon_cpu_path, TYPE_CPU, NULL); if (!cpu) { - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D NULL; + g_free(hmp->mon_cpu_path); + hmp->mon_cpu_path =3D NULL; } } - if (!mon->mon_cpu_path) { + if (!hmp->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 Sat Sep 26 23:03:02 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=1787949780; cv=none; d=zohomail.com; s=zohoarc; b=hfZFmZa3ARB0hXVYOF40HhuO8Otb/UqGDkKojiWYPAOa7sJRiK08fAsLgBuUVcq6ftRktRGVsPskpdsohO7bXfjR+cu14+473I/f6GmZVwViaR8mgBLMvP2KyUvsh1pwX5Jj3i8zlSRpy10mb9r+Ow659OOrPoeTqtlMXA1OiV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949780; 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=EpcC2w62/lSXsp20E/QAPSDIcPWQaTZ4db2BLfr2Gs4=; b=Yt/WAXb/KLZc2E5RDySePCdw3rA1cOhUzNr2WO/uIxOJFzSnlO9vwHeeu37PTBoiKBzVhRGz6mF1DaKCVGV6oXvlkIr8EZ56/0K1UKvquT12X/3Ijy2XK93lJsRf7FRulaQE+SzrDiRTelKw+0XQP6A8gv2WnjzszyxB9xplwzk= 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 1787949780453483.13760179880467; Fri, 28 Aug 2026 13:43:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03PM-0005Xk-UG; Fri, 28 Aug 2026 16:42:40 -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 1x03PJ-0005Un-OF for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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 1x03PH-000852-Jo for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:37 -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-612-BKj35jrcO8ei_VyMuRYmqw-1; Fri, 28 Aug 2026 16:42:33 -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 923ED1802165; Fri, 28 Aug 2026 20:42:32 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C86C618001CF; Fri, 28 Aug 2026 20:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949754; 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=EpcC2w62/lSXsp20E/QAPSDIcPWQaTZ4db2BLfr2Gs4=; b=GJkTnzsG56R5NZZsOCXLQ0jvfYJ+8rZaFZmGp9p2bZimQij7kseP5GVzjae816iaKSJuHa bGvYF0ZI2/Ms/LTEPbDcy99+glAzA6ls/XLXadT5qXvoZRM9qhU7BfkufT+snEwNAQNfLP zBNAi7Gy2HXLHlAKquXviZhXkEtzk9Y= X-MC-Unique: BKj35jrcO8ei_VyMuRYmqw-1 X-Mimecast-MFC-AGG-ID: BKj35jrcO8ei_VyMuRYmqw_1787949752 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:48 +0400 Subject: [GIT PULL 09/50] 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: <20260829-nohmp-v1-9-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1480; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=a7BQAN4Rq456sMPJdhnEnU9XECWArxIaaAddrjhmjno=; b=kA0DAAoB2ujhCXWWnOUByyZiAGqR8pTIx/ShbocnLP4h4elTO7fyJZNrjZHcDawi6LSjIgw3J YkCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJqkfKUAAoJENro4Ql1lpzliXEQALfK HZbKXR381CKLSxNSEFNh/OijYFvOM9t5hwVqJXrIyd3AgNd6RGuCO2dKma2562vkkWEvZuaPp0O 7yRpl8DKNId/2rKFQC4O+7/0OzW0PGwsi64JvwDU8CtbY5kT06LYZsfDDeTN0KcgQEMrfavTYei bIoxoT6m5az2ObtHjvjERfyxbNAV4ldtjlAIqf+ui9ZKd6zlLVaatj2Ue9Ke9b7hFgjqSauimTs jBkLTIQ0Nogj53b7xDSTxSl00fHCwWOf/WhNJqoLNvh7uY8VWUCMqcRsgWHleCkdyaViBx3DxIh VSy/qOfSHSSsELNLeHgiByWgdWsidW626ttbjZXGz3TIajmraebQHxg+tcjxLMwRW508ceAi951 xJ0pUFhOLMaBw0sW2KsEuWry1ONL8iDOwvYPcfbDyzyOiBvgI7CiMG12g9qtffyI5LFdTj7cw6H VYpvhQbbj9rwAJ2uvrSfJY8aahu5zLJGmtqv0DC0ZNcF0dA6EU3VLex1L8CuQa9OvfFJEW6Crb2 ucxv5y4eGwzvBadj/xND87EHCHoT5/nYGZaOlVLIwN+rSSogSL+kWVstT7fYop9RQlaz4cLpK9u iKio6xfWoNlm+2bHBjdrkTZhO+RW9AnnVhFEr21k9yB4GLaFXCbRXK+h+5p2uvSOabhJIAwID5C WOldT 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949781592158500 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 Message-ID: <20260828-qemu-no-hmp-v5-9-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949984; cv=none; d=zohomail.com; s=zohoarc; b=d433XP4J4Hox62BX6zn34sw9WrovxpeaUri/ETmKXsu90bnN+U6MVwx9EdLsJCtQPQq5ugkKwPpd6hoyktkjVYc7b4UQ9goTh66pAVNRhpI+GOHVPCZZ2k19XXnirlPDGrzILME1gt49B9IcwxZoPH9/AlOWODuPeaXb3aXjFPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949984; 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=B2W7gEbcQvoW+FTos9Dgma/aM4XpWbxnIXFt8Gt9QKQ=; b=NJTExDx1vdDfZJ5u/OoE4t/hR4BYhBNUXZO4m09jhPZgJa8F7XLtZl0KYh9JTBEfQG/OCALf17yXfvOjRf/QfcPQ0kxV6vSDIwfQTH/qMQkIkyev+7wnMSR8Vaj2C5hjHF7RgqHX/vNltMydP8YWsVar3PcYirP+cxuw9AmKG5Y= 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 1787949984295177.0834576931867; Fri, 28 Aug 2026 13:46:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pa-0005pZ-5I; Fri, 28 Aug 2026 16:42: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 1x03PO-0005dN-SZ for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:46 -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 1x03PN-00087c-6M for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:42 -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-112-eNycyH0HONannZz1vc6cSQ-1; Fri, 28 Aug 2026 16:42:37 -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 28FE7190A34A; Fri, 28 Aug 2026 20:42:36 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 44C113001D3D; Fri, 28 Aug 2026 20:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949760; 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=B2W7gEbcQvoW+FTos9Dgma/aM4XpWbxnIXFt8Gt9QKQ=; b=SgAw7AaJFu5mF8y80GaNMSMKqQXG3rLGXuWcJcgZQTuv99iTlMfnZfG3nQGnwkSyUKeIQZ wwHPDXqnFy/NI9gdgHvyTwJvl2EzTQhMMAfyoE5DotHC+OcUdDLvexfHJTIBGAFAANVoDA g8UZdrmzKOGuEcD57RTow8WYel6hbH0= X-MC-Unique: eNycyH0HONannZz1vc6cSQ-1 X-Mimecast-MFC-AGG-ID: eNycyH0HONannZz1vc6cSQ_1787949756 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:49 +0400 Subject: [GIT PULL 10/50] 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: <20260829-nohmp-v1-10-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Samuel Thibault , Jason Wang , Eric Blake , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3882; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=F3SoeJDBt3rrzT1cQF1tnvqxl7EEFuI+x4m5q9N397Y=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUtkfxV1YxhjIZqQgi5qmrXTdo9d20Xv0II yU/jKSfr/2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5YQkD/9nFWG07kz2b7CxG4GvUDheEwHZpXVzRI5SkEfGdgkLzqKTZddT4T8vdkk3hCGPaSSN1VL GqyF7juWkx9+ToeXhopat+qyDVjYQwvFHR3vNd8yUztYOBxkYtjeUSES1avWziBX0ACc9oXkfXd 1XU7/PkCUdkxjDlNsOC4D724HrlckYjD96fg5/Wzbf7cC7nVqQtHeagK/ka1xGBMmrFKHHm6Q50 K/OgdQlsSCP9tK2jOpL8arbXbEX8KqbNULk+2RFRKJRXgURf6OASd44cVybMN9XiBd33xP85Ws5 hsiAZtAWPFCtYSXesu15ejC6satpEOsfOYRu+zaXRxLUf9N7NxfAV0O2n3emZGgmJvAv9Zv+5BD vmdtgL/lTYhZQGHrrcLOec5+iYOszm8Z+vluykV1x/iaYx4KN8ypOtgGgjuhTjm+c8j7iHDwAFO eBMZHXOmDCLiYMmJQ0Ztub6rXc/40okQsB86BI5mCk8oK+xjnX8mqb+FYN90X1dYVhsEWKPkUqk 9bNQ3ZDN0BHLMHT42ViZJ8I37MKG8tOi30NKpEXBnFnSzJQVFATf2MmNn2EDIzdpP550a/0eIth xC76H4NtDxfJIh0s3Sg7qSinGObPJgZRfVA1UAeq2BQ5/qe8BUF6pnlHbXYgbYejAw91sD4FeoI dbSBDfexVnGOHAw== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949986311158500 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 Message-ID: <20260828-qemu-no-hmp-v5-10-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949883; cv=none; d=zohomail.com; s=zohoarc; b=ngJCA/pDzqyYoc/OYRkotypn2HlUrhBRCQW+nmNo2NQKPmtvsJferPNr7VjnkiKaBwho7RE/MYs3/s3wORidaLM+C4iySkGt2YgqutUS6mh+QiVz125+NbeHE+8NFhkhYyZLsZfOat1bS7rNuTmId4SG/8OKi+BB3FZ3lR1AzZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949883; 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=5hDibQ/76bLAuXZOX4GEYOaUl81zkc5tt+tMjQi0FuE=; b=QbsT+3kU7ZOz8wvEo7YN4q6NDd2i7xJ4EZggZzos/URri0IusztAoDGV4dmk2upVOVh/qsjQqLcSsjHtj9pE4+hywjqvFshkpbTcl4CTfMiaLK6sTpJMlE/NYSOTkm3Y3BFzSpR/HghLGRfRXz0Ywxi82TV42PfDIByGleEnF5g= 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 1787949883612908.2401284752051; Fri, 28 Aug 2026 13:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pg-0006RP-M5; Fri, 28 Aug 2026 16:43:00 -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 1x03Pa-0005rn-7p for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:55 -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 1x03PW-0008BT-D1 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42: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-655-5tuNl5uHMqiFyWuRDPWnlA-1; Fri, 28 Aug 2026 16:42:41 -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 CC24618CC49E; Fri, 28 Aug 2026 20:42:39 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 980E51955F0A; Fri, 28 Aug 2026 20:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949767; 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=5hDibQ/76bLAuXZOX4GEYOaUl81zkc5tt+tMjQi0FuE=; b=HlY7P70bDROwGe6CQE0Hqvr079A0u60IL0ziSQbniw6q3+9dYLyrIa06EIeL/fAJppPIkf yUkMtDUYnBi2Zj+2F5d1Az1rjuUlDO2qEZ259SJQy5DLIOz6Xog6Qu8L87tc8Hb+L5bY13 5/BtI3G/WCoQqYyv6P4j2FMQKnjw4Tc= X-MC-Unique: 5tuNl5uHMqiFyWuRDPWnlA-1 X-Mimecast-MFC-AGG-ID: 5tuNl5uHMqiFyWuRDPWnlA_1787949760 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:50 +0400 Subject: [GIT PULL 11/50] 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: <20260829-nohmp-v1-11-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, John Snow , Cleber Rosa , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=3604; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Ts1ydKczmkeF1pPgicN1uWQ5eabDW6urDzxS2MLEnJ0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUMzsfshXQR4lYG72cCJXRUMBrKeoZj96nX pOEXn937MCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5VjpEACpwliy1GUwAMqsAP6UgCD6b/mCPxFy1ahgXZWqdVtZjOw/o4yuYo23h2p8ds3SIxtJddF mUGN/qIkZnSxLuGQP8FNacv+CXD695Shl/xNoaYq+KsScGVKAk2ROIKhWMVZnP4+RebhXx+pQGg Svgmx5hpByOFNaUD/IGY+dI6nuX6oO1+c8i9zlKvzwDF50QxPGvwRBMzXczEy9d3VeyXC8EWwdy Ag19L9EI+eW/uVsYNziPlUXCEPsaH8kgZuzOB9z9FSIJTvAzX0yMLwu3PfyWOdvOAE+u+Ce9FL/ ROspkE6P696+BRLuy3AiUCvEp7CH+tGnKVfpc5nFBRckawT84HHxCIO9wbne0bw1++23qX8YqJk M98zCdyP5d/pulUePFziTTOUMSKGMSeqoZy3D3fLrrMPSBI5lgusV8nxuABdUV1TnpblD+GqEW2 Kq8nTqfJ1Ws80JO3gMZl3u9jMdoTtPgbShFD0TVDkrVwhv425MB+VcLe9y4jL9wGxwog34HZZdc cC5yUkisEcA61OLuYgAh+50EtJ4XkkrqwNJ6kU07vHKl10sdt1hCKTqd8OUEZr0t8uzNIs+HxQu GVSDfIsBIwkCmvOhL1Qvwl0hr/xFx1EpLS+xoKUHXWDbl7qbL7fgwV2fgXyVNyxhL2aYIhhecbx AMfttI+CUSYCzdg== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949886173154100 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: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau Message-ID: <20260828-qemu-no-hmp-v5-11-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949895; cv=none; d=zohomail.com; s=zohoarc; b=iUt0mRlir7dHS/JxdyjLNWiBArsXy+mhqF4QcFPvMwXhrj+R88A+lbBdlUGQVHAbRibPr6YtPmvlXcfsmQWXLGyjiLReqRsfxRvC1xd1LZd5S3Ih0Q0wJTGfZvUrVpAdDn3D/dZw6fwsHkr7CR79Og6KX0ZUA8OwfxYjgYX2qmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949895; 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=uU8sds7aM6wAilrJnyaQ3kr01ihnKymK2P5WMvoYwbg=; b=ZbedGpX6Si04Mc2rrHSQ5A+X3UpOE8Psf8xOY8db4ssd1dfWKpM5bluqmt7/gxP9sJyy/kZWb+f1LzXI67OaU9rfiSlZXAqr0KKPv8BO33BvF2lmq88pEELjSMuAZpkuUJOIxGmIE1XmtQT95K/7uBkbawTrsm2wv0cwVY6VrF4= 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 1787949895354664.2336792987584; Fri, 28 Aug 2026 13:44:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pf-0006J6-Oj; Fri, 28 Aug 2026 16:42: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 1x03Pc-0005xU-Au for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:57 -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 1x03PY-0008DN-6f for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:54 -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-294-Y1pwp4HgMXu1sZJUpo3SPA-1; Fri, 28 Aug 2026 16:42:44 -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 3C5F618A3C11; Fri, 28 Aug 2026 20:42:43 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 60D281955F0A; Fri, 28 Aug 2026 20:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949771; 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=uU8sds7aM6wAilrJnyaQ3kr01ihnKymK2P5WMvoYwbg=; b=YTfttf44CD9M1ey6gXFOjuOkB72s92TQ/VLc2NgTLFbm+AzDsSgThOyPP79SKj5zdvUB4M a3Jr90fZmbDvuVoBojHV5ALQThqWp1zoSAL/yUxQJbx+A12oTJYG0suzEsZyHN3QyvP/YZ PJhXVksgzIvmWDUw1lxWkJ0ojLxWUYE= X-MC-Unique: Y1pwp4HgMXu1sZJUpo3SPA-1 X-Mimecast-MFC-AGG-ID: Y1pwp4HgMXu1sZJUpo3SPA_1787949763 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:51 +0400 Subject: [GIT PULL 12/50] 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: <20260829-nohmp-v1-12-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Gautam Menghani , qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1840; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=qZLyCeiYWh2MeR/q2fqqG83AqU+7LAiJGxG5LAGGE0s=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUPXoBC2fUDOnVl03NcDGH0lHCmlEQeH9CW q0DtsfAuqiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5bVBD/46SxRdy6lOG7+N2W0HVpsjdW9qaf16lc8MiA+AFDk7Lpu1iNBEPUr0c4pIQbzcPH2ZT9F J6NBumD5FurpHMa7aw/C+tpYJlo7rIWOCioYfopZnCj1EjwivggeBzpjspKrvqLwFyXhfa6Vvrf ZbkPz+OYuqWQ6CC2Iwp7pS+GeDh8eRrpueWkXN8osyXv7YvUzJplukk4NlEwjBgk7Gqph4wCrHG hJu9CW5ghosNKBpf3YYpNcD/AHkOsv58iM17jfhPD/iIcKvIwFXxzj2jQ/iHfd4+uXLNEUUxHKD R/Axq0/uwNjTj9oDgFrGsDoeAW8xzlgGH/DmGHE5Xv34Dt4MUGF8luXSwxTC8Qv9Qv4IpQHnvsk EzIQgnO/Vnt+gVNcsQ0cXMUDXIfmabDHliiMQ+4Hj5cYrcW7Tur5zNqEQurgaDaOMszqfufg/Po 68uOLQ4+W09IoC6IOfWaXz3SGNOmfjWP/3n2Un4RfmYWKLoLmkoESGw3Dvi56Sos+snxcCdgRjA C9jW8X7Va3PicgGDqFtJdSuZEK6VKAxUdXIMy/jdD86RML0TRbfUzXGGfDp2als2Dzo0WhmsScw lYW/hiq30YC4X5DxiPLh9/ENj4bfHH3Jd6sT7APwaoOPyK7cNBBJptYkL9icayOXZNPJ1jYiSGt fel2/HPS3Zcz2Fg== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949897878154100 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 Message-ID: <20260828-qemu-no-hmp-v5-12-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949906; cv=none; d=zohomail.com; s=zohoarc; b=DMYOHUJXMbAsPQ8Z1DTbfiIX/b/SU+SykX2uykT37tcdizWU8vCb/2rXz8bJYanJambfUaW+Yruh0YRdCBRVYthVrekE/ktr2J0o0G3NtJkYJsfisoZ6BCJ7q32WqlSLpN5MXSemuDvnJhLgQchYjUrwcdjdz/iDfwGAm45bPz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949906; 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=GzC5K76Tb+dXHF6/UefJwgU7djajUKZNMrpyzqlVvG4=; b=EiYAXW2H6aOdBYGdzt1swdAiAradlTbbYLwrNl/raEyzVdqLJZu9HpSe+9oa4qorMuv2ihkd8TnqqSXOI3oCA28PXbnKIouu5gJ7ljG6GImmPnOcLi4Oc2t1g9hANAkII9dhILhtGwb55mtjvdtCcx6PSmpv1gP5TqTHvj+aJr4= 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 1787949906962961.5887268332183; Fri, 28 Aug 2026 13:45:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Ph-0006VF-L5; Fri, 28 Aug 2026 16:43:01 -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 1x03Pc-0005xa-Be for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:57 -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 1x03PY-0008D8-78 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:54 -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-228-hpgfvsxmP_-XDRCBwDK4eg-1; Fri, 28 Aug 2026 16:42:47 -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 8E00B19540EA; Fri, 28 Aug 2026 20:42:46 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BC0E71955F0A; Fri, 28 Aug 2026 20:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949771; 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=GzC5K76Tb+dXHF6/UefJwgU7djajUKZNMrpyzqlVvG4=; b=LR1arw/W6EOLswkRYgQ+DIRo8Y3D29dTHi+se9mAX9RLf7ucKOXyumLIkJInS8mGfwdzV1 SZuyv6B8UB84C7M2POqN2f9F2uh2YY13DSDMOrlwcJCJhUf6kuM/F3sB/cKuAsxinRAdX4 Wg9FvpoN0Zt8+eqPWqq1zJZbyfhbEcc= X-MC-Unique: hpgfvsxmP_-XDRCBwDK4eg-1 X-Mimecast-MFC-AGG-ID: hpgfvsxmP_-XDRCBwDK4eg_1787949766 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:52 +0400 Subject: [GIT PULL 13/50] 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: <20260829-nohmp-v1-13-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2253; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=oMwmTRZhG9dX41Lg0h+wnNJGCaH/n5gXgI0kuR3Yxzc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUIqEl31CT3tyt0xBNy0GWHGuX7/JDwDPhl AOaxUTycUqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5eDnEAChQPqQs2H9cGrIgW8zBdiEHZDDXeTQtAvZhKidYbzs2xe1Q38rLmRRiM1YnLZKLur5TlQ Rp+GykmP41+6AUz+ovw56HpTUYWVeSKow0gEZ48LGKKBnHfCP4D8kzXOvOtRg+xSeGXaJ0Gtptn sO/z1Ut8IjYtPabtAtDD0VE+3Y242xt9iS/O4R5N6nRzxwCwDBksRT2eAoqLOcKV/a+E2b0upz1 0jgzY8q8hjsXBRBeX8BqJkWH5QqIei/iJZ7VTeqDNlykMa5Fb+fjpAbMrjKyEqUJNpJP2/tm2kn Os/IYnbbQfb2RX7Xyy6HY57d/y++mXIi4wYkzZXcuO/Q4JCggoL4/avunz6KaXvZNbe++NbM7/N c7QU+ViXy0alvDvpS2lB/ijC94QOn2ckBqL16wNI9Is6ZjN22nDcuoJSgVej9Y2ctPdM3yFonwS onCdjVs49AJO9Z49FETutSOiSoGgJS5ogh4nkf9Fsp44X3XnpQOpP0+stiUhzbcGa6gRmf4VEfO rAX36IKn7MUkJjaMdLGWgMAS5GlM1Ji/Q2KfSeza1iv1Lx9MKvVUtqrGox1p0H3wixqp3N9DkSX zaE+MrqrIUXqiKgnto688f0QW2erEzose3qEIerp5NMi4fXB6CrDwRFawb+OKGuNHFCnMw6g5ne /czlZkFNZSEjWMA== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949907916158500 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 Message-ID: <20260828-qemu-no-hmp-v5-13-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949910; cv=none; d=zohomail.com; s=zohoarc; b=A8cn6MC+j8klMXZlH9NtOky6jMqALtRsZ5zSEm5YgEniutWJKCOi+Cz0PG8F3PUhMprRoA30JYETkVcxp9WDQj8FBQFFxxG1+gdwm11WG8Z5JkeT0YpscOtYKvMJ3gZPB7uONtx8vIuSyPq6ozhW6+pEKFuu9TtiKWUFXpL/bXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949910; 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=3sBb5wKXIMM15ZG8HrtOTQGP++QueaQ7m+mrQd1vMSA=; b=BLuoOA5GOPCCs3O4qC3rJtUqX9aU4pooVLxYFYmi4UoyWyMnvQgHyv7WAbJ9v/iscPgrtw85ge7MNilnAsDX6TjltjMO7QvigWcW4UUOKsBpu4dV7PAV7pVlI70OiYlHZYocX4U+G5gpHNa98otNGL7F/PrtocbZFqeCm3Bj010= 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 1787949910539733.374486189838; Fri, 28 Aug 2026 13:45:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pi-0006Yf-C7; Fri, 28 Aug 2026 16:43:02 -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 1x03Pe-00065C-6G for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:58 -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 1x03Pc-0008FJ-1d for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:42:57 -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-434-iirwSKgJO52CDvhblqWv7g-1; Fri, 28 Aug 2026 16:42:51 -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 3A04918C0FA5; Fri, 28 Aug 2026 20:42:50 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6AA0A18005AC; Fri, 28 Aug 2026 20:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949774; 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=3sBb5wKXIMM15ZG8HrtOTQGP++QueaQ7m+mrQd1vMSA=; b=HBCQ2FGL+uXegcdZP/7sRInmpfpuW0UjdQPtUolZdz/3zNNQi52AGxN9Y3dbiT5+HgvBMA UXcyUxwW0/CLWZUwJrI6fHkxl1teXUiSSciO8BTJhu95HUlPJPwc48FTYrP1TOGN3ZFRps gaqxHSCHv/VrxZrpJMUNwlPmR4JPfX4= X-MC-Unique: iirwSKgJO52CDvhblqWv7g-1 X-Mimecast-MFC-AGG-ID: iirwSKgJO52CDvhblqWv7g_1787949770 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:53 +0400 Subject: [GIT PULL 14/50] 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: <20260829-nohmp-v1-14-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=4107; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=T05QOCjWGcUCJjKa4FdLIFwcZrDf2hmNVYzR42TH3wM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUiQ1JumHY1QT3F8UPJCIb8TO3NfNIGGOm7 ABMu3+g3zaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5Q3lEACPQGmuQbC0mepdL11/CFU6rtJzo6BsJlxGLQi5TrSZoKbbmzrXsC/LOENnbAtTx5fLNFx yN2VNq7kmF1XVMElsDYY+xrUa/jKkMPDXpvj4dHYip3CEjCgIvzN+uO4Nnwf6OZzg4W5c7ZGTk+ g88PALcL5b6RxNqjuTis95MSBy8M6F80EyxAm7Pwqb7QQiVo6IhX0Ha+eP1gnFcMvY/qIjz9EN0 olnnfb+XExK0cAvpentahPD1HVH4IL+g5cSy4iPYAJitWgZhL3wDI32p4FRc6UxsSoG5b6P708/ cQEdLuEEdHgkkSM2sBpXIQO42pNguzVQ4DUVFp73wXID9JVYsfdOei0V58HVOSohnwUAujzLByH tz9m03/FqG8+YGDoOAatiUUwAVHAnWInCmQhA8HJqKtb71DD6BGy5hccQS4XT/EN2+9bkj7mHfo t3HcUQ6nZqweq7mdzJG5q0OBdS41WjE4h6LbHuHPTHXqlIGXZYR7f6ek1KisyyMHapF5IYl2MpM S3o7oi1IbgAhkkOv/y5pyA0y496JQuOL++jXS7GENjQlR5GIXA+jHFuq6sITj+t+MAlifB/gH1J UpqwPLWrUB2Tm7OaSJ+S45GaUhN92NmDvTA1goHuxG803zDTKrJEoQaCmukzB5Lu5AwOYSRxEPm c0Gk1DRSMs0aVgg== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949911954158500 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 Message-ID: <20260828-qemu-no-hmp-v5-14-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949809; cv=none; d=zohomail.com; s=zohoarc; b=N1KeG2aDoZikxH5KAXgth8IlVan73/klX8I/eHG7gD9Hu2JDye8g5wIm7dl5H56X9sBw69Oju7rTlG1gIHFpN1HkMT1agCwAANFKVlR4cQeVSBleUIo+C3PCdCEn+9OF8l2+wy69mxXVlpeShK/6aKGnP4ipsuwjqIHyK/ruFG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949809; 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=7rzlkd2+BKZxOYKk7ruwu+JOJATUqJP0A89XiG/7GSc=; b=W9d0ezHnSQJ7YmJQiCJevmq5gHYrnWlBDj4/mWG8TXI44PSvfVp4Y0X/NP0gu+lbVwQgPEsEtLj0Z3T9114kScDaMjcqU+Zy7kzUMPvpWeKI2k/x/qvMv1ka8Y+1NpCaQW9AdhhUO2Eu9tjBeIBy+tmDF0U3xNqrIXz+e2BjREo= 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 1787949809836719.6884758759023; Fri, 28 Aug 2026 13:43:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pk-0006mr-2a; Fri, 28 Aug 2026 16:43:04 -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 1x03Ph-0006WR-Ql for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:01 -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 1x03Pf-0008Ig-Q0 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43: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-562-gGHY_hSONeOwYlcoT5Ihjg-1; Fri, 28 Aug 2026 16:42:54 -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 7F6131944F2C; Fri, 28 Aug 2026 20:42:53 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9D9F83001D3D; Fri, 28 Aug 2026 20:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949779; 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=7rzlkd2+BKZxOYKk7ruwu+JOJATUqJP0A89XiG/7GSc=; b=Ay8lWjuwrIJWu96xXDuWk/sH4URY133WM0qIJOQVAiBhVgNp9r7VtBKHV7L2gmHQNYVA2/ b5XJLdUCQmwnZQm54fveDgVmtB0SjTs/e4JdMZhviD4vdM1yKZP4XHEZG3E5flGomQy5XN 7QSAVd1QGUuy3Jt6RTYtqDo1fVUA/9o= X-MC-Unique: gGHY_hSONeOwYlcoT5Ihjg-1 X-Mimecast-MFC-AGG-ID: gGHY_hSONeOwYlcoT5Ihjg_1787949773 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:54 +0400 Subject: [GIT PULL 15/50] 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: <20260829-nohmp-v1-15-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, John Snow , "Denis V. Lunev" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2367; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=xhJEizoqGjh3FfP4/9t/2DEdWVsfugPSy+jyJAz+SHg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUX20qCaJNixKq4aZcXNdiW3YMd1bAb1miS ua/3fZkIzuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5VikD/4vlGNdaaXKn7kVDCP0oWYnu1xdilJXDxoZbo3wvqBpxaze5nl+f5LDySNxqsqGoAffVvR UwrAKfBMbe5BgLK/lTU36COkP7RLDPWZzhlcLd4UiD8BB3tLp9gylFBS/l5jpRYjC/LYamE2eLC eHS2gNsMsYQPWloIxFcVz3hYBqLMo2hYHGs3JeIDoSZ6y5Wol1Ep2Sux6blOqOder4ceLri0nNf HrAcQD7UzTmY1y32fb2sny5IJUy/M1WUmvULmWU7NAU/cfB2bTvPrYiJI/xZs6zT2nSx3v7whCh gKj/g3Ayv4R/WKKRztssrc+kKCK8F8GlQP3uaHzHvqmyxD8Hr2u1lSugJv+JGns+CFvyx81IgNu gKnTnjDPTQRVIAmOm/KZu7oSrv4Ebq0k8sdoWh/uJvS5rG/Bcjgs+TKDr/aK2lUS+du1zoH6Px0 ABv0K92Yi+iaXns7G69pLSxI5pzGolFVksaGYYuNc1XZUVZh/y1qOK0QVfeWrM1cQ1z0v/1l2YJ sFZL0VUnuzS9LNmcxksfjLRPcarxIxNCWGYP88nKMiJwwn1McFV2wgLsAKD4g3rdh1qo/lTLHTc kt/KMyp2Sbe/jhSI406MUj4EEGlwJvi2tV0qCSavLjRrVVJP8AHCSb1Ew5woYM9dMPgNDHsXd3U SR2cCEBdUpRkM/A== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949812620154100 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 Reviewed-by: Denis V. Lunev Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-15-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949833; cv=none; d=zohomail.com; s=zohoarc; b=ewR8QtIJ7iTD1xCvMWBddODD/HftaAuOkosvWUNLa1zXkkW8sstWDOSjGDA10XqQHAikcSmCfzSIgvV+qgloz3E0CE3piwqF1WxtD4wPFOkbddAOXugvtU6HzsE0krKuBCa+O7BF4ChJ/ORrvAfx2iorpHUMDdkcnC41T6Gk0Zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949833; 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=Q7aJVi5LXJ+NtA2gG+7uKXZdAeNwER+/p995kZn6wtA=; b=fslJ+CWnAxO6l94Ic64PtsQ14ZAZEbDXqjVNy5jf0yZLkOdCd5JbVBcotQRPecKu7Pl+uI+B+NJxkMHg5NcLybC32n7GgEG047nUiuzXpeVCWxh4dPgPhVnQkwqdAbO+WkLlO0W3XrWUJV5IAGi4T3xOnSj/VbPISaELvHE1nEw= 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 178794983314636.8330224636228; Fri, 28 Aug 2026 13:43:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pk-0006me-1u; Fri, 28 Aug 2026 16:43:04 -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 1x03Pi-0006eS-V8 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43: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 1x03Pg-0008JZ-PW for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:02 -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-302-4KCPBTQrMbuy_B8gyzTU0Q-1; Fri, 28 Aug 2026 16:42: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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 469A018A3C0A; Fri, 28 Aug 2026 20:42:57 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 563971803A40; Fri, 28 Aug 2026 20:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949780; 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=Q7aJVi5LXJ+NtA2gG+7uKXZdAeNwER+/p995kZn6wtA=; b=fNHbDa31wvr6VFaxipW/vEJ2/8L93WJn3uUghXB2fLDuthXNa78sq54/9cZxi6IyzKyYFC jO/Mylhdlo8DVySMOEDcLoR5ha4gHIQXO9KsjYRX2TWbRMrE9vSfJTEDht3EbqdKeXAhvk C2wA3Mq82wEakBF2dGhOfaJ/4IbVh6o= X-MC-Unique: 4KCPBTQrMbuy_B8gyzTU0Q-1 X-Mimecast-MFC-AGG-ID: 4KCPBTQrMbuy_B8gyzTU0Q_1787949777 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:55 +0400 Subject: [GIT PULL 16/50] tests/qtest/device-introspect-test: replace 'info qom-tree' MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-16-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=5554; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=FVCkBeD7AGwbOPHtW4E0zgvzeheUmYontGT5jAr9fls=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUlNhE+aty2QZi2t05GX3f6tpXx+1lDbtG9 5SlXwssheuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5azeD/0YVIAORAywdwiPLjxAbxJwrY/D/0c0vAhys71mkyjGqEsbNvyEU5qb5EGS6qI6u4SPWYH t0TFGBQPFvdNGoqmso3dIWnYbtt9k0gl+S+cOZ88mrRnwF1Bic6SrjRBBQaOubcWDOBXPrWzDdm Yq0cX9h+xvMO/6WRwiAecWcUAPIwJtWDcEPl0a7UzElO6KuKnhgndMiK0IjqSc+sPlwlEnAnmxn /ogJ1atQNWb0idslfCbDUs/DOPfV0mOPNy3BHJgQNnETAxq3ajBuZyVsPfUiE6qEGYUJLYHW/5g byrLLvgw2UR8TLuu9Qmh0s2VBu5ECQFAf+48T5h0yOv0F7HNoLEoIihdJGjPgfDkECUMdVzSIrw 6bh6DBDZTAoQ5osbHFjFDJ0SHBipBlggfkLnMiWRk9mpJ1vUfrS7O9kh8Co7LHcM/nMFkTkoPTp 67lS48hez7eAyco3ZitiJlW9lC1AoJ/lPp9DyQiB9GCgqZAEqd2nUxNmX8BkXYRVQTEpNW9ljlS QAnTycJ+A/q1pzRiHpOr0MPFOW1xwxmCbMVSFoHh72yRF0ZjLjH92XLtfLwHFcA4KA9ZNaQVnXv mEVwt/9DyiagjfnZE5Bfg2ubMhvqa355Fn5qwTJAKdKyNjzDkyiWLtxWytJrPd+7L5A3TGcXSzd eVNnuCxMhq1gVBA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949834833154100 Replace "info qom-tree" with recursive qom-list walk. This substitutes a HMP-only command by a QOM command, allowing the test to run when !CONFIG_HMP later in this series. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-16-9227de146347@redhat.com> --- tests/qtest/device-introspect-test.c | 65 ++++++++++++++++++++++++++++++++= ---- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index f84cec51dc2e..1ee441e19a0a 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -100,6 +100,57 @@ static QList *device_type_list(QTestState *qts, bool a= bstract) 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; @@ -198,7 +249,7 @@ 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; g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; @@ -206,7 +257,7 @@ static void test_device_intro_none(void) 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); qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); @@ -217,7 +268,7 @@ 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; g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; @@ -225,7 +276,7 @@ static void test_device_intro_abstract(void) 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); qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); @@ -239,7 +290,7 @@ static void test_device_intro_concrete(const void *args) 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; g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; @@ -255,10 +306,10 @@ 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); =20 qtree_end =3D qtest_hmp(qts, "info qtree"); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 23:03:02 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=1787949885; cv=none; d=zohomail.com; s=zohoarc; b=UKyHHqgf2y8SrHvEk3tfPsnaspJ0AX6vs9e2D7r7E9DSZP2jdJ6UnmF8FXi1QZScduscdde9ibfcp9GDGRk0Gz0jtkcCSLfr58pr0tOMxDTRZuyr7poPEPY9Vvnae7c6yUjZharWFEk6coc0L/mCIEkaNxuTm6h48u0FxxR49nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949885; 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=gDByVdbOQzj/X5djpv63KJlGsQvNstABsTuLcMC55Y8=; b=GQCMp7MBMMM177OEqt+jQ4DpOC+XbwoVwiTYky4UWEK+Yb/i7EAZw5QcD9rQ+Ztqd5Gsaf/7CwctZkW5ClKNOTz4egbO9s/VOmcUKBeCayqWYHTCTXkqdJvbvfgeDAeMXqJD8inJYNH63d88uoDuvI41jcyBT6O2L2k0zE0zD0Q= 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 1787949885200342.19779999717; Fri, 28 Aug 2026 13:44:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Po-0006zt-UG; Fri, 28 Aug 2026 16:43:08 -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 1x03Pn-0006yn-DT for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:07 -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 1x03Pl-0008Mz-O7 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:07 -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-325-wCNyhkRyPeKZ4yMdAfIQMg-1; Fri, 28 Aug 2026 16:43: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9D72C190A0BF; Fri, 28 Aug 2026 20:43:00 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C3C8818005AC; Fri, 28 Aug 2026 20:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949785; 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=gDByVdbOQzj/X5djpv63KJlGsQvNstABsTuLcMC55Y8=; b=Emc6zy+GaxPuNwL0UrbrsNan64yExkGpMzwEO44EZbL0PeBXpJ9LYCkLnX7+PARM3ittIQ RsqfDWffk6Uuo1vpLLEdDZmcnFLzgUS0VDRfSpWJAqQ3jnvnuZvav8D76pJtLG7d3wEuH1 N5vBzaTZHhyUaNL394lBiaCm6Qc2Fqg= X-MC-Unique: wCNyhkRyPeKZ4yMdAfIQMg-1 X-Mimecast-MFC-AGG-ID: wCNyhkRyPeKZ4yMdAfIQMg_1787949780 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:56 +0400 Subject: [GIT PULL 17/50] tests/qtest/device-introspect-test: restrict test when !CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-17-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=4888; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=bX1+LSgjrqP6lVsB/sGXy4CiqpBFIviTTy/TUQSFOUI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUMhHHHdaNsRWnytVdMmzuuynUQlWjxjZAI 7vWpcWcE2eJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5XDoD/sF75jCOMrslDIJKX2PWwc7ebZ1VKaAtQLvV1DfEzLzlxD/EpgHClSy0ghhwl9ob9awNUy BvRRoyWO2d9r0CrWYOdyqLxiFi9v81EXqZOHbnNz8J7SXxgQljww+VM51iAz9C0XA95zZ4jCUdo 8mQL6tMN1xlYHAk1THHZ9LfyqGc+PAtN8YmZhLHVFNroaQejWNNArCOgTevX6qJI7b9FkeLIafg SHoCeRO3Q4j++qlBL3WHCoyYgDQ3VppmAi9IWS9bwcT7FGYtmhEwYyObg/lwng7yhAlwKduE3ZM V+2YZnoWgEqE1/SBZsCQ99KqkFzlNcORJXOEb0NwgBBW0RZ2KB2srRx0wWGQW04ApHAvUj29nGT QJAsBmWSc53GEmmjMWoDCx2114rnY7eroUZUYxDqd/ktX3v6pgSird2xehwRNVDDwsIymCs8csK ApytJNNWmaIJ6zp/P3pXDvRNqzW16yelrdXMBZbMaiCzgfIW0oboMX2T2VJCjPOqI9dns4UWBQT cHr99qKPFXxbXlftkO7aLZVAjnACwQgjmPcVBwbT1D4WJX/VAPcI0tdJ+IDBXuMkmIsXrzsGUBj 3dmslF2b1IGI11ajVmeicFCgJYHZ1rxy1VmbriCboIVJ0UN0UWEpLDNUeQtqzkUpWwONoALTDNM Zw87jeDpnZsxfOw== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949887697154100 Wrap all HMP-dependent code paths in #ifdef CONFIG_HMP. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-17-9227de146347@redhat.com> --- tests/qtest/device-introspect-test.c | 46 +++++++++++++++++++++++---------= ---- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index 1ee441e19a0a..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" @@ -154,8 +154,6 @@ static char *qom_tree_str(QTestState *qts) 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 @@ -164,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); @@ -184,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); } @@ -251,16 +254,20 @@ static void test_device_intro_none(void) QTestState *qts =3D qtest_init(common_args); 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 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); } @@ -270,16 +277,20 @@ static void test_device_intro_abstract(void) QTestState *qts =3D qtest_init(common_args); 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 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); } @@ -292,8 +303,10 @@ static void test_device_intro_concrete(const void *arg= s) QTestState *qts =3D qtest_init(args); 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 @@ -311,9 +324,10 @@ static void test_device_intro_concrete(const void *arg= s) */ 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 Sat Sep 26 23:03:02 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=1787949898; cv=none; d=zohomail.com; s=zohoarc; b=kb2IhIK8nIDK8sv/SffKQvAPCCBnhCytaaY/fVT+sS0BIGivpCPtmQSFAlnkQxHZs55bVbTLYybKaIjiHW4b+eSzvI82mcfZxiFXoNRD4DGpJbie8zbSE2zzBZvXpAOk0WInuxCpUqZGdSWmcVJYEEq9Jjiufu3FvNe9ErMVxEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949898; 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=opysn1bRFu0R0A9H/fB7b7lpVgHXolfrxFYbGxB1Axw=; b=SBPPGrQLxs2pnrJ7YioiVTen8XsF2m3sU4nZCB0oAXRh6iDYR1hIxucRBeo8gb4HnZ4gaON8jF0FEjBTO3BMLed+7vKFYFDYfcibP7Cg2JhSyYvlUYV7j+GmefhqmrGUJWzMHe+EjhNOM1HZPZLXU/P/XooymCOTbF1yKK2OC0g= 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 1787949898391200.8079205730146; Fri, 28 Aug 2026 13:44:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Pq-00077i-B1; Fri, 28 Aug 2026 16:43:10 -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 1x03Pp-000706-6J for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:09 -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 1x03Pn-0008Nd-MW for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:08 -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-209-QYz4VjkUPfS3XeAZ5XtsfQ-1; Fri, 28 Aug 2026 16:43:05 -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 7278A186A704; Fri, 28 Aug 2026 20:43:04 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 92E243001D3D; Fri, 28 Aug 2026 20:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949787; 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=opysn1bRFu0R0A9H/fB7b7lpVgHXolfrxFYbGxB1Axw=; b=HW1Pv+AFdEKZXs1mj+v0I5Dqi6RwcJjqyS6BJOFVWqConrcJoz0HgCkjvqXfYNd/Mk33qp A41qHX9F3PTqB/6VLWjvbFArEAqjV2wGWovvCUL+EFimKZLjIhL+4BOtfhQUANM/7Kh7MV 2LXNs0l3GZ68SgDxVZ4UUvQo0KjfdYo= X-MC-Unique: QYz4VjkUPfS3XeAZ5XtsfQ-1 X-Mimecast-MFC-AGG-ID: QYz4VjkUPfS3XeAZ5XtsfQ_1787949784 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:57 +0400 Subject: [GIT PULL 18/50] 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: <20260829-nohmp-v1-18-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1559; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SYciGynbZfmzHmj6GnVAH6YIbsG3S4jakiHZ3jHlMHY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKU4+VCtzGm6PhcNU7893v2tTKJ3l+iJsTy4 7w2kJYokgeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5UbLEACkDq89lPciOO44Of9shlmSxj3zof2zq9PqlN7N9Bvp1SQf84OT78SEeVVkR8Fbb/d9H1+ /JIQlKMiWyMu7kr9ehhMJgZMHpDWThSonGcEO06/Dxz/VG+bfEO5x/OiSf+54mbLgYDzQg/M4gX Ap6HOC5pmNfhStxyFrDN4BNe/0R6DKtE8xEpo13p5+h3ihYxmRbeLjqA7SJRZ8iLtRwhNqFEfcS 8SoRA0W3TY+nyNEyGzvBmNlqlk54HfBr+VJyC9GS8nSyTYdXGocn8KYrXEmimD0L8jSGRWImzxz sjWTJMzTyyf9qNHy7xUuAD6lKvO9Wz+LvpVwduTzq9BrhTIhXjr843r+sOPAGbejev19/wRTK3a y5TrFrRV6glKpmxxiKo/JCDs/e7DJ4IsN/Zx9zf2N93KSouoPgJus/pBO9oXVWySgbllaG19h63 t9d9NrTTnadoKlVV0ZiIAuy+9i5IacCUDvBCKBpN/gxUR451kN10YwO64dRsPerJOVmzLH6aiDU ChfmjK5zgz52nydV6etrWkwB3dOTJCsPYL6uIljM1yA5TCUfVtQrSHCxq6wiWUlvwDEsvvx41S8 rmtRjojL+4AegWe/vXTp7i8yG8gGHO7SUaS+3zUpfIvHyJWGgeCHpoG9mJwmYiEc62af77Bk1N3 /8NQemJILLXaQsQ== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949899857154100 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 Message-ID: <20260828-qemu-no-hmp-v5-18-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949904; cv=none; d=zohomail.com; s=zohoarc; b=lEH8tSCRbBlsitONVvRny4WF4CjNt9cWsykyiSO42zcwWKZq9I1jXemYO0eFn7zIUDS10WcRdcPnb/f9Gxzm7L1RyV5WsgyFtnXxMgOhP/InyCGKhCJHBMDFFdpGExgAPZLYxV3ShXME6EWDUsKosT3n9jwRfpm4qntbzbI4gu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949904; 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=VVv6I3EZZZj47/5Fs3nxoceopjIyEJE+Ae9MSTveG7I=; b=fEcmeN3FReCUS8PkrwYQ3a+ud7ZIgsNOKnTWUMIOJGM9JNaDkxN05jX/k8u+JmGD8mZ0+DwVgANPnHq04RV8SKDSoPYdCRYgY9deZRX+LA1j/iuuSKXjTSJZPUeMlggCuNVf1XP5AY6ZYlPw8vUP6RPgArnvOnhx9eWXsbG8Sw0= 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 1787949904348769.6583164012478; Fri, 28 Aug 2026 13:45:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Px-0007MX-Q1; Fri, 28 Aug 2026 16:43:17 -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 1x03Pv-0007LT-UQ for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:15 -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 1x03Pt-0008Pa-Fx for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:15 -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-390-YuYM4eGjPiqou07Zy-J7Jw-1; Fri, 28 Aug 2026 16:43:08 -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 B412F18A3C04; Fri, 28 Aug 2026 20:43:07 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E5B7C1955F75; Fri, 28 Aug 2026 20:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949792; 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=VVv6I3EZZZj47/5Fs3nxoceopjIyEJE+Ae9MSTveG7I=; b=Xi6tBJyY2uYWI6Xxhy2qNxFWQeK90y6WjV3RN+veIPwAJeOHEQJwiJQ21xwvX5Fy5VrHOp iZ/VZ5IqslI+0wIXYPxCRt6w+SU/76uW38EvqY3V1/O8aFyLHN8r81KzteyZ0XJxXCZ0aV h5sE6H1WXQgpDDaRXLpfgwSSKQoxjhE= X-MC-Unique: YuYM4eGjPiqou07Zy-J7Jw-1 X-Mimecast-MFC-AGG-ID: YuYM4eGjPiqou07Zy-J7Jw_1787949787 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:58 +0400 Subject: [GIT PULL 19/50] 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: <20260829-nohmp-v1-19-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Jason Wang , Eric Blake , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=13601; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DbpXld2HO8z+5kerREPDBzzqqNoJfLjnpB1QXcMe3nE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUhMBk45KFwELfSlynD819XjTsypC1mvMnh fFjr+4aRlKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5c1xD/wNuFM33zNmtHnSFg3c1NjTmkyDxOx3aOPBHTFouIcb/HFtJWWCzLybeKRCMOyQ7eZfMwQ sp4kis3bJyvN8qZFAZzoAGivJAH5Ll4ny6gbOBIPG9RCMifSfLazBmcohOTbDHh941CHF+Szgnm B6bGH/ln3zfbgCRG1RFAWYb9xbBDGWcbmk2/I2F9X+lZycIj7Fw5ZVWcy7ODgy9NgVrU1xPBD9W rUBRXtAK3vxXAsvRlPT/EXU4BwoK1VEyXFJSixU8JcqqwFz5+IV4A6rcOen4lGoaXFBk1Z9BxeV 4nYBurLWKc0C0sRBNvX5D3zCHjdjorrC9tLvyxdDNxvA4woOct4CfoAx2Ea5eYM47fh+JtIR1aH EQhoX2S+L1sTy1bxkMPHK4HoLtXI+1dn0l1qfi6L12LIHGdOLn8wKAOJQ1U/0OjzsmdCfDKojHf PYfFmzacN8IrgFqMbG9q3Nk8Q0M2+hDA2r9FfSUiUi/8/wPtgIxpFt7Cm/qvKzyRn4p2esAFIas n7zjj1lXnN3nnuHekCowjEE39wbh49CoJuT8EoPqA3EC9pIUJImsd40R5nUq2VaqkbFpnKxOTay MYTwYEO5bALG6LI5sW1B3XLGRZ4mp86hhls5lE9njjXNGO/pcoqs85Fohy026oqNe4uVJbZAds3 jaBpiuXKvOWPN2A== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949906270154100 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-19-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949980; cv=none; d=zohomail.com; s=zohoarc; b=cAw8SpC4ObnUEgELvzw4iGprceHnlS+xPd38Dey5wV0Su8+zLlBje+yp08SmLjwmwyW3XciEOcl7gTiVXTLGOhbsE1dbJE54u2Cpfgtb2wEiZHcERUMUIQ04W6rd2mt6VuY3HbgDCr7w7a9PZqNLV6Of8AvI2wUQhy13Lurn2A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949980; 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=g3532pJx8XtC8b5BqHRkc/LDFBIfrOpABziYCCae0mI=; b=Ng2kK8ayN9vJQ3sFuG+7qSlBuAtebOvuTuVLBV8RUDWVU85VQZSEHomoT1yP/Ca4DIBwvzWWGEIWAOwZGugOxfeL2fwwP0oMdyNR7RTgUPrlA/xysIbNZAAOuzhCJu2eoDJtJ55jYSawcjlmLEnTUiINUUikgGoihQFRYHIv2AA= 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 1787949980731342.43979349496726; Fri, 28 Aug 2026 13:46:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Py-0007N9-Rd; Fri, 28 Aug 2026 16:43: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 1x03Px-0007MV-MQ for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43: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 1x03Pu-0008QE-IN for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:16 -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-639-j64ThpVLMniqy_pVpUOu7A-1; Fri, 28 Aug 2026 16:43:12 -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 383E41944DF1; Fri, 28 Aug 2026 20:43:11 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6DEBD18005AC; Fri, 28 Aug 2026 20:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949793; 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=g3532pJx8XtC8b5BqHRkc/LDFBIfrOpABziYCCae0mI=; b=TuKbA/peW2qe6yWnL43rfBv2/0gcF6gFw6rjbR2L3cN49L6IY5gQXtBqgjfkRenOrk5+oL QRvHw/GsPKpleayZt4Y29lpdbargXOJ4uf4VXixEBym7KxBChceWkM3YY+qIs8HotrjZJL 5ku9hNIV5obYzceH1sVt6RSq53Zsy8M= X-MC-Unique: j64ThpVLMniqy_pVpUOu7A-1 X-Mimecast-MFC-AGG-ID: j64ThpVLMniqy_pVpUOu7A_1787949791 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:41:59 +0400 Subject: [GIT PULL 20/50] 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: <20260829-nohmp-v1-20-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=12898; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=wpmE1TS6HfynuLy8xc2o2mqysRdbeyZssssQvNGj95M=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKU9mC+zQ3tci8sN4uZP9lJUVAEBAUB34xNE NPOdX+JudOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5QeTEACMUJecLqhlNCHoeMYjJk31MP1fhhxPYAM/lbvhEz3zFZu+K+rMTtrSw7s7JUzsQ/JY0D4 ABrQlINrUpQHp53KuRwasUtHu2lhP6xP7FqsJVhH55qkQbCKt9YrJikWfmzmdrY/eSKVd0RrRVF R/UcX9DA54DcnGIzrBk5s4yA3Q6q9furEcoKhUMbumi6oerbhYP2j5R48FJpIICwlFy6GJCbwtf Dcfk0ETrxZRwbKkwXb/7h972o92pos2Ql4y9jVf3VECb6uP1WaGnESEU5sz9CoibodYSjw5sGkT llksByAONEH8ad39JZzeHzng7GkByFe3Gt3CjhH9XR9zoiKN7hDKg6vSzBsX1AnCdItNqgnnBkN s0s4Tc0DQAqdx0blKNpIh9JYS+rCPi4w/1cn+8+uN0ykL07nOBFpRGgjpBLYJg6uSpCURtEfqW4 e/DJ914NSIXzQq4OCwYCO7HHlBHEos8bTyH2lEsxF2+dD1XiXbgFQc1woEuzWaQ/HfcHFznfDt8 zJxF8TBvRkRR7OTa1PgcUNyXvujnMWZaaRg2PKqK07UFPeRqJ+uFU6cKTjNEevOTt0JaH1FmHnk XYft9O8Xxuy4gJBSYhH5VjPmMLVSiu+9smcYxFWn+vHL+iVAKlb5Ei9qhlOtGOq/GqCGBVu40St m1sIH5TjIdsg+cg== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949983195154100 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-20-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949915; cv=none; d=zohomail.com; s=zohoarc; b=ep//b4jMVns/co1XLz+oniOFTexr3VnM43Tgacyd3woQqJuxepg+VUM6XPbJ7pfwT4HYi12mvLepe9nk5y+Ehd0o7+3x+uOsAE4jFzzAGyuWauRIz17pQ2aF6HRwo0+4C6MAaJLXLT3/PQFDHZAjmt3eZE9Lf42Ju/cya3OTUb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949915; 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=O+C4cCt1U7ukAlcSau9Mw8x1Im100UvqxVRXFm+q/9g=; b=ARtJEBgOA6PJXS/LJyc6ddqEAY3Sm+BXkru3Vovv46d5uCWGGpgbzDNsdQ5/LucSG/idNBCTEJFYi+G0v34LCjxOPYhBFYtZua8tpzGKWzaGGQx2r1DBng+XNzTXON+VpUCU7bpHH81zrwkezVqo0Zl7s3f9lxfGTIAKiS3Itlg= 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 1787949915255895.596485011317; Fri, 28 Aug 2026 13:45:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Q8-0007tH-B4; Fri, 28 Aug 2026 16:43:28 -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 1x03Q6-0007mE-Om for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:26 -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 1x03Q1-0008Si-DM for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:26 -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-115-YS3WyD7ANpKDfNNNpGkHIw-1; Fri, 28 Aug 2026 16:43:16 -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 7059818A3C11; Fri, 28 Aug 2026 20:43:15 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9E19F1955F43; Fri, 28 Aug 2026 20:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949800; 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=O+C4cCt1U7ukAlcSau9Mw8x1Im100UvqxVRXFm+q/9g=; b=exP2rXAn2X+o1Q6TtnLH7n/ULBHPFcucgJzkvqDaj4bTEyCmI6IS9r4jXxaRPGVnLszLre 3gP48MOf+MQbWpiA4T2+LsQX5oqHsf8d2mkbjmEXj7rO6ww0LT3iNPl4tcnsS+jZO/FfUz j/yJtBywDadIC5psH/YrZvlOE3gIeA0= X-MC-Unique: YS3WyD7ANpKDfNNNpGkHIw-1 X-Mimecast-MFC-AGG-ID: YS3WyD7ANpKDfNNNpGkHIw_1787949795 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:00 +0400 Subject: [GIT PULL 21/50] 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: <20260829-nohmp-v1-21-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , Eric Blake , Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=150708; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=1SRU4qDVUnQOtqnhjoVIy8wyHO+sXGmJqSBeL+Hnf+Q=; b=owEBbAKT/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUJs9nzYstLVR62sla6whpJw1hPHegKJ8eH mA/vXPaVMiJAjIEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5cBCD/ddsww3jIlDo2CF3MM6eZrB/W6r2OFsHY+Z0imNL56Wra1XjrjZH2RYL7u/3LmCynt67qs mlxKLK0N+FCj6ECS4v110X41YI+ByyTrWGezQsPZcd2dr+f2X32IpRcrZK77WgCDIine93r1ajC rOoT6e/FqawdFAKwyrW/SZG/AuwlhSDdJZgKcjP/h6GfGXl5I9QDGXsn35dQe5jUB2dW6W8rvii hAO1tWMk68rKP0ZNhk/HClUATrAZjBtREHimGf1P0xMFbAlQNaEmPI23HKcOKSCdVI2QNSruVxj wxNGBezDa624xd+Srqgb+qV+9+fYz/90Ew8YWVM6GMnbiqAxTi6ezyoAYJnRpASmgKCW6vHyY0L AhzCV5cqItv/hCrfE9Zx/s2qIxzR1PQie74pNfLacmm8Qo6vCJXwp9SpAh6feUNm1HqUYzLwiK3 nZ4Zel51YFygSq8LgabhoZHk8yzABmpRCYbtVQeaWGNAxYsr6uJXY43o8ENzZ/eJE5+50U/D3DF HD19F/BbTODH/vyHnXy4pCHqzluPT91hwnggGoHxAqNENo2b1ycRg5vDLLHm4blqvyOwojdSbZZ t9/rEVfG9mpXVA03/+CVc/nMSuEckjGPLCaixATBZ+IzDooFpgyDRoxjAKZFAKzSM2ex8qQ4l7R XdQItqaEgjDeb 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949916450158500 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 Message-ID: <20260828-qemu-no-hmp-v5-21-9227de146347@redhat.com> --- 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 1787949855737295.81670195528125; Fri, 28 Aug 2026 13:44:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Q9-0007wJ-Vj; Fri, 28 Aug 2026 16:43: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 1x03Q8-0007tE-8P for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43: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 1x03Q4-0008Tq-5q for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43: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-530-O9bgTKQ5Od-S42hmxRIjrg-1; Fri, 28 Aug 2026 16:43:20 -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 F161E18C0FA5; Fri, 28 Aug 2026 20:43:18 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 337DC18005AC; Fri, 28 Aug 2026 20:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949803; 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=E0yxtRsnNgXPrXpPXUGgJhq34lX3aNVdT4/ghpoDFvM=; b=gU4u9C57ZeNi5uC5YtoV8h1TEEoqpnIWxat2bPidpMKnXCkJl0tlAKErfQyZUKL1ZRIOPC HDNCYORe3ezVQ324Ih0Y2Ga202ovTscM+SFPkSBLF3duPKgZB1st2fWwIp9UPOmveEWrFs XvKZVofKOFlW7EifR2fSyga1iBuNVgk= X-MC-Unique: O9bgTKQ5Od-S42hmxRIjrg-1 X-Mimecast-MFC-AGG-ID: O9bgTKQ5Od-S42hmxRIjrg_1787949799 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:01 +0400 Subject: [GIT PULL 22/50] 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: <20260829-nohmp-v1-22-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , Eric Blake , Markus Armbruster , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8577; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=O35SqeQo2IpeZKsiiSdgBY4xBrrl6SXMcIuOiZF3XPU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUawbONsYhZx1fZcLaGD+r4q3ISc8gT5w/e 9p84pHWQNuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5Q5qD/9oRqT8Zhh8dvTgiGPUOyJXMp6a6cjjpIW4KEafRzaOV6ftbIoKn9XFIAfm+sZgPaKSh6v Mefxa9+rMIoFv/f2p+sAm7iLhMtrS/HAdcES2uXfUR3pqxNo9rh77STDUDI4lgGKNkyUvLSu6A0 s11ARJw58mFKcRb/7iBivUk14GEMePh3M8k5jIErbgt++ESWKS7MDFgf/eQUeYvZkog0u/zfHYo /aWDwaCc2D8iBH6gJpf2qSIlql6CgCEDvSEcRKeRLIgRKRndPnGmcvOVzvX6NsHWdofTm6cqYDm sZnb0D6xpQnw5xrhjYyhEu7vrkZk4VHfAtvcY/9jHMwmp50z6XHGFWL7SJrjfrzvMgvwO3Y5Wx2 rVnfdBTfmPfS7Usc0vxgMo1Sq0PpXg/eSPb5l6uPNz87g7p4jdebg+9ZND4wIWIW3YaJW2rQVXB La7d3jYYVLYRt2zwi7dwkE7kliH/yx5u3v1btR6aQ4RcAaa1IpLSO1HKQxyg/VG5Ak/o7faqDXk yGbxHQI2pukoHWeM4ICiFwvV0GKi3geVZzyi9zDgnVqmNsgsFsONEpJxvTc37iNKYI1WZU7oIq5 2zvHyyTByt4OWgAJuWvbV0xXeumGzjY9RjTq6fP4YqLuv/ulSSAEhGts6ZDWLeRT+CRZfK834SA EnTv4e9vAWBBTWw== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949857346154100 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 Message-ID: <20260828-qemu-no-hmp-v5-22-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949883; cv=none; d=zohomail.com; s=zohoarc; b=biwWDds3+2Cjy68j9GRNlpznpfvRixnqYvAgbzy2YZCHhYzB7TTiXIIQ0yjSsuWrnz6FSJ2zlhwpTsnItI7I6fjLa2yPppiTVpUnLGIVNSIzWEInijFY1QRBJjkKdwofReyccz8nK+5a/UUmgHWE442zT9F7yXK54I6s6op/J68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949883; 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=rU1JuobZe1INS7my5A1LrdEWPdwzd/Y214ba/NisCV8=; b=IPoLF1zwvZX4BnStZocRC4Ax4PofNqSGWvJQnpPUjgc4GFEAA8MzbP4oGmMH59dkwo3Qb7rUCeT+C3UpRJq4HI1R8gRCAJr8jlSqxdNsd4CQwmxdsDW0jb0HH5kz3Hfp5FVd6YhFLIwelaNsf20GsLHOIAOxIj5bO02APNOolSk= 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 1787949883552202.9647360373167; Fri, 28 Aug 2026 13:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03QC-00085k-Hn; Fri, 28 Aug 2026 16:43:32 -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 1x03QB-0007yh-5O for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:31 -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 1x03Q9-0008WF-E9 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:30 -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-623-dXqQg4BWM5-ASX4FffGbbA-1; Fri, 28 Aug 2026 16:43:23 -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 58B3B180AE2E; Fri, 28 Aug 2026 20:43:22 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 62F101955F43; Fri, 28 Aug 2026 20:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949808; 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=rU1JuobZe1INS7my5A1LrdEWPdwzd/Y214ba/NisCV8=; b=ieGkDiWB2IE4qnZPrhFqrHo/+bHsax+mnJw2Xtll9qHxM323M5SmI31dO15Db44HmTAxnl k+rbiEY3z8b/8a7lxSWQV9nSy2dRrduLHXShwL0IbgIBGam7TBorYwrNXs4ZswfMBxYKBQ TR8rRfj9KviabUD2wa336ym09/t94Lg= X-MC-Unique: dXqQg4BWM5-ASX4FffGbbA-1 X-Mimecast-MFC-AGG-ID: dXqQg4BWM5-ASX4FffGbbA_1787949802 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:02 +0400 Subject: [GIT PULL 23/50] 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: <20260829-nohmp-v1-23-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=3305; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=RgvVsUcW+QcFTDrMP/ZKBkf1CzCW2rqeaLm06HOOQYo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUiGKIosU0zUJ0Th2/REFFXterv74AnftsN GWo1P9go0mJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5VXKD/wOx5pBaKTGqvq2ytm95Ws3mDeuttkjXqgWcHftWfHioEBaMAz8CFScWban+xiw+loyZ+j fqzbxh1gkymBdXMXIklCeAjHGNImBoJyhD1I8EzCvm6hNYJciz+z7oCYRoe1fRF+XX4HjWg90Vb VmOSp1qj+ss/dNsvknGmRxVUl7hg4oll5GFzLcaEevpX0jX9UaBcBTtxRbBFuF/zlgiktchJIqc 2pKKXQEGKKVWb8vFoNRmDw7R5XhiaR5EokOW1YUToomU4oV475Pwr+p3n2wH6c51BsXn2RoH9QY tcFRzYWWfhZ1UpmcX/nsqnVEPmIoN+5mxwJ6kA/LZWxwEQRY37ETPQix7CAdRxigL59Cp+SaGzS q2xZG7SqXoe8MNjL2oYsdfvP/EcFtT0DOZsDqU6VC/uHR7QIZ19xMRoxSPGj8Z8Aj63XxAG5kJ4 izi9KKCS7lDtFAQArHrPpoTGowaUw8nodOgCB/Pu8KiIXtkovMC96mOkDW9rATf4OinxgMauaRW fFjip19rC5acTkM4zSA/VWZQl0b8bLmrqnnS5/F/WQFz3BkRhVbmiIZVaQzM7S+q5Vlcc+mRgu1 8lVFi9j7g0ps2ue2vBWzz4kExWoVsD4ZyjmseNpW+8wLCnRukz4VzDIpvvZSA0ZgqEOjW1l7zlB ZzJ+TAwwffiG9fg== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949883808158501 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-23-9227de146347@redhat.com> --- 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 bec37c71b8c1..28bb72bfaecf 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 Sat Sep 26 23:03:02 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=1787949887; cv=none; d=zohomail.com; s=zohoarc; b=EREdReN0XttTuW8HoEaBCX857v88UwdcepMwEqScXO0OW2sYMFGlehGJ5Ee/4m/wss1xXiuqSZLXP0ftq8nD1BiqPi7gtrek4QQx3pgc8HuxAzGb73QHl2OcNWosHUFwIr6RRdYR33XAVcKevzSGaiY8B0nkUxloPd/WZGhxPPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949887; 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=D00l5FTSxYFuzcd1Y5U4YFVNswLFPmD71iWlEb8JX7M=; b=E7sovM+R05Em7q+Qodi9FYi0NWVfH5oYVyvJmyZ24IgwOmztwAziHSeXlbsRTaJlR8z+KdaFSdCcZFRgEUvR/e77MFquqCvqVLvuYXlL+LaEN/qXwxp8vb/aN00d1Q5mA1kurSOTkrpWDnI/Lzb4tGHVvEcFuCCVVYV3RfW3A9w= 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 1787949887647743.9247189863438; Fri, 28 Aug 2026 13:44:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03QG-0008Di-89; Fri, 28 Aug 2026 16:43:36 -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 1x03QD-0008B6-Kz for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:33 -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 1x03QB-00005O-0S for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:33 -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-675-hk2LE6W_MrWFR9LIfMh-2Q-1; Fri, 28 Aug 2026 16:43: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BA655190A0BF; Fri, 28 Aug 2026 20:43:25 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DFD441955F0A; Fri, 28 Aug 2026 20:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949810; 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=D00l5FTSxYFuzcd1Y5U4YFVNswLFPmD71iWlEb8JX7M=; b=NrSe/oKobZ3T1py6NbWfvkUcE+kfzR8osKGtqKrYwjRKWXEuVmYrd7pAsFTXCkNBUQ0lPc IH71OuSXAU+l3aNPf1Io6QtlkEuZJnxdL8Awx/oDqHQYTJ3RrjJghrHnHnl/Lsc7JT83eP 8xIxgALctCyprKHUtc9ESwxMer2s3MA= X-MC-Unique: hk2LE6W_MrWFR9LIfMh-2Q-1 X-Mimecast-MFC-AGG-ID: hk2LE6W_MrWFR9LIfMh-2Q_1787949805 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:03 +0400 Subject: [GIT PULL 24/50] 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: <20260829-nohmp-v1-24-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, John Snow , "Denis V. Lunev" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2509; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/fv4qfoBrfSIQzPmJEBy59uUqC32wRREnpe5HVVqozU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUxH8K8ul0Os3u4DcIyOAeDAlS05zrk+G7d ZeyWWJDkRiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5fkFD/9kswX39QAe0OPs7XqreTCh70kIHrkqImRarWqD0oJ6syY1lGGzBqh+T5nDq6irB3FB7SY 1kgQ2esi27fxFvO9DJHG6ZdzuJLKJs3Ta0tRd495LeCg5NdIF4b09hDagGPhk+2qVp7CRCT+Gk7 qUTyMAgL1qTmvLsrkRMku7KhhvsHeoa2xwt1Xq4g2WqLeuoSp795Ouly8IhcSBzAfOLLlpC0GB+ 9ei15TAHhtioSNpHnZoOG/WBS1rd8P0/eFSsk3+sNbHTwosTTtmIvnUIT8cuM/Zb+7zPYQCRHAj G3VHPE9l5ni6NAAXLkAqF9NTDWamt9OCnPluBgqlW15+Egy4zYBmbjpHg/zdk97GOSv4CjcJ76o RRerLi2Ys4b5ZCC8gEfehyDn2wQ7CnRKooAad6RpedtkKjgwFHZC3+ob9kyNua9Fnj9B91ZjMLK RiAu7yR0kUUNabu9bWQGy0Sf0tHMn0wAkGpF9FClK+vErJ76eJENBWaS+zocFNwP1OG+kM9pS5r vm4+qU9ity2TjVKg0HqrSHimG/yRXUKbzTDVBgkdZFovYxZ4NQUVn00n0Yr1mgRaarNdB42iAwM TJYtJUbj8KkjWGk9QDAcr8hJAVksGh/JT3rfZf+YZ2vEbn/zmcJqyoKCNvB6R8R6bAwluATBWL8 BKCqPkWiQJ/B5+Q== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949890047154100 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Denis V. Lunev Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-24-9227de146347@redhat.com> --- 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 b143862ce70c..3406ca884fb4 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1758,8 +1758,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); @@ -1771,7 +1770,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 92e3d9b3437e..05ec58f8c528 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -839,7 +839,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); @@ -851,7 +851,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 Sat Sep 26 23:03:02 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=1787949941; cv=none; d=zohomail.com; s=zohoarc; b=HKaIL4CNfJVDHyCHBd/qRtq3PkgVd1hTzwHsdZcrmgUaY/YzKc1vbG2wYt0bkrxTrniT4XWftAMkvvAKzvIwZ/mPE5+hCzaN1EadBL5N/R6aKwGK4Qk1GbBtgo6K5ZOBwmF2XwXnSmR+vIf4a3j6k1a5ujOLzK9LLNA3II1Ge4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949941; 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=nREVHJ2ggPDWwiykw8rk/olCs7J+5ZR9LLZEi+jxMJs=; b=bNazJT3HYQS3HRYWJUzcfyoOaLH5R6wM5SgVO4V5gwjK/1qNeHVAu2UiFx/T0waMGvAZDj+q6FPCCsPnHRQcct9sYMGMv/zg9Wk829Dw+vet2TqR+lr8xAZRa+eY6/qtM9hFmEZBsc6/vrESOW4Sg/ScAMd9nHgw1Bs6eePr3TM= 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 1787949941248590.4154015416048; Fri, 28 Aug 2026 13:45:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03QM-0000Ee-6w; Fri, 28 Aug 2026 16:43: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 1x03QK-0008T4-4M for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:40 -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 1x03QE-00006p-7J for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:35 -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-121-IG5Lq1xXNoi-H8xqkvZQLA-1; Fri, 28 Aug 2026 16:43:29 -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 CE3C618052C9; Fri, 28 Aug 2026 20:43:28 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 11F8E5B1; Fri, 28 Aug 2026 20:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949813; 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=nREVHJ2ggPDWwiykw8rk/olCs7J+5ZR9LLZEi+jxMJs=; b=Qo45+u/OfueJlhNDaB8XisuQavadDdYBe0l4siyarykwaA7Mcc2EVykjQ+aziVpN4HkTk8 jG+gobFeODXzILqqpNGFgvOe5rhqLM1ehkO+EyXAbEp0WI6AZoDy3M1EBJ+ztf/5G5Rn+g BFYb/y4DbnUoA9mWdX0kRfnq1wpccXI= X-MC-Unique: IG5Lq1xXNoi-H8xqkvZQLA-1 X-Mimecast-MFC-AGG-ID: IG5Lq1xXNoi-H8xqkvZQLA_1787949808 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:04 +0400 Subject: [GIT PULL 25/50] 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: <20260829-nohmp-v1-25-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1613; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=e7iJENBS4MN65nfoPd/4nF4dxmVAXNCN4WhH4u45gAI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUJZ/MdLw4Xw4Q8fj0h0ReXRDVYtAqsvzcG t3Cqi2wKhWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5ex5EACdLYB+ce4TJnFV1XbCwXIv2N/QCQ9Qn78fICX7CquHOsfP7+PJ0HBdG7TbWMl7maGwi83 mhiBwLI4lyrSniOU7csBlUln7Q5Vn4XSF9GGEu2fFndPcpybzzGoZrbFy1Wu0uyBjzqVPx+Uw7S D/bRvvpmOhQ5wLdaww/01IkAoa96zovxkpUJsA8FPBnbPSrDS3LfftGPmeHtgXEWxCiuTabo4mw E5bqyzjdWctvB+LVN0r0TDorCs2d2BQrKNIOy5Ep6iPTRhMK7ksHRPrH9Zfp1CIq3Nqv69lYzto qyaM5Tiko/hMW/F6iNUpXCRHpKMgvW707VtLXHixbDrxHewzezucbVXUKXQX74MxEiXftwiHHTP ciqB3Omh1w58rreQwNXWxogUuo34nOFeXosMznFT/gPkrokLb1hxlMutjvoR6uWNKQ1cd9S9BqH i2bem+96iM7bIfDztUmZ8+5e1PeFzXuaTNU6pAbTDNJW0T6eX/X1B9n6fFZdxBK4eWdTlLSpEZY D+FAce0u4vopNQ1eBW0XHncSi5adEMv9m6/Vv3Zi9ZKmAp3GmfY4rAheOtfFEJoeVT13KTFgWA1 GQ7xALbsC3gd5eQARooi8eMk9CHO1eIQ/keofRTi/TZKplVrP/oZnG1CZSViD1XSvtAryJ2JRot mSkwszsOoH0U3Ng== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949942094158500 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 Message-ID: <20260828-qemu-no-hmp-v5-25-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949830; cv=none; d=zohomail.com; s=zohoarc; b=MKrsZ8055POrieuqUHEROTUaaw0k/BD3LK+9IYMUpeahIyQQ0f2bP9KresVn9HRo9ZdAfF4YcDT7zOFXgtKvCY9SIMG8+6FoEv7XHAU+EHZANtsEW2ZeeGCbk8YHngbsY/0SPm8uNjVmrRribhl7GNm8L54y593Ud+3xxBNqyJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949830; 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=PLeeZ0AHiOKQ2oOvOf6V4+XfqMQ/FMyIOOORqxDbaMs=; b=BEHTR4rtm01dqQDwJkTH5rE3ARXzT3lKZ2vk4p1buBoqCEKxzMy+5qD5ZzuxrWttBaFT60KAYwWJMRYacwtREIOX6D22zgNogXo3f3UKgrQz2QHStiXX54L0oE/K8Rev5GmsYSSZTf8lmeCEbxQuwy1uW3XI33qu85wJl0TRL1s= 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 1787949830931368.0251307486118; Fri, 28 Aug 2026 13:43:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03QN-0000I9-TY; Fri, 28 Aug 2026 16:43:43 -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 1x03QN-0000H2-2J for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:43 -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 1x03QJ-00007x-Ot for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:42 -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-152-uc1HaLSJMRqSFDICYj3Zrw-1; Fri, 28 Aug 2026 16:43:33 -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 2F68B180AEBE; Fri, 28 Aug 2026 20:43:32 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 64B4F1955F0A; Fri, 28 Aug 2026 20:43:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949816; 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=PLeeZ0AHiOKQ2oOvOf6V4+XfqMQ/FMyIOOORqxDbaMs=; b=G+YsAMs2G9Sr3/o2wR9utr9ROqzB+FgTeixS0JWMIQiQanGnNz7gtfEFBoTkrlGIAecGXg 9PLvNtnVxlhaPEEdALi10PFbZr8VJZA/cLRmq7XEATb7Sx+IqYScf8z+1jhmXYppW7ghMo RA1JqvhRZTutAfDoqiqGLZvLetw7wVA= X-MC-Unique: uc1HaLSJMRqSFDICYj3Zrw-1 X-Mimecast-MFC-AGG-ID: uc1HaLSJMRqSFDICYj3Zrw_1787949812 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:05 +0400 Subject: [GIT PULL 26/50] 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: <20260829-nohmp-v1-26-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1317; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9yUWqz9+Kpd5K4Ga7zpfZ8+so7PJQ0UEYfgEPskRBu4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUV1ySLwAY99VN9LCdOEalNXUDtePdDeRdt Xy5hciFi8KJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5eDiEACSP/G8wSC47oOi8csklvyMt//BuMaRnFWYhG9sCGDZ4WNt0+8iy4XAjrQOoDjMq5uguvy hHwYGBnMz3ZSORX8wquZB/KQYataTybNk+PTBP023uB7E22KcGZmefxB2S2yJbyJq8AhLx3dSFz dy68WDkI1RnEVAz5Frl3fa4vauhIx27wp1wIMAj2m7zNb7pCqCsyO22qNRG5FDFWPtREs7Zv9lI SK0YlKE4s+Ut4Ry6dnJZXTZrBbsKj6+OCWgBgj60BUtTZuhlqSAsZWAbVwLn+8SZ8txG/dXzWZh vBJN+KhHaikgv4bG9GLr2e79eaIMWi0odvntec/PLr8G8IGFo5kADwdO0XKrBHtr9R/dJBVpNtR Kv+seYjjL5eHl2HlPq5etZLu6fTdyhvc4N2Fh0kjXgSMpVugFRy2klyfXXRk2lDHkZOcitDLrUc n63kr72pJ0bj70x28Qpif7s/HdxTjv09ANwfUMnB179k2jslii+VpeiHYJJ/Qz8MPURxGV6wewj dgK793O7YeuJ0V+LVcF3F40bWCapOg8L0Xg8BOAv6alIxkGCHRhatgi6ANnNCE5/LJz0yVtVhDW H0RbYkBnqpUvAhRRo5o3fFIzNO0DfJwbQ7z0maXb/E68jagCsiUcdTVswxpX/EAHiqbapkgFwlF pXDg+z7+J9fAw2w== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949831575158500 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 Message-ID: <20260828-qemu-no-hmp-v5-26-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949883; cv=none; d=zohomail.com; s=zohoarc; b=JHop3tD4OnE39FP+7o1cgV+9tdDafF8VWg6F11ktxD0A4S1RA4k7UIp6ThdyxhBy3fJx4I/PUsN4rvMlLh/DorzZwZ1YKpYiWwqW4Pw/ocC8RqzdgQ56dl+dHZe5qNY/ZQnFLG/s1Ghowq8Tm3MRHogCKymgMjpRfWegryumwt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949883; 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=iVPrkPp6gs0IB0j0xiU0o5owVlvgiG2b14b9p5/j2Pk=; b=CJrtkYRmdwXhz60jAXyfJYH0CcL2JKm5Y1N+2Pt9ZhMnjPu4qfZJy4jxj7hmsl9moK3r6UpZrnbcnI7wgN1rl2h2rLcC+EdLCf+Jzw7zt7ousYdOlbDowtqC/50hkC9jKECGH0X6Cob1oJzTKHr7lnCsXfTyk2/IOmQ/PKAHrU0= 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 1787949883306294.93961884969633; Fri, 28 Aug 2026 13:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03QO-0000QA-SB; Fri, 28 Aug 2026 16:43: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 1x03QM-0000Gz-Tj for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:42 -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 1x03QJ-00008I-P3 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:42 -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-GA1zKLuyPXKagwUnWNhTJQ-1; Fri, 28 Aug 2026 16:43:36 -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 652E319091F8; Fri, 28 Aug 2026 20:43:35 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9AC003001D3D; Fri, 28 Aug 2026 20:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949817; 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=iVPrkPp6gs0IB0j0xiU0o5owVlvgiG2b14b9p5/j2Pk=; b=FibohBNcp8/7ZQLFkeqkeGRA5D5trWA+Aupe4Y9QkkR+l6cWnHYhCkokkndivv/Goz3KQM +gT+q5XNsRaXUp10Z62FMSf4/NeF9rYdEpb3w1wwBBoxyVpdWYOoh1Hi6zavdm2OTDCnYY lHLjzetAjl/U1i3Yzl9Ab9ZeQjF5G/8= X-MC-Unique: GA1zKLuyPXKagwUnWNhTJQ-1 X-Mimecast-MFC-AGG-ID: GA1zKLuyPXKagwUnWNhTJQ_1787949815 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:06 +0400 Subject: [GIT PULL 27/50] 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: <20260829-nohmp-v1-27-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1234; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=QNxQQy78jELbT7+yM8nfG44cMuZbkNhjHaeOwKj5cOw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUr5kNQVavc+INsF4m4M4Qua5daawbS+n1U m7Qr1MpqVqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5fGPD/9hj7Y6CjCxxPenxdWKF3v67sGA/QC+IsNNy4ljMFfNPFvu0dK4WVqLrwksqqqTnnGmYmT hVI/SKF/jv+K9yji39rhYXBV1q1hY3cf0ftDz+fOF9zzdhbPNSteT4lD9m6I5cFCxfKNZgrk/u+ A9+/o3o6T9RZIe3wHBtCUIKMmp3py5iwVtLvfIKzskur5ZlJXACHv73ZRLFxXRWbnZKmw/jqYin TtWTJHtHK2zqWyvpkMapwWR9P6kAmeMtaPij1aqgQDRMBfImuf0ns3MY4mt3awlo8+rgveZFiCg LGMeB4ACkBKazwPbV1f/XWq3/HbjkWdX+Gg6wA5LSh2488JcZqLDlSDxiCXwEOeeeMZTQmmy3Gx 5A+f+GTt8FK/NYBW23AvRL/8vGkJX/B5e+iyB2jrpBmuESrOkEFY95TmcPBgAkExIjuy0V8xve+ /j7Lb1q9deQ7nvOm/NsvaXwb+m9DTxd3SbWYyPkbImb9D0uotCOJAIeIWtPzRLVrZ1B2xNTiSbB 5gjjnw44pfQZX4R6Uxtjl0Tp7Rhjp6ouKlVPYT4HThJZKG5FAlSQXrKSiXN0x3ad7Dfw298oWEr /oL6lAUqNH3aWizFqae+ArOpeNTzK8vrnIvgjAJCRk2jkhrOH60ZLQ+YCBLPrGwgx0ROwUklSRU s61NX/HftVNKV5w== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949885649154100 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. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andre Lureau Message-ID: <20260828-qemu-no-hmp-v5-27-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949845; cv=none; d=zohomail.com; s=zohoarc; b=fcf+yXobQXLUdBdtnkl0wM5wkGISg6KB4dGCBtGfScVENwynPm1oRhmvQngfXDa8vES9Zb1wAg+Xr8mLna9rWezUu1B2E6aOKeS+G6sl7Mrka3LtRPGblbErTqwky6mzhtSctMvE49ykxu3vFIDvsnxcb9QYIZf75UM61plB1C4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949845; 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=BXCLwhgcQi/gt5bym7mqNkDOb0wR31qDVj1pXJtDITc=; b=n728SOYtGy9flXJs7Na9HHlsy6VXzPCuBb2WT9s+q5lfxr80yIzRpmjDNL5VKGx/UwvJfsb9gjO3aEdH3og0s6dNuDuluhuv0S84cPmvQlHe/NPuhLo89Bk3uQlIS3RjbJrJrOy8iFL6W48hINV2B7omkQDn3A7SCYZH/nd0v/I= 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 1787949845631929.3305180115361; Fri, 28 Aug 2026 13:44:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03QU-00010d-9J; Fri, 28 Aug 2026 16:43: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 1x03QS-0000lU-7y for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:48 -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 1x03QO-0000Bf-Ro for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:47 -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-149-7q6numqANhK5Ocr4v2Qgig-1; Fri, 28 Aug 2026 16:43: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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5C54C18A3C04; Fri, 28 Aug 2026 20:43:39 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 54C671955F43; Fri, 28 Aug 2026 20:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949824; 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=BXCLwhgcQi/gt5bym7mqNkDOb0wR31qDVj1pXJtDITc=; b=RgaIyROSUzHHDMUCCXpLU2tbxtNh9wRJk85mCZXtEscQkHvztXFn7M2Brjvr+LEAkE6hkP 6IlaAzzBm4A+oxqGcBpCmsHjso3/vDaysrLECPDYFjXfO671E2W2dF8YFi4UNSxVwlB3Jf RRk15gR181o9TlLiPWEecgc/JRMtJZs= X-MC-Unique: 7q6numqANhK5Ocr4v2Qgig-1 X-Mimecast-MFC-AGG-ID: 7q6numqANhK5Ocr4v2Qgig_1787949819 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:07 +0400 Subject: [GIT PULL 28/50] 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: <20260829-nohmp-v1-28-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3808; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=mS/yD7T+C1jv09uRDGQ8wX8aprHujpG0sx8jk3RQCNM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUTXWXHjLM0HVtcbKbRvvNA0C2hWNJ04ZkW hWnG4yBX0iJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5QR5D/9V5W0Ig9KUVyvF0UWq2tJHnjs6Kj3H+orlpNcBgikHsSK1fNJdT+iURepIs5Y+n/3hGJp 9E5Wh1vOzM2qcc6m6VZpk0uoUK1FRaBcUaIlnxB6lcVNEvzBQ7JKlQMm8VDrMCcEYsl8rpP8CPV ilGkbRffI1+bSn6WdbcPXRaz+avfL4P1Wlxq3elnhclLVebj5zHLKQhkzzVsV4edf9ZCjWEvQ9B d7bzCSdC6iGsMUxC2P/nmqM50Vfm0VbShPc32TN/spoXMZDplxbqFfu83OYdNVE2HMgrXhJpf9X dfVHoPCSS46O17lg99nwzcq+8kuNETTPvJc9VuPV6YXC0AHC6xiFtEWDcYKZNAXY78700W9uXif Qa/+mfvEwFMQfUZZBEAdEfU7XZZljmtjYUJEBDssqVkUaU5Q/vnOkqpoGN4jYQZHaeXtVOiz6qV 0MSbL8LyMXVuKNNGC9g7W/2aFgHLeZTNKlAXRsGIm5l5AbrFCj5W5mdo993g4T7PsvvmmNIHtUD 5YuBg8LJLakb7cAKRDUPWn6gH4sJSevP6PbDtY7adrVdoWy881RR9wqvkMJKMfidbZR38vVzYFJ XUXZnw4WQSVDBMFOs8iLN5WZshb7GclR37kRMv+ho0wFu3hQHDghHTfL+F9rcM3tMqBtrxH4AAj cBIx7tm73cXLg8w== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949847712158500 - 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 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-28-9227de146347@redhat.com> --- chardev/char.c | 9 ++++++++- gdbstub/system.c | 8 ++++++++ qemu-options.hx | 6 +++++- system/vl.c | 2 +- 4 files changed, 22 insertions(+), 3 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 562c4c2b0353..d8c7bb20ef23 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4993,7 +4993,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..eded498fa7e0 100644 --- a/system/vl.c +++ b/system/vl.c @@ -199,7 +199,7 @@ static int has_defaults =3D 1; static int default_audio =3D 1; static int default_serial =3D 1; static int default_parallel =3D 1; -static int default_monitor =3D 1; +static int default_monitor =3D IS_ENABLED(CONFIG_HMP); 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 Sat Sep 26 23:03:02 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=1787949973; cv=none; d=zohomail.com; s=zohoarc; b=H7xbaHc9ohiVpifXy1S6bGzAwVcS0EeHB8fW+vidtreCWOF01dNCo308IuYvrHFVoFD3zla7IAy8odJ6HglVxNrP7jzcRteAj5KH35DpPDcQkd1Y3Sjnyvkp2fxQoFEWWApRycKcdEPm89fedFUWpy4glI6lYEyfEsTThWda22g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949973; 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=QRCEFE9/Da71Xo927Igc/zC1HSCYRTOzUiW4AkqZbMQ=; b=SYK8fqwodFgPUzZXSywcVv/iAq6GZjZMVOPIifHB9KAaM28szDktu+pnP/JJg4nmsiPeb+aBN81lG0KAtE6XGp51OFTOBjfb3AnCljjdjyq8ysyrL36EWXn+NzUs80PIMEYTAy+PhM4WCsHGcSLcKZkcAN2rPUIbKGbFNsbYmL8= 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 1787949973983866.4599207313292; Fri, 28 Aug 2026 13:46:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Qa-0001Mf-6z; Fri, 28 Aug 2026 16:43: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 1x03QX-0001KS-Vf for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:53 -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 1x03QR-0000Dz-Id for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:53 -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-390-OBAbDsSVOMyUMQw23qH7pQ-1; Fri, 28 Aug 2026 16:43: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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1204F1944B0E; Fri, 28 Aug 2026 20:43:43 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C37F418001CF; Fri, 28 Aug 2026 20:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949826; 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=QRCEFE9/Da71Xo927Igc/zC1HSCYRTOzUiW4AkqZbMQ=; b=H6gnGpB8E2/40IyDMt1dVSUoICBmdgxfjJbPSvPdCoPu585yUSkxg1LmyZu6vxXwR8hE4s 5mwFlY2zy3uC2GXzXR2zhM9NvQA//EyaOIdPNQHN04t55fbLfPPbA+nCua4fxydhDQVhwZ RHqZXJ6lkykOfFV/uECM2U3DcGoXzS4= X-MC-Unique: OBAbDsSVOMyUMQw23qH7pQ-1 X-Mimecast-MFC-AGG-ID: OBAbDsSVOMyUMQw23qH7pQ_1787949823 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:08 +0400 Subject: [GIT PULL 29/50] 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: <20260829-nohmp-v1-29-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, 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=41132; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=GXeZouiEcb6nKyMRNXhijNP+66nw3hd9IJ2drFOFRDM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKUnHDJFlo0CL/d3aPLBTFNGu1ScKbAT0eMD u8qcRVzG4OJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylAAKCRDa6OEJdZac 5ehIEAC4y6B3tkaBU9Rb0T0f8Rt4FmKUQkZpZBfDqLUIO872n2eoJ+U9hGq5DGVZdHKFRkR4oIz nh7VHUhDo8l7Fd63KXEDxNCPHzUhrXll24WroJs3LgRcgxVpMt8apreCje1gSRpoiR7bIDc3iEq WDEHcIVmXOx49RW/jHMTMDtnYU4CP8orEKpAx4HMbdnmc6DsNHpCuVC8YgZoj63W4qTGSyNXmAL kRPyIBM7Pz6CmQmNzJ56sy4F36eeSnof6ACgBlx8UmfQ6nK/HRJ10hE1ptTLPYEtivlyga2cztH O5omWnaoCjByHUTLwn/jV5CbJP56jZmfUu3epmum/L3nqjDwY78ZhTOZkTXRb/pt/CEVqaFlzUg REhBRx6uSrZPwm6fZHof1wApSUyRy4DWljDxcL+iwL779N0e5EuIG4nShZWSHOAA16kaWxvUOvA wgYDXNeZ/xs+hUq28w3m+8ZqbbrADY9f1JTd0RTkYvrFfxlVPbLQHJ6TrY3Awt0jwGRHkEq0c5c e9aNVQRYC9ciVLo7N9qcS8aHotpKdO33EsrVJGxb045/jpRMh9rpvSBNKUyafonxIIwIHbYYiyy MRXDs0ptdMTt5jFOeafTX/msJ46ZoyqyVMqO+Meui55BljwgowzgFtnbqbhbCNld3tBIbm7ARO3 5lhp5AiUP0ZxSCA== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949975272154100 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 Message-ID: <20260828-qemu-no-hmp-v5-29-9227de146347@redhat.com> --- 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 cb9154ca8d7f..25439c9eb773 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -329,7 +329,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 4c32da594a4a..cc52c2d87936 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; @@ -405,6 +420,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; @@ -436,6 +456,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 Sat Sep 26 23:03:02 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=1787949923; cv=none; d=zohomail.com; s=zohoarc; b=ilBHB9wya+b0MRo97XnhbxkhSMkuDxidJl5jOX+KBFsYoosJ8Z0drjpsEjDTGTFovgGrMH9Iare8AzoKax23BBCySHjwst/Xy6r5xVAt8zWsGQKtLhvH4qXNtEU4Fl3+xKir2UT8kjxqtDtPvkUT3HqqPE205Ro7Ghqvrzr4oBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949923; 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=eoW7o2w3JwJ3/PKM3kaLrXOjzHuADU29Xw8e0B2gWQc=; b=aJjKJO3khIBbUKtl4cq9Cp7PMxNBV8acUxENL7Dh1AEJHhbCQmIhIevkA5Zjq9p4pKNGUbK0q7wCi5AfzgNWg4imYmLv5TK0LojE75+mXX9+z8fQmUHUUkTjK7+jsdwjcfJiLeJIEAhLtyVpx54jnaB2VO+c7basb6yoWRKhLVE= 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 178794992374374.16302503384327; Fri, 28 Aug 2026 13:45:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Qc-0001e7-He; Fri, 28 Aug 2026 16:43: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 1x03Qb-0001VV-Eo for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:57 -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 1x03QY-0000Iq-FO for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:43:57 -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-678-0Ob0tm8COMqsk2YHk8nb0w-1; Fri, 28 Aug 2026 16:43: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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3ADE51944CE7; Fri, 28 Aug 2026 20:43:47 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B91FF18001CF; Fri, 28 Aug 2026 20:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949833; 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=eoW7o2w3JwJ3/PKM3kaLrXOjzHuADU29Xw8e0B2gWQc=; b=BTj7b+9xJNLeF0Eb1hpzw3bJNirBaH9S3rHcQEM4aVz5vZBXoVctpGPbMqoemyhtogu3XM v9dJcjDgoFz/UJUDVFe8RAbvkmTu/69piB3m/jjhRoTawzj3EovnwU+VwyBNDvWKFQ9Ozl 22dLtKUu3+KEqAVpY9t6r0C0vftoDII= X-MC-Unique: 0Ob0tm8COMqsk2YHk8nb0w-1 X-Mimecast-MFC-AGG-ID: 0Ob0tm8COMqsk2YHk8nb0w_1787949827 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:09 +0400 Subject: [GIT PULL 30/50] monitor: isolate HMP declarations in hmp.h MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-30-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S. Tsirkin" , Laurent Vivier , Amit Shah , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Brian Cain , Pierrick Bouvier , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , "Dr. David Alan Gilbert" , Markus Armbruster , Samuel Thibault , Jason Wang , Yoshinori Sato , Stefan Hajnoczi , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=15946; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ZxP2zuDU77QuYSgeDP8Q6OgGS3abQd+ghG/LNZ1fqlc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKV+TiBXIR4jlgcsWZeWMBsAT4CApvmu2jsA ftWJcS3GnCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5Rk/D/455eZoCiTR9S9WIn0xamX12ONzpRLrbFXzA5SfJEe542d5yawTFv1VjjY/ehGgKjTgefl q2Tpr3RpgG1TLjcOMVxnk7rcX6ATgKk97EI5qhrnwSz+7mVoh4yyvo5f8ZMv+UWzvrwyllAdm3r jK8Lm5QXVtkInMNJLinALKrL+aNyxQR8kt41NWu3BKclNOMkWpYrZUt1BFY8rWYQkNT8XKjUJY7 bLqQzTsEjHeZZOrwACSqHyM/Niw8kF0pRPvS0z1e2gdxJcnnNn3E5pzW1E5Scw9/+Ad9fAAU9ES KF/SNdkBmNzgQrirb8VMfT4N9enbLoiY+kmHI4rPOzT920czgfU8oZ/A7X0Vp9DrEPSDuQYcdBO KWkSz7APd8gAIg4PEQ1qGuzWDwtNRPuynUUk6XkJgpxiL8nnh3wYN7Qy/CE5W537rvH+qqrYW73 RBbRDQMuGuLWtp6JglPTbuzrCigYHto5n5OK/nfDBgvR8lgugyQKTqAxZdkX7X/moL9rt3DOPBU 4YOAK0EJe4OSw57zmZF9K4OtBo7gPYpZ7K6kwLhB9pZ/bEAVDTz1OnGMh+mYPh6NEMpGr0ZpBZ4 bVnYj/6Q0v8NIsq7zWdXhjrXW9kIFtEHOU2jevBQ1IWD7v7fYwJ5EtmHW590/WEw+fnAwkOdNKd JiEeBQ7dbCPsp3Q== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949924137158500 Also rename password & commands with hmp in the name, while at it. Other functions need larger changes which we will take care of next. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-30-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949961; cv=none; d=zohomail.com; s=zohoarc; b=KQNtvXCdnog/JXfryFrT1CWoJbBgpC/IgEK5Sq+6LtDjLw0m6odxx2cS4pPnb/Wc3LW3Nwsa1p8XLyg/LE/PNCsMV6UPBIow96pApuGeyJPWlvmmQqhZZHi/limVPHN/cpBTUdfVX3Wq9dxv6zqP+RDGne/O1qf9yhRG51dg8+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949961; 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=cFoxPtLu3Ck35QSCzEloxQU1yiQKuRhEpzYxa4Nk+fU=; b=BSuadLYVGzaQaY7rjTWfwwN9k3nIiefT0fkjVUuKC/Yj63tIXr6VsuYyFunOpLohbR0UsUmpXjMqVapUdAKj3KO0FRi6QcYbmprAzEPA+vEpDQQTV/exG8C5eR/ZeS8bHaBdEGWdhE5OEyGpg1dHo+qPsBFyQFXN9hYVl2jTroE= 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 1787949961909210.29407480064094; Fri, 28 Aug 2026 13:46:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Qv-0002yN-Rq; Fri, 28 Aug 2026 16:44:17 -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 1x03Qr-0002nh-Q0 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:14 -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 1x03Qi-0000Oq-BR for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44: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-586-5wIVm95oOJq-xu2dbm6biA-1; Fri, 28 Aug 2026 16:43:59 -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 992BD1907BF8; Fri, 28 Aug 2026 20:43:53 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 46D1F18001CF; Fri, 28 Aug 2026 20:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949843; 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=cFoxPtLu3Ck35QSCzEloxQU1yiQKuRhEpzYxa4Nk+fU=; b=cxbaNABy46WVJlSS4L9VOWP8xQZvxsyMZHBA5ooxSDfx6Bmw0cHjs5RP2+j9si8lAIHgl3 Kz9+rnqGG++Hznm6ZzxQZQjFH04FgV6O37hUTA4Xx9Z7xNDjgONd02X2sjZMgzg4FbyDFm 5g+xyc4azsqQfInkrL/Euw0v/M4h4gA= X-MC-Unique: 5wIVm95oOJq-xu2dbm6biA-1 X-Mimecast-MFC-AGG-ID: 5wIVm95oOJq-xu2dbm6biA_1787949835 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:10 +0400 Subject: [GIT PULL 31/50] 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: <20260829-nohmp-v1-31-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Gonglei (Arei)" , zhenwei pi , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , David Woodhouse , Paul Durrant , "Michael S. Tsirkin" , Marcelo Tosatti , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Halil Pasic , Christian Borntraeger , Jason Herne , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Eric Farman , Matthew Rosato , "Dr. David Alan Gilbert" , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Samuel Thibault , Hyman Huang , Peter Xu , Fabiano Rosas , Markus Armbruster , =?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=108582; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yn6dyABfVLQUK2T3OLQkYLf2GR4UFPHk72clDER1lFk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVcLtKrqfa1qYX8VwvBmzMD/nH6mb0vVJ72 dWyXvYwox2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5XOaEACrWUiMhg9BAgldQi8map/Yf7+1Z5btlC+1b9RxA/P3GQs8UrfVbQCapgj5lJXihrJvQqG 0sIRHgdaT7Z4QQQZ7R0V8FZ/7/7AwbmdfbXRC68zDdV2Ek2BPh2WoHo6hBct9lgYb0t2sn+8UHl YyPlaaHmRD1BF8KmgFGl09FTjBgz1R7n5Q0lh8yWCT/tROR8FEMZ97uS5FHph5k8Mnv4c6R7Cpa B670RYC8fQMSG94KqUIoOQ3LCt+IEiUkDJcrASdeMipuW/Livv3DVBGMTWF9DawGiaPYpgorIVK ZEFpyshNyyXJyzL5TzS57sdgKpvBWfbZ91s0Q+NOycCKzgQXycFLBLEMmWAxcLDS4SD6jNlfGRl JZsYhTvF05V5ILZNGkfRYgMgindBYTgryD6keuIyKjFyJZEjBhzbOOWuww/3L5rBFfsgzp2O26U q5MrsDUSh6gK9NKgHVLB8+7NhK2rVePxD/ltV/k2tTKJUymVH1ZFQKH721yoglMDLjCc9KakWzw BqaWZrm9nU59ERg6GnCA4jyq+kP+kdMoGaHYHms/wp61XBkq8exX+ubAIm64jtFHXcPDd3kc0CG f9LO0Aq98O32KGW7pZ3maQLXgpDuSRfIFOIS+hh7Fe9hOxf4u8Z3ufYDH91kQ7LNT6dTw9b2crx I8qKDjZzL843R3A== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949964874154100 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. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Jason J. Herne Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-31-9227de146347@redhat.com> --- 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 7c3fedb91936..31ce54e28449 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 b4cf048a7c0f..3219f78bd12a 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -83,8 +83,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 4d875d10ff23..a3f6ee95aaed 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -784,8 +784,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 Sat Sep 26 23:03:02 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=1787949905; cv=none; d=zohomail.com; s=zohoarc; b=lCxvq1AdEliWMyMpEpEApNUS793yUJVtv2yIZHucj1I1feb7KN8HmPzNdg3pbLnJKostdP7Bo9BeaDp4iPjhLNew3hLo23QI8XdT1yoWvw2EdiG9SxegxJIVoqvlm4wCBf5+KbWcXD20qjdTx2frb8yago/cPsCR/9LIIE432nI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949905; 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=li8Ae/m9oZTeYNA/59sT/lhdymbLjMM8UfStvvVWHqo=; b=nRSe2rP1W/+epHPYMYuJBYiHAHMAqyt/G/ALe/MQnYsNzx+m8hTDxJ9+MoCcgx2ucnZs3mwTa4ICesyTnbxVTUiX4hjpRK5qVyxbBt19B8J9trwU9DytZWOaDvPwYGDXG5aASuRYAWm/IWCWVtXPHcubLPd0eWy4X2jY3rFtdO0= 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 1787949905439709.730984958335; Fri, 28 Aug 2026 13:45:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Qz-0003EW-EJ; Fri, 28 Aug 2026 16:44: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 1x03Qx-00039k-V1 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:19 -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 1x03Qr-0000Q1-5t for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:19 -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-584-5qd3hwRIOFGOzf2vIzvZ_Q-1; Fri, 28 Aug 2026 16:44:01 -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 BEA9419540EA; Fri, 28 Aug 2026 20:43:58 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 897433001D3E; Fri, 28 Aug 2026 20:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949845; 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=li8Ae/m9oZTeYNA/59sT/lhdymbLjMM8UfStvvVWHqo=; b=OBAALVYDdvDI1AxLIAOVHnCRWw/zDcF0nv8JJYy3ri/UpfmOIsgWcvzr5ixN4uxYczFzNo 4kgFDes82Lxs/O0qDBbF4uLbKO/3SZlJwBeGOUAmA7tTi9pRNJfmh/sbjAbLavS3laMmpX poCdBqZLBkZ68AO0c4d1bK3ol/fOLZ8= X-MC-Unique: 5qd3hwRIOFGOzf2vIzvZ_Q-1 X-Mimecast-MFC-AGG-ID: 5qd3hwRIOFGOzf2vIzvZ_Q_1787949839 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:11 +0400 Subject: [GIT PULL 32/50] 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: <20260829-nohmp-v1-32-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Kevin Wolf , Hanna Reitz , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , Ani Sinha , David Woodhouse , Paul Durrant , "Michael S. Tsirkin" , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Gerd Hoffmann , "Dr. David Alan Gilbert" , Hyman Huang , Peter Xu , Fabiano Rosas , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Zhao Liu , qemu-block@nongnu.org, qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=45187; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UBl0r09xHDY3Lk5h5/hSogL3ErGmH2KO87hG91A+CpE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKV8a5UxhWoJC/bTqnDlPj4eb2VqQAq3gjqP nY7++Xv2aCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5Z6ND/0e52n3zfpv5IVjks1gz0Qqoehh8NpeSZ49ROcq3sRMDhgoz8eSyOEFo9jqAuTTg5gS/sf Oanr2e9d6x2GWi/7CaQ2bXUFOGqlTJ6b5/VZDn18P1WlS9sRCXUg5l96YmlJy284JLkh/1GdBqb j6bVHTYkaSjYW5bly4IoPCU6iUchw9oHqFRv6cDweHaHJJXVid851cZgke4M3mannQmRB5oG7eC 1EuA7ehcIsPp46Pmha7Wy1CbWJ1ARaXzoYs/lDA452qBcNPpUSRnp7p6yEMyin7ZkZoz9xkY1OK pu0cUeCo3YlAiIUBPz29hFQNIB/TiRjfDvaoBXyzh7TU/oUjPf2nYT2qIMbPklp/vmlGkgacSDL 6N6XA3chCF+Ofdbc46tv2xf3108GBAeZzo66k12Z+uJGrSJ8IMbM0si0LVi8Tm64ap8a1qVN0Y6 YwADtusu5oIEf96fV/CJhtvyNs+QRSE536qvVLOQnlpFI6l4Xp0LG/CbFLnGilqr7PbRphEHOKP KX+cTdf5pnXhwQitNJ+jrE2gau7lx8ehb767Psm7m8HYCLpd7Dr27Zh3dzEu1OTlEx2/xOkA8En +TamACxi8/jeGWv63L+3QZGKShFTDzwTd/XYTNxfznA2a3oMDMnTkalVgg6/wOdTvDuW7O2Huu4 QflDdpG1tAvRr+Q== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949909002158500 Mostly mechanical, with a few adjustments around it. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-32-9227de146347@redhat.com> --- 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 | 41 +++++++++-------------- 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, 114 insertions(+), 177 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..a164a59080c5 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)); @@ -868,12 +857,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 @@ -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 31ce54e28449..e2a967516e0a 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 Sat Sep 26 23:03:02 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=1787949968; cv=none; d=zohomail.com; s=zohoarc; b=MzSZNfyrmT231CoNnd4W8htHdfjLqdOUoKh2fU9CerBfzrc1AQSomUuhfMIahHfL1Szy9T4yCjAWaWsHsDtyqi6gRPHQMvAyeUQikKBT4unXUM8jd+t8eorU3mqKFoEvJ2xDURhiwmeU6xGfuSvpOFiTSdH99FewhJ5uFqva/hM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949968; 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=IntAqb7DnZPw6ci/kULNqGR78w6ikkZFP3o6TpicLh8=; b=KkQ130uD8ppCgEephplT6tiNME2AY/SbHGrW9MrpJgNDlXF/w6lO1hswHtzjKPy89ZX/MuCTE/PtBwcJYeXdETXr3ZFYhGKxG84V9FMaN8xSZLw0EReiYtgO+1iP1wpzHkXBvLEXBpn2RNM9Js9v53dgP4ca864ejedP8gkY5hA= 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 1787949968521904.267918552517; Fri, 28 Aug 2026 13:46:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Qy-0003Cs-W7; Fri, 28 Aug 2026 16:44: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 1x03Qx-00035x-9C for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:19 -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 1x03Qr-0000Qg-6Z for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:18 -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-529-2WOQko4xMZitTIMLl5vekQ-1; Fri, 28 Aug 2026 16:44:02 -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 E77B018052C9; Fri, 28 Aug 2026 20:44:01 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 298A718001CF; Fri, 28 Aug 2026 20:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949846; 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=IntAqb7DnZPw6ci/kULNqGR78w6ikkZFP3o6TpicLh8=; b=eDNWMw9Aao8XsnQ5ENC/9J7ax8fY6carr6/PGkQs0p1Hws6V7IlXJTa63gMRhxvsM5q0EG qnucEtz7HNrzgAkFsaeetpONKzUREOsst6z73hisDW0yS1lsi6lbTjmDQqFoWbsUHwHf8Y u8QbFe+EGR9R9NwVAA1g/mF5QsCntvM= X-MC-Unique: 2WOQko4xMZitTIMLl5vekQ-1 X-Mimecast-MFC-AGG-ID: 2WOQko4xMZitTIMLl5vekQ_1787949842 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:12 +0400 Subject: [GIT PULL 33/50] monitor: add monitor_cur_hmp() helper MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-33-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2349; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=C7Z2MiwnXVYSvRFfuRJ23ToGCWaLGW6Cqe4I0EiKEdU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVWYphTjA2mExblVbQLzkMoggkIFnOQ7D9C 2AOs5E560mJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5WWvD/94X3+Eiok0N451C06a1MMlJfqsAx5L9MI6ZpoOM77+w0ih1omIguByI7Q/2cU/9RMqd4e Vu8RjcWYapl5rMY1LYPcmwtXxBGVcPEVvhhCckBDXCl3+pbg4A7BGEwQe6YBiQVbl3T23cImMww zcK/p716SDeIs+C0KAZnQ3jkWwyjpk1RUaixJUxtrbz3IMjtKVlZMlESR7Mp7a2NL6qPRVYcN8T eNoJDrxMxj8/ju1s9hJYXCpRDFgyKheTz53Eg4ESl0TEyUuXbBO2+X8RkW1lGFuF8qnL/kH2++8 TfRkqLD7uu48ebpj04ObUreQdnvmKKWIX9hKh4BM7cTrcTmjQN2hPDbH30D74vJ0dsTXiD6rpUg xZLoWEywaKMIm/G9cJ3oNOGdh+mihd6XaFyLtgf6FTum1Ie2iATWztMChQh32GtrDxvHydCSYQt JHy5xNr3MPnl7fE5/GjicyjXXJzoT7MPgy8BuCpPcBmanxX3k+FRlXmt7rd9zzASnCKrlRChEzn jIuYNtR0kYq29R2I7EJ9oX39DllF6XgQdidy3dSCJ6i6Rc154RQnPXXBFajopbSVp+BXOz4EDsh dAjNl5Rnt9qw4ty7Ap2upw5u6N3r33aMWAFnZwLKPLjR6kIWo49PE0CW7l2Ge2Mnx3EAJcJZpWg LrJ8cJxU37kpHlA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949970228158500 This will help to simplify the code in the following changes. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-33-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949917; cv=none; d=zohomail.com; s=zohoarc; b=DyunQR+ny5HVZhJKjd3VivsKbmXujH4nmi4KjoJmZfkbk4tJjJpQbxmHMN4uPXrjfoLnTw8PF3SZFiBqznChdxpIHayo0RcycAniUzdJwD/Pad/W/6TUM+GQa+V0xdGkLcf8e5GbD/GAr5/MUQon5587B+xCp/6kPQwHRn9tTtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949917; 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=FfoPCqnTZIE6i4/lwOooOZP0EnfLYW28cDlRixXBTdc=; b=gaRMYjW8J1iR/P2VQkyCZD4IxmWJ8aOgopdafr2gwinBHwOlmULiiG4FmhFUjCJH5bRrp9En7BRWIsKuzlD8Dh5bhNTEnFLi0+07+498cOTAy4dEixQ/kwyIYhUzsMX6wuc7ukGJBnkD73JB2Ch8b8qy9fBFdpL1nymQT/vZ2dE= 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 1787949917073449.9020597487571; Fri, 28 Aug 2026 13:45:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03R0-0003KT-EI; Fri, 28 Aug 2026 16:44: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 1x03Qy-0003Bw-GQ for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:20 -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 1x03Qt-0000SX-2s for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:20 -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-447-kGvFT0DPO62dXM3ZnMGCeQ-1; Fri, 28 Aug 2026 16:44:07 -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 AC8FE19091F7; Fri, 28 Aug 2026 20:44:05 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E3F0118001CF; Fri, 28 Aug 2026 20:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949851; 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=FfoPCqnTZIE6i4/lwOooOZP0EnfLYW28cDlRixXBTdc=; b=JDelFEQLue9O18nvTZQy48iAl+SgkA+RP3e0o/dW1yJzsxAzJ2rB9taUv1VRgBnHTFg+CD hHcUoyeVi26NUgJZ/4/0HuCkNT32XobXWz1OPbvY7jmzB/dq5C73xZb0k4j3hhtj8Dtam8 C9IC232UH1FB6ly/IfqrGMU0iPY5RHY= X-MC-Unique: kGvFT0DPO62dXM3ZnMGCeQ-1 X-Mimecast-MFC-AGG-ID: kGvFT0DPO62dXM3ZnMGCeQ_1787949845 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:13 +0400 Subject: [GIT PULL 34/50] qemu-print: document HMP/QMP behaviour better MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-34-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" X-Developer-Signature: v=1; a=openpgp-sha256; l=1090; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=KjYt5VMknU+zhdOOGGZoVmw0P+kwqyai2VbWN9tXTaY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVJGO6yCmR4qSruDrcHdwb6mit0kLEeOk3P nqHqJCNlsCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5a9kD/4ll59kY+7XXPhO48EOIbnqmS5oRdC7UqirYjY0KAQGPItxxeWQ/Wyve6M6jfxRTiDaxDs dhcGel9ewpk8U8qEBjqo7zo57rf9lHTW/4Jpaug5eJNB9pVPBzS0k+F/757xHsGCm+ojtXoO3P9 CLQ7KKYu3JP44v4rbHWNePzk5/8D07pHBS6LUl2qjQfddNJq2/gipHJAlsyj3DBRVkqK4/0/N3a aUGJUNN1khX2YY2A8LaR0ElHERN/rtDNAzy7YAFA7Q11I9zwD9MQl4oyunowhHGIMSOmwumCcuB tn0T9yhOXKnSA3YnpUALalNpxynJhWOSG/w/ReNvV7lA0gK6NTbvvVE0yN58x8+TZgWI40pmQfy wbLNRgEd8BIiBp5SiIn4yMNlX6AJpIVdeX1tVBJBD3mboylybwboJ7PnpPgSopEmU2umk0sy30y J4Tc/Qip0ce+qLvUrfkdc0tswznE8AOlQVjJclCwcCdRvZYTsxCTZDAJu5R3hLz6136vQltIxFM 1h0ZVPtp/6UNJukSOhJY6qYO20wD7g3R1rK8qzbbbMW6aqdVVkKjpThd4l7UO+Vq+hRP1kDzNTG ht8W5bTEEsGB+VJ8if6/EYu9sAGgMtLufRGv6XoBICTuWxupYKcttJVpocecG8hd5j3usrGzFpR 3cg9IYh6XxwM72A== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949918327154100 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-34-9227de146347@redhat.com> --- util/qemu-print.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/qemu-print.c b/util/qemu-print.c index a2d1f0244168..5d4143d425a1 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -17,7 +17,8 @@ =20 /* * Print like vprintf(). - * Print to current HMP monitor if we have one, else to stdout. + * Print to current monitor if we have one, else to stdout. + * (if the monitor is QMP, fail without printing anything) */ int qemu_vprintf(const char *fmt, va_list ap) { @@ -30,7 +31,8 @@ int qemu_vprintf(const char *fmt, va_list ap) =20 /* * Print like printf(). - * Print to current HMP monitor if we have one, else to stdout. + * Print to current monitor if we have one, else to stdout. + * (if the monitor is QMP, fail without printing anything) */ int qemu_printf(const char *fmt, ...) { --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 23:03:02 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=1787949922; cv=none; d=zohomail.com; s=zohoarc; b=I9x5ldO5FhAYCDrOl++dLrnoAuI1UCkb6TIIYb1YzaHjUsBAqPuQiSifbCUVuFxiCW38U8u+vcXnoyhduB+ebpaEV97mXwAm4UaAniT6fV/naz9+vgH7zNCD8hTqLUgWia1JHzmbbcngOjdkvpt0q4gyfTquK0XALBOjTmZLviA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949922; 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=QrNBPdMkqgnLI46Ras2VV4AsVFVh5A8BZDdYKCS6UoM=; b=MkqikF7PqTo+zo+QhTIA0zUMFlaZFa3ct8IUTI/r4SqZIGBGNN6zsvfx1leFREkjclT/b4l2AOPJZO5iIPHIgcM3LKQjJezuTr7HNXlW+Mp5u4V8b9qgtZlfX+2HzA07aSt8uNoP4UVx00s7grt191nZoQE+yOk30TaVYSwdyzw= 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 178794992228941.09983902818658; Fri, 28 Aug 2026 13:45:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03R2-0003Tk-0S; Fri, 28 Aug 2026 16:44: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 1x03R0-0003JP-21 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44: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 1x03Qu-0000VN-O5 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:21 -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-433-h8YapMAYMkyYzQ44jt3oSw-1; Fri, 28 Aug 2026 16:44:10 -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 934A11907BF8; Fri, 28 Aug 2026 20:44:09 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 06C9C18005AC; Fri, 28 Aug 2026 20:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949855; 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=QrNBPdMkqgnLI46Ras2VV4AsVFVh5A8BZDdYKCS6UoM=; b=hJ8sGpD3tkuH3uyw274S7rXjTfhCy6l8EHvnXVdsa+AJOqWokgYmskJ5dOewdp68FkQn00 dNnaSTy77aJNf8NaFahUGZa5qD5pIwGitTpdXwaFGD82SpS5R9wies9akNy6ubnO0Jznqu mclWjHuWjyEGOnL1yZRt+56IgSJUOv0= X-MC-Unique: h8YapMAYMkyYzQ44jt3oSw-1 X-Mimecast-MFC-AGG-ID: h8YapMAYMkyYzQ44jt3oSw_1787949849 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:14 +0400 Subject: [GIT PULL 35/50] 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: <20260829-nohmp-v1-35-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=5723; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=If9hrVpPhywSafzh1zVmU7B1v/XnHXcHsRux6Ki1A/g=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVlyIPQEERgYCiR3TBSYYS6MiZzB8ekz9gn ygozJ/Ku0SJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5WhkD/0ZeOWZH/YyeCOUgv4YStIqnh7yhuR60YN6jVYfq5X18QlWnqNeOJxlWMWXmoLeI+QlrK7 MZjw9dr4QKF24Tm8lh5Lfw9JnHUo5HwDzl5D0JqgrFfZkWEX6ZhT7ojCBf7CENvuUnUngNCGlJb 85cVeV239XXx42A/HB0oglsu71KpDzJ0xBsIcIfD3qUwB9guZoaz7QOiQheysKA+uBvgUP/frrB 52Ny/Ycb0n/D6W68wyMG7Vfvb9KaESsw8/PWB8L5J5SPD85JdDIBaFmgdrlRrXS7C+VsfAlqbDF grkrrnB8QruBvOgrRHWj2Bd2jXAIeKEIP6BVh/8aidiK1KBalCkAbwPGJwCe9x7UrmxpqqOkMtz oRWhcFOyXchz0spMpgcheAAdG6UW4re+MhNPU05Blqqemsm6k3mNr0+Vc9B/LFJgKDQd7jf1VAp JkGxMu3iRVwRyKzgA0KVvpGFmQn+HVaDf+yODB8QetO04T5kz8zg0u47YS4tcI2Uwa0bod22R9k 5GBVlyzWnGfWtjwcnNKiOZzj/tmPAh5MUH/RMCCdfK2DNWrgzOKrxiIQo9LPMRHGeZlsY9EdyjU XkD9+BUhkcJxBm8ApuSyutqdX5jhcqji4p+YUH/KWCLxXfWAkfZy2MKCHaxoXE91D0EM8yObpMn o+LGqRlU49k3mog== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949924181154100 Thread through the current *hmp monitor, a non-NULL pointer is guaranteed to be a valid HMP monitor. Adjust doc comments. Rename _mon()->_hmp() for readability. No behavioral change. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-35-9227de146347@redhat.com> --- util/error-report.c | 69 ++++++++++++++++++++++---------------------------= ---- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/util/error-report.c b/util/error-report.c index aaa15bc79827..41694d61cf2d 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -30,34 +30,29 @@ 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 @hmp monitor, else to stderr. */ static int G_GNUC_PRINTF(2, 0) -error_vprintf_mon(Monitor *cur_mon, const char *fmt, va_list ap) +error_vprintf_hmp(MonitorHMP *hmp, 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); + 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 @hmp monitor, else to stderr. */ static int G_GNUC_PRINTF(2, 3) -error_printf_mon(Monitor *cur_mon, const char *fmt, ...) +error_printf_hmp(MonitorHMP *hmp, 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_hmp(hmp, fmt, ap); va_end(ap); return ret; } @@ -67,7 +62,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_hmp(monitor_cur_hmp(), fmt, ap); } =20 /* @@ -79,7 +74,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_hmp(monitor_cur_hmp(), fmt, ap); va_end(ap); return ret; } @@ -183,13 +178,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 +192,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_hmp(hmp, "%s%s", sep, argp[i]); sep =3D " "; } - error_printf_mon(cur, ": "); + error_printf_hmp(hmp, ": "); break; case LOC_FILE: - error_printf_mon(cur, "%s:", (const char *)cur_loc->ptr); + error_printf_hmp(hmp, "%s:", (const char *)cur_loc->ptr); if (cur_loc->num) { - error_printf_mon(cur, "%d:", cur_loc->num); + error_printf_hmp(hmp, "%d:", cur_loc->num); } - error_printf_mon(cur, " "); + error_printf_hmp(hmp, " "); break; default: - error_printf_mon(cur, "%s", sep); + error_printf_hmp(hmp, "%s", sep); } } =20 @@ -231,47 +226,41 @@ char *real_time_iso8601(void) G_GNUC_PRINTF(2, 0) 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' - * 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_hmp(hmp, "warning: "); break; case REPORT_TYPE_INFO: - error_printf_mon(cur, "info: "); + error_printf_hmp(hmp, "info: "); break; } =20 - error_vprintf_mon(cur, fmt, ap); - error_printf_mon(cur, "\n"); + error_vprintf_hmp(hmp, fmt, ap); + error_printf_hmp(hmp, "\n"); =20 - if (!cur) { + if (!hmp) { qemu_funlockfile(stderr); } } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 23:03:02 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=1787949951; cv=none; d=zohomail.com; s=zohoarc; b=Z9tXYkFK+eWFWGxXUuE4W83tDQGOpl5QF8JHQ4O7IPmlZQIGFu9aZwIqhlAnepe6PW83aqAMG3kxXf64q+NXS0tv873Rv5E1qJa1I0Viyw9wxXeHn5hXG2aN/rchnUomZZoQX97cvHMZd2CLxodwiouMVU5zNe6rnwSISJXiCXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949951; 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=gf5JudHu8ARiFpDn+QA5RlWjgIlsNXgRcKR2fS5zbh0=; b=FITPN1GQEU8jSrc8zusDdeVDTBZBKLWSVdhvvfdvO7LhD7aaqwW100v5FYJXzuOSTO5Crv6Xd2BdeVMdom/1F6hSB/uFyCr6dlXQu6jW6L1G+QefZQQimECxEkP/8CMva+au8jTj8aGUl3DplHLL+Ua/oKk9yrjdYkX71aAW6NM= 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 1787949951206501.85516054755715; Fri, 28 Aug 2026 13:45:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03R2-0003V2-Ar; Fri, 28 Aug 2026 16:44: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 1x03R1-0003Si-MF for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:23 -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 1x03Qx-0000XD-Md for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:23 -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-390-xLwrrcOgP7aK0wccz0T3_A-1; Fri, 28 Aug 2026 16:44:16 -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 344E118A3C04; Fri, 28 Aug 2026 20:44:13 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4CBB81803A40; Fri, 28 Aug 2026 20:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949859; 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=gf5JudHu8ARiFpDn+QA5RlWjgIlsNXgRcKR2fS5zbh0=; b=Cxkszash7582BBaAY9l6Q9yLcOFFnOB+xyYg3WznG/r35uF+ggrbNnAf4lr1P81HMkgFen 2L4fm7EagZ8RIP4YfhOHVshSfUKsqA6MDHdEeeMen95qk9VmqZoOzFc/Y1S1I9hqFN4XPn Km/TT8RWLbnd0yYWZ7Gpxq0xAPXLbqA= X-MC-Unique: xLwrrcOgP7aK0wccz0T3_A-1 X-Mimecast-MFC-AGG-ID: xLwrrcOgP7aK0wccz0T3_A_1787949853 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:15 +0400 Subject: [GIT PULL 36/50] 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: <20260829-nohmp-v1-36-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Markus Armbruster , 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=17750; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=c9GOFdDDkyOOn3Rpfbus7/WkcrZ9EbMiyBL0wwGq66o=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKV7Jg20axv5SWTAu4t+JJhTSNi+iiWTLwCP UUsMiQRV2eJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5Qp5D/0ei9sCz7saUgG/G4yUOkJ7hQJKF2MUp8HzKcqV6liqH6oMvTkRBvMHKU/sgij5+sEDYWL c0ZIPbSH6RKvEQCYy2tiAV3qPSUunuTnkNpJnkgb0bFrKHx6xMHJBGU786c8epOsCR2E5XqIypy ibZEkLQtwB95TE3Yswb++U4rx6RABSfE+clSI7mETAJ8kacwPuZXvHry/QgPwtO5EFqOqPLRxyb oFBh0Ec8EdFLRCKozUEXjSeiu+aK7/JS3LDWJoU5NUx4xZ6nyvZthIHPyruPaPzHV1P7oWA10lO 3bnZJ8jNMBCssrEfT1Bi8C3jzBTHaqAGgOy/tvaTGQcFTVVpKBgwD4HPblHc4RGnFRPZwR6SerM c+UNBRKDN5NTbEIqcXJENqP2QzgzqCc4oUpkH8VAqeQdoVOfI96BBQgQihxetW7ygLuwLr/UzF1 sf2+afsAiE0SHZSZWwrLei/OSsZK5Q92QXZBdqrd7UR6JuqYWmdMxtbOBu0tvpdtRW3Kwr/Gxqn 1ORHur+/4vDPnTu0T2Gjklxv46wOPqlrHnNZF7HzcqSIQkkDdx+qOgfJ4FuQIoEPc+v5ZQKH4Lb 0oRctcXAu9llUSgmxkcsyqIK2ltOmAetDk+CiUQnzzL+McINbFA74wzlts2t1/LMlyFov6vHWV3 S/wzSn9tXh4/FPA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949952919154101 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. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-36-9227de146347@redhat.com> --- hw/core/machine-hmp-cmds.c | 4 ++-- include/monitor/hmp.h | 7 ++++--- include/monitor/monitor.h | 1 - monitor/hmp-cmds.c | 39 ++++++++++++++++++--------------------- 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, 47 insertions(+), 50 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 e2a967516e0a..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,9 +512,8 @@ 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 =3D MONITOR_HMP(mon); CPUState *cpu; =20 cpu =3D qemu_get_cpu(cpu_index); @@ -527,9 +526,8 @@ int monitor_set_cpu(Monitor *mon, int cpu_index) } =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 =3D MONITOR_HMP(mon); CPUState *cpu =3D NULL; =20 if (hmp->mon_cpu_path) { @@ -544,7 +542,7 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool sy= nchronize) 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 3219f78bd12a..af67f00dad32 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -96,7 +96,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 Sat Sep 26 23:03:02 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=1787949897; cv=none; d=zohomail.com; s=zohoarc; b=FuC5E0Z0jE0ZLRbtew6fzgINI0iIFOlb+NuGlHqlwbBWiXWDyQ5QmDIsMGxXPkURTuAxZSnls6iFSf1jAUCEOeTG+f/SMXk4bBiyGO/51Dcm3UrqkZz7t76iPugGXaRf4HVOUjRlKg+JkLnoXevjQAwgXw6oBTqppxXR2q+n/Dg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949897; 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=gJWaIUQ+Rh5ZZTSNCUYk7XQu3SgPv11Eaab7cvEsj6k=; b=GGu8wi7U0EkBQnqMIIlGzFbkVgbAVrWSXTkTbpjVytvYu5N1YpyKIE0ZpMFZVUYf3mEVLumneSLgrCE/nOztUKnXOEXNC0g++toMOcoDOdHS80PSNTMOiJ5WnMKXaGPIbKMwDiNIYuyz9q924hVBRfpWI1roeCKtWwzrniK309Y= 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 178794989730940.57293177624649; Fri, 28 Aug 2026 13:44:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1402459.1637563 (Exim 4.92) (envelope-from ) id 1x03RD-0003k4-16; Fri, 28 Aug 2026 20:44:35 +0000 Received: by outflank-mailman (output) from mailman id 1402459.1637563; Fri, 28 Aug 2026 20:44:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x03RC-0003if-PW; Fri, 28 Aug 2026 20:44:34 +0000 Received: by outflank-mailman (input) for mailman id 1402459; Fri, 28 Aug 2026 20:44:33 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x03RA-0003fb-Fg for xen-devel@lists.xenproject.org; Fri, 28 Aug 2026 20:44:33 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1x03R9-006xgO-Sz for xen-devel@lists.xenproject.org; Fri, 28 Aug 2026 22:44:31 +0200 Received: from [10.42.69.5] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a91f30b-8faa-0a2a0a5109dd-0a2a4505ed72-12 for ; Fri, 28 Aug 2026 22:44:31 +0200 Received: from [170.10.133.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-c201ff.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a91f32e-4cb1-0a2a45050019-aa0a857c6a95-3 for ; Fri, 28 Aug 2026 22:44:31 +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-278-poRlay46OteKBs3Hmh4_Ew-1; Fri, 28 Aug 2026 16:44:25 -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 9082118A3C12; Fri, 28 Aug 2026 20:44:18 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 252111955F0A; Fri, 28 Aug 2026 20:44:15 +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=1787949869; 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=gJWaIUQ+Rh5ZZTSNCUYk7XQu3SgPv11Eaab7cvEsj6k=; b=RsxDCikU+JITzveDp65SwMQ/xyMQuNFGNUW5ECh5lBqv4RFK+zAH/gXXfZb455SrRKuqRz E9DTdsS62dcdJJYkRqEbMDCc7iVRA0DDxH4KLj4kRMkSXzeHhki2WyUWQ6FF252mzStBfN aSTflP4OYSBH8V0NuvG6gVx3cVEAr4g= X-MC-Unique: poRlay46OteKBs3Hmh4_Ew-1 X-Mimecast-MFC-AGG-ID: poRlay46OteKBs3Hmh4_Ew_1787949859 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:16 +0400 Subject: [GIT PULL 37/50] monitor: tighten monitor_printf*() MIME-Version: 1.0 Message-Id: <20260829-nohmp-v1-37-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Gonglei (Arei)" , zhenwei pi , Kevin Wolf , Hanna Reitz , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Ani Sinha , "Michael S. Tsirkin" , Laurent Vivier , Amit Shah , Brian Cain , David Woodhouse , Paul Durrant , Marcelo Tosatti , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Halil Pasic , Christian Borntraeger , Jason Herne , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Eric Farman , Matthew Rosato , 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=268631; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eStCm3fDwloFYBzXb7O0tH4I8RXs2cYA6hH2qNxTmDU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVg+H990hVGQYLaJ4pfqR9chrH4/IREn7DW AZZDNmE5B6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5TzdD/9gZsNG65LADBCmCuI+ESb5rnO6R6WBBueixdHT5DQRCZFDKvWjfSc8sLBejdfUcLE07BD D2wQGAbp9wUVhG/nq7gTCzk8SkphbMNh/4FR0UstydeIN8WQPVi0dM7iicxPsYiWnEqjhGvUulU 3g3FtozKEf8uTZIEmQQoJjVo9L/oDZP2bYJGRw4hvkkcpdxWakmZ04mOsKvp/2YZBJdR7sEEDM7 IeOms1k82vKisEhbvw1WPRnwArsQUYT6tStEGrWIV34vqe7/Gn56P8cuKIcSRwidIj/ZQQdrPS4 x4hhCEjlMS69vCU7zeIkZackcHSuIO0+9hgOksGHUvdhd6asEe37IW8bd0UxLM2LeX53Ev10o3o TxdDk6NQ48zZZypegCUaxpSe6Jba9Ox7VRCSJSOpI/hwO5/z7CJB/uDbONU4IIHeou03ykRc4TH 7HvPi7vbLALGtbsg+uRWvQGliEi3gsJ/UH61sJqxz0CD7j3mnLmIwyKGrZzqbE3vChC9AG/hR0q KD1GGmyCdjsv6xWIgA81X7TpmgLR1Du+5dSF8LoT+xZJequv81aWOpXOODWsonU7tjBrPeplVS6 uVjIwbJACsVQ3qoESmsFplNlEafuWbv39kESRH+S4bVKnO6ebfxmEvCXL97ygU5YJQEeRO8RToN MkKypNcwv/5/wwA== 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: xqx46AHDYFZhiQmk0mzsWt5BAYeOLUg_L8RrmumB_tk_1787949859 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-c201ff/1787949871-F44A4101-A3DFB07B/0/0 X-purgate-type: clean X-purgate-size: 268633 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1787949900255154100 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. Early return in qemu_vprintf() if "hmp" is NULL, relying on monitor_hmp_vprintf() handling NULL case is a bit uncommon. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-37-9227de146347@redhat.com> --- 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 | 301 ++++++++++++++++------------= ---- 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 | 17 +- 63 files changed, 1225 insertions(+), 1327 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 a164a59080c5..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); @@ -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 af67f00dad32..96d6ad897275 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -85,7 +85,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")) { @@ -101,7 +100,7 @@ void hmp_info_local_apic(MonitorHMP *hmp, const QDict *= qdict) =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 a3f6ee95aaed..7b2eb75fd480 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -786,33 +786,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 41694d61cf2d..0e3aaa539e78 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -36,7 +36,7 @@ static int G_GNUC_PRINTF(2, 0) error_vprintf_hmp(MonitorHMP *hmp, const char *fmt, va_list ap) { 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 5d4143d425a1..01ed43b5a588 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" #include "monitor/hmp.h" +#include "qom/object.h" #include "qemu/qemu-print.h" =20 /* @@ -23,8 +24,16 @@ int qemu_vprintf(const char *fmt, va_list ap) { Monitor *cur_mon =3D monitor_cur(); + + /* for all monitors: QMP & HMP */ if (cur_mon) { - return monitor_vprintf(cur_mon, fmt, ap); + /* don't use monitor_cur_hmp(), to avoid a second lookup */ + MonitorHMP *hmp =3D (MonitorHMP *) + object_dynamic_cast(OBJECT(cur_mon), TYPE_MONITOR_HMP); + if (!hmp) { + return -1; + } + return monitor_hmp_vprintf(hmp, fmt, ap); } return vprintf(fmt, ap); } @@ -55,7 +64,11 @@ 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(); + if (!hmp) { + return -1; + } + return monitor_hmp_vprintf(hmp, fmt, ap); } return vfprintf(stream, fmt, ap); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 23:03:02 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=1787949942; cv=none; d=zohomail.com; s=zohoarc; b=i7217buGRXUGryhKr+wp1fDuYuR9piaImZ2/RsgdTzkQn8cxjLn7b+zgQ0tTk2kNcQUYfX2G8f/dD5tRl96I6JhCu/7c4SzqDASeY/37qzFZOQyiq/Y6IRywE0RvI/x3KnZxYwLiYHWHEwOE8i2RzP9G1iYK8DAKsyG1eNc93dw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949942; 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=fvdmdMpIXJ8l74+yaKTi+gZlWOVbTLXR3VIp12IRDEk=; b=CXl7dkDThJfh4WLvv5TNPoX49ejdwSFA9BBlJ3j/DuyQouw2KLoDHDdloBExycJwmqeCzY4NdcU3lsjMEpREgP7ZHPgC7wP1Qytn/GH17YeZ+qlv4uWzo6zoX4M2MQvkn9mnCiDGiBsdngoIvH1ok4DwFh4k8zVgFySfeetYXzo= 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 1787949942463840.6627180917008; Fri, 28 Aug 2026 13:45:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03R8-0003cE-1f; Fri, 28 Aug 2026 16:44:30 -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 1x03R6-0003bP-B4 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44: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 1x03R4-0000bg-L9 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:28 -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-193-NQC3t8U8NCCvSNjsAeYrIQ-1; Fri, 28 Aug 2026 16:44:23 -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 0DBAD18A3C0F; Fri, 28 Aug 2026 20:44:22 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4345A18005AC; Fri, 28 Aug 2026 20:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949866; 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=fvdmdMpIXJ8l74+yaKTi+gZlWOVbTLXR3VIp12IRDEk=; b=CXiwv8fwJNPlaj+L0opoa4YFJkXbq8ky7M0GTEndMAulGQS44CkEi6WfBjZUbSqRF3Tflw o3zoFLn/Z1qAPtxlQUE+Su2ot6ZcBqzx4iptggrHK6cXZwo/hKnJa3Awy6ApXst3Aw3+Au JQzZHCXUaF0lt5yx7hVGlTHhvEayjeI= X-MC-Unique: NQC3t8U8NCCvSNjsAeYrIQ-1 X-Mimecast-MFC-AGG-ID: NQC3t8U8NCCvSNjsAeYrIQ_1787949862 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:17 +0400 Subject: [GIT PULL 38/50] hexagon: make dump_mmu() take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-38-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Brian Cain , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=4167; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eKsXIj/FsvM+AGZc8eLmTPzWSKRNAhynkYldeVV8efI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKViPY9NUab4z/9l8zmRlJJg3QgoCf7v5tux 5LdzO7Z5kSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5eUDD/4xZwWlW1rLaVK/g32kABpA6vpX2ubaGo+Aw3zTIvT17Poy7Yvc/9Lqri273Mqca6GbH4+ vMmL6TgMnQsWXorECNjBHDGRGPCP/ho2dhuIM891Xld/34vcyB+adpPFAj2OHmXZ5X88PiltxE6 PB5RiibPy8glz3+AbjpzMUgurLe8d58TkwJvUd+Vd+xjH3FRPzW7XPvFteAWnqkLU337UvNZs6D h9Fp+2yTmkwiZr3nM0SKbnalDyAiuVu7Fc2MJvftvBnmhUHGPjmhVazUjaxvZlAlWpoh8/qQB/T l+RzvWgSl3xNgtkk0RXIVnbhNQ2cUzPfYCbes6PNLs1ZyJr85S3WSAgspViQmlsddCgAPHKyeOD 2YVjr282dPaYNrFJJEAW8VJ4fH2Znrx7qOdnLrCchBuAPmG9X/BTPNe1YH+yMSvdv5mLmPzPHmv utDFNkZXwrpjAfeX8TUV+4y1FuSm097RuPOijMCic2+JdrEYCE7fjYMFXrLaWTf1t5x5MaxnQPG m/ULbhMQZzQburFIQc2O1vRwt/yIZh0MV+yevvN/TO5zsDGE9KkX8+8FnTAXsY7TDdujvwVDRwB J+woz5DdOEOnRUkBlgAC8ytexdR3ykekWQrfwSw7+q58woWrVB2pHebpoR/IbY29/5sc8nDKwDi JyIEMZsEyQRtfnA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949946494154100 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. Reviewed-by: Brian Cain Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-38-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949885; cv=none; d=zohomail.com; s=zohoarc; b=QKdD/fJThYCc7OLjhQ4afxG6/I7vXr7rsAOWDDl1vHbVm+TT0AknVIZWTsgo6XUapLexGCKuNE+VLAEz2h1u8bwYZCrtl5sMZbMy7ZpFL301+jmVEIig8Qsqg4gEuHLrmFOjesXLv7vQzNOhNYsOMpMCOdntQc/sbS4enxdDx1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949885; 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=3tt1Li1Xgl8ddzlGr2B8S7+Mrjv2YOxklMy5kdNutVQ=; b=ODSY+dommomdpWnf3CJ5MLkDuevxyUldtrSfT9ubdZvWeoQUQj3EQWCVYRMc7Ug0oNSzI2RFtKcRJoXWT1rwBJzukKgOEmPmXElcknrWh4tAYjUsaXtvvfcVR5Q5FacdHE4SeR3I3knnc0x4IqHTpB92XqBOpwECZnlTQonnxSY= 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 17879498858988.79736213842807; Fri, 28 Aug 2026 13:44:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1402458.1637556 (Exim 4.92) (envelope-from ) id 1x03RC-0003gB-Iq; Fri, 28 Aug 2026 20:44:34 +0000 Received: by outflank-mailman (output) from mailman id 1402458.1637556; Fri, 28 Aug 2026 20:44:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x03RC-0003g4-Fx; Fri, 28 Aug 2026 20:44:34 +0000 Received: by outflank-mailman (input) for mailman id 1402458; Fri, 28 Aug 2026 20:44:32 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1x03RA-0003fa-By for xen-devel@lists.xenproject.org; Fri, 28 Aug 2026 20:44:32 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1x03R9-004EBF-PI for xen-devel@lists.xenproject.org; Fri, 28 Aug 2026 22:44:31 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a91f30d-2eae-0a2a0a5409dd-0a2a4509db90-24 for ; Fri, 28 Aug 2026 22:44:31 +0200 Received: from [170.10.129.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a91f32e-be1a-0a2a45090019-aa0a817c8243-3 for ; Fri, 28 Aug 2026 22:44:31 +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-351-G-B1MgVaN6aAdqTWAoTJ1g-1; Fri, 28 Aug 2026 16:44:26 -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 6F4FA180AEBE; Fri, 28 Aug 2026 20:44:25 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7BDAE7D9; Fri, 28 Aug 2026 20:44:23 +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=1787949870; 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=3tt1Li1Xgl8ddzlGr2B8S7+Mrjv2YOxklMy5kdNutVQ=; b=UX6hmHZZknY2GIjDI9G7HYl7Ip9Hka2I1ivTaII4xyv1o5H35sqcUXCqwlgJjDr+edYLaa oPozOLfbVJGfTtN/zdVBsSgrdOxnJMmz4CAdC/V69xc2YMUjtmbBLKXkGbqrzkOLTMRo5d dJDLfBuy48jF4u/v+tPItSmWZTOerP8= X-MC-Unique: G-B1MgVaN6aAdqTWAoTJ1g-1 X-Mimecast-MFC-AGG-ID: G-B1MgVaN6aAdqTWAoTJ1g_1787949865 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:18 +0400 Subject: [GIT PULL 39/50] qdev-monitor: make print_dev() callback take MonitorHMP MIME-Version: 1.0 Message-Id: <20260829-nohmp-v1-39-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8864; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yhdT14CCjQBH3XB2MAJuktkFy3BQqu+3tvJiv7NtYD0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVBF+dcyUO8acre9UTIyRuoRk5B+6NoKVbf 7ZzLN0hGDWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5UaaD/9PPDFeyFi0aR/4kzKPGwlgkCol/O9YralbhXK29ecxzlJ+wH091XOW6kXWjWElEC8yTFA buzgJKN5PjmbRZujJ9d3fal8WRUFzKZXVTCSog09Qx6oEh152mndo+Cy4OCwzzYuz9X72x2w/ZB mWZyqBQm5eTqZSkHlLMoMaJkBswcZfbtbxhl/R0DQKZCMfrPrKxy9kdScAWKI8ieSLlGExbHlJS TXbyWOtNmNj866rjZbFUq7182tz3TxNIRbVjf+ySp1eTqt1/Ea44Raigg8H76MXyr32qL+evKEd 3NJNhd8mmQ4akyy/rERBnfbXd/kv0GqPYDMa/3K5f95zmoZzGSiLz+3meD5hTVLN/SS6LUKnRtZ Kod+sawsBvlO4EkUtOSFeU7Sl2XE7/ac7joV8YJTtcqOn2jDkjl1pccM0aCHX2YVWkN71rdlVlN qSMIfP/m6zHBAgkqQl5hk0VjkfAgHwpK5V3fLt+8bY/9Bl6goLi+ZynO29rL2IxUhCinwN6ooxe y6sIwxCMellb7FgfyR2hYjV6a7GVdXCl3PitikvNK9UcoCZVBCVcz9v3ZcZxZgdLh1ShnusKb1J RE3uzD7M/nN4A5lVnoGxzI4iTlqezeuapZ6B7BExz1xFvjjA3Wlt9VAMQueIBVm+/NEp64A0TSk jYfAc+kD9ts/r6w== 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: 0ufPQ28szVWy1dpHBGvB80qMnnlSNoahloSybO1NPQk_1787949865 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-bad1c0/1787949871-BD6C2034-FC4386C8/0/0 X-purgate-type: clean X-purgate-size: 8866 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1787949887659154100 The callback is specific to HMP context, avoid unsafe MONITOR_HMP() cast. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-39-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949951; cv=none; d=zohomail.com; s=zohoarc; b=NCXF2lY626qX8lVklVRcsyQVxnnZCVb9Q+qkUjdB366gBQr6ToiypbIvQ2DhNLkMykh/bl5IQ8CMIJjkHcyfF5xdBSNuDDoC3zLj5J6I3KZj++Nvz7ai5jixqvhcPQXrqkOArQ5D0TEDZIWqtlAnEL47S1OWfAcvX17oVb3gfqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949951; 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=jXk05tU7+Jv8htjmpZtVpiRikG2PZO/cUQrqa6KKBJg=; b=Q+KSStqthTwABcH/XcTlH8Ur7qdg+2rv2JV9XBjJKACqISTm+j+hRbkQfHvmgthg04Je0F9LyKsFZ+9wS8bk4P8d5IFbgC6XelircwLJBVVaLENhwAk8DcodS8or51mL4+oSWMK21cxtIG0FQ3Y8Z35x30us0McLuvJvvr3vLt8= 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 1787949951057392.0286532161067; Fri, 28 Aug 2026 13:45:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03RN-00041d-GO; Fri, 28 Aug 2026 16:44:45 -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 1x03RJ-0003gy-PG for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44: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 1x03RA-0000eZ-0o for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44: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-591-UIn9cwjsMEKal8sbX7XtIA-1; Fri, 28 Aug 2026 16:44:29 -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 E18AF18089AE; Fri, 28 Aug 2026 20:44:28 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 22B7E5B1; Fri, 28 Aug 2026 20:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949871; 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=jXk05tU7+Jv8htjmpZtVpiRikG2PZO/cUQrqa6KKBJg=; b=Xveh2ERYog/Zs5ruZ/g/LM62R4SxsW0ZGUaIbbrbS3DcjmcP/BzjtO7TvZVzJy4WvnJz1x +S2MrtxvNl/YWuLnzcxkxxMlK7wGs5KUbsjnYWAl7OKFCUYteUfsBmIbrqa7Y9WWjyqWa9 3HrYebUBIPRIMC8tOOlVV9Lywy4b2dg= X-MC-Unique: UIn9cwjsMEKal8sbX7XtIA-1 X-Mimecast-MFC-AGG-ID: UIn9cwjsMEKal8sbX7XtIA_1787949869 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:19 +0400 Subject: [GIT PULL 40/50] 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: <20260829-nohmp-v1-40-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Markus Armbruster , "Dr. David Alan Gilbert" , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=3127; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Wef4LhxrxQa6lso98C+8riKoFNaM9RiWaNcg6dkiutQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVHR6dBtjG6Z7k/+mv3bTJzrE6Y6xP8wbxk geCbWTAjMWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5S7qD/4vhqxtpwfk/0EFr/hoQuIcJ/Jn8+0uUCcolBMBIUFG4hbhy6bscRZlW8kSQeCNr968xG3 c07uY/WhGI46Av2jxQXzG2VoqN1RQ1Cv/7mv7cj56em7wfwGpBJeMXlknS4cXoQ5OkCO4ndh5kh hMWX+TBJshNjZW0xdb6VpW+I7orHnjZ8ozOTpoTqNg4B+rdBFScBo7Ik5IslLALrFHKpP/Eodbe xWwgkcpcirckLUl7E2Gvref+D2z/QFnEmWZIHgkhcAbmcQXZxoT+7h1YhNNZK7ros+p7OBxb8ns v7NZQiK+0lhbcFAphrnpmvfnqsM+c7rJ5ndNKgExVtcnukbUPaBoiyiQWQF/kf4MtbDvu2EMQMd gnmKY+bp7YlNG/D7dlnLVdfvruBoN47PRPT2XuQe7QXv9HeA1k9cP+1MxQUtcgF9iBi2RSySxI3 +7TedRzrejS0Fo0ujNQIz2GLrYaPkD19tVTY+tO8DohH0wHbqmhHRMTW9vmim00ujMK3n5VW8ed VAHE5x7M5efNo3prBUZrwu0FnjsF1cYRUx3nHQnvpfgzSHiRQNp7d3nYurfG2D7DL2X/fv2JCtG 9cTC8CDwSMCe2xtBBvBFQnaXVLRc4ET1zhOE0Uc4JtwYxS9jLr4TW3WvqvfXClqTcgnScr12zfD 5uMq4MFvY0SEANw== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949952642154100 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. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-40-9227de146347@redhat.com> --- monitor/monitor.c | 10 ++++++++++ monitor/qmp-cmds.c | 2 ++ qapi/control.json | 4 +++- qapi/misc.json | 3 ++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/monitor/monitor.c b/monitor/monitor.c index da76e6e4ac19..7b22553a8731 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -740,13 +740,22 @@ int monitor_new(MonitorOptions *opts, bool allow_hmp,= Error **errp) ERRP_GUARD(); =20 if (!opts->has_mode) { +#ifdef CONFIG_HMP opts->mode =3D allow_hmp ? MONITOR_MODE_READLINE : MONITOR_MODE_CO= NTROL; +#else + if (allow_hmp) { + error_setg(errp, "HMP support is not built in this QEMU"); + return -1; + } + opts->mode =3D MONITOR_MODE_CONTROL; +#endif } =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 +767,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 Sat Sep 26 23:03:02 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=1787949921; cv=none; d=zohomail.com; s=zohoarc; b=WGMY3p2ESj0grMm3a/715+f4+HZtV+wkB2t7JcKsA9hW+2A23/g/ObK+6lTRXYo9QI/hNcCMSAxnXFZVAj/oZbaZjS2WSYCxhLU1TkRB1GrV5bf8REUKJtc+dyhVMPxw0KpVboUddeD2xGsVArKtQ5KmR3VdkyI/8e7OJfgT1/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949921; 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=1MnlwV9u4hBAhAqG20I2D2aQxHEJi2OE3WLohKT4/Tg=; b=cWnyvJeSBfVe+MrPiS3QPo6JwWO8wrYMEZFgZjSy8/sBBCzlmVQ+IDq3jt/2/VjK5lJbkZdZfy9rFeiZlfj/uL68isJxvm+Rqyj9voy728X+cs4GW+zoz2c0HX8MknCKB40zyUxm6VxaCBPCdJbrXQy6nFhUrfrxxdpN3qbqtA0= 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 1787949921148379.5756798372594; Fri, 28 Aug 2026 13:45:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03RQ-0004AI-2U; Fri, 28 Aug 2026 16:44:48 -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 1x03RO-00045R-AR for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:46 -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 1x03RK-0000jt-AA for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:45 -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-675-mv0IbRlvMdS2PtvGq013zQ-1; Fri, 28 Aug 2026 16:44:37 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D235B19541B1; Fri, 28 Aug 2026 20:44:32 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D34921803A40; Fri, 28 Aug 2026 20:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949881; 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=1MnlwV9u4hBAhAqG20I2D2aQxHEJi2OE3WLohKT4/Tg=; b=SREy8mC4e+PWcxJzoDGSpfck631uGbixmKF3tqF7q1Shco0txdI6Enflo9Go3dlbTLebrV YB/gI5UbVZCF6KIqKIrpg8TXhacNshhtHgdkaA/RRubugPAxOaxv/A7wBA4Nh6kWcaB0K0 pSugXskwQiF/CY1FHBjgJnlxPHex7L0= X-MC-Unique: mv0IbRlvMdS2PtvGq013zQ-1 X-Mimecast-MFC-AGG-ID: mv0IbRlvMdS2PtvGq013zQ_1787949873 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:20 +0400 Subject: [GIT PULL 41/50] 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: <20260829-nohmp-v1-41-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , David Woodhouse , Paul Durrant , "Michael S. Tsirkin" , Marcelo Tosatti , Mark Cave-Ayland , Halil Pasic , Christian Borntraeger , Jason Herne , Ilya Leoshkevich , David Hildenbrand , Eric Farman , Matthew Rosato , 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?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , 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=20762; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VeMRhlxYmz+T9jOYPDTApDrfgg2t6fF/rqpbmuy+YRE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVXxzv1ttcI+MHb7bj9caVbDTCB75HeI1/D XziqGsanFOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5bA3EACwxy+ab3IpYr5KQgbpBcyHuuaXS39CuQFmZ0JG1reuVTizhiQECoEIEa8rmPBV6W0G23B xLBnrC6wGVt6Id/uClr/rWAvHz1duHKP3Y1/UG1dXTapRb5ouNW71xcm691zGemaoX6A1p3jpei YaWwrnJKdvggeg41ZX8ik7odUxn3DlopLqJcVx1KV7UGeoy+C5yowBRvt8WPbpujV+IwvvZ+zet mrOShUQ3xKsgRZ3Y58cApr93QKprOGCBHI/scnP6YXkjjRrEDqJqv14N/sGh3TTfWtLLCBtBQW9 jMLQnIMod2KSTyrbi8R0g+kPt7amg80V9DMfqh9a9kj9lmX/JYqI5xT8Jv9L41MNcm77P0zPYsF 2eRmiGVgnFw7pWn7kYLNdiHDJC0xZj12bQsDJPn/hwcGCF9U8aDZMUFWDrnNXX91KI91CKiBCHa SCUgeGTmeL0BpMGeOm6XLP7h07+mSaEEoZxpjR97tJEE5rGvmzp2trKOPq296l5SULYK9arYgTp SfB+gQMaBdKi/dro0WhbFcyJjtapxROrQGAgS9PHmhx5S7OZDw8dzX4EcCnQgZUY1uzSxc7WE26 C7D20rIs7xEHW9MuEeW9a0lXbhqNzs/uKcHRUQ4IlcottTzx/9kT5blD0AqEgnF7vkkhQ+sfCLh CZxmKFDFDNbJYSQ== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949922487154100 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: Jason J. Herne Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-41-9227de146347@redhat.com> --- 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 96d6ad897275..2e703ae1fd3f 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -83,6 +83,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; @@ -105,3 +106,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 7b2eb75fd480..cc16c6b07123 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -784,6 +784,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(); @@ -817,6 +818,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 Sat Sep 26 23:03:02 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=1787949999; cv=none; d=zohomail.com; s=zohoarc; b=ANdmJzxhHeNAPOJedBO3J4pTu7nsyE4ZyLgKmB1IgIHdJVb23Mphuf+Lrub/MMViUYCRSeLNPjMbrESa6RkmiNqdSw3TX3aC6/BE9Ojxba8LDe/fo7A0btaJMg5wF8ImmWy9rmPppKAB6hbuh6Zl3DQAPN1fMChSe1QHorfOxag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949999; 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=1wvV0XaLDeMmbI491Q4Aza0VNc/60ghOFU2iTnPYtEQ=; b=cJPyAYPLPyNYsj4saAm9+GgXi//khTghVVmVPO0qDdhyf0Oq7lAdTvib1/0bUvpD8+0ECJvQszssU97HZfg/PsDoXMZZevFTbpFsPHA9xlRAb18a2p9eqhoKav08UsQTeqszcil6sQqawhvK02WX6rirh86i0ZP+PWuJDfhYIs0= 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 1787949999008264.5511131644338; Fri, 28 Aug 2026 13:46:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03RP-00049G-PT; Fri, 28 Aug 2026 16:44:47 -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 1x03RO-000467-LN for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:46 -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 1x03RL-0000kJ-0S for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:46 -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-118-a3zw4xfPOkyoBntL5q34Nw-1; Fri, 28 Aug 2026 16:44:37 -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 4BC21180AE2E; Fri, 28 Aug 2026 20:44:36 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EA9D1955F43; Fri, 28 Aug 2026 20:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949882; 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=1wvV0XaLDeMmbI491Q4Aza0VNc/60ghOFU2iTnPYtEQ=; b=Dc/q+XWjD8Js0G2dIqWVQtPtKol/SIk6/czyUiVt94fyTmeh5i33Sdcs9nLVSNbMYeM97M 5f2wV8o02twdcz4pTIEe9H7jExn5JKzm92Qi3VISEsYJqBSElGwjRG0Uh0mhs3CeNMfMCp 1y6H/b+U8goEIcEnwShGKn1//U9cllw= X-MC-Unique: a3zw4xfPOkyoBntL5q34Nw-1 X-Mimecast-MFC-AGG-ID: a3zw4xfPOkyoBntL5q34Nw_1787949876 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:21 +0400 Subject: [GIT PULL 42/50] 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: <20260829-nohmp-v1-42-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Paolo Bonzini , Zhao Liu , Laurent Vivier , Mark Cave-Ayland , Artyom Tarasenko X-Developer-Signature: v=1; a=openpgp-sha256; l=4787; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=g3r7Dni6ohgRr5AIApZ4NegBv2f/TfmUMSOJUoTYfw0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVlTmwiXqVSvLktZboY0t80etK3DRNZgdgq vSHMtg7ILWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5XOfEACpnRANFblkQOtAuaA6vM/4KvjTAL4UDzpj483e6W/+4bfNFSV3hhSEAOKqUuXxWxa9E1D rPULMmhBW4e6fVn3J4Nq38DsIJnHuEFYVBhZ91vmYlerSB3XLX1M9XkV8kZcuYJlLeBPzup+m92 1kepPTYp8fZjCKKOtw9nz14FzGQXN8a7jglUo0+tuzW1BIfzo/ZvgV0F2S4BePJGg34KWzW8LB1 aqegEsVrJXfn+SkG1f3ZH0GHB4O7f0qsZ2DnPQpcnGM20GuyoAwrDtfXJS5fN/XkL7NIreXPjfb M0XpfLpFvCDmC8HW4nmB7EvY5O5xkvqjVfQUrc+dMSqR/B2M2xJpT3JanJa8uWIKHnijoCxbuTF 6thRoCBuA0rQtaWDG+zcX++pDaauO8Ffr578OB7SjQjS5S0Zc44whNm+4B0ihj7o3qJAHb1qPc8 +3e5TBVGBmhpVSRLF442qf3R6mf/xTezpigZ9eqp1RDJnKy29md6dzRwThI0fyKTYcK2bSynive FuMmON/TqSfl2tHy12q+hsGkTNZardlIf1A8Q6EhECjEgPJeH2hgUIrUQ8AIZ2WnEN93q0nt4VS grMNAXX52FYBJZFk+3zksCmN46rus/MN9r/f3UdqjGpPJAqBXNek5uXrpck5s5Pec6qo6VWUfAz 4UzHOJi5a9OOt6w== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787950000710158500 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. Note that the #ifdef in hmp.c is not optimal, but will be removed later once the unit is built conditionally. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-42-9227de146347@redhat.com> --- 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 6012dc3186c7..9b52ad5fc234 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -666,6 +666,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]) }, @@ -681,13 +682,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 Sat Sep 26 23:03:02 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=1787949908; cv=none; d=zohomail.com; s=zohoarc; b=ezpvGW1n/yy46A86zNej0AV0ODpSgKtYLeTLjXWH/SsCZJl//r+2qg+kiNbiFtZ8f0kOlv5lRRYgrWes91jq5jjYuUCYc6TTGaZylOx++HAvnSSnuH/Ml2b1i5b6rCpl8TYH2Aanj6Wf7adnKV13tfqWcgJZD+2GyLjHrbYIJr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949908; 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=O0gilCMcTw5GY6oy+YVwRqReRSTX/SrtxwLMRYrDZVs=; b=Ag7X0eAqalCGIRc6s8Xqnt2QF3yQieli1qpnzHoBlHyzA6RlkEAKaF6dXt/UC8APUYegmdvUeNiaNK2vZvW0vpqEYr6ZUHjmDf1W748GdYvuCakpY9LO7vaXgnIcBHWvk7T2f+V2vthk6JiqUf7vk2qn8UH4Kb9f7ZjJfzr19Ww= 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 1787949908666485.65880650796964; Fri, 28 Aug 2026 13:45:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03RS-0004Rz-My; Fri, 28 Aug 2026 16:44: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 1x03RQ-0004B2-6h for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:48 -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 1x03RL-0000kV-Gn for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:47 -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-670-TeuMH2ZtO3ew8EvnX0HPYw-1; Fri, 28 Aug 2026 16:44:41 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B60611944F2C; Fri, 28 Aug 2026 20:44:39 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E99AA1803A40; Fri, 28 Aug 2026 20:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949882; 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=O0gilCMcTw5GY6oy+YVwRqReRSTX/SrtxwLMRYrDZVs=; b=LiQcjaXzmuA9sS8hN3s8o79jRF8PrEgfpR+2yYSNHhV7r520MeVzFfpc1hzj9zN8wD/7dj 1Kwz+1J2x3H1WUmSG0Ak34P+8NwOJqjCDrFGQdsvpg30jBHbS6xrUTGmv6xGYv0g/dwUhK joyc4sbcY45GnDbQNx+1lu5e3+QQ2rk= X-MC-Unique: TeuMH2ZtO3ew8EvnX0HPYw-1 X-Mimecast-MFC-AGG-ID: TeuMH2ZtO3ew8EvnX0HPYw_1787949879 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:22 +0400 Subject: [GIT PULL 43/50] 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: <20260829-nohmp-v1-43-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=9570; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=L3Loi/onUFTsM2fjxBfrKJdXskJwqRvtiYRcMlKMo2w=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVd+m32mJrZbVhGLpXFwMRIXrxLaCIEMZQD Zj5VnNgz7CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5Z2UD/4lT/YcsQpKiBSeaW34Rt6KLiZToHdewe53DXktQz/zLhMbXg0ro/ciVu3giu55hxebadE ZUadjNPI6eyfqmjNFIrvT4yC4B31liBIV0uXJvfV9g61SROBkq0uuCs/zdzbQEBJL0RtpQWJCCk IJUAf3ISbhmEYdm5sQAODfhQo4504YCsYMGR3ztVgSwmxTziDojBp6asRhq+ti9xRnQ3GHrHLkk iMycfc1cbtRG32JK8Lz0BhEiRiDTBnMhuBptseXC8vEItQG3/Mc6YioQqlRCqhvNfLN0TTSRvoj XJUB9BL41FrXym+uAAc7Lv5MWW8WIoJ1vUBYaaMHRmxzAIvG4grZ0mcnX3pUN24rdPMn8oSAwWC yl/FsCK+ktURtE1ZbeXVn0pj/9srsv+2tds8IAKUoyqRyK+bqhM0XuVPV2ic/kZ1GOF1GCdZJbF bElR3nAqEMOR5tEx1UBhdnDjVhglfp6OgO6z8y1T07Xq+sWWmqg3x8OGCmjsYrQhqyl8HW0l+Yr oQ6G0zugSfElA60YbY2EFkEtG+IbkRlE11WUcHri8GJOXJyBRY32m01a1cvRqxTI2yF1nZVPJMe Ey2nt/p1rD6i9pgAcwmJUIOpKJOyK9Sq1So6n8BZ/CIOsyp+B5/Qnfgv8D90PoeEWQvi1qMbcxM smThkRrXYJZPxOQ== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949910132158500 The print_dev callback is only used by HMP 'info qtree'. Guard the field in BusClass, all implementations, and the caller with CONFIG_HMP. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-43-9227de146347@redhat.com> --- 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 e8e8a3b76714..c15f2b9f084a 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -293,7 +293,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 Sat Sep 26 23:03:02 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=1787949919; cv=none; d=zohomail.com; s=zohoarc; b=TkQiDNyTxfkM8oB5F7nZRDXHRtXjLiiU6c47gKm4iM8qjRhlSaUDwyAS24f+FKEAdTVd4Qyhy79rlCXBY/viFeAgFWZIyBzvWsyYxQssJtAiQy2ISthF3Vo8uNSlisFAJ26X2f43884UEXax2qWfdxqgHR/Zv2b+O4oPauN5Mkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949919; 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=uW89xMgX17FJLHEV2mQ9tkDS/sWNr9vmwHVXElFD+Cg=; b=cbPZXDZBdEovJfxczk+lbCfGFyolbiozis1Zsv322unHncCCHvqSGhfGuGRGJieeO/z86waOynpZ1sLl6T+WJSp2KhqObkTm94s+4D0HoxzMFDCTigfJvdqr2aADCbMel14FANytbdMT/ZU8mgKAbmdDVgw+wdY8VF7d72syH9A= 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 1787949919554325.99550092633194; Fri, 28 Aug 2026 13:45:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Rc-000603-DS; Fri, 28 Aug 2026 16:45:00 -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 1x03Ra-0005kU-9A for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:58 -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 1x03RY-0000oj-Il for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:44:57 -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-416-BTMulVlXOziJ6jeZ8CIDNg-1; Fri, 28 Aug 2026 16:44:49 -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 5CA211953983; Fri, 28 Aug 2026 20:44:48 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 90BCC1955F0D; Fri, 28 Aug 2026 20:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949896; 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=uW89xMgX17FJLHEV2mQ9tkDS/sWNr9vmwHVXElFD+Cg=; b=fbXWZSN51nAGlkHv+qnHC3aKbCWF0PK58eipoeItvQQU21/s2Ej2bOP9Ofm0EZGAJcVn5H jzjq7z14Y0r28p0Yj4E894/2SvhEFRdC6CLAxE0f8vcpQ0F8Gb1rZs9S5hBZj5qyZL5Wif a7u425er8snIDEJYxczQlEn5pY956FA= X-MC-Unique: BTMulVlXOziJ6jeZ8CIDNg-1 X-Mimecast-MFC-AGG-ID: BTMulVlXOziJ6jeZ8CIDNg_1787949888 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:23 +0400 Subject: [GIT PULL 44/50] hexagon: condition HMP-specific code MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-44-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Brian Cain , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=2896; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=N2LjTtiTAvCP4nbe8+diEXHASG4vpGhtplbW9DEsFmg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVB0I5z/4B9qWQ3VdZ3Og+RTK4/yMsmdLE3 3VOV4iNFdaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5bqMD/9QLZops8CguueekDcv3tTCp1mzdZnGWGY+WOitecI6ElREUls+P4xqHuP+t5ryvyg3RL/ VeNLHCKbMoCZM08DS6qBSAYDiMDuEz7myrKsMawlfOl6sgw1HQvzzB+m/jwk6bFBHmCat9e18+0 zoC/oNPDjvkxfvWgj4KDfBdP5gpEgjEYQF8/gSAK3N1lEuS7c4SIC7oN/IrtKuhxqvOQ9cXS00p RwuXiR6NiNUOvPxU7eof44IuuIpBlELQST7tNJhFy6yEV7+z16mfYn7Snyc4BLoKqWXwmpm4Io6 HmS3Fud1BJXtT+Ya/3n+d42UH6OB+NiJA5ouQAI4FSN0tpNcLv0f5DYVoxw8RiissORSF8upsr4 YYXYgkAQIwcrK0j/FZFRfA8FDfwgPrUDZIvh6g0zByoBASLhyQehyWRldnx6LU51lKdGm021ZHh tzdjg88OSbQmfqEBbtinQXUqs3KnNEvygxfzHgr11ALLMX1xmgIbdQHqiggZHrLaus4ZiPBca6m 8PohqHE24xpFTdqSJttzIG0Ijyi4X5Meja8UcP2CoU1CKEkwPnXy/YQbRkR6LGmA7iN1RIbWqcg 2JbTUhh5mOT2fNP2yCOTlX2oNfjAoM0PfL/rc9LzOW7erdrLh8i1TqU0vKjqO/RJsteVI+/V9Ag xjez+k6MZxvbuQA== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949919997158500 Reviewed-by: Brian Cain Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-44-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949935; cv=none; d=zohomail.com; s=zohoarc; b=NGRmj0qJCuJjj+IDMKHRCHl/bve3/NtVYPNOR4rE43gtOcav+h/tuscU7JG/4Kg218Wx8u+okjBqkayIoMhFI1dLCxmyq7ATGNyiWySkdmmT7CKoiChVfBHocJa08fOK6dZF0RI98keQKVl0JraVgbleedsxe5XeZAe7Sv38Abg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949935; 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=rfqb0FEcbIHTyHlmRxYvze99asW3BLGfma2FfFEb8FU=; b=PGRhtICOe5ZLGbH7MZstGM/evc6HG2Rtya0DhdilhfnH7zzQvpROI8OuzNB/jZaSCosFRQc1XfLffnEgSywe/dM5fFDuJgAl5ksBy2rzakmrRYquMt3o2HsEsm6FawmTRGlilsUL4FjrCwEJ8GUnSWU8iLbdsHRVVCyfqEQ7eHs= 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 1787949935476326.94332376449574; Fri, 28 Aug 2026 13:45:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Rg-0006Qh-QY; Fri, 28 Aug 2026 16:45:04 -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 1x03Re-0006AQ-L5 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45: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 1x03Rc-0000ph-2d for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:02 -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-481-GqsQk1J7MjuPVBYaHGAdOg-1; Fri, 28 Aug 2026 16:44:54 -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 880771944CE7; Fri, 28 Aug 2026 20:44:52 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3B1241955F0A; Fri, 28 Aug 2026 20:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949899; 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=rfqb0FEcbIHTyHlmRxYvze99asW3BLGfma2FfFEb8FU=; b=K9/scNXlQBWQs01RC7ruwsBfQTnaJnqsQgyC/U3noi9P6waQFSKdY9PhJf0vP5z88/dS/k xxo27xrpmoqyA+KhdRYsYd754u76xB03ZiT8AAbDVatSxKMfs6e0KGpJSRrnSCMSmwf1sO 5oLN4H23Qy1cWBWTuoHxidK4hjnF9c8= X-MC-Unique: GqsQk1J7MjuPVBYaHGAdOg-1 X-Mimecast-MFC-AGG-ID: GqsQk1J7MjuPVBYaHGAdOg_1787949892 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:24 +0400 Subject: [GIT PULL 45/50] 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: <20260829-nohmp-v1-45-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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=13105; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=geIjSE50og8DTAyPDYswZtLBbH6rskqQRTEyvYnrooY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVLmr5bohgm3ivbs9K5wo0lTCkCAlgtxV72 O0VuHH7MjKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5fCREACqfTyL3QnIrEP5rAUtQdxh2Crcq3a91fBjxfg0M0KTbxSYo11kiRsFU6tpMGEEm38DJBM yAqy8U9qA1sNtGQULEdAgiTdX45A6nbFVlbT6MGGq02Yd/pW/L2nsAUFX+h65Jq8HgTBRIX1+gq RYFYBcjBfqhJ6SvAgKT/QDWKM1se4aHm/28dN9G+v6vJ46ohMU37QpWRRbhbRmMY8w8buY5reM7 lMt6aPJSFlDg9HfeLjxJ3MVuhZQdXMsIwwSsf7FHiOCjRDoaLpdii8mCz+gworJYWhLxmiGwD3k +jwnexYW8gNVQH+LDQrgoPTeh4XYfxJeowzKzDCdBYAEGt43F9diwAJ0mdEHIa9BLS+2BWrh95W R3VvwKiX78ZsDTc2gZVqP/7gvoULAcmY0BqubwKPEvh33fqNiNA/5KoamxOjCmkNlUMTmq9NpLE bdKzn71vnWkA369nhfkN9XMmdGgSfFzXxm+6O8SGD7hI5YhFts8g4x3G75BtLp7u3GW+mtjtaF6 C4oqqWNrDQDNh3LiYLpjWIO70mWPQ/sR7+pukQuvPFczKFZjoG6sZCEaPfQBYAR6Qv8lSuyePsQ GV6YeGFKxNLomSKyAhosinIpkdalURqCCVB968Cn/vMXWudJUe9RKLfp5IGEqL7+giNIzLr6rzz 9+/rgg+BHudBLug== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949936334158500 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. Acked-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-45-9227de146347@redhat.com> --- 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 39ac8c9edc09..e16930c43197 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 aca56813ab8c..b10af358f947 100644 --- a/meson.build +++ b/meson.build @@ -3548,7 +3548,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 cbdef5a54550..a13c4af989ce 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 Sat Sep 26 23:03:02 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=1787949907; cv=none; d=zohomail.com; s=zohoarc; b=JPQc5Tc1wrzWfzm8guShxQbn8rA7owZZVMxhCaF3DM04xrRVBzjmM59sqZaNYxHE96xavQIA7dhxJ10t+DsaQnjAQWGUEFO4oHw11Ww0Alsr4FfaCQ/RZrsrhPDZoVgR/d5Sb5L9aMsipI8ruNJ48WS96msWXWurOQULPye6TCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949907; 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=sjafwm5BPsMoAETHERG3mpzCG9mRi3WYXcNEkit22Bo=; b=iabJYI1RoKQdF4Mcy9CLD6tmmTGcK4Jz9ITXKeciTBotWM7EsiWPa8XeALE/Rh+3UBdFn1t4OiIoTnKWrx3OKqbgCMFXr+Zy7A73LuQXosD0+PXUVutXaCIKriuWlemFSXi737mDeR+/AR2siFiK+qytkgIvJP7pJoZ9GYYG0b8= 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 1787949907137171.9507090436448; Fri, 28 Aug 2026 13:45:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Rf-0006CZ-0o; Fri, 28 Aug 2026 16:45:03 -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 1x03Rd-00065c-KX for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:01 -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 1x03Rb-0000pj-VG for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:01 -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-84-rvbS6FknN-G1x-xlc57DfQ-1; Fri, 28 Aug 2026 16:44:56 -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 B4300195D01A; Fri, 28 Aug 2026 20:44:55 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EB1BE1803A40; Fri, 28 Aug 2026 20:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949899; 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=sjafwm5BPsMoAETHERG3mpzCG9mRi3WYXcNEkit22Bo=; b=ZTHDjLmRslxvHW/kBsKONpG54rgRaKmv4kZtfCMoP18KcGgzT5xPWMx3M0pBqCFkzEMN7X z1M5cXqW+anV/d5HfzqRQq4uwlKfCBnPBNy4mqNyeuolz55Qfblqhhgas/nY6+/QFkItLo s35lrqpSxtNNjHlklvs62oNxSPT82Ts= X-MC-Unique: rvbS6FknN-G1x-xlc57DfQ-1 X-Mimecast-MFC-AGG-ID: rvbS6FknN-G1x-xlc57DfQ_1787949895 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:25 +0400 Subject: [GIT PULL 46/50] 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: <20260829-nohmp-v1-46-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2768; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=e5zsDvqDHKFLUfJ1DZKf+ow2Mc/1tNSAbECpvkKyt34=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVGrDZK1nqofi9w80BrrsxP0W+OpwDGstxt IcB62suCX+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5bIKD/0ZKJOEyrQ4H3yBHreXXQLWqrna7/OU8xXdZ3+OOPsyWOdFkwkEno5xwA/wI/QZ9JmwaTu bfdsd5B36jNDYXz5sfycm/lz958h8uxvDVj/SrxCWKe8T912+xyBnyvkGZfbrxo3X0kUkwxxnLu vfeX1g40iHS3XIPZwRQcS0xgpJEAzC9UxW0W/+8jkX5qwf+UEXIagqFRHtDLG1ehVRtDMgxAUNt ec0q8AkfrLiiLQ+o1y53qJJ3frHEhC8nL4ylWbsrznJ7P7foqiYH+0JY/flejOJxH+jUf6YFGKp h6cVvpD6lzKENKNfe4p2qePfwMkZaUxg1ElFcBOgZrVTxY/OBPdNqFxKdsxrkiBYCafG/NwouRb tQ5saP3TIS6yfK4Sn4MJCIV2GhSl0hvgPFk1hDmhFKnhY9pBh1zTnV7ZAEN5hzp9wSYwFUV4g49 LDVhJcA5Hv4HYHLUwV70daaeNkBGy+Bx+o1apxZuIJ8sIzTi8DdCeGg73hEVaPqgHq/yV6XgxCz cJ2ntQSV6ADmA9z8BhOWy82GD+n+LB3QGvUq09aQbq1nHBjTJUY/owH08immoy92PE+bpx5AERV GO7hk+L2xSJT/PbIbAsf5W89b/YVeDnFSJKEJxqD2lHjCyTeuzwWQLR3dBj6MOny/yzXf7PFGZ6 sxzcyxS+NmFBHoA== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949908052154100 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. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-46-9227de146347@redhat.com> --- 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 Sat Sep 26 23:03:02 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=1787949950; cv=none; d=zohomail.com; s=zohoarc; b=exSxLyls6NU4A8/uNvVgWEeuwiaCPVUEr0CPA511q2RiO/Htjaj5GCFWwTz3Odbh8NDu6UG1R4g0eZsmLZAq4TfgBXZPQA6laBH2rPKkgQvieYEsCxR9BEhn4xh1Ejc3OeN3a9rBJDK5GKq23+tgGZEahBxFv4QFy7rxkPP+nNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949950; 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=ww7blIMBoGp2UeKhBXzhHpBijTwcIavNL5U8fiOt18Y=; b=G2OElPJKHtZZGCEOFq6VvSmB8dI8aPVgJnZeNsqsD0DIzFVJdkkPif5orqDaY6ehi4wo2Z4xwv29E48boPtintO0N0CA5W5zHqNtKaSglcpSl1PTPvvLQx2SCUEgffA5wrCIgjo2TBin7AshtC0/TC1acxOXK93XNxA+NbC3bzw= 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 1787949950633958.5359815806671; Fri, 28 Aug 2026 13:45:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Rj-0006en-Id; Fri, 28 Aug 2026 16:45:07 -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 1x03Ri-0006b6-GS for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:06 -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 1x03Rg-00011T-Nf for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:06 -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-278-noAAecTANqC-lGElpv0W8Q-1; Fri, 28 Aug 2026 16:45:00 -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 2ABFC1944F2C; Fri, 28 Aug 2026 20:44:59 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 60D273001D3D; Fri, 28 Aug 2026 20:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949904; 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=ww7blIMBoGp2UeKhBXzhHpBijTwcIavNL5U8fiOt18Y=; b=AcT4BHRohpWz4oioDLDkS+IHEv4niVuGUzblGJ+fSnRV7rJGZ7QWOdm5n0Sq6ykxRLI05w /53RhQekU2s/yIKthDBV2x7ICP6Pl3BCCmhycq8Q6aAcSH9HGFHoz/ypSrBPvb/N8jlxb/ JntVlVFLo5EX0RmydFdQUa+ta+QWJug= X-MC-Unique: noAAecTANqC-lGElpv0W8Q-1 X-Mimecast-MFC-AGG-ID: noAAecTANqC-lGElpv0W8Q_1787949899 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:26 +0400 Subject: [GIT PULL 47/50] 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: <20260829-nohmp-v1-47-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=5242; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=hQYL/vHgYNpi41AkLAPE++k6s/L3pPhglmykhJ34LTk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVulUYZO62aDC2lPHhgYoMVO1yX6uh7ZGeL Owexd/agbmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5dCAD/0WeKGVgpNn8UHMSdFCHrP6LIjDnRlaNp11JogOXwvXMlxiaRC9Yg6lbRIAD8587tZmoqv 2N1Qk3yxJzd/lTrRXxo9C+NjUkwbz/l0q174yxDMeOR6zlQDjxMCu0VAu2YpjhVX1MPfIhH+Swk +PuN8JFJlAnokO3IwrjnvuZ7d8VD+IXk7m9URq6bZ49WSWMolTXjyXNDWjfQeyf5KBp5vpYbAEr TKZxj8y/TEWVhoCCfMa3CqUnUK3W76okFDu9oxQ5tUUDy+JZqc3x3bUFta1cwu20Qg7i7t1cT9Q i5L4g3y8Je5ghXbWonidV6pN47tzIzFk58Y7oL3DawnD/DmCNTk1AaDgyRUajrswrtfZgawMbwD yVTwGGvnpBJDJ1y5GV1zG+RpA9uj59s57imrn+SviPfZKiHGHdTkhdRp78ReMRGHWqx0+sY5AfG 12xUffwSe7TLQ6UCRcdk1ylPvocAXFXKSBouX4fbJfAYsOdfHSqqX0FslxwIiiair6A1ZV0Qghh kshElHenLBY7sspU0gtqFUuCc0yTmUtGhYTJDY3PJAmB4m+w1ghilI+Dr3E8gYenWe2W5KAgptw yP/PplO3/1DqsYhJM37f7wqEes3hyVyJgTfjydZi/oQkC9fcc3CzEqrYDiqiP8l6e/JVxnYjngY GouBdd2rShfnC4Q== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1787949952199158500 Those functions are only used when CONFIG_HMP, compile them out, and add conditions for the calling code. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-47-9227de146347@redhat.com> --- monitor/hmp.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ monitor/monitor.c | 49 ------------------------------------------------- util/error-report.c | 3 ++- util/qemu-print.c | 6 ++++++ 4 files changed, 57 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 7b22553a8731..44f2339d31fc 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 0e3aaa539e78..8932beebfb9f 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -35,10 +35,11 @@ const char *error_guest_name; static int G_GNUC_PRINTF(2, 0) error_vprintf_hmp(MonitorHMP *hmp, const char *fmt, va_list ap) { +#ifdef CONFIG_HMP 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 01ed43b5a588..ab09dd8600ec 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -27,6 +27,7 @@ int qemu_vprintf(const char *fmt, va_list ap) =20 /* for all monitors: QMP & HMP */ if (cur_mon) { +#ifdef CONFIG_HMP /* don't use monitor_cur_hmp(), to avoid a second lookup */ MonitorHMP *hmp =3D (MonitorHMP *) object_dynamic_cast(OBJECT(cur_mon), TYPE_MONITOR_HMP); @@ -34,6 +35,9 @@ int qemu_vprintf(const char *fmt, va_list ap) return -1; } return monitor_hmp_vprintf(hmp, fmt, ap); +#else + return -1; +#endif } return vprintf(fmt, ap); } @@ -63,6 +67,7 @@ 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(); if (!hmp) { @@ -70,6 +75,7 @@ int qemu_vfprintf(FILE *stream, const char *fmt, va_list = ap) } return monitor_hmp_vprintf(hmp, fmt, ap); } +#endif return vfprintf(stream, fmt, ap); } =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 23:03:02 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=1787949978; cv=none; d=zohomail.com; s=zohoarc; b=a0XZMGsNnKi5vfDx2+aU04MSCEjWHYWLkr0v4Mpv+0g7fPct4uYGj2s62U+8MP9YcDRn7gtZmBzm2DqrN2Svu4EIwqBdpXVBH+mHc4Li9U6ENG3OCHCiCe8Ht2DTK7EPR7SZU2oO0tZ8dKQHEIQ19e1Ri6Vc8DwD2ECeDz+P5Gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949978; 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=7X7Biat8iFEvLB+Ud40Ml6+Lm2g85/4vHBFqZRkVSLM=; b=MB7Zpo5KtFACPp7ZRwMqeaUIju3a+s6jWhpLzkuaNyooGWamiWe48x9fvcVdxeE7x9I/UgFZp4rSdFh8EDVvk4K2DcOfR0SplR9xULzOTSxGjCh06d222Ik/EbW0ptgp013bcP0PCxrhdKhZjoAFEj4/43rrioATVqLDpP/A68E= 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 1787949978149930.926979714988; Fri, 28 Aug 2026 13:46:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Ro-00076G-09; Fri, 28 Aug 2026 16:45: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 1x03Rm-0006xg-SV for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:10 -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 1x03Rj-00013v-Nr for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:10 -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-197-38uPFx-dPhqBuS1jP6iO3g-1; Fri, 28 Aug 2026 16:45:03 -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 7700318089AE; Fri, 28 Aug 2026 20:45:02 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A84543001D3D; Fri, 28 Aug 2026 20:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949906; 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=7X7Biat8iFEvLB+Ud40Ml6+Lm2g85/4vHBFqZRkVSLM=; b=FX2vxjaDIgHdsJ/38DJOWA6IfnROzjxi6wqzMLdZ+Hy3hSYSy8FwuIPjU62+rX9zrHfYnH B2GG3d2C9egzupu5sKT1Eb6vajF+xO8UzJTuFk7yxiISIrYV4uVNb3bMaTlix15fANpHIP 4F1EoboQmJ5n/CM2Evxo89IBDwu7IyY= X-MC-Unique: 38uPFx-dPhqBuS1jP6iO3g-1 X-Mimecast-MFC-AGG-ID: 38uPFx-dPhqBuS1jP6iO3g_1787949902 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:27 +0400 Subject: [GIT PULL 48/50] 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: <20260829-nohmp-v1-48-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, "Dr. David Alan Gilbert" , Peter Xu , Fabiano Rosas , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=15527; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UqgpvkHwwnAd3RPM537gINsej3G4pVW3o9ZKCYvc2X8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKV/a47vbKMLihEcj+npvYLyFiCVUsQ9vWmH SV2xHOQyDiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5YJKD/0Z0dTA/h0lO32N9jqwdObBl8gARhc6UahmYRoHNY9vBrFL9PSFFoiZ7Y3HYzUgh4QHRkt fFgCnlqvckIkTq8H9BuW7zjVd3cBaGt5djUAkBXqlNmvgXXcMUeqJVrDznOwJnfy/AWi3dDh9qx VSYtTdbkyIRIV5LV36ZVs1ekGk04UgDT4460Y6tEKfp9tnY0phwOG5g0AuI0wAaSsPPQ2+tjPYy 2a1yR1mfrc1X2ZNpxmH1rhF4ExA0OEg2Uu3qkQAh2bnrFQFn4K19oJEh0gAcLC58try8e//L1tz hM0zLjgC3vaBupGxzeSNk4fkJdfrvJ6cSZp8I42igeRfHCsYiOvcNqKd6CZCiSAipn1ZvxYkNve 5mA+vZiwynE4uV2sz6dXl71OIrV9geLktz1k+cNzwQyDL7ZFrNFgf/thLcBsrEBLokH0zp8ipEJ sTXXfd3c4K0ceaaCFT4cFtKaUtZir2Hur7BojlfROkN0HbZly5K/dqN55M6JGfI1GTohvINFAnZ Y29o7JrQ1F5XoPpq+jpd6DgfHpXceARRfwGR7ulef0JIMmhpHuyLhqsxB6wW0jZ4Hzm7skaysjR x0/dZ6oQ+91NIvreQgSp6kBH1H1Nz+2eW1KFHsbc1JDBCGVcvhwZKkBNydSK6JaAUpRDqOVn+IW Ks6XRvVwJmc1HaA== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949980518158500 Move HMP-specific declarations to its own CONFIG_HMP guarded header. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-48-9227de146347@redhat.com> --- 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 44f2339d31fc..2654b81890dd 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 Sat Sep 26 23:03:02 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=1787949952; cv=none; d=zohomail.com; s=zohoarc; b=K8aczyKTrbZQSpijaL/NYg8PXlAiKTg4cizi1tNjAjvkxxTMMnpFSfTb2EKTqovZOoZYPm0yVQAhaPMseu7ULs9oTkBQtzspx1tU5XXeTtDOjKlhmNXG0QlRFkOZz6dzPw6VkuQK4pifjuVhLmiStpy3HzmIHWaR4JX6KMa4oDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949952; 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=WY0qEHeU+RwcHPu8EYIRmNIY8U0l8cuHWeqoDJQ2dEs=; b=bgIqR0/zacMoh5AF4I3rmkrZPpzzhpZ7/rXgCm34B8P4AX2uuoUJzLzCnLusK9lLjKEL4+XuE29AA3O/b5YAPIPv+jPnAl52h+kvFy28YR+iqZJZ2RXumue9mf/sqSR8Jq8FDsNAo9R7MaD4DXHZEd2LGth44J33wy9sUnEzwf8= 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 1787949952296823.2187097042497; Fri, 28 Aug 2026 13:45:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Rq-0007P8-Fo; Fri, 28 Aug 2026 16:45: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 1x03Ro-0007AL-C0 for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45: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 1x03Rm-00015L-HL for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45: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-313-P8GtXmLfPEu9wHzJeRO7TQ-1; Fri, 28 Aug 2026 16:45:07 -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 5E3F618A3C0D; Fri, 28 Aug 2026 20:45:06 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7AF3C1955F43; Fri, 28 Aug 2026 20:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949909; 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=WY0qEHeU+RwcHPu8EYIRmNIY8U0l8cuHWeqoDJQ2dEs=; b=D+xfolY3jKaTTSmbhEdDbuqfcJhQP+ZDuZ1ICyllWtWKEkMtZucKL7a9IPbSqUCYtBI5MW vbP9X/G802CTBFp/n05Z90huXgFEojKK3kZsG5wmE2eBxwISEIG8WpegECtUMTDH55ZkAL sbLBCB/ja9qZ/g4I3DNz6uIgAiand/s= X-MC-Unique: P8GtXmLfPEu9wHzJeRO7TQ-1 X-Mimecast-MFC-AGG-ID: P8GtXmLfPEu9wHzJeRO7TQ_1787949906 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:28 +0400 Subject: [GIT PULL 49/50] build-sys: add 'hmp' option MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260829-nohmp-v1-49-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2951; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Z1R9b7P7xYeGUV3lMBKVImoUuEK4as61pIMmcRCfubY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKVlfuNva6oBIOnVzn/gvKS4YXF16j4n6F9r 3WXHPdjnviJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5Y97D/0fr4Zp1t7bOU8yAnvleEPEXpBz/jJrQY7Fb+Ibfci0ja24DC5ozO5plJkVQLAMccGJy8q h6ZZGOxqOcpuV7dh3rOkfSZzlJ9KibWsE4a4lTPWgmlAnT1t89LVZpwJMx3T7CYQ9tPF/HZ5rlQ 16WfE7sSAjX13WBOGOBF509zT7z3MVOnKTafSNKDoFbJIipfNtRIwuLAXA1/UlDJ/4ywaAgw3vI /ITZLH6UeEBxktjjuOmYoeiwQdii1fJhpphJYCtCMZeiPYfb71KqRRW/G02w4KwiBlqRyZ0Pf+N o0NrnZH7ZQOoaXmp/Jn5vnoQ7vENJxooIdvADDxzi1FcJGSJHbAHJVsd8NOzLvYmdhqtAYTjaxn 2Kunut4OAxsIvVIsW551b1/IT7zE8N6hz3TLdSNbRVY/TN7gpz6kWRgf561sPO1xr1ygsl+I/Ai FxeoYX32+DmHt+rtd0QXp2QbJ+iuzW+8sDS7fZ1p5+pYM/JwnKApqkJLMwdaijl3rExrF7PBvfv l7AM6WRqh7Ll4NomR9JDBo89QoXJ52Fa3OukQdzZ891bQTxGLCAvvr5VmhvwODmxaJSir5XOP/c WiWvKfNEv1ejVM/tZyUdoXqqD3o5uscQPdoymvAdBzdnLStGUAsINM7h6jFCJWvqyRl6cvq8yEK Vtp67+KPtjNCYkg== 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949954172158500 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 Message-ID: <20260828-qemu-no-hmp-v5-49-9227de146347@redhat.com> --- meson.build | 4 +++- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b10af358f947..5c9de307b081 100644 --- a/meson.build +++ b/meson.build @@ -243,7 +243,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 true +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() 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 Sat Sep 26 23:03:02 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=1787949950; cv=none; d=zohomail.com; s=zohoarc; b=BuXYPbiIxoZxi8alx8p+g3r16ZaEOcIKPLAVdtoHCB5u3josVrIsSV0PIFuuWS0zgCsnCTKp5xWGeYc2xpQOpVlKpcsXw50eTu6wJbq2b0ehH1c/4i0ssIaYWoQK6UrTLmfkU9lJzJ1Sgk+TWKFaVUWMqVEobrDJ4yzfMjF5c0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787949950; 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=cEyg0m5FztStRBZuUnt6glmSlGUyeONOGRmHfmCriAI=; b=JKNadMY82ERyB+juVeuRYqYJglD2aQlO6HDHScIQHOG4wJrIXQLBqcUxiLVwlEL7D/MVI7VxwX7ARt1AYRtU6VmZbRaVTN2/QEXFrNhNxgIS/7r0kEekLKbkR6BWouLWyeiIKTq9B/doYaFxCsgL/r18Svr9fj7qPJXaWTQSytY= 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 1787949950546265.02861267695175; Fri, 28 Aug 2026 13:45:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x03Rt-0007ZJ-4d; Fri, 28 Aug 2026 16:45:17 -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 1x03Rs-0007XF-6Q for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:16 -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 1x03Rq-00017y-Np for qemu-devel@nongnu.org; Fri, 28 Aug 2026 16:45:15 -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-601-IPQoO7jFNJOShBvapcQowA-1; Fri, 28 Aug 2026 16:45: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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7915A19541B1; Fri, 28 Aug 2026 20:45:09 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 980C65B1; Fri, 28 Aug 2026 20:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787949914; 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=cEyg0m5FztStRBZuUnt6glmSlGUyeONOGRmHfmCriAI=; b=fA0U/T/5YB8d+/5HCtQfU171r0rDFATOz5synaftQP2pHcoHzhG3c1TD4tsXE9jU6U4Bjq oYuCV45IzL9Dzc2ZArBBpZT5QwtpLQxeNvf+nwEQlIUGyOu3C76hEf6agvmgizMMcyxpfo 71aoB40Fvi8bl18sP6XG5jyPDpZGfmo= X-MC-Unique: IPQoO7jFNJOShBvapcQowA-1 X-Mimecast-MFC-AGG-ID: IPQoO7jFNJOShBvapcQowA_1787949909 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Sat, 29 Aug 2026 00:42:29 +0400 Subject: [GIT PULL 50/50] 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: <20260829-nohmp-v1-50-4dcc2b4b0055@redhat.com> References: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> In-Reply-To: <20260829-nohmp-v1-0-4dcc2b4b0055@redhat.com> To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=794; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=tAfsfmjEe94TsnvrvX4Ti/Qrng1s9tl5J40fDm9Zfxk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqkfKViMWtfDyBJzmyzPWiAq2jQnP+7YuH7jN3e K8WY3UHRTqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCapHylQAKCRDa6OEJdZac 5RVsD/4z0OsczM1VNfugNiI3jnYo5c8qUHAf2WfF70SiT17+5Y+DFvZab5pyHv8gZclRsUMJF1V dF2LJrPDgWNqqjuhPEJSp+z+14WW3Rncm8s1piFgkv1gD7gTURUtpmXOf1T7taHzIBDj+Bvrqri seS9rfmInKPAnzroSt256ryRXVed37IqH4R0U9t6t2PhHOfWqMYja2VqhYYUvNmsYNOQan9oNEE 3u85N8MGURQahTIL/SzPyuhBLxroxdw7XnDvqFm37gDFsp5O/BU3TKxxewck1XM9+YPtmPjii3k fAaLcUS3hqEFfeM75j3i+SY5urMptOJh9NoFqR3P7OggE8TJAINezbZjtEJl4CcQ33tbo+bZao8 7rl1MxnP9cIN1mRBqJ6GNKkN2zHFteX3yqkyofjW6xwzGYNVycS6ALkFQhKelCB4PjWiClmSnKb DJSIyrRjKvJ5pO5lcnwPjFr2O9c+askmz+9k0fSIVt4umpBlHUfJFcvdRS6qF/CkGxRfeSyzpK1 Znm3vxRhCY+wg10/sdZdp6uRBtcsI7oWnkE86nJe/8jaaqr/hu/2C4E6xw2A78PXDAszBQCD1Lq GJy1CFwBxr9C5pIR9Hd4ruuQJUUorUOD3M44SsGAOnsOeD2gDVnkm1sTV7XzSPnyDpcFzs6zGJx yp1B8j8smEYKi2w== 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: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, 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: 1787949952107158501 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-ID: <20260828-qemu-no-hmp-v5-50-9227de146347@redhat.com> --- .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