From nobody Sat Sep 26 21:37:38 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=1787685051; cv=none; d=zohomail.com; s=zohoarc; b=flImqkWHFzcMkh2Fm4Yk/rm2kBWYmoyceyi0Zq9mgr48oyNu+j/7zve4h8pZM6T+LNIXVaJnxsm41UyvnjKnLU1cx4UX87NNQ+YQq7V0cc1fdL/EudiuLGYIt/51JyIC5AMwoLv5hrDc0oYZxE51ft3hzZkEQ3ymCDaCBeJoBzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685051; 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=/fJ1CyNejRoo+qK0w/miGDBvyJfcNNUpShbXpHkw5bc=; b=YANd+MRXlXx7RvgDHKLNJNWufl7b7SI8d6Kfd0bKtdtH1HOumx18Z9e3zuUpYkZI6X8N++fgGH7MCyzPm9vqH3aihcK5l9Hs2TPP+0UKLk+A0pEYgDOz7s9vLOOCjG0APXsZ0jURQIMv4d2TO5FVOdQiU0zLaCMA2T/pfqMscoM= 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 1787685051158619.1446158293707; Tue, 25 Aug 2026 12:10:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXM-0004AK-S9; Tue, 25 Aug 2026 15:10:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywXL-00049x-34 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXI-0003ry-V3 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:18 -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-383-NnxYWqOFPRCTEbUfZYZsqQ-1; Tue, 25 Aug 2026 15:10:11 -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 7342F19539AF; Tue, 25 Aug 2026 19:10:08 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7BAB41801AFF; Tue, 25 Aug 2026 19:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685015; 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=/fJ1CyNejRoo+qK0w/miGDBvyJfcNNUpShbXpHkw5bc=; b=Jn4GJoFiOVreeiSlZNLW//tbPZXsP48W4uwTuZf/1yW6/Ec7vkrnuX3J2V3D7jiLCbXRhh FqmXl3eaJiXTmpFSZu1mZQJbOh1xUMGEl9y7rw/hpKIawQhy87e3eOmPjfLG2QzffLwM/L VF/gcUoC4H6jLAzNm90UcLUcD2nQF7A= X-MC-Unique: NnxYWqOFPRCTEbUfZYZsqQ-1 X-Mimecast-MFC-AGG-ID: NnxYWqOFPRCTEbUfZYZsqQ_1787685009 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:08 +0400 Subject: [PATCH v4 01/49] build-sys: introduce CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-1-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=1002; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=BjQzrX96/2TCRCuhB8WDOKZUyWrHd7nZfvI+I+3Z/8s=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiG/57rymXIzpActMZ//RgbcduN3xi+wVNoi 5hJHjNvYniJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5cMbD/4i+QZ+VwkFYfMVU42f44O5IMII9TdDfmQ19KuKwjnM1k6jHtsfSErbPIj1jMcKemHWG4R 1pqEXRfzCGZJHyLC1wM7qu2Mx3CHiSMLpoql5HVYTQrpe/iDN2IEPC3bkGUnJdRpkPdsryXwlzx ZacDgsHG3RV+sur+AI/EkzQQBryykTT22631tY5H3e/bs7/hfOFpQyUJxZZCX3G0cU+c0SfCN7e jyT23MEBkx2o8uLihe10605g/ok/aMOothqQh6vpZtaJE/nCuZSjrLwzSK3upaM235SHpGLyghZ Klvh3qIpt2HxKeJAafvBGOj39X/V0+JgumO6hXvMonmMPA1YmfeD3R4drqBb4KYDDiHihZipftX ypgmxYAQ7QubsCTe524kWVHXzxxLFQtLiFg8+FlOHfakxfUV0XOp1N2f0i3zUbuvriqA03/l2xe D3l3lH6ah4o4/6dlCO/XLkx872+z7Vjtzgn86TPvyQ5k4paOArgaDFUJqGk3KpS3A020oYUxD8D ViZrqVh448T8KSD5iWNk6Bi2GDIEd8rOFnBvKKEJNg4+5qG/obPyg2aIQiOm+25lBv31hEy2t12 pfJZQ5GYhlZie90qjQVzSXhIcQE8NFfGbnpDiQCdXCZV1SZ6WU0YhRnh9DHp5x6xdKqQJgeeYF8 DAOTBpczK5iQ5aw== 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: 1787685053446158500 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. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685316; cv=none; d=zohomail.com; s=zohoarc; b=De4mTh+qaTY8Xza//PMFfaWJF9WSPKs2MbfDwzp63TEJfKsGJZTDoci7ioKYaB675AloOY5nGjhQNHY9DVr3VeCkDW4OYyINpeIgWVeZWrAdivFCu06PIs9WqP7N4mGbAhFTAJTHyBZ4WHW4r7hASFziCJeuyiNB+nHlppQ1Q2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685316; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JHUWUIlV1L88EuNWpXBRzIO9zHPWAXRW9+Hdx8pgeCk=; b=dUFQ0z05IabtC21cjq6YjWmnUj7tCRu4AHaFM8XIwLTEAgZY0FCwEBWdmeMyhzjhFL16DYTkvigZWWLywXrvtHaXIQSOOyxEKM0JI1soIIgAkjsITmY6B9JSc+4nuSKApApxgBhqOmRCskNw2xWtOyxq8JWiFPIr+44MjtccrSo= 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 1787685316534919.0655454349517; Tue, 25 Aug 2026 12:15:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXP-0004Ch-5W; Tue, 25 Aug 2026 15:10:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywXM-0004AC-AA for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXK-0003s8-SN for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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-595-ZfBIOGurMdeyrZeKPlDRJg-1; Tue, 25 Aug 2026 15:10:13 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 57CA119792FF; Tue, 25 Aug 2026 19:10:12 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 47FA91944B2A; Tue, 25 Aug 2026 19:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JHUWUIlV1L88EuNWpXBRzIO9zHPWAXRW9+Hdx8pgeCk=; b=EBk9A8WVyC0iHicVRUZ4P41JGnHSqSCmPq9wnmm5HoyAvv6lzrHtuTCDOHvZvH3+flEFnI h9ZCk1fLf9g+xk+11pDw9donLBNkCpCxvICn05Pd54Yroak8CFEtVTFz+T2HXNaglIC/TK Mu6fD8jbTW/uqGV/81RbBZf9sSjIUwE= X-MC-Unique: ZfBIOGurMdeyrZeKPlDRJg-1 X-Mimecast-MFC-AGG-ID: ZfBIOGurMdeyrZeKPlDRJg_1787685012 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:09 +0400 Subject: [PATCH v4 02/49] vl: fix -monitor none prefix matching MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-2-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=937; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=3iiRReSd94lLGBmuGE+7JzjtOZA9/s2KBjEkNLxXG5k=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiG6yuY0SXZH0k2TWbkiJeU6z499lzz1k/50 2FlqemqTjSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5cMOD/4gd0HmVtyGCWOWTpMi6RAxPpLX7SmNNoVb53qDN+Jlz2J+EqC+nyHuvxRjGZsyndwl4sX bO4WT6jeZ/0ffkuFl+oNl0Jn8BewB23lsG56XBiL60ApKUv5i+79eCIGOMvufCzj7fABsjOWSTX OrXC9Shh95LpU/xiGSE8bnqRvDbGQavg6bado2+prOUpXuFBauoDkhSyyeEAfgN34gAvzfQ2uki KRZB1Ru2yPITbaA3sPn1tBzzlIi35PxGCjSqnW4xYVw5a6HRu0niGm+Orjvx8uU3bewF0GTKYkY ADcGTIIjr/6m4UuGdl+aMQ0cQ9QO7z3W6yWB6ZwF/hf4Zq7S8Bjq2+anUoHsOTX47yyR/dTRHER rCTJCoXuIaapPcpsBbzs++vbzMwwCjlLaB/Pb2Ua6rDTjm1SGnems22JPPC9WLPLrP5ksTbEmWI KQe4jjQpPCLCfHDIhGyUhj5FBl6iY3EyUiBhH+mcS6DPn4XOqymPy5k71kS9IyN5g3DAiuKplDR kmAEdm4JyMB2lhhHIW65XQyj2YptN+BBSz+VLU0WKZhyc+vLNFM3At3hwWIeuM237YIpNk65OKm hdFzdgVVBE6akGBuL3ifVdCdYevgkAz4BvCd9VejA1Qv7MAKC9Jd98DDsuKnRF27p5WsUQdt3I7 3f8PZYVB6ura+9A== 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: 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: 1787685317484158500 Use g_strcmp0() for exact match instead of strncmp() which would incorrectly treat any string starting with "none" as disabling the monitor. Fixes: 70e098af88f ("monitor: allow to disable the default monitor") Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- system/vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/vl.c b/system/vl.c index 061cbdf860bf..5ccc19282ba2 100644 --- a/system/vl.c +++ b/system/vl.c @@ -3226,7 +3226,7 @@ void qemu_init(int argc, char **argv) } case QEMU_OPTION_monitor: default_monitor =3D 0; - if (strncmp(optarg, "none", 4)) { + if (g_strcmp0(optarg, "none")) { monitor_parse(optarg, "readline", false); } break; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685062; cv=none; d=zohomail.com; s=zohoarc; b=X8acHyrfkBG+NFWR9Cz40PkyfoVxWHg9PoGhKgcxqYx2d5P5PrGdlFhZ4+INyzyZ/+FH+3xtK6hclm65Z7lOUu4YafpFybRZUAYrMIM/Rh6Fsqd0Vkyt+CRUT8XkiizdRNjJ+7NWjskbkUg2h0FI8KzmSD01mCflNrpxjLVVRFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685062; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RGi09MNmySOgH4WHAvnetZBypHn4P+kRuWbKiz64GwI=; b=AYYH/05zjHe65Et072Cb4a6nGx5zkk5BhUzE/gBbJB9o9CCXt11GMLcUpSvHiC4VKPefETT66QQg/mNdeTXs9BZpOIMbxEw+ydtBg2uQzGvb9FdVPelcQupeLwfuDSu30ATdn1iEdipi5jIOgsB9tN7jIKWeKXtbV8N5rUwXlWc= 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 1787685062366415.7989261547199; Tue, 25 Aug 2026 12:11:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXS-0004FG-9I; Tue, 25 Aug 2026 15:10: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 1wywXO-0004Dg-It for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:23 -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 1wywXM-0003sa-TP for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:22 -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-605-EQPngGvyPeaC6gNGuB7PGg-1; Tue, 25 Aug 2026 15:10:17 -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 E67851886217; Tue, 25 Aug 2026 19:10:15 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CC7C91944B2A; Tue, 25 Aug 2026 19:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RGi09MNmySOgH4WHAvnetZBypHn4P+kRuWbKiz64GwI=; b=TfGESanMzc5EBOKZCvkkRmZnGpJwHDYDwB4apuBX0UbQ0oodWer/+JY4r0UWGvTR4emOOY c9GADl65DeFEhR1nqSye9+bj79qep+3O4WfERXv+vKce4VvLcAfNkXnDPT+LHoyGzZ3KnL uDvaKgchXmiCpuUYY+XktyNkGR9Bv6E= X-MC-Unique: EQPngGvyPeaC6gNGuB7PGg-1 X-Mimecast-MFC-AGG-ID: EQPngGvyPeaC6gNGuB7PGg_1787685016 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:10 +0400 Subject: [PATCH v4 03/49] hmp: remove 'vcpu' argument from trace-event help MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-3-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1813; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=tuapEdWlbge9nQ8zXoXUzq/8HC5xbWVmFJeX4uAItoY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiGt915pHmVxpilS3o7/rLNsznYOpSki0pxI ZMMh8uNBHKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5fr5D/9o3kjrnhHuV4OPMpTUWQwcZ/rLKp7lDlba57VRD/Wez2J5AZISEtOw+khh3fbXCWBQrJl sKgGOVpTsuWw/Xw6i0Rusd69YR6YwX7y3bLMITwEyIssUO6L9xh8G8qrBb2JeWWoeSZJEA6PjvH l41arBbEF/xgtK8tIkf6dPAGhgMM9GxA/wPfnLK0bH2L4DsG/xtn4gkfOEedkh2zblEGMbYR0Nx i9IhltcfjeN66ujzWAYsO7QQEePt+Mb25jKXCocHJeRUoE7v3yD5Xo3cjVGa6K+AyI0KGTakJaH hNWbKS+v2CPYm/tnACUKSBaB7B4Wn4DMAoN7VdG6Mm9/R82Jn1lNw6UdNtMYFN1qOI+0Exi7Cre rTKFpJvnnI2Wru8ikI5fDCePWJ3bIBMcMxZW63pJg6vcepAyP2F0eR487+ORFKq/u/TbYmGqLGb hNesalq7MUS3Gea+5catY4X4n2FM/S+pWYj75rFNYpMZ4HIxha++0BsQ2RuRz4rSrWHrpo7Ics4 Iqu0+2COf+ALKe2cGFdeVXiivmvXaiBuBojk6XaIu+J/ry132D9nplcWEe9OjWxh02coH+xANlr zQnMyE/XQsBKgvWr0jJNvD3UEARTE30PcYfzD0vBO7JxRZJEZMIe7JSMGESQIeSzxQUvRRJi7qw +DwTSTXJkDqxWiQ== 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: 1787685064212158500 Fixes: 89aafcf2a793 ("trace: remove code that depends on setting vcpu") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hmp-commands-info.hx | 6 +++--- hmp-commands.hx | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 82134eb6c21d..2695ff04ffce 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -587,10 +587,10 @@ ERST =20 { .name =3D "trace-events", - .args_type =3D "name:s?,vcpu:i?", - .params =3D "[name] [vcpu]", + .args_type =3D "name:s?", + .params =3D "[name]", .help =3D "show available trace-events & their state " - "(name: event name pattern; vcpu: vCPU to query, def= ault is any)", + "(name: event name pattern)", .cmd =3D hmp_info_trace_events, .command_completion =3D info_trace_events_completion, }, diff --git a/hmp-commands.hx b/hmp-commands.hx index 43ff220b5feb..ea4a1db78f18 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -299,10 +299,9 @@ ERST =20 { .name =3D "trace-event", - .args_type =3D "name:s,option:b,vcpu:i?", - .params =3D "name on|off [vcpu]", - .help =3D "changes status of a specific trace event " - "(vcpu: vCPU to set, default is all)", + .args_type =3D "name:s,option:b", + .params =3D "name on|off", + .help =3D "changes status of a specific trace event", .cmd =3D hmp_trace_event, .command_completion =3D trace_event_completion, }, --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685109; cv=none; d=zohomail.com; s=zohoarc; b=Y95kfrt+jB519zFQJq6wnQbp5qUNIpdOHpwDL3//yJDEPeqkKewB2u00XXDpb4iOPjY4e3c2ZYs3jzqpqn3G2p+DYNLbTq8GN2FViAwCZVFtbSAnys+0NxPQmuV7FE29lR3uoIrupx6sB28mjWGYcjl94r2yB+4VIlT2PKIPqtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685109; 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=Rr+vVFND/Cvbzh7dc8WpGZvEOcDRXY0Xin80A/b/SA0=; b=OqOKrx9XvhvREnCGCk67Mj0itSpT+2/A3306TdpTVvOS2ikarXfi1KhBzYnYgnRim8NaFEyc+X5reCcTqbAMwVMXPeygwrCCY8YmQQrbLA8cUlEgb6cN1eT80Rb6Kq332ys4KNydWYTQlPh90TuIDwtW0aOPONzMIKpY5YHyfN4= 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 1787685109130996.3983293035484; Tue, 25 Aug 2026 12:11:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXY-0004Na-6x; Tue, 25 Aug 2026 15:10: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 1wywXT-0004Fz-N6 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:27 -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 1wywXS-0003tC-BD for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:27 -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-151-OAv55jJUNHK08XqqWqWl_w-1; Tue, 25 Aug 2026 15:10:21 -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 CF4021977401; Tue, 25 Aug 2026 19:10:19 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D17AF30002F7; Tue, 25 Aug 2026 19:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685025; 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=Rr+vVFND/Cvbzh7dc8WpGZvEOcDRXY0Xin80A/b/SA0=; b=Cf/4JBhtnSXB8NTHU7oH6KHi6P+iIqUg+57WMsHahqJVsUsfwACuTlnWTk0tdxTH+g5IQg UKOQj/oZ2Nla5RBZmIHGuB7BQp9fBQYv1dh5xTQ/DOUurSHdaHHiOKGDKbK89tRG0AYvg/ Sh/KjQ1lcKszrkE8Vqkm5YrmQbblnmA= X-MC-Unique: OAv55jJUNHK08XqqWqWl_w-1 X-Mimecast-MFC-AGG-ID: OAv55jJUNHK08XqqWqWl_w_1787685020 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:11 +0400 Subject: [PATCH v4 04/49] hmp: fix snapshot_blkdev argument type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-4-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2336; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=V/ypuJVU2ZRrXgnpXuFivZH47izZr2kXRQXZ5sUhcL8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiG0yW9hwCDZ++e03v+sPWT+fQgv+GfGCOA2 whztovgDEKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5f+gD/90dXzK8sg9/s7zCTx5iDnyn3s9bgYZ1bobObPyzif3WAPnBSysMVIQ8323OIFxnPyXac9 x4lN1XlgoL2gREvjd+DQh3Je/IM/uY1lbezRnI5Ni8i/CpltuWVJM5SZMyDE7B8+RPRghihhDQx 20KHlx2gmaOPj2MJ0KJfd0mNE3hpEEwJKTfmDLxyt1E9xRPBtOTaHSYX87jOLAn9FDUoJx9VrpS 8wUFYsFknydFqF8shKjNTg4qsPxdcBIhI57LRKAOcju/EQnjMvPWs1PxR5rDH4vaeMdznnHgOYj XdJSR3bh8ZL0Q3AKTiPeyauFvWb9sOAUHJJv6KtMgaGGKrFmFtl7qVkq43GVEkIzl6KDsvnrk2x KPwdto1mVeWF7NStWX1BMpoGsOgrLpQhFyhEzcLcKyeQ7tU7O1/Nmfq5Us1tca/pSRC3fbdprqo BDE46zc6hFnGKWOHmgDWpuUUb2LWx6ZC4DTE/10jKGcx+94MbPH9Ev1SNqWQqNR4DR9PgxoufmZ pBF7WXukOiTwr6o6/njIZeQUy7mK1o4Sj0R7esO5/y62D+dpWu+MH8nbBc/GQB5c6WSxOihYOz0 bxvBA7WjoFbM5lHi35PrBRpHeKw5GUxqfE1SYrVsyxJWjAzVcbuLcdD49YIgcdGA7T93neR1qbv 0ziBVv+5Oew/5lg== 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: 1787685110392158500 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 --- 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 21:37:38 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=1787685124; cv=none; d=zohomail.com; s=zohoarc; b=iJBSBsDMrRzQliTFI0BPI0crapxY4PNsRW3hFEla3eyMmLxTNANW3yUd1peQRLSaopeT2EQjnK/z8+gGlO8VuzmLCUaQ8aGqu4XgA/3kvTwpaOqERjFxSy93TA17cOvtVyAk63k3JB5D2V3xy1gbhx4sEBdyL1Zkk++5hoaYmvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685124; 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=8TUtIvfv2gg0aRDhrAhGSbFo8JLrTo92AiN7/f51Xts=; b=Bn1B6GRLDK3tpNLBmv9hUCExvKsQsmb5+f7sAOxsmIsoxmJBeZAvA+3G//DVjXRP9A2xccUk/0h8BwHkapSmoMREL7US+0aS4tiHMLfCQKO0Uslc9RaFl5k5bLEUqFRzU7VhvimTFfzWZ/rvRslsuKAQdym9Co8tPJeX7ytjn1E= 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 1787685124456411.6683476919627; Tue, 25 Aug 2026 12:12:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXd-0004OW-Pl; Tue, 25 Aug 2026 15:10:38 -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 1wywXW-0004N1-V9 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXV-0003tV-30 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:30 -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-403-OvU-n3L3NAu4ASG2Wf-Wcw-1; Tue, 25 Aug 2026 15:10:24 -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 797321921ED5; Tue, 25 Aug 2026 19:10:23 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 77E2718005B4; Tue, 25 Aug 2026 19:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685028; 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=8TUtIvfv2gg0aRDhrAhGSbFo8JLrTo92AiN7/f51Xts=; b=WwLD/YYPuGJTxCjvqmzvwCsair/FIkEkd+ZGKA+TBfDi/L3ytaJktxHLUmJwDLEunGfhT7 zGGk1S6wM+8Oyp2khxvVXThSh/B3My9fJ7oFJ/P4MgUitiVlqdUR0Zf2RdTRkmVAS6ugvP ezn56dUo/q1lFTe2HiE95X1rMWy+GR8= X-MC-Unique: OvU-n3L3NAu4ASG2Wf-Wcw-1 X-Mimecast-MFC-AGG-ID: OvU-n3L3NAu4ASG2Wf-Wcw_1787685023 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:12 +0400 Subject: [PATCH v4 05/49] target/i386: decouple cpu_x86_inject_mce() from Monitor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-5-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Zhao Liu , Marcelo Tosatti , kvm@vger.kernel.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7649; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=GETmOiGo2L/g6lLcuBRxR9mY/ci64uyDlTFcOWNAjy0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiGpZoIq2GxbaAKdZbxvMWapR4YLDEC5N0ZX xyDgWtpVamJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5YHMD/9AnjS+wCbYmvbrrKYh04k+LlykQJYI7k2MtvZg8vFsUD7THMizAQWdOVKgJr9BwC0iTR0 +l5Bt8DK0HwWyfHiQ8+YYfCv0da5Hi3rKzPWNOgnDStNERawkDh3GxNuyBq+MhiQPIni8syT4VE VSqqGIcx2q/eN/NSBqsnOlnXq/jz513Le7D2Pz2GC5hwDUFHQ9NshOBv4i2BMAFf2DOKtJsybAc SmbW+eqf96ASq1AC9xgwpK2ME0yOsoty0HtfQxMqXlhpzVlNsJhWVLnrNIUNVkkehOXPD3qtEYM BDmLRu8PE01ano6NeNYIpVi5Wa/emUbtKqcjLleP9Chw5j7HpoCPd5cbg+veyMs7fbCbtJ9djjW oJYsPZ3Paj2ww9xCJteQMp/F1HJ91UIgPifRkqTIqVbG6pWZDJhHJpmdvSOHAlqU9ymF59CGTWf yc/TkrJVUey6IESAeVoBYv+eZysQwkEfo59i3QtMXDdZ5Q4Zov6xGvnVi3oW1ReKWrcGQw737gD ld076uFEv01fzpzEzPBS/fS8JAd76WWf9/la8tdcI8vLbzO/OdOWRLW+wntqp9Ti+S/XteSwGiE ipzJTUFGBoRUXMvmDXKlsOPl5FUJnrk3Z8es+8m0uxN4R8jtvmtZ5e7H8GyX8BsMzbba/7pMmcR sth3MiqXkjgeTbw== 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: 1787685126421158500 Replace monitor_printf() error reporting with the standard **errp pattern. Drop the Monitor *mon parameter and return bool to indicate success, improving the function usage from non-HMP contexts. Update the KVM MCE injection path and hmp_mce() accordingly. Notes: - we may want to print the error in KVM path too Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/cpu.h | 4 ++-- target/i386/helper.c | 49 ++++++++++++++++++++++++++++-------------------= -- target/i386/kvm/kvm.c | 4 ++-- target/i386/monitor.c | 6 ++++-- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 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 21:37:38 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=1787685101; cv=none; d=zohomail.com; s=zohoarc; b=bx8hUHVBCtYEj3IoeYUepD2JbOhmEhJNdy/8Sjc4eNNwpQg5/Ahr2rLymlvFbx4Oaosu3KfL3nYQlTctDqqxJ2sHTi9XHVUXN0HGSYq8D0ilWg+2bY1+xaLwy8NEAmfvKk+kKKUhFqWlzV/d9PogHzjx5DKILJKLO1IUUVI9ZhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685101; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ryj4j8cwb+L87RB5THQx359dU0bCD3EIL92GqKreHVI=; b=FPKpn2E+8XCjDpt3rpaYOdiNS65TSt35xP1sAz7UL7teo9/ftK27aLftyUibOIJNq7oF028jx3Qgv0hPVjKdRdgXNqeePuvW3QFaomikooP6LlspuS4UM4Xaq/cQ2UGHWs1+2nDDdVYA04urPGO6tq4KxW/TaXiKl/SnQS7qyQM= 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 1787685101362594.6622276950491; Tue, 25 Aug 2026 12:11:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXg-0004Oo-S0; Tue, 25 Aug 2026 15:10:41 -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 1wywXa-0004OB-6Q for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:35 -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 1wywXY-0003tl-L3 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:33 -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-169-4vMwDe4AOUSToOPPQoXIqg-1; Tue, 25 Aug 2026 15:10:28 -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 A455318C0FC9; Tue, 25 Aug 2026 19:10:27 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 482EE30002F7; Tue, 25 Aug 2026 19:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ryj4j8cwb+L87RB5THQx359dU0bCD3EIL92GqKreHVI=; b=aJ+xVkq1Z7umEqPRcT1tCcNRNFqsBxZhcPL9u3yGIauKIYczjGKDrMU52CHICpON2Dh2vn W3YpWzDrR3kjCK81JVJP5Jpub2cbZH/gYiTRVzM//zkjMpIxqQlnKi+25/EDX33lQWppyF y2L4be/WiavnJIe9QtIGnggMHbYZFUw= X-MC-Unique: 4vMwDe4AOUSToOPPQoXIqg-1 X-Mimecast-MFC-AGG-ID: 4vMwDe4AOUSToOPPQoXIqg_1787685027 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:13 +0400 Subject: [PATCH v4 06/49] target/i386: return an error for invalid CPU in hmp_mce() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-6-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1062; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TKMHsISeJFnOg9PU9gqpis8lZrnYbUihXFpgcYqdi0w=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiGqM9WwVS4Y2nSmBNTZSwylyveYfkGoZpO1 v1mImSGiX+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5Up2EACLlkc6zCy2Yfu8ik+h5akwz85iFWyMrtJ7S6CtRXot65WURkLLWv3R65YiIOgKkhflnfp oIYRWJATiCbW28lkgiX9dH/my9CnriNhYDGA3tDGf5j8uffsqZkyXeshq/K5pyJ/bQDnszOlqj2 RRTYImJdkGAKiPUbkluGAv+C23uq4rTl1cfX1HrkeC5ayjLKnYfgbCmgyh4snbPWQNoVYFTI0YN 8JWLWylga1IfonV/cvqDjVk7umwXy6NJyGowJjCrd1eMrOEqD5GFJEv3PdJwpOs5ISjioZKnO7y bXlgIBqTRkaBZjEHHoQzvHlbVvWUyCfVlTIRxfvnRbW8pKXeruCr2NiAmWQgEybZg4kX79KvKQu CRnQe3pngA9nNkubAWCyS9/ko+vdFe+RD7NFWE16zhrRxdV+ub2ymAu275Xn9ycjg7PLGe7LIn8 CsoD5a2YKUdE2Wt74Nz1YWf4g7tKAftDFuEoaNGX1zLQh/ZhT80V3hrtJ+3OccEFHAuyRuS+LmG eJAmCeb7W9KHglfgBvFUPFCH9z3Babdz6swTSdr2M5nLDo1elOOpM5j7HorB4LZVx8MN2h5sa/f rQkdu11HIytO7I2MneKFcVlyScUik7SLkR10ViVn/tmWj4cYBTOPtScUp79PAf2SwxCs2XxmH3P Kbv17N/3IEWJ01A== 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: 1787685102494158500 Rather than silently doing nothing. Suggested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 785a13dd7107..9ed772e6d7f2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -586,10 +586,12 @@ void hmp_mce(Monitor *mon, const QDict *qdict) flags |=3D MCE_INJECT_BROADCAST; } cs =3D qemu_get_cpu(cpu_index); - if (cs !=3D NULL) { + if (cs) { cpu =3D X86_CPU(cs); cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc, flags, &err); - hmp_handle_error(mon, err); + } else { + error_setg(&err, "Invalid CPU %d", cpu_index); } + hmp_handle_error(mon, err); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685130; cv=none; d=zohomail.com; s=zohoarc; b=YDhIAgp5AXuo8OTrWZtYIWYb5RrlaOJIJZlS9n8b2HYspC+XZOWubIPIV0HHs0Zjz0swQWoTV1NeKunCSFUIdmWI5s7a51SCzzftTdUDxoKRQkQyv+sccMf9PBnTKw3BTNHD0a7H0HemvL/Zuw5aiP39RPA9BxsYsJfkP7LANwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685130; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l6kUigrlIhW5lDQflJBIlNr7RimcAGbj2MbyqJLdEI4=; b=dFPCqirNfWyZCX20OxHOIRuKoo3C4gVxUTc8SxXUm01UXNieJIPoxhLWDJ4bUr9QvBwr82Fwk2uzxasz32AFV/hJxcgP9LgoU2iapE5o4t8kVZ5wtK8KvZgQnHlhcmZ5IM2stzfiDkGceUlMjsQySTfbCzoBaW9BBwQKWmnZUjo= 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 1787685130534363.2833281812781; Tue, 25 Aug 2026 12:12:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXi-0004Pa-SA; Tue, 25 Aug 2026 15:10: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 1wywXf-0004Ok-9E for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXd-0003uJ-Mq for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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-421-MaHNTi_8PueaNe6LAMHkTw-1; Tue, 25 Aug 2026 15:10:32 -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 26993185BE9D; Tue, 25 Aug 2026 19:10:31 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 261451800765; Tue, 25 Aug 2026 19:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l6kUigrlIhW5lDQflJBIlNr7RimcAGbj2MbyqJLdEI4=; b=a5SnSAQb4pO8M8zp3XrEJ1g+VhiRSzMMwcLtkdUqo64cOhycOxv2w+MzQ/yBHqYEhfPt6t Nr28JMxpg+6weGtyNfj/f5kH8kVqjn6AIiWzN5djggRE664DuwVSxpI/Ih7HR+6F0MsnCq OcRI4S+lX1YNzX+Nx7uNBfo5XBi9hqM= X-MC-Unique: MaHNTi_8PueaNe6LAMHkTw-1 X-Mimecast-MFC-AGG-ID: MaHNTi_8PueaNe6LAMHkTw_1787685031 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:14 +0400 Subject: [PATCH v4 07/49] system: move gpa2hva() to system memory unit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-7-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Peter Xu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=4376; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UkN1HvNZWl3MPBsr0N0lhRKtt1UrsfqkUkLxVSggBA4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiGDhSgs9WvVU9QwMxjtJ2OPOetzjB4Mkpd4 RZ7Ch57z2SJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohgAKCRDa6OEJdZac 5YLkD/9lQ6ISIAGHD9o3tZ307nVL7lN7gOZWGZNQ2vgtYhm7HIsDKmDOFIl4mM0etjAOPCbSfji zMl5EsiE+eBsPQh7XzmnQHrYZejtOY4OEsZ3/9amTGiwOm2WSec8Wm/vpii+U4vJrH4WNspwSdb bU+FqM91cwAkS1PPE9+E22rPinpChgmyq2g0kopNPf2QBAkE3lFsWolaGOiVhlI84NgpsCdPDjf kIbScp2MHkLBWPSpvwGT3gmtrhDkGvD5cWgD1FZVvr3F7WCYWxJdZpicoZu7lcHyp2Adc7NY0O9 KyX02Nq890VaKfIdZuw519mhcs7C7lA2fsqi0uGs4AtM+eUdYfna7Ahtf9aOo3R2dINIwY03T5S XYHl8FNOir7B3ctaw3axL0UeFmPAOlBmjvEyLE5GvtLCO7k1zUrQZXMhh4ZeWdGm7+HIIlEaruw 2YHXmsIw0/Q+iivDkU78YtZwYFdwL8x0u6SObi0yVbIiuBQ+xesKZMEyOKl5hJP1JKLeVSAxiLu 1zEt6YXSMLv74CZwKtl/R1KUbXxSJYHf1r9ItkVTm+AGWTO/NMM2iZCE82xTcJzWWcwsFE2q/E4 X20+UimoYmCTDhd5HIeOZ0IAIja4KOSyC/4rQEukX+k2vc5DEC62zhddTIfvTB/pmAA5fteKnAe e59sMNTS0wo17ww== 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: 1787685132498158500 The function is now used by SEV code path. Move it to physmem.c rather than hmp-cmds.c. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/monitor/monitor.h | 2 -- include/system/memory.h | 2 ++ monitor/hmp-cmds.c | 31 ------------------------------- system/physmem.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 54134f2aa4fc..9f048ba103b5 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -53,8 +53,6 @@ int monitor_get_cpu_index(Monitor *mon); int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); =20 -void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p); - void monitor_read_command(MonitorHMP *hmp, int show_prompt); int monitor_read_password(MonitorHMP *hmp, ReadLineFunc *readline_func, void *opaque); diff --git a/include/system/memory.h b/include/system/memory.h index 1dc761058f52..a7e03fc3e7c3 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -2860,4 +2860,6 @@ bool ram_block_discard_is_required(void); void ram_block_add_cpr_blocker(RAMBlock *rb, Error **errp); void ram_block_del_cpr_blocker(RAMBlock *rb); =20 +void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p); + #endif diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 4e8d996dbb5b..6b1114fdaf13 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -712,37 +712,6 @@ void hmp_physical_memory_dump(Monitor *mon, const QDic= t *qdict) memory_dump(mon, count, format, size, addr, true); } =20 -void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p) -{ - Int128 gpa_region_size; - MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), - addr, size); - - if (!mrs.mr) { - error_setg(errp, - "No memory is mapped at address 0x%" HWADDR_PRIx, addr); - return NULL; - } - - if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) { - error_setg(errp, - "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr= ); - memory_region_unref(mrs.mr); - return NULL; - } - - gpa_region_size =3D int128_make64(size); - if (int128_lt(mrs.size, gpa_region_size)) { - error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx - " exceeded.", addr); - memory_region_unref(mrs.mr); - return NULL; - } - - *p_mr =3D mrs.mr; - return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); -} - void hmp_gpa2hva(Monitor *mon, const QDict *qdict) { hwaddr addr =3D qdict_get_int(qdict, "addr"); diff --git a/system/physmem.c b/system/physmem.c index 362a00f76c03..a4a6a4710c64 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -4534,3 +4534,34 @@ void ram_block_del_cpr_blocker(RAMBlock *rb) { migrate_del_blocker(&rb->cpr_blocker); } + +void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p) +{ + Int128 gpa_region_size; + MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), + addr, size); + + if (!mrs.mr) { + error_setg(errp, + "No memory is mapped at address 0x%" HWADDR_PRIx, addr); + return NULL; + } + + if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) { + error_setg(errp, + "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr= ); + memory_region_unref(mrs.mr); + return NULL; + } + + gpa_region_size =3D int128_make64(size); + if (int128_lt(mrs.size, gpa_region_size)) { + error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx + " exceeded.", addr); + memory_region_unref(mrs.mr); + return NULL; + } + + *p_mr =3D mrs.mr; + return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); +} --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685281; cv=none; d=zohomail.com; s=zohoarc; b=lvLpnI78vNi/aGe6mRU2FlrkjMXi1UY6/ecv2Ap2UfSeijFSRLBDuQ+k67kAtxzzodcw3yaT8lZw6rB0Vdrt4uBlQzqXTM7dH3SPsdW28eArT/gd9o0DZXemR/lt+F6HyVexP9axJWxd6HlKNJXFpaw/m1um8Eqo7Y2QbJc6iaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685281; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZJQnMGT3qPvOFeMDZSH+QYBFaicXbP9+52KZazx/GNM=; b=F7EOuqj+WczKWT3m4Jgrq/TY4011zsgT1gG55JU4TcFbgBjuy0DAyw2T4trDI7dr18JPqPbqd7bAdUavgzPaHSbDdurCGafAY+AePjDw9qdvlOxs5snbEiGpcxEkFzYnxoZPVbBvQpSjpI/4PtqV/VhnB4sQRx4LUW6l22BajAk= 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 1787685281370629.6386163062217; Tue, 25 Aug 2026 12:14:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXj-0004Ps-No; Tue, 25 Aug 2026 15:10: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 1wywXh-0004PB-Mn for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXf-0003ur-2O for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:40 -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-177-M7Tt8VRkMp6u_Zz3kGL2gw-1; Tue, 25 Aug 2026 15:10:36 -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 0CEA4180ABF2; Tue, 25 Aug 2026 19:10:35 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3D9111955F0C; Tue, 25 Aug 2026 19:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZJQnMGT3qPvOFeMDZSH+QYBFaicXbP9+52KZazx/GNM=; b=BqqgedndZhsGSVSl5KCt7r+Lfzy4Es1B4S5yOOy60Pw43qGyeRVlsIeUTqJQl+DcIh2twj Neu9J8+yvukB0IHuta0SzAOihuVCzg2Vrr6ijKAYpmScr+o9ZCijhBFstoyKpXsU06hfB7 oRJ0d5F/OuaZkj2pmOX28A9TRz7BSMw= X-MC-Unique: M7Tt8VRkMp6u_Zz3kGL2gw-1 X-Mimecast-MFC-AGG-ID: M7Tt8VRkMp6u_Zz3kGL2gw_1787685035 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:15 +0400 Subject: [PATCH v4 08/49] monitor: move HMP-only fields from Monitor to MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-8-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=5135; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=wkR8gnQD/9TIbnh3sLfGrwv66uEiNuUKUoUzahWjols=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHW9bgozZOKp658cep5S+/NfAISYTuSvzkh NkkKi260a6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5RnfEACgOPNYrywtU0V/PgMB1PvpluQageznAjjGEo3qpfrdyOAWqS7WYkaDi+DP5NCtqzW/yuF AjrxjeTzUNydEnBqzBwksoaRmXErinBrcj+uUjqWtdyVXrYxvRGAB+0AyDvA8cyZ1ZWbDb0eHg3 4vCaBmZHZ/uY4P+OwnP/kbktDm8IefMiQ8BacS+PE+uVPgiVH0xHESZEWGLlW6GLQPk8POGWjS5 8+BS3Tm4xCnzAMcajLyMfOC0OsGuT5yVXyqQmEL/WJoft5W1qeBaWsoaUEPyKhP73+1gB5L2mlm QWS/NrPe5laRVTMNM4Pn/+m/CQSsSpgRxrFOf40dW02hUxzEPchZRwx/Tn2d4SFrKIL0aw7WJGP AiEpw+dzOg38EWTza31t+yyPQZKajFivQVwqRk13c7XqtI+THKSNnYwT1EUH4SPMlEoMYLsBea1 5IPDptbuTJRfLJqfcdU4Inzw+cMKp+iHFyL2AOjVvM3m5oHm0OtatBTsvt3czKmrjDcR0HBC2jz 67Zi4MhWhsLxHp8Me8784vqrfOUYYcJyr+zqNMGuars0j61TXqCX1iquTi8WAf/Llv7Izp3wlNO NTN+m7+znIr9BhuwR+cDEOe1OTLQH+z6b5r8EGM6yZXcMW4UZQkIiQMGJwt2tBsB384j6T8lWDZ z8IINld/7m99KdA== 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: 1787685283349158500 mon_cpu_path and reset_seen are only used by HMP monitors; move them from the base Monitor struct into MonitorHMP to properly encapsulate HMP-specific state. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- monitor/hmp-cmds.c | 16 +++++++++------- monitor/hmp.c | 9 +++++---- monitor/monitor-internal.h | 4 ++-- monitor/monitor.c | 1 - 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 6b1114fdaf13..6718fec97047 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -499,31 +499,33 @@ void hmp_dumpdtb(Monitor *mon, const QDict *qdict) /* Set the current CPU defined by the user. Callers must hold BQL. */ int monitor_set_cpu(Monitor *mon, int cpu_index) { + MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu; =20 cpu =3D qemu_get_cpu(cpu_index); if (cpu =3D=3D NULL) { return -1; } - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); + g_free(hmp_mon->mon_cpu_path); + hmp_mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); return 0; } =20 /* Callers must hold BQL. */ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize) { + MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu =3D NULL; =20 - if (mon->mon_cpu_path) { - cpu =3D (CPUState *) object_resolve_path_type(mon->mon_cpu_path, + if (hmp_mon->mon_cpu_path) { + cpu =3D (CPUState *) object_resolve_path_type(hmp_mon->mon_cpu_pat= h, TYPE_CPU, NULL); if (!cpu) { - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D NULL; + g_free(hmp_mon->mon_cpu_path); + hmp_mon->mon_cpu_path =3D NULL; } } - if (!mon->mon_cpu_path) { + if (!hmp_mon->mon_cpu_path) { if (!first_cpu) { return NULL; } diff --git a/monitor/hmp.c b/monitor/hmp.c index 22b1972d346a..8134dfaad4bb 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -50,6 +50,7 @@ OBJECT_DEFINE_TYPE(MonitorHMP, monitor_hmp, MONITOR_HMP, = MONITOR); static void monitor_hmp_finalize(Object *obj) { MonitorHMP *hmp =3D MONITOR_HMP(obj); + g_free(hmp->mon_cpu_path); if (hmp->rs) { readline_free(hmp->rs); } @@ -112,8 +113,8 @@ int monitor_hmp_vprintf(Monitor *mon, const char *fmt, = va_list ap) static void monitor_hmp_accept_input(Monitor *mon) { qemu_mutex_lock(&mon->mon_lock); - if (mon->reset_seen) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); + MonitorHMP *hmp =3D MONITOR_HMP(mon); + if (hmp->reset_seen) { assert(hmp->rs); readline_restart(hmp->rs); qemu_chr_fe_accept_input(&mon->chr); @@ -1556,7 +1557,7 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) case CHR_EVENT_MUX_OUT: qemu_mutex_lock(&mon->mon_lock); if (!mon->mux_out) { - if (mon->reset_seen && !mon->suspend_cnt) { + if (hmp->reset_seen && !mon->suspend_cnt) { monitor_puts_locked(mon, "\n"); } else { monitor_flush_locked(mon); @@ -1573,7 +1574,7 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); qemu_mutex_lock(&mon->mon_lock); - mon->reset_seen =3D 1; + hmp->reset_seen =3D 1; if (!mon->mux_out && hmp->use_readline) { /* Suspend-resume forces the prompt to be printed. */ monitor_suspend(mon); diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index e0a124a317a5..fdeeeb853636 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -137,7 +137,6 @@ struct Monitor { CharFrontend chr; int suspend_cnt; /* Needs to be accessed atomically */ QEMUBH *accept_input_bh; /* persistent BH for monitor_accept_input = */ - char *mon_cpu_path; QTAILQ_ENTRY(Monitor) entry; =20 /* @@ -153,7 +152,6 @@ struct Monitor { GString *outbuf; guint out_watch; int mux_out; - int reset_seen; }; =20 struct MonitorHMPClass { @@ -170,6 +168,8 @@ struct MonitorHMP { * These members can be safely accessed without locks. */ ReadLineState *rs; + char *mon_cpu_path; + int reset_seen; }; =20 struct MonitorQMPClass { diff --git a/monitor/monitor.c b/monitor/monitor.c index 6af09f2f6eac..6d6ffbb0f78a 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -89,7 +89,6 @@ static void monitor_finalize(Object *obj) qemu_bh_delete(mon->accept_input_bh); } g_free(mon->chardev_id); - g_free(mon->mon_cpu_path); qemu_chr_fe_deinit(&mon->chr, false); g_string_free(mon->outbuf, true); qemu_mutex_destroy(&mon->mon_lock); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685341; cv=none; d=zohomail.com; s=zohoarc; b=CIAQbI6ifM2a3uHEcwiA0AhW5OkNv/3kq24/CNFJqbUfgk5xwBx2wEnejNHReTPnG4AphcliCS92fx0Co+Io+6bb7+Nct8BMVEeqij2A5lgKJOU5tOvwWqRwvPGL8BngJ3XSWhyK/DwUHXLsQVo9gzyFSQcSR/QI7saKl4bpxe8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685341; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SQ3k0bOKS5GQKJg6KQ1y4RmKrPluHHk47PS3dTfcuK0=; b=Fvz5UdCAhOFScCmBAE4rOI9OFwV5AcXx1mWTeygJ+MfrG8W2fNcPjdfX/ukJYDkI3F29dvGGD9aRwJnj/wPQZ2GCH4So9cijnFJLcDeTK4k5GEDybXqAyXJqjRUGQ5/ErGuz1gqOQS8/EIuoMQUwdPYo8P2w4UuFZYdKyA5AoMs= 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 178768534098776.55132122774444; Tue, 25 Aug 2026 12:15:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXn-0004QN-61; Tue, 25 Aug 2026 15:10: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 1wywXl-0004QC-2f for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXj-0003vt-IG for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:44 -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-680-5g3dn_McPTqZkE-Z8jFjGA-1; Tue, 25 Aug 2026 15:10:39 -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 94F5319792E1; Tue, 25 Aug 2026 19:10:38 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 65F841955F0C; Tue, 25 Aug 2026 19:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SQ3k0bOKS5GQKJg6KQ1y4RmKrPluHHk47PS3dTfcuK0=; b=fjqF7DwGubnOQ1gTFpAeYIvZJx/nNcVpuV2QIizMcoK5CeghnedfUkaBQ+eFOovKBLc5uC oTZbJx+88oHXSg4XGSDseMRJwbHqx+nKIZvuKKPKvO0Fq1Tt/umfbF9nBG4uMq65QyxC/S BmGnVEhefXzpHg6yK+QBAeh8+4ABX00= X-MC-Unique: 5g3dn_McPTqZkE-Z8jFjGA-1 X-Mimecast-MFC-AGG-ID: 5g3dn_McPTqZkE-Z8jFjGA_1787685038 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:16 +0400 Subject: [PATCH v4 09/49] tests/functional: use query-version QMP command instead of HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-9-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1415; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=E12bnf1BnZYcd0xThQbrRXQW65sQtsWdYsKbNPUWaYA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHqPjZrfRrtmv5sVdsO1hzu4fWlOpC3f7pz DTHZ1UIHJSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5VzZD/40cymQYxQIgKgo88Z0RjyOcnqu5psZcYDlJPGhgVgGuNfgl6zYYTWgy1Ju58/igRmkb9z ijIVNy7RsCINtzdzlWkov6BiyUQFQ9U79yICrurjPj0J7heBNL/FpGck6atEysyuMUosCZEVO3D k5+8QYcpmmcIKJTb8OEm8yvj4sFQBScu2rSmeM4hAq1mL4l7j9DMLW87Oovbz2JbZM+E5A0fUXJ 3s/8Vpdw+rqbigAnTNkcH9oFZCKigfyUGJLKOXXLTPHUKtuVaudjuscbidyXVqlOHu3mOXI1YfB lvyNtzvXPPIX/+1OLgF6P5KOJ7ezfXWU6OKophM3uZogJSpkwKeAFRIMKHGPyR3MBafwPjWjlR3 B92lgEHTTdmsMls7EpSAjEmVgWQmsCeaDNsl1PGVQCOLNp+cZHNvlseSTtc0dz8RUUxeaxEn58t hMlZBSM4ZpEXl4ULSF4uSVK8uI02lrxTdjvBrPdRPk/epcy7ZK2akgY2GHj6ikpgKdqDBxdg8xt 1XXRDROHWJ7t+/umnQaXPvMrtns3tsy8fLx9jxAtfOiSRO2Vy2JiQwHd+XMEyW43U8qp/B54zOq CAxZtPj2nMug8Xc0ZfEtqCr/lkYGmrPK/wBCC8vAMHCfBKM3KHvOz2lqitFjxMLmNOwf86N6Uf9 0OwmC1OSl6kuOdg== 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: 1787685341653158500 Replace the human-monitor-command based version test with the native QMP query-version command, which returns structured version data. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/functional/generic/test_version.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/functional/generic/test_version.py b/tests/functional/ge= neric/test_version.py index 3ab3b67f7e39..7764424826e0 100755 --- a/tests/functional/generic/test_version.py +++ b/tests/functional/generic/test_version.py @@ -16,13 +16,15 @@ =20 class Version(QemuSystemTest): =20 - def test_qmp_human_info_version(self): + def test_qmp_query_version(self): self.set_machine('none') self.vm.add_args('-nodefaults') self.vm.launch() - res =3D self.vm.cmd('human-monitor-command', - command_line=3D'info version') - self.assertRegex(res, r'^(\d+\.\d+\.\d)') + res =3D self.vm.cmd('query-version') + version =3D res['qemu'] + self.assertIsInstance(version['major'], int) + self.assertIsInstance(version['minor'], int) + self.assertIsInstance(version['micro'], int) =20 if __name__ =3D=3D '__main__': QemuSystemTest.main() --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685283; cv=none; d=zohomail.com; s=zohoarc; b=Ld8bS0JnT8rd8lJMnkNkQBeGtHnMaVSCQ+JsooWFDywtroNCJTWKlWqZ7eVJalqpRV3tsrNHFrO1kJJHvTMe2QGPFfhMgBDjkdfuaWk9GR/NudQy9Ai+anqV0mbps3XC/MUt9P6IbK0KODczRIzXfnu/YmkEY3kn4pA/29wjMco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685283; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=A5rJL39r60/35LZLysmBCrpC68JHwhbcZtjRUJEvMqk=; b=QmbmeG7bCx15k3oZvgaIwyFGULuJ1y8lWhDaumnqghZ5FxckAF2iiQeL4Mg0gJNh2uwBDoigKQ6H47O+TplFz163omjMmrire7eGQCA4UUc/f3EVwg0aRmMtkUC/3UZ1SeQMpNl6kdgL4L6+g1POE2aGE2Vhm2cQu+NdlRwW+fU= 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 1787685283112678.6303229790373; Tue, 25 Aug 2026 12:14:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXs-0004TV-8I; Tue, 25 Aug 2026 15:10:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywXq-0004SA-2b for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:50 -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 1wywXo-0003w3-C5 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:49 -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-657-w0zfAu-aOKqMuVGjfgSuig-1; Tue, 25 Aug 2026 15:10: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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 125E4185BE9D; Tue, 25 Aug 2026 19:10:42 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3528F1800765; Tue, 25 Aug 2026 19:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A5rJL39r60/35LZLysmBCrpC68JHwhbcZtjRUJEvMqk=; b=OBs3G7HdoBK5ptBKT6k5MbPtC23BnKMik+ns1eOZyoAzX2N16Hzh73easR1Fg/O45TIGex GrNaVTNyfgVfZk0Rw0828oVwirTxxOBlfrNqxnYcmppRG1J95MucujXvJWiCdEaDMS/zBk I2Gji8G6BabtTrEDp24Io2lRLuBUaRY= X-MC-Unique: w0zfAu-aOKqMuVGjfgSuig-1 X-Mimecast-MFC-AGG-ID: w0zfAu-aOKqMuVGjfgSuig_1787685042 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:17 +0400 Subject: [PATCH v4 10/49] net/qapi: add x-query-usernet command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-10-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Samuel Thibault , Jason Wang , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=3816; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=f+pBY7K9E3HdtzS9Ahsq3e8j7aQZanCIxcPzFBfxZu8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHnCN1wUPqmnc7z9wgYcRi2LRujCzQvgaLo JbwUpNZQmaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5WQXEACbciJfEAFrFqIaVnpvFE8QHje/J/3X4UPjMVd+5wO66KSLf2os+3BfW74Pb5xvYmliSbJ w9clKeqrEqx0MwoLprxmACk73jYPaGKD3UIR5P3T8oySz2iHpctAg6hDTWMR4mCaHNtp51/6DtZ 79xOxF9HNj9S7Mkui96TsbSD8SwmPvaNSg31YLB3WsX9AHJZQVvfsC6BAVGVq9stiVNF1XHxe2K 4t9Yq4ijyvjK88e01O+JlSPEle0tdr+WFaHtw34A8JRIo4SkFQb92Ny9lHxc2qC+1SsZQeVqRQ5 OxP9ONLZ/KA4TXk3O9Wsf2jpckhwQGVQZZ4sDjguWG6cApmrNGbb6ItTYSNy92W1/rpAMYUxl0P WsvWg9mCH31TygaWhHSli7c9iaQ8DX4bSktUAevId/KXimMED6I5wfhNQY3uupZxK3UPNNCbAfH A7oNwM/yHj/WRpyl5xDwr9X/K/v+1BzgpKdLVOKJnK/aJWHebgIP2GbgjBgRZFGGPWyGDqp5cFI Dt9QGw3tOoEhF/IfbnneJNQ2AlfpWl+GOp5BDgXBtdbB5rJQsL3Du3TnEutUHS7Wdhefs00Rc5b NRDq047aTs/6rLczvZHbQKxH8r/iZAR50NXRouREnko0DEMAaXOSuMXomfuWGGYr4Lm8mazewSD IIWjPN/UxICbgHQ== 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: 1787685285391158500 Add a QMP command to query user-mode network stack (slirp) connection states, providing a structured alternative to "info usernet" HMP. The new command returns a list of UsernetInfo, with hub-id, hub-name, and connection info for each slirp stack. It is marked unstable as it is meant for debugging. Rewrite hmp_info_usernet() as a thin wrapper over qmp_x_query_usernet() so the HMP and QMP paths share the same implementation. This is part of the effort to decouple HMP from QEMU core. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- net/slirp.c | 34 ++++++++++++++++++++++++++++------ qapi/net.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 9e9941fe73e7..517dd23be14b 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -43,6 +43,7 @@ #include "system/system.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "qapi/qapi-commands-net.h" #include "qobject/qdict.h" #include "util.h" #include "migration/register.h" @@ -1200,18 +1201,39 @@ static int slirp_guestfwd(SlirpState *s, const char= *config_str, Error **errp) return -1; } =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict) +UsernetInfoList *qmp_x_query_usernet(Error **errp) { + UsernetInfoList *head =3D NULL, **tail =3D &head; SlirpState *s; =20 QTAILQ_FOREACH(s, &slirp_stacks, entry) { + UsernetInfo *ui =3D g_new0(UsernetInfo, 1); int id; - bool got_hub_id =3D net_hub_id_for_client(&s->nc, &id) =3D=3D 0; - char *info =3D slirp_connection_info(s->slirp); + + if (net_hub_id_for_client(&s->nc, &id) =3D=3D 0) { + ui->has_hub_id =3D true; + ui->hub_id =3D id; + } + ui->hub_name =3D g_strdup(s->nc.name); + ui->info =3D slirp_connection_info(s->slirp); + + QAPI_LIST_APPEND(tail, ui); + } + + return head; +} + +void hmp_info_usernet(Monitor *mon, const QDict *qdict) +{ + g_autoptr(UsernetInfoList) list =3D NULL; + UsernetInfoList *entry; + + list =3D qmp_x_query_usernet(&error_abort); + for (entry =3D list; entry; entry =3D entry->next) { + UsernetInfo *ui =3D entry->value; monitor_printf(mon, "Hub %d (%s):\n%s", - got_hub_id ? id : -1, - s->nc.name, info); - g_free(info); + ui->has_hub_id ? (int)ui->hub_id : -1, + ui->hub_name, ui->info); } } =20 diff --git a/qapi/net.json b/qapi/net.json index 1a6382825c5e..5d3342fba23b 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1261,3 +1261,47 @@ ## { 'event': 'NETDEV_VHOST_USER_DISCONNECTED', 'data': { 'netdev-id': 'str' } } + +## +# @UsernetInfo: +# +# Information about a user-mode network stack (slirp). +# +# @hub-id: The hub id, if available. +# +# @hub-name: The name of the hub. +# +# @info: Network information from slirp. +# +# Since: 11.2 +## +{ 'struct': 'UsernetInfo', + 'data': { + '*hub-id': 'int', + 'hub-name': 'str', + 'info': 'str' }, + 'if': 'CONFIG_SLIRP' } + +## +# @x-query-usernet: +# +# Query user-mode network stack connection states. +# +# Features: +# +# @unstable: This command is meant for debugging. +# +# Returns: list of user-mode network stack information. +# +# Since: 11.2 +# +# .. qmp-example:: +# +# -> { "execute": "x-query-usernet" } +# <- { "return": [ { "hub-id": 0, "hub-name": "vnet", +# "info": "..." } ] } +## +{ 'command': 'x-query-usernet', + 'returns': ['UsernetInfo'], + 'if': 'CONFIG_SLIRP', + 'features': [ 'unstable' ] } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685172; cv=none; d=zohomail.com; s=zohoarc; b=krY4BvMZ7sNtHc5yWoD3mRCuLOZtoKYX7GNOhIL1nTWYZYQ4108BE8yN5d/IvTCLHuHQcmVj5+PUgefzqe7PyyTRwxrB16IKipi+qUuhU6eopzD+GW9kQohj05ITFIRcNwbYof0RejAzutVeMnLxzaoQUiZG9ZUR65NAHTvRBqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685172; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qCX+g+9B5pUAIu9lN6dO+J/k9b2ZyYTzjJYZl5J/LV0=; b=A5lQHr6xlMS2Qq73aF4JuVcE+u9CYC2fERlF58kWEsLSAZ+UdVKJaGtZodUYlRcYwgNVSD4oHTCuZasde+88RaWqeXKIrbSCg2S7FI4Gm7ndB1uuPnvPG9Ou3Dkun+g5CTCujpeFNPg57aP+3viu4gJ0LCBuq09Haa4ZIRciQ7w= 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 1787685172507590.7337183825068; Tue, 25 Aug 2026 12:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXt-0004U7-Po; Tue, 25 Aug 2026 15:10:53 -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 1wywXt-0004Tw-3j for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXr-0003wK-ER for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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-530-usZe_UFGO4y1Xrde9V_0ww-1; Tue, 25 Aug 2026 15:10:47 -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 B90C718C0FA9; Tue, 25 Aug 2026 19:10:45 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7983D1801AEA; Tue, 25 Aug 2026 19:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qCX+g+9B5pUAIu9lN6dO+J/k9b2ZyYTzjJYZl5J/LV0=; b=iknVVJjSKYWw1rObTAjSeMcwUe/Us44txK49Ai8vOQMBstPfEXlAaufExw2J4fHVkZjaun o98xU/DYoRiRcA+mCsHJorJSo6E0Os+9c+mOHks7jD0QsHCOXWzvXityZru/+b73504mw5 Fg4LRheaWM7CeRbiBZ6L835uPIZL+0E= X-MC-Unique: usZe_UFGO4y1Xrde9V_0ww-1 X-Mimecast-MFC-AGG-ID: usZe_UFGO4y1Xrde9V_0ww_1787685046 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:18 +0400 Subject: [PATCH v4 11/49] python, tests: switch usernet queries from HMP to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-11-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , John Snow , Cleber Rosa , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=3487; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=BGr4jMtvHXTYjpFsBnp2mkhw2E82vBePeQYIs1jgUAU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHWFR7cweUSv8fefB4HX6uotB+3xCDpl4SU ptAzMYrRtOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5Z5hD/97xRbQDBVsRd/TZ2o/PGLTQQUDc++QpMbSXCTm0INqqE37XZ0xPUKOHznV9Vd7in2mZYS 6NYKQ2ICR6+r251D1kgywgzQaRUzyDPLk2XHGtJjELLgG2MpgQiZMTpJuA0JAcDOQae8yTC1Txh ZvyFUFi9Yz5lFrCa4ZNn4/5LCV2QxgawnPbm5Yj79xx73LKrT+mwFUhSZ7+AgxjqIg7PwjQW4Lc ECLk75oy2ZpcQy6i1W9LDTm0GeO8md2NSHwvqslfQdY65lYLpq6ddLvp0cSP1zfxN9YBZeaVmmz MuISFUv4bh+apZEFx/2FkVIChgqky9B3DPrpLjxRPQ/6xbHbYSS02GRWDjnx5ODTWm/a+k+KNU8 9TbIcAYqFoPe/iUTkcaHaLIGSVLMY2og1G2rgJcbSFjFKxCszXS4biTBohJBz8A6+NWghC81Pjj C0duy+VwISAtyKy17JVN9hMzIg7WZfhMsdvqmdK/vRr5OrHVCFeXrBfPM/fjlkHklmlO+BGApVh 7wvqr3nY1AnPKR0MxtScyGTmnOEsoDeGw981P8QAKmQ4HRyZMK15B6Yr5ON0yT54xpAH+oiRKhW oqJnVYvSo1zmjVMc/I8C+eHODivLQVzdgXBDbcs71efBfucVkxzaUxwvBsHuM3jfXr14XtgF1lm fcOIOXk9oEl/3kg== 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: 1787685174907158500 Replace human-monitor-command "info usernet" calls with the structured x-query-usernet QMP command in get_usernet_hostfwd_port() and the VM test runner boot path. Since x-query-usernet returns a list of UsernetInfo entries, callers now iterate over the result and extract the port from each entry's "info" field. Also switch get_info_usernet_hostfwd_port() from split('\r\n') to splitlines(), since QMP strings use \n rather than the HMP monitor's \r\n line endings. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau Reviewed-by: Thomas Huth --- 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 21:37:38 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=1787685087; cv=none; d=zohomail.com; s=zohoarc; b=c59GLZpBgkCRtybLdJFi+cdp54Jqm29SibXqYvl+M5AiAJSUJ+2EI2RSFy/9XLQRvwA3hOIklGBZpSUKzV9c/HoFZMJ88epFd6vV2Fd7wpZSnHaYQ+mDXG641f7vKahfVg549cnkXsOwFYUL5ltj6yJtvLrB0MzLaw1iSqe5SOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685087; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SopzVZmki+Hnpy0NQ2yaF9P+Y9MMP6qFbH7RSqmwlo0=; b=QekjBFj22xKp0IHGuXRnU4CdsbVsZ6qO3qn/0JdzrlGsmTJqPhzDri8Y91Jj4EAjRKwAx3eaA3lXfcZ8tJlDSIhWTyoVeWRLKOKDEifBgb0VIs3tijmMqIknGVoVpe9L2pNgFSCXgmxrqK3pJZsAcLljxQmDN1UakPawfpKQ190= 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 1787685087265568.2125518153191; Tue, 25 Aug 2026 12:11:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywXy-0004Up-E9; Tue, 25 Aug 2026 15:10: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 1wywXx-0004UU-50 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10: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 1wywXv-0003wa-MC for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:10:56 -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-220-_Z5OCpKUMoSjcOoonvj1jw-1; Tue, 25 Aug 2026 15:10:51 -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 6ABFD195DE21; Tue, 25 Aug 2026 19:10:49 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 761E21955F0C; Tue, 25 Aug 2026 19:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SopzVZmki+Hnpy0NQ2yaF9P+Y9MMP6qFbH7RSqmwlo0=; b=VRljj0XLSmZaO6md2PcoO3g/7kne5tZ0h0AV/I+lODkP1BXNSlVo68BSL05hQANhATYcDI TASGl+JoNRdNMsENO7yVKvkoVcQJnRBrPLhhZsBLZb57FOtZTp43fYNFZEerzryLJWWsyd dKQLvSsrcbWdjfuo5/027ScsDIdg5z0= X-MC-Unique: _Z5OCpKUMoSjcOoonvj1jw-1 X-Mimecast-MFC-AGG-ID: _Z5OCpKUMoSjcOoonvj1jw_1787685049 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:19 +0400 Subject: [PATCH v4 12/49] tests/qtest/pnv: drop unnecessary -serial mon:stdio MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-12-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Gautam Menghani , qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1774; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VqG8CcLp6vBSBhgsb7VgD9sJ4gnMAM/5MArloE3n1GI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHBN7NzbXzZ+dRsm7YtWyV+JpVVzBUF9KyZ 1+MNJg8oviJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5eNUD/kBaOxTMPz91+m2SqFj2UIAIqpWEPwOHOI10NRbHOFL4UwzcYx+Nvtz4muNZPI5suvmkvH MxzpRcbkRSqywgrgaObQoYVfq0PKmrU5vV0Zt1WxNBNrcDhd2r9Fa6b8i0rGGyw9NzYNGQiMO10 4NSeCRZYuMT7HCBASgosT5RnKdM5gJ5tJLkTz8WtVJIwzZjkLjyUT9t/uFTSzflIdlEBEYI5K4q IN8eO9AS1TtYYIw4OaAFU0UIfDAyfWImF4E1IwDLihVVPiYEGA0IxPhX98sxqrUQPVloVM6ZdJp FbansqzQeiJYtBTDB/GC9K2hMpebizpHPaXVXKkxlW6Lvotd0iwzpEy6OZpvxMpA+TqgoT/ac74 2GyFHQIkC1u967er/UVpa/qT4m85rZLRT/fdly1w70E8tJ7JwEy2/6JJ327CGYoF9AhSQ5bH6ub BrNdqDRXWXIFgs+Ti//Yeg/L91K023UadIHVKP6sJhsDThkb4QijdOsqsa42RNmuet4Xs5Z5V+0 HBtK4u2O46rokKGyMTddVCfMr4/EDdV/R65ZpyHK6wZeJgTUeHcS27gOWCjd5HFkc6HZIIfZfc1 IG9v/hSZJAAC5r5+V0j1PTdD6ERZJxDvhauG7dhMsRUlyy5LBfkPB8utcRfNrV74UnFtjny5lMP DYV6MdQ6uAopfJg== 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: 1787685088520158500 The pnv-xive2-test and pnv-host-i2c-test pass "-serial mon:stdio" but never use HMP commands. The "mon:" chardev prefix creates an HMP monitor mux, which fails when HMP is disabled. Other pnv tests (e.g. pnv-spi-seeprom-test) don't specify -serial at all. Drop the unnecessary -serial mon:stdio option. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/pnv-host-i2c-test.c | 2 +- tests/qtest/pnv-xive2-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/pnv-host-i2c-test.c b/tests/qtest/pnv-host-i2c-tes= t.c index 5fd54f9de771..f97f6f65eed3 100644 --- a/tests/qtest/pnv-host-i2c-test.c +++ b/tests/qtest/pnv-host-i2c-test.c @@ -414,7 +414,7 @@ static void test_host_i2c(const void *data) } =20 qts =3D qtest_initf("-M %s -smp %d,cores=3D1,threads=3D%d -nographic " - "-nodefaults -serial mon:stdio -S " + "-nodefaults -S " "-d guest_errors", machine, SMT, SMT); =20 diff --git a/tests/qtest/pnv-xive2-test.c b/tests/qtest/pnv-xive2-test.c index 9f67a0066864..a0892c0f8e89 100644 --- a/tests/qtest/pnv-xive2-test.c +++ b/tests/qtest/pnv-xive2-test.c @@ -552,7 +552,7 @@ static void test_xive(const void *data) QTestState *qts; =20 qts =3D qtest_initf("-M %s -smp %d,cores=3D1,threads=3D%d -nographic " - "-nodefaults -serial mon:stdio -S " + "-nodefaults -S " "-d guest_errors -trace '*xive*'", machine, SMT, SMT); init_xive(qts); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685094; cv=none; d=zohomail.com; s=zohoarc; b=oLR4KXIdXuaF1dfmLYQEp8o0YKXDvOeHxbY05HyG15qYMurqZ2KyvXToMTWNxiyyN2aLd8MDW8if2xnMybir41NRDOZLRXmCBgOWK7hSgrGGUGWgT2Kpc13BSSpHhBdfVHXjFJSWES1tPMTKvSewWTz/KYGj7JjFYe+sLwjG59s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685094; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=awsGiKws/Oc72EBonW3yVf4RQnkpQdBbgtMuliluxhg=; b=gR6TpxbDpcccSTwP99N2i6FgfGqmaKRlar0l/qk2KKrberxkSvO6kQwceERMELd2PDS7k3LjCwbNP2gdOg7QzZ3gmNn5qYDfw96suhIdDzNyEwUYKe3+Fa5pkCnfECM/SmltBWUy2plvmy56x4Cy0/rCd3YS30IVPpXNKSpY4/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 1787685094580809.6841246464735; Tue, 25 Aug 2026 12:11:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYB-0004qs-3M; Tue, 25 Aug 2026 15:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywY2-0004a4-Fo for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:04 -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 1wywXz-0003wy-0C for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:01 -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-659-bFGl94X-OoK8jtqsNk29AQ-1; Tue, 25 Aug 2026 15:10:54 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF5C6184B3AE; Tue, 25 Aug 2026 19:10:52 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 00FFC1944B2A; Tue, 25 Aug 2026 19:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=awsGiKws/Oc72EBonW3yVf4RQnkpQdBbgtMuliluxhg=; b=QR9Pkfv9FuCpRRVSddVMVzPdSHFuyaodxm8YBcmv09T5Ma52AAAkNigE6pY/XKx2xxC4uv f89Kq7U/rzMB/x/WQtSR5TiAdK8HhtiKVmhijGygDXwMDcsDkgaJ+Udyn3KDI7UbTm8vyx /spv+BOViLMgl+C+7jL0eNk/H7BpVkM= X-MC-Unique: bFGl94X-OoK8jtqsNk29AQ-1 X-Mimecast-MFC-AGG-ID: bFGl94X-OoK8jtqsNk29AQ_1787685053 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:20 +0400 Subject: [PATCH v4 13/49] tests/qtest/qmp-test: don't depend on human-monitor-command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-13-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2187; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=LYlALLNnLGBmvLJkUw/CVWFy33xbwEoBffB+2rz9Cl0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHBJXrrO8hT9LJImCxzq/rvNFPv2J4yLP+7 OR/SYaNr3uJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5bdsD/0bEu+4Z/zgvGSZYEEi6qhH2oAtfw+Hba0KPRRrRcir9I2HtCTf/L2XI3V35pWlmbtfjrr eZBhp12TpM6keXXOWBVY8eJ3aax9gZ5gt57GJlhkkUlVoAu3mCS8SF2NQHxue04th001WkfKUs7 g8q7uHKlWjgCEip7+qq2eKRDMjflN67EV7uJ4vEYFZKNzXWsvJDGKVsXdTOXx8qLN22xfltCakz q5M/1ozWx+u524c3KL9SyNOKm6di/7yRPfO9WpOkcasl7Uk2BbMBvaxHXx4R/LyfdDhns3B3VRB 2B8FcTM6uCOTGGccYkqHJ7N1xTRLt9jKM5rgTxEdPzF2cGVn6ulSmnf/GP6pfz/5g1O18T1k53X kDzrrCvTbI+KPa8JNByJJYTV4X+I1tRlBT55KccdQHjG8WV4FwB/Iu/9Qfoas5DZYp/yI9NBOBN MIX0T71rClJgLXcRkbW92FsuxysHGja4+pn115M/hOls4RBhZVTDUOAgjea/jXDVBA+qVe7qbmO xp35WyoyBuwqi4mosG6FcLpDRPAkz+7CMUchvNxr/6iy3vBovxpb/bbnbhqhjiNDoYTMttdocSz 4J54OFKAWJjquAjLSAYkx/Mf6PwYiA86OIWaRu3pAQnzpu+GJFrEC7FadnuOkbRE90lYUTlNTqf 5/2qIV7aZ7PZC/Q== 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: 1787685096430158500 The test was using 'human-monitor-command' (which requires HMP) to verify that an integer 'id' is echoed back on failure. Replace with 'query-name' for the success case and 'block_resize' (missing required args) for the failure case, so the test works regardless of HMP availability. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/qmp-test.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index 3a325a04e07b..927ab053f8ab 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -151,9 +151,14 @@ static void test_qmp_protocol(void) g_assert_cmpstr(qdict_get_try_str(resp, "id"), =3D=3D, "cookie#1"); qobject_unref(resp); =20 - /* Test command failure with 'id' */ - resp =3D qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2= }"); + /* Test integer 'id' is echoed back on success */ + resp =3D qtest_qmp(qts, "{ 'execute': 'query-name', 'id': 2 }"); g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 2); + qobject_unref(resp); + + /* Test integer 'id' is echoed back on failure */ + resp =3D qtest_qmp(qts, "{ 'execute': 'block_resize', 'id': 3 }"); + g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 3); qmp_expect_error_and_unref(resp, "GenericError"); =20 qtest_quit(qts); @@ -487,6 +492,7 @@ static void test_qmp_monitor_remove_cli(void) qtest_quit(qts); } =20 +#ifdef CONFIG_HMP static void test_qmp_monitor_remove_hmp(void) { QTestState *qts; @@ -504,6 +510,7 @@ static void test_qmp_monitor_remove_hmp(void) =20 qtest_quit(qts); } +#endif =20 int main(int argc, char *argv[]) { @@ -521,7 +528,9 @@ int main(int argc, char *argv[]) qtest_add_func("qmp/monitor-chardev-in-use", test_qmp_monitor_chardev_in_use); qtest_add_func("qmp/monitor-remove-cli", test_qmp_monitor_remove_cli); +#ifdef CONFIG_HMP qtest_add_func("qmp/monitor-remove-hmp", test_qmp_monitor_remove_hmp); +#endif =20 return g_test_run(); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685169; cv=none; d=zohomail.com; s=zohoarc; b=ISl3uwBliu8ZB8IVoJieqRhcDRHHF404yFMwuzA9OFAmZzNmSw/eQ8P3j1ArceSXf2rPhlPjho5ZxgOUxeQ+pVMkrDs/0d8AFF65tb0hrA+EyJSXCEwgwS+12nEAtlSvSLF66JojP5LLkSJMEWvvrCP0oCL0Q6ffHdSYmr1lqZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685169; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WuTj5x+fSNUVNN2LMJ3vFG3XqkgK85waEsJYQTSVFbk=; b=W9rAOViYbtDNuUrJ6Bu8Pb7bhcX+SL2kFjNf0EnDxpif8yJy3iPChFmPAdcmpoLqP+3a7VIJerzSZwKczHXzqOuRgsbJi+FNyiM07+jmK9GNVDYqmL3KpVUKKPLGgTmEtNV7uYxkc4lf8dcZaSZd8fGOWytNRpg5HFtH/E/+7RE= 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 1787685169229810.8674979885272; Tue, 25 Aug 2026 12:12:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYC-0004zM-87; Tue, 25 Aug 2026 15:11: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 1wywY4-0004fP-DY for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywY2-0003yh-7u for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:04 -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-570-yEhIdn6CPtari-MisAhohA-1; Tue, 25 Aug 2026 15:10:57 -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 940EF188FECA; Tue, 25 Aug 2026 19:10:56 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C04A118005BE; Tue, 25 Aug 2026 19:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WuTj5x+fSNUVNN2LMJ3vFG3XqkgK85waEsJYQTSVFbk=; b=YCDW2LuZ/ovtyGv7qMTq181S+l5RQyMwnz75f7lA8+tUuENkT9lc3Hlle2ZFZ6svcgEVuB su8ALFP/r2YlA4pAKVxgWFR+vgfrYRsGrCUHVxqjoPoqybUXGbcN0BucCcykQbW1FCr55V Qtd3YVzM7w3EoVlrAOGexOOfwJUm3bk= X-MC-Unique: yEhIdn6CPtari-MisAhohA-1 X-Mimecast-MFC-AGG-ID: yEhIdn6CPtari-MisAhohA_1787685056 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:21 +0400 Subject: [PATCH v4 14/49] tests/qtest/numa-test: replace HMP "info numa" with QMP query-cpus-fast MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-14-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=4041; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+FBAR2ZPq7hb97oLmYP2VfmJ5ZxlMcXNs2ksRVhW/zk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHy5MYCOjiCt5u/tQW/JwoviNOE+jQJfUDX e7pRSj7Kv+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5b0qEACzgTH5Uh3dWORJxGtDpTlvVactUkvpNsbq73QQm6P8dmaA0UgI+DA51YUhReNS82JjdRa IIU7SkQzkL/a7vEC44oiHVChntDp6J5yWJp9f6EPEkrQffxeKMN8UcxvBfNmwXYTgZyro/cvIvW T2+jrYHyDRdNraj5mYTLByN1mbWLWbbLlJqPdI3aysYPdHn8sEt+UwAH9A04trg0Zp85ndzklUg otuBKouhLMxOGBfLku8iQYsToVLx8MJA6m7b2xW+PMEMdt1lGVY+T4sWM3q/KLbaP9WTocdN2gK 9tiiHZSTna8MwEgjAwIsygrFirFAzu2gd5zBvRXUhZPcnbIMC6TYxYl2rHCKW2ZaScT/xTWmrtN 3X/BZV6LGLg7LhK5u+kDR90elYLE33Ojr1QyWkZb/B44drldPR7RIviyR6qhlj/hFP7cTcHT4kX kvzsRGXMa41IDvWAR7/bfH/pIsVcifVcuTSL3gKReqzeSPzp3LG/q0YjkXiFy39UL/ngp7j0Hmp IvgTmo0zQHYBqU3ASwXl+Voe65djrioK+8N45dfJqduqiGDMW90yOr7RlHX17XXH0aOivmv6bYC QILnyz4kCMPiX0TWUAhCfE9gx3/86mxfwy0qBKCBB+/R1iMvniMhfCQDGHMx4HKlxiTUzuRYBjt ZKj/TjC3z25XNqA== 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: 1787685170976158500 Convert the three test functions that relied on HMP "info numa" to use QMP "query-cpus-fast" instead, verifying each CPU's node-id through the structured response. Add a check_cpu_node() helper for the per-CPU assertions. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/numa-test.c | 63 +++++++++++++++++++++++++++++++++++++++------= ---- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index d657f3894743..8f563c079f62 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -19,19 +19,50 @@ static char *make_cli(const GString *generic_cli, const= char *test_cli) return g_strdup_printf("%s %s", generic_cli->str, test_cli); } =20 +static void check_cpu_node(QTestState *qts, int cpu_idx, int expected_node) +{ + QDict *resp; + QList *cpus; + QListEntry *e; + bool found =3D false; + + resp =3D qtest_qmp(qts, "{ 'execute': 'query-cpus-fast' }"); + g_assert(resp); + g_assert(qdict_haskey(resp, "return")); + cpus =3D qdict_get_qlist(resp, "return"); + g_assert(cpus); + + QLIST_FOREACH_ENTRY(cpus, e) { + QDict *cpu =3D qobject_to(QDict, qlist_entry_obj(e)); + int64_t idx =3D qdict_get_int(cpu, "cpu-index"); + if (idx =3D=3D cpu_idx) { + QDict *props =3D qdict_get_qdict(cpu, "props"); + g_assert(qdict_haskey(props, "node-id")); + g_assert_cmpint(qdict_get_int(props, "node-id"), =3D=3D, expec= ted_node); + found =3D true; + break; + } + } + g_assert(found); + qobject_unref(resp); +} + static void test_mon_explicit(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8 -numa node,nodeid=3D0,me= mdev=3Dram,cpus=3D0-3 " "-numa node,nodeid=3D1,cpus=3D4-7"); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3")); - g_assert(strstr(s, "node 1 cpus: 4 5 6 7")); + for (i =3D 0; i < 4; i++) { + check_cpu_node(qts, i, 0); + } + for (i =3D 4; i < 8; i++) { + check_cpu_node(qts, i, 1); + } =20 qtest_quit(qts); } @@ -39,16 +70,19 @@ static void test_mon_explicit(const void *data) static void test_def_cpu_split(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int even_cpus[] =3D {0, 2, 4, 6}; + int odd_cpus[] =3D {1, 3, 5, 7}; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8,smp.sockets=3D8 " "-numa node,memdev=3Dram -numa node"); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 2 4 6")); - g_assert(strstr(s, "node 1 cpus: 1 3 5 7")); + for (i =3D 0; i < 4; i++) { + check_cpu_node(qts, even_cpus[i], 0); + check_cpu_node(qts, odd_cpus[i], 1); + } =20 qtest_quit(qts); } @@ -56,17 +90,22 @@ static void test_def_cpu_split(const void *data) static void test_mon_partial(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int node0_cpus[] =3D {0, 1, 2, 3, 6, 7}; + int node1_cpus[] =3D {4, 5}; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8 " "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-1 " "-numa node,nodeid=3D1,cpus=3D4-5 "); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7")); - g_assert(strstr(s, "node 1 cpus: 4 5")); + for (i =3D 0; i < 6; i++) { + check_cpu_node(qts, node0_cpus[i], 0); + } + for (i =3D 0; i < 2; i++) { + check_cpu_node(qts, node1_cpus[i], 1); + } =20 qtest_quit(qts); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685169; cv=none; d=zohomail.com; s=zohoarc; b=ealFjH27JCyiHcXsIa1Y4abxwDf4EV32Qx++PGkkEGYjxVM7sWrU51DzeqVCA06tNAsWPpYl4Ut1U2HlfZiI4hQKhVssMRihxaeYQQMFEHJlqV7+1duQ9r79GD3ETY75vfZ7FWqAKW0UFD70P4NJq7HG0BNVQyJh9O64b2kUnHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685169; 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=HfMcQcx6b8V1GGc85U1OGllXkTDW5Em7kmZJjqakvXg=; b=nocyo2lYx+h/SXJj8X9FWSgy0Dnf3RRaXzb+8MuAooMF0QY53bj9hVEPRR8j6vBB48mO8/QYnaz42HBERgl928dEyv52Kuti9sDFVEvX/Yv99LNZE8cEpbC/X+hW61KdGZPP4OqJVgYGcWSxcVtxrPJ+dyRUMekjW3oqWm1pBTM= 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 178768516968730.587528056794895; Tue, 25 Aug 2026 12:12:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYE-0005AO-75; Tue, 25 Aug 2026 15:11: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 1wywYB-0004zL-VK for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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 1wywY7-00042U-Ti for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:10 -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-689-IqzHG08mOISL4VdtFNSW7g-1; Tue, 25 Aug 2026 15:11:04 -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 EA78A1955F1F; Tue, 25 Aug 2026 19:10:59 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 124CF18005B4; Tue, 25 Aug 2026 19:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685067; 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=HfMcQcx6b8V1GGc85U1OGllXkTDW5Em7kmZJjqakvXg=; b=gi2ccwhlDc7QUaLTX0bmISuSDp4Zrf5fWSzEOylnk1DldcM1bVPJG84CLV/TF054hrUFkD mjxvefaz4G/YlwE4Y2BKm9Y67prs5toZtrdu4p+gwgcUcSWrJ7vSosBPa9xGS50aqQYdLX uE8Q6zjyviMigMkSZSS7+Ho78aa84UM= X-MC-Unique: IqzHG08mOISL4VdtFNSW7g-1 X-Mimecast-MFC-AGG-ID: IqzHG08mOISL4VdtFNSW7g_1787685063 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:22 +0400 Subject: [PATCH v4 15/49] tests/qtest/cdrom-test: replace HMP "info block" with QMP query-block MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-15-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Denis V. Lunev" , John Snow , "Denis V. Lunev" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2301; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=5wY91W0L9laNoGmdtIKhtW9LqkeXAMcQEZWY3DWeEYU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHpFLCpWxiyhDCzSYNJKbPhoM5EhWYc8mLt 9bhHEipto2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5chCD/9JEG9mBQ46LLQikbV2yDnb9B65mVDcd9Vz0bjFp0hFFeoQnPv56F4w0GdDLfJbtI9VP5O DN6UiWV55DJkgjTyPtjlm3a4xDHjKDk2VG/rN6IqNKaWW0HofzcOpuHR0KWUMeMWxV2rc0CaJNF xX+PbUs+o3YQ+z/7q9FduosLlf8FYT7uPb36XNLvgFS7fMlx3OMLV/79KSccI7BpY2F91IAqGJf BprWXoC2L1WerdX4f2fgFSWw90T4gdX6FBGpJH6ZPOZNlWrsp12paNySfCfpLemikbFAyA4ExAj 2904nbEXvdTvYEMZJjJAuIC5kttT0bt0IEf2larue8N1svAHo2YfryB6M03vdXnMe7dwQM2MDmd RtegoqPwL3YNgpMBWYdGXHRrYioyZyozE/BymyTg1e+ciAUpELa3yfSpdYfIIvLnTiwo1gikHpj VprTONqxzGJVNfWXPrylkwalNtM/LbOyL0YYQyBjGrNpKnRVSzS+bG+Gox9cJB7HO0PasD8X8Rg y3FQFdujQFbaLF6gqpgt+TE1pfwHoUCPWIfZOXtN6DVnSlh5Fuz0YksBGEos5hDLf0BYrIzZdiR 05X2LX3OTzrg22TL4+T8A9XfAPLDb110wyXH2cIIPQ9MOqQ7Alv2lRtrNIfYQ5el/DypshTTAv/ pd6imMODKO17U1w== 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: 1787685170980158500 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 --- 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 21:37:38 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=1787685258; cv=none; d=zohomail.com; s=zohoarc; b=XuMTVALCZjkzSLXn6C0OTzRgOtYi0H+KQWkKOL6X8ebF8dAxKHuSxTRmhFEFHIDyTBizNhPKkFdeDopVCGQCOtox2YFcf/djfXTa/tDa2h2R1Vo7D6FbEnlse1lsZV/cXJSsg5wW8rvDMn7maWxORhP/MVB9Jb228u0YC9FgmI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685258; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UZRz3EkbKUI26MlQnyuxQXcUyNkJElc5W8Guw6Tk6gI=; b=G+ULYbBLJlscIFYJHNoAjqQHYxj3WxpYTB8jsud50hib2X4sGRVGIhXN89onQfhGgFdHE5jm0Cb0PG4Yx2DqA1Hjl+1LycYP5/Z4EDPPc22vOfX/8v6jPsGd968ZJaL49Zw1FC0lor/inEn5uZ1CkOFj4BSrR3klz/SJKqxThZQ= 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 1787685258054475.2646481311061; Tue, 25 Aug 2026 12:14:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYD-00056j-HL; Tue, 25 Aug 2026 15:11:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYB-0004zK-V0 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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 1wywY9-00043F-Ik for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:11 -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-189-rfsv6LM_Oeqa_a84bzHM0w-1; Tue, 25 Aug 2026 15:11:05 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BAFF91978F71; Tue, 25 Aug 2026 19:11:03 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D6A951801AFF; Tue, 25 Aug 2026 19:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UZRz3EkbKUI26MlQnyuxQXcUyNkJElc5W8Guw6Tk6gI=; b=aNAN+9MOsRsbuivHl19z0vdrsKCeIxRN+Q8+qklJi3EoBPN6et86cx4sp6GiPA/tmGHlOR 7BOztK/0EjQXzNZDaDWze5sNhZp1UUhfxNQyi4miHdY5pTImhQXwJSwvXoF6NLPQfNY8O+ 5VbEWXjvGeyDNpMsGvTCqOeOXi3mtEY= X-MC-Unique: rfsv6LM_Oeqa_a84bzHM0w-1 X-Mimecast-MFC-AGG-ID: rfsv6LM_Oeqa_a84bzHM0w_1787685063 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:23 +0400 Subject: [PATCH v4 16/49] tests/qtest/device-introspect-test: fix test without HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-16-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=7518; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9Kj/FtbaZbFHg5LizU23usl5iX+58YVJ4JW3Ey5xlPk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHttP4NPgADoH/r/V42nwM4tqcNyqPHy5QK JRtoi6r9E2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5UylD/9AaYT6Gq8uf3trP91rdXeMUCy/k51BtTOkDGokGts+KIiGmQpiZHzbYq98pQu6bPrIlJL eQcpFwyAAD1a2B9k08H4cXRGGOyQ18qLFI9GIUVrXPSqyT6Y/osblfqkUHMNRTc+RO3iPpH4Z2/ BduBQ3eqMdjyoZcLruUIcfhJdqClaL4CeTCfImZAjvSKRk6AF+Fh4jyWigqFPqy+Ybm4WTkVcY8 f2t8tLaAzYBL2Z+yKScFG9lgCQmBmTIwOKyHDQPlg9YfvaI8tputUnGVtj20kxyLFBwqEVYRd7Q B6zfRs3A9F/nPnwuwiNJT7WoIuZVe3a+EbEw40YRRtg0ugPeLSaJAkpg1PczV1t0FOyTeUYyR56 Wjh8y3QGtyS+ts6ogDGkppxSfLTxw8a4L+LSW0YUzbf9SSNLHGJcZjzATdLzeUdgoWGjOFLcaQd nbAYeIKZPNq57DIR5vk2T9Q27dAx166KsKY1UJ6ExaQ5YOb17gXDXHdCOFoczd8cMr0E0JdCpc1 LWV+OH6xqRyMf/0cZxZgb8zdOvjWiiH9wd9GZEjyKGZeW5D+x/7w2t5SvaREVmTBE9DHjY8pSFg YqJY9ZU0ao1qswGze63GxxO8GU9e36JmCsGbZl172WJ+CKLpwnRC2Gz25Xa26g6Un1ng+6LJ1CF GM6q+/qyMYy2Xow== 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: 1787685259271158500 Replace "info qom-tree" with recursive qom-list walk. Disable HMP-only code paths, info qtree, kinda duplicating the test. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/device-introspect-test.c | 111 +++++++++++++++++++++++++++----= ---- 1 file changed, 88 insertions(+), 23 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index f84cec51dc2e..f6eca2c8eb7e 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -11,10 +11,10 @@ */ =20 /* - * Covers QMP device-list-properties and HMP device_add help. We - * currently don't check that their output makes sense, only that QEMU - * survives. Useful since we've had an astounding number of crash - * bugs around here. + * Covers QMP device-list-properties and HMP device_add help (if + * CONFIG_HMP). We currently don't check that the output makes sense, + * only that QEMU survives. Useful since we've had an astounding + * number of crash bugs around here. */ =20 #include "qemu/osdep.h" @@ -100,11 +100,60 @@ static QList *device_type_list(QTestState *qts, bool = abstract) return qom_list_types(qts, "device", abstract); } =20 +/* + * Recursively walk the QOM composition tree via qom-list and build a + * string representation. This serves two purposes: detecting dangling + * pointers (qom-list would crash QEMU) and detecting leaked objects + * (by comparing the output before and after device introspection). + */ +static void qom_tree_walk(QTestState *qts, const char *path, GString *resu= lt) +{ + QDict *resp; + QList *list; + QListEntry *e; + GList *children =3D NULL; + + resp =3D qtest_qmp(qts, "{'execute': 'qom-list'," + " 'arguments': {'path': %s}}", path); + g_assert(qdict_haskey(resp, "return")); + list =3D qdict_get_qlist(resp, "return"); + + QLIST_FOREACH_ENTRY(list, e) { + QDict *prop =3D qobject_to(QDict, qlist_entry_obj(e)); + const char *type =3D qdict_get_str(prop, "type"); + if (g_str_has_prefix(type, "child<")) { + const char *name =3D qdict_get_str(prop, "name"); + children =3D g_list_prepend(children, g_strdup(name)); + } + } + + children =3D g_list_sort_with_data(children, (GCompareDataFunc)g_strcm= p0, + NULL); + + for (GList *l =3D children; l; l =3D l->next) { + const char *name =3D l->data; + g_autofree char *child_path =3D (!strcmp(path, "/")) + ? g_strdup_printf("/%s", name) + : g_strdup_printf("%s/%s", path, name); + + g_string_append_printf(result, "%s\n", child_path); + qom_tree_walk(qts, child_path, result); + } + + g_list_free_full(children, g_free); + qobject_unref(resp); +} + +static char *qom_tree_str(QTestState *qts) +{ + GString *result =3D g_string_new(""); + qom_tree_walk(qts, "/", result); + return g_string_free(result, FALSE); +} + static void test_one_device(QTestState *qts, const char *type) { QDict *resp; - char *help, *escaped; - GRegex *comma; =20 g_test_message("Testing device '%s'", type); =20 @@ -113,19 +162,21 @@ static void test_one_device(QTestState *qts, const ch= ar *type) type); qobject_unref(resp); =20 - comma =3D g_regex_new(",", 0, 0, NULL); - escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, NULL); - g_regex_unref(comma); +#ifdef CONFIG_HMP + { + g_autofree char *escaped =3D NULL; + g_autoptr(GRegex) comma =3D NULL; =20 - help =3D qtest_hmp(qts, "device_add \"%s,help\"", escaped); - g_free(help); - g_free(escaped); + comma =3D g_regex_new(",", 0, 0, NULL); + escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, N= ULL); + g_free(qtest_hmp(qts, "device_add \"%s,help\"", escaped)); + } +#endif } =20 static void test_device_intro_list(void) { QList *types; - char *help; QTestState *qts; =20 qts =3D qtest_init(common_args); @@ -133,8 +184,11 @@ static void test_device_intro_list(void) types =3D device_type_list(qts, true); qobject_unref(types); =20 - help =3D qtest_hmp(qts, "device_add help"); - g_free(help); +#ifdef CONFIG_HMP + { + g_free(qtest_hmp(qts, "device_add help")); + } +#endif =20 qtest_quit(qts); } @@ -198,18 +252,22 @@ static void test_qom_list_fields(void) static void test_device_intro_none(void) { QTestState *qts =3D qtest_init(common_args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 test_one_device(qts, "nonexistent"); =20 /* Make sure that really nothing changed in the trees */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qtest_quit(qts); } @@ -217,18 +275,22 @@ static void test_device_intro_none(void) static void test_device_intro_abstract(void) { QTestState *qts =3D qtest_init(common_args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 test_one_device(qts, "device"); =20 /* Make sure that really nothing changed in the trees */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qtest_quit(qts); } @@ -239,10 +301,12 @@ static void test_device_intro_concrete(const void *ar= gs) QListEntry *entry; const char *type; QTestState *qts =3D qtest_init(args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 types =3D device_type_list(qts, false); =20 @@ -255,14 +319,15 @@ static void test_device_intro_concrete(const void *ar= gs) =20 /* * Some devices leave dangling pointers in QOM behind. - * "info qom-tree" or "info qtree" have a good chance at crashing then. + * Walking the QOM tree via qom-list has a good chance at crashing the= n. * Also make sure that the tree did not change. */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); - +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qobject_unref(types); qtest_quit(qts); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685100; cv=none; d=zohomail.com; s=zohoarc; b=C0DeWDWEOyKbCic5oRH2pjjfKC6iixeu7rDXIk3pmrtBPDXvAS6rB8CRLRwySmPU6ls8H5ShMj4eOGq5139QCjC1ufCLe6mW5JrqskyfnRLYq4zGVAg5IpiPeuvLYvHVAo8CKANdgzIsJ7BvVauU8Z3RF5AyJZBHOjC1Sy3etIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Mpb/2b3qMFQzTLzTCER3qNfrQzUe3H5wt66hPLCR09I=; b=hBCRMwNY4Cr1lEE2a5wGVY2GgctBWo0kyewKpuXEo0wRJWC5rQr4/DKw82eK6ghS8g5V7TU1deF1WdQMWFJeFUsqku5TqljP/34PUAOsjqDHhCjtELM4A0nHW2YxkqUvRpI6Oz++YB/NRjNZxxqaf6PYEH9Kqrn0ImToYPDnwpw= 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 1787685100860911.6351224858174; Tue, 25 Aug 2026 12:11:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYF-0005Gg-VA; Tue, 25 Aug 2026 15:11:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYE-0005Cw-Ln for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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 1wywYD-00044H-1y for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:14 -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-686-2xD1sbghNOmoCBF7nApFbw-1; Tue, 25 Aug 2026 15:11:08 -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 10A631953943; Tue, 25 Aug 2026 19:11:07 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 42DED18005B4; Tue, 25 Aug 2026 19:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mpb/2b3qMFQzTLzTCER3qNfrQzUe3H5wt66hPLCR09I=; b=URWxBQtqY8omK4E+r0cYKzHJkkHZ50XjncRCrTT5YIj84vhV5GwHybomK4iEoU6UayNptB UJ1eRJEiIfmVlFs8vwvq+DFjcGZtNdQcA7/BqYSzTiTgqXyzWvkh/v5wkWTFwjjiE2GOKj hyxUs90PjKBJZRJm+fquEQE3mohOKBA= X-MC-Unique: 2xD1sbghNOmoCBF7nApFbw-1 X-Mimecast-MFC-AGG-ID: 2xD1sbghNOmoCBF7nApFbw_1787685067 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:24 +0400 Subject: [PATCH v4 17/49] tests/qemu-iotests/205: fix race in assertExportNotFound MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-17-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1493; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=skNsYNNV1xMEy9mfAYu0UimfTtL6eome8md1k82hjKA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHEzoWa/QVyCu2VNLj2ztQsaGS58+bqg94R GPNYNaFILmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5eGfD/wNuSoC9HZBH4mB6ql2ngog4Q4Z43keZHid7/jTG4QyESdCxDkviF9pGQqqFadHRO/60RO ABBW8qXUXpSQYXvS2M33FQdC6+fEfJJd+7SpxR6+080fYZYFLKOvDeevNeBIHWT7/zlEK6GcsYo 0PppoF9voH88gs29KeYPvp6zGEVcQ+sWoB8oXp8IFT+6snLWmrwcoEot0oko8mbhxsvMgrFBdCr VpP6Fwu6h4mfiVaq086JbkjRmDeoJGOX1KixtrRAwfONZPbcUKPJTNlb/mUg5CHLtDy+ae26NAq W12qanRdUet3KE6GZt3rQF7U/M+WGLYYvM9eext9YmrgP8fT0IHt1QPC+QBDvzrFqyiQR1rXkVe 3J0JQd/7pmRpskrhV2frzbWI19HLwjZYEOhiJXIb4qZSF8+Kzrbj8oxTuDh3G4w/2sSJ57HHLCo YZAH927fW5V36oCAdYL+UxYCeOpRg7KIjZdxUXltg43aN0TruJMXYh3nOE0JTXAUUb7kNUoajU9 xfiX0/Z0QUYwhdRbRbOM8w75g5bDph8abJQKikASlQpSc/pkHgOsV+GG1Bn3hY4JkYd7D8hT+F7 m5yw9K3Vw5x8vxbcbp3RlBMEPGKNTneZUKE+eyxAQZDLvI5dNMoe1bI7gRmt1ULESDquzkBUE+B N3f9Q4mIihIKKDw== 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: 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: 1787685102505158500 After nbd-server-remove with mode=3Dhard and an active client, the export is removed from the NBD export list synchronously but remains in the block export list until async cleanup completes (via blk_exp_delete_bh bottom-half). A subsequent nbd-server-remove call may find the export still in the block list with user_owned=3Dfalse, returning "already shutting down" instead of "not found". Accept both error messages in assertExportNotFound, since both indicate the export is no longer usable. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/205 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index 2370e1a138b1..78459065418c 100755 --- a/tests/qemu-iotests/205 +++ b/tests/qemu-iotests/205 @@ -60,7 +60,9 @@ class TestNbdServerRemove(iotests.QMPTestCase): =20 def assertExportNotFound(self, name): result =3D self.vm.qmp('nbd-server-remove', name=3Dname) - self.assert_qmp(result, 'error/desc', "Export 'exp' is not found") + desc =3D result.get('error', {}).get('desc', '') + self.assertIn(desc, ("Export '%s' is not found" % name, + "Export '%s' is already shutting down" % name= )) =20 def assertExistingClients(self, result): self.assert_qmp(result, 'error/desc', "export 'exp' still in use") --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685107; cv=none; d=zohomail.com; s=zohoarc; b=gySQ/srhOotWHLPwXN0ak+dEIlG7np4aZV90XAS2DQ98HPtWT4s3fl9MUV4dJG6BIapSypZ5GfZ1ZfkponOX/9E7xUnP5wuWNJmTgUAUnooZ4cPGtdv0PVUWQFe+nFukcagnOzhyojod5q8CMi2hdIiY5Ra2BPsB2sW0xa0xtH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685107; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L1xp1lTvd3MdMUX8dmf1CMEjnTVNcsxKTotSufqvHi0=; b=h9IJvWujAy1SGg+v9yOgZ93ahEMtylq6vCjnhPUEIpsRRAU8khBhw0OkzTx1mx9r9TGi7qfPvppeZ5lFhxoFlf1Y8kTXQTN6USR9dfcLWFoIW91p+Hk5ln/brZoVYW24aB9U++LItUOgF8IZhI5fvIGmNyRaagZzVUJPKSPuk8o= 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 1787685107989253.274160004637; Tue, 25 Aug 2026 12:11:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYJ-0005RN-L6; Tue, 25 Aug 2026 15:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYH-0005Hg-S1 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYF-00044u-Et for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:17 -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-466-cdFoCMiPOi-GkTAmSTL7cQ-1; Tue, 25 Aug 2026 15:11:13 -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 DF8051886217; Tue, 25 Aug 2026 19:11:10 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ED2E6434; Tue, 25 Aug 2026 19:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1xp1lTvd3MdMUX8dmf1CMEjnTVNcsxKTotSufqvHi0=; b=H94Kb3QgSIwSKM8SIOc2hJY4DFyAmc6U0ue++VW1ynkIozkKxuN9EbSg1FjqTrTeuqrn2C rtcOx6S+tymUMRRcg1RjZjajzZi0tuyIGuczCv+ngzBM+xShij8gAj1a+oNJBkWEs01d2U rVLVeWJ186+Vdy3inVyzWJg7y2mhMBQ= X-MC-Unique: cdFoCMiPOi-GkTAmSTL7cQ-1 X-Mimecast-MFC-AGG-ID: cdFoCMiPOi-GkTAmSTL7cQ_1787685071 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:25 +0400 Subject: [PATCH v4 18/49] net: add x-query-network QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-18-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Jason Wang , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=13471; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=5ogvqlrNxwtpqR/CR70+i3muFtGVdTJv35bVBwQ7mug=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHbAPBG5oEjMTOAx0Qvsa0qYEv6xSIhWR9F j2v2kW2A+KJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5Su/D/99dAs8fQJXW8GP+zB1xF2mADfKjTTZqcbn/L3lwlx8YaJm3lbByWeVmzpyhNY7CQVkH7o uCQDjfEibMX/3xASoGRf5LJAOHUSdlrtxdIVSdsNn1byE0C7fkn7abcIBtpU0cor6D6ofnpn3lv kqOH5IzZdjI6RpzFmlX/+w8gzbPYPGuguYrQFSJKpzmLC6G8co7W8c34+RPJbVe4djSe7pfswdL nXZjas/L6LoHrqU5L7YqDKUNFbpHnqQrbjcmkYvBQtTfslJ5D+L22C/yXJMJ3N5R/x0bv5s7BSD 5vZL8aj8y+X/cE76jDy5fGKamLjNxLb1p1+GlhS/pYnOe5/WjIZ1PnkM4krYqbPIIYTMfVDKBQZ iNSP4riUjDl722pZMbhRB5ixIq2uhek+fErB4I+F/kHmV5y/BtBTtkHQKimoIPRNAleDAAAfN8I 9XfKXLhW2KWZbQpL6I/BtgAAKVFOwgDnriso632ggnWMKeTS1kN54L0ueTtkzQj3OXIAKCLACQx 9rHZkzE/ReKJjMaS6Gx8o+NBHTs89sPw3SvJmqeNF29HMV8D4Q/NKDOzoEhnH1WKN+RPD1RJwp+ E+0MA011SFbrcapHKX7Ia+JsfyjO5I5bHRamaK2KZDFGvimKRz3W2pqTz7GYsjG2+m2+g22tKhL Q8yzOGjTjvOtJXg== 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: 1787685108532158500 Add a structured x-query-network QMP command that returns network configuration as a NetworkInfo struct with pre-grouped hub information and a flat list of non-hub clients. Each hub includes its ports with inlined peer client info, and each client includes attached netfilter details. Refactor hmp_info_network() to consume only the QMP result instead of directly accessing internal net_clients state. This decouples HMP from internal data structures, making it possible to remove HMP support without losing programmatic network introspection. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685173; cv=none; d=zohomail.com; s=zohoarc; b=YMGr18le36uCxrR3fqurXEoj+RTS4CHffFJ6wEXzw8KNZ8D9W7u2hO0wBX/akZYrXXT/SamNKnzd/HL9JBRfHZXlKyIaWs6zknnGL3g3pAxrg7XNJ+msDX4Px2W6I20I+cSLxcXnxzJFw5vTck//JwEdrWh8rKAk2EU7JgQMEdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685173; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5me9IKB/1eEE3FMoQ1tv4Jcm7F9fMPCSAmLmmud3nJs=; b=Xw3ZDcShs+vduNt7vIZgB3JSpqcCr0uBMz7kSfUqc2JgmXlFEeVB9r/v0br4Vm2deLZ4k7yxLj9Oipn8aQ7SbQ6/H7F4QJlfVxzhxspqjHw9Qag1YAf2wL9ISu0mnuh2Gfp2v7Wb06OpPt+BxDC1kUmNKmKhPY07dairIwWWP9A= 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 1787685173099360.2154842841911; Tue, 25 Aug 2026 12:12:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYO-0005YH-Cu; Tue, 25 Aug 2026 15:11: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 1wywYL-0005VA-01 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:21 -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 1wywYI-00045H-Fm for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:20 -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-139-wYypShFhPwaGU8NiiWZ5fQ-1; Tue, 25 Aug 2026 15:11:15 -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 1AE26183F9F7; Tue, 25 Aug 2026 19:11:14 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4AB2430002F7; Tue, 25 Aug 2026 19:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5me9IKB/1eEE3FMoQ1tv4Jcm7F9fMPCSAmLmmud3nJs=; b=E/T2/fnbj1y0HrMKIP6L1VK9IO8zYBeS+LCY4P4o3YrQLNJP0N60C6ymbPEJnhXhZEQyys 5N71+S8tyBpc8eiTCpiwCVVIWaHc6Lx9WCmK4c5d0Ik0H0YwOzucfTlTVsGvWUyVO2qelV dmtr3V4nFaZK5H6T9PDaeE3CRl8gHHc= X-MC-Unique: wYypShFhPwaGU8NiiWZ5fQ-1 X-Mimecast-MFC-AGG-ID: wYypShFhPwaGU8NiiWZ5fQ_1787685074 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:26 +0400 Subject: [PATCH v4 19/49] tests/qtest/netdev-socket: replace HMP with x-query-network QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-19-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=12768; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=YA9IeNRf5eE0PbcbZTc2CKcxjqnSRjTaO3sj+6MVCNQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHzxRs70jYlX+EdBXXa1//+3eIvH7uIAOEJ sC8TbtIbBqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5TuRD/9Ez7vRUTD7Nf0hf+zArWWEcj/5ILO2OWrRk0ygf9QQbjjdLEIQPaYaQW+UlLVnz1Q4jUW y/E7Tfbj2ZvWjg58c/6WwKyqCF7JW5HRdwjzCGinAodATexHrPfGE0pdIu3MhQpNUXl61P6jVJX 5iMYBN9FekEIeB1ir+oYkxOpmPpPlU8vlVD61Cjr0lg4tVr9rx7oj94Y7oEtZtMwV0Z3mrd02Nz 4eVEQbyOpZW9QgVdVAWiLwOpD5897+LtdLIEo430/Hex5GUcYLBTe17ZogmUmkQ1h0IFXkO97Op SPNOK2dIQTaWd9XtbVjM1WSDA0AdQBxRitEXBk7awOpZFRgpIHaKm+/7+xxbyLoHI7CkzR6lCgc hkt2MkK85inW+ppKxLObmAzb8LDeer4u0IPJQcrmh/ENeaTamErO5NS4fKpIAYIihArD3NVdedJ 8vTJOeIH0V1lqvFKJwyhGvZrQcy5DW+s6r3W8Gh4vpwdffCGEFkdcbZvFTC4JxO6i25FjBpsc8O 9sy0D1vMuQ3F9NhGncSUcXZnpbAK9MGb12x5bnIyF4sUsU2ogg3VcZH9LFN9suNhWLX9fZ0So7g 8zQdrqQOOFk/OH3nPeNDRhhruXkeUZKABDcACmau4qWe9M5zEEb3bShr0EJvTTDidbbEq9uuiMN +zsbVhbK0FbqVZQ== 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: 1787685174898158500 Replace the HMP "info network" text parsing with the structured x-query-network QMP command. This makes the test assertions more robust by matching individual fields (info-str) instead of parsing the full HMP line format. The EXPECT_STATE macro now takes an explicit netdev id argument to look up the client by name in the QMP response. The strrchr truncation is made NULL-safe: if the truncation character is not found, the full string is compared (and the final g_assert_cmpstr will catch mismatches). While at it, fix the pre-existing duplicate "qemu/sockets.h" include, and reorder includes. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685133; cv=none; d=zohomail.com; s=zohoarc; b=E2jvlvNh00Y9wgm3wIsnLq1pkRXDZIihMxN2PebfdU1/UgFsxytB6NDIwvSafKK3f6Er3MIerL7fmV2BhFdw2J21TI/s+g5BlYRtPz/BhEbGL+ty/SvQVFy8vaQ1sN++s14W7ipUOJd5jpE7f6mx5yppGmEFjxUDZC0h60915Os= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685133; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n7cL9jkG1qTwA+bQqy6YVKpxCwpQSIY9VApSEqym9nA=; b=Nm+HwlUDIFJsFJTZbxuYA1G1K1dKeI2QW7OCXuOMw4fT/XMySxKd08OSAsDGNEuj2zDCIJ4IlZ1ETdBHu40r3eSwFqCgDGSR1UBNaSQg/QhHJ09V/JHbLYtsUkhrVq6PwpQS6gVxMkTvTdBisPCuyVe/UrOaI8ADAdi619qJwVw= 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 178768513375519.418272907485402; Tue, 25 Aug 2026 12:12:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYk-00069e-1H; Tue, 25 Aug 2026 15:11:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYV-0005m3-Oh for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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 1wywYQ-00046m-Vn for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:31 -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-572-ZguA6lhrN2Cy2rMThsUDUA-1; Tue, 25 Aug 2026 15:11:21 -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 0E6C7188FEF0; Tue, 25 Aug 2026 19:11:19 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2109A1944B2D; Tue, 25 Aug 2026 19:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n7cL9jkG1qTwA+bQqy6YVKpxCwpQSIY9VApSEqym9nA=; b=L+ApE2tgiEGqo90sn59Ez3eMucGBrNq1bHBE++otf+Ykr2bIqZOEdsPgDKOd0pPDcGk32g WOAVdUOYs+u5MraU23OgxpHdOSf4+2oYTehp4o/zpJErTRF8hY8H/f7VKQ7N84wvlX0pjd LomfGIfLJWUuyIR08nRn14pv5gLTTuw= X-MC-Unique: ZguA6lhrN2Cy2rMThsUDUA-1 X-Mimecast-MFC-AGG-ID: ZguA6lhrN2Cy2rMThsUDUA_1787685079 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:27 +0400 Subject: [PATCH v4 20/49] qemu-io: propagate errors through Error API instead of printf MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-20-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Eric Blake , Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=150642; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zQHMNaYObNXnDZ8CiRgCLzH9MMH+iYmDHmRqyMJuIzc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHZDdkvZGj/NGnGexIdv0jsv6xbB1voCtlD kgbqYPE23SJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5awaD/92PryAJzfStr5yHgTkwu8n9/Mee/LLIlOvqt08wMNR8NzqNSc0/JKWSpnJuWFxOR9JnFt 5cDwQne66B0QGp9EZc0fnO6iha7R4EObdjqz4YK6drVUoDllBS3KrJvt/GpECc2UFh1Lt5B8Yto MC4zyBvr7z/a2smhomonf1DaVTKvx3Swm+wDO22rP7SUbqwOM5MicFdgOhab8J3jheV3biFQDpO IpyehYJwGCjOYDPpKDKWuJtasNMpcMrtI/dLLUV8nODYOTS2mleTAMZlDFPRBIT4amZj1IoRHLe OyR9lFyLrVynDcM5fB0UtnDJUKwJT5ziouniNduLZmNbUrzKpAHmwiPVuIkPdN3RFVhByjEjhlU kHmkMTomqWaHVKsGF6wSZvf26U+9z9qEpEwL81fUXraIvEPJZ3aTLMugGj9nTnAz4ESk4RBzg6z OB7tRSdKyS9PJpb0Ec4FcTpDndyUjboAWwNHuXaRDse9sNHW9xgf5NATPaSCpGTjF3ds2XCgKZs gB4qC9YzhYy9WzgKql+e0rofpQQHuuNaxAejpjA8ncCqwxAIoWSAGscveBsrQO0Pj5Q2qdfSq/D JQPCHMfC+Ft9b3C/8BZmA0kicPUw80t+q67a1E39AtDa9lw2opR7hsw6uyYxVsh/f1cvzZ26CvY Z2LTCVAzR8X/XcA== 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: 1787685138732158500 Convert the qemu-io command infrastructure to use QEMU's Error API (Error **errp) for error propagation instead of printing directly to stdout/stderr via printf/fprintf. The cfunc_t typedef, all ~35 command functions, the dispatcher chain (command/init_check_command/qemuio_command), and helper functions (parse_pattern, create_iovec, qemu_io_alloc_from_file) all gain an Error **errp parameter. Async completion callbacks (aio_read_done, aio_write_done, aio_discard_done) use error_report() since they have no Error path back to the caller. Update tests: - error_report_err() prepends qemu-io: prefix - copy-before-write: check the HMP return value, rather than stdio - other tests: update to check JSON {"return": "Error: error text"} Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- block/monitor/block-hmp-cmds.c | 2 +- include/qemu-io.h | 4 +- qemu-io-cmds.c | 414 +++++++++++++--------= ---- qemu-io.c | 17 +- tests/qemu-iotests/004.out | 20 +- tests/qemu-iotests/021.out | 60 ++-- tests/qemu-iotests/026.out | 228 +++++++------- tests/qemu-iotests/060.out | 44 ++- tests/qemu-iotests/071.out | 10 +- tests/qemu-iotests/072.out | 2 +- tests/qemu-iotests/080.out | 4 +- tests/qemu-iotests/081.out | 2 +- tests/qemu-iotests/083.out | 36 +-- tests/qemu-iotests/089.out | 4 +- tests/qemu-iotests/114.out | 2 +- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/137.out | 2 +- tests/qemu-iotests/153.out | 12 +- tests/qemu-iotests/171 | 2 +- tests/qemu-iotests/171.out | 68 ++-- tests/qemu-iotests/205 | 2 +- tests/qemu-iotests/214.out | 2 +- tests/qemu-iotests/220.out | 2 +- tests/qemu-iotests/225.out | 4 +- tests/qemu-iotests/244.out | 12 +- tests/qemu-iotests/249.out | 6 +- tests/qemu-iotests/271.out | 14 +- tests/qemu-iotests/289.out | 2 +- tests/qemu-iotests/305.out | 2 +- tests/qemu-iotests/307.out | 2 +- tests/qemu-iotests/tests/backup-discard-source | 4 +- tests/qemu-iotests/tests/copy-before-write | 66 ++-- tests/qemu-iotests/tests/file-io-error.out | 2 +- tests/qemu-iotests/tests/image-fleecing.out | 12 +- tests/qemu-iotests/tests/inactive-node-nbd.out | 8 +- 35 files changed, 552 insertions(+), 523 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 39b82e8ef501..9930620a4a16 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -598,7 +598,7 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) * extended, possibly resulting in a read-only guest device keeping wr= ite * permissions. Ugly, but it appears to be the lesser evil. */ - qemuio_command(blk, command); + qemuio_command(blk, command, &err); =20 fail: blk_unref(local_blk); diff --git a/include/qemu-io.h b/include/qemu-io.h index 3af513004a68..240764bb35cd 100644 --- a/include/qemu-io.h +++ b/include/qemu-io.h @@ -25,7 +25,7 @@ * Operate on @blk using @argc/@argv as the command's arguments, and * return 0 on success or negative errno on failure. */ -typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv); +typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv, Error **e= rrp); =20 typedef void (*helpfunc_t)(void); =20 @@ -45,7 +45,7 @@ typedef struct cmdinfo { =20 extern bool qemuio_misalign; =20 -int qemuio_command(BlockBackend *blk, const char *cmd); +int qemuio_command(BlockBackend *blk, const char *cmd, Error **errp); =20 void qemuio_add_command(const cmdinfo_t *ci); void qemuio_command_usage(const cmdinfo_t *ci); diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index de4c1966feae..aa795fd87a14 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -55,40 +55,43 @@ void qemuio_command_usage(const cmdinfo_t *ci) printf("%s %s -- %s\n", ci->name, ci->args, ci->oneline); } =20 -static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct) +static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct, + Error **errp) { if (ct->flags & CMD_FLAG_GLOBAL) { return 1; } if (!(ct->flags & CMD_NOFILE_OK) && !blk) { - fprintf(stderr, "no file open, try 'help open'\n"); + error_setg(errp, "no file open, try 'help open'"); return 0; } return 1; } =20 static int command(BlockBackend *blk, const cmdinfo_t *ct, int argc, - char **argv) + char **argv, Error **errp) { char *cmd =3D argv[0]; =20 - if (!init_check_command(blk, ct)) { + if (!init_check_command(blk, ct, errp)) { return -EINVAL; } =20 if (argc - 1 < ct->argmin || (ct->argmax !=3D -1 && argc - 1 > ct->arg= max)) { if (ct->argmax =3D=3D -1) { - fprintf(stderr, - "bad argument count %d to %s, expected at least %d arg= uments\n", - argc-1, cmd, ct->argmin); + error_setg(errp, + "bad argument count %d to %s," + " expected at least %d arguments", + argc - 1, cmd, ct->argmin); } else if (ct->argmin =3D=3D ct->argmax) { - fprintf(stderr, - "bad argument count %d to %s, expected %d arguments\n", - argc-1, cmd, ct->argmin); + error_setg(errp, + "bad argument count %d to %s, expected %d arguments= ", + argc - 1, cmd, ct->argmin); } else { - fprintf(stderr, - "bad argument count %d to %s, expected between %d and = %d arguments\n", - argc-1, cmd, ct->argmin, ct->argmax); + error_setg(errp, + "bad argument count %d to %s," + " expected between %d and %d arguments", + argc - 1, cmd, ct->argmin, ct->argmax); } return -EINVAL; } @@ -112,21 +115,19 @@ static int command(BlockBackend *blk, const cmdinfo_t= *ct, int argc, =20 if (ct->perm & ~orig_perm) { uint64_t new_perm; - Error *local_err =3D NULL; int ret; =20 new_perm =3D orig_perm | ct->perm; =20 - ret =3D blk_set_perm(blk, new_perm, orig_shared_perm, &local_e= rr); + ret =3D blk_set_perm(blk, new_perm, orig_shared_perm, errp); if (ret < 0) { - error_report_err(local_err); return ret; } } } =20 qemu_reset_optind(); - return ct->cfunc(blk, argc, argv); + return ct->cfunc(blk, argc, argv, errp); } =20 static const cmdinfo_t *find_command(const char *cmd) @@ -192,18 +193,18 @@ static int64_t cvtnum(const char *s) return value; } =20 -static void print_cvtnum_err(int64_t rc, const char *arg) +static void set_cvtnum_err(int64_t rc, const char *arg, Error **errp) { switch (rc) { case -EINVAL: - printf("Parsing error: non-numeric argument," - " or extraneous/unrecognized suffix -- %s\n", arg); + error_setg(errp, "Parsing error: non-numeric argument," + " or extraneous/unrecognized suffix -- %s", arg); break; case -ERANGE: - printf("Parsing error: argument too large -- %s\n", arg); + error_setg(errp, "Parsing error: argument too large -- %s", arg); break; default: - printf("Parsing error: %s\n", arg); + error_setg(errp, "Parsing error: %s", arg); } } =20 @@ -316,14 +317,14 @@ static void timestr(struct timespec *tv, char *ts, si= ze_t size, int format) * Because the pattern is used as an argument to memset it must evaluate * to an unsigned integer that fits into a single byte. */ -static int parse_pattern(const char *arg) +static int parse_pattern(const char *arg, Error **errp) { char *endptr =3D NULL; long pattern; =20 pattern =3D strtol(arg, &endptr, 0); if (pattern < 0 || pattern > UCHAR_MAX || *endptr !=3D '\0') { - printf("%s is not a valid pattern byte\n", arg); + error_setg(errp, "%s is not a valid pattern byte", arg); return -1; } =20 @@ -386,7 +387,8 @@ static void qemu_io_free(BlockBackend *blk, void *p, si= ze_t len, * NULL on error */ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, - const char *file_name, bool register_= buf) + const char *file_name, bool register_= buf, + Error **errp) { size_t alloc_len =3D len + (qemuio_misalign ? MISALIGN_OFFSET : 0); char *alloc_buf, *buf, *end; @@ -394,7 +396,7 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk,= size_t len, int pattern_len; =20 if (!f) { - perror(file_name); + error_setg_errno(errp, errno, "%s", file_name); return NULL; } =20 @@ -407,12 +409,12 @@ static void *qemu_io_alloc_from_file(BlockBackend *bl= k, size_t len, pattern_len =3D fread(buf, 1, len, f); =20 if (ferror(f)) { - perror(file_name); + error_setg_errno(errp, errno, "%s", file_name); goto error; } =20 if (pattern_len =3D=3D 0) { - fprintf(stderr, "%s: file is empty\n", file_name); + error_setg(errp, "%s: file is empty", file_name); goto error; } =20 @@ -494,7 +496,7 @@ static void print_report(const char *op, struct timespe= c *t, int64_t offset, */ static void * create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_io= v, - int pattern, bool register_buf) + int pattern, bool register_buf, Error **errp) { size_t *sizes =3D g_new0(size_t, nr_iov); size_t count =3D 0; @@ -508,19 +510,20 @@ create_iovec(BlockBackend *blk, QEMUIOVector *qiov, c= har **argv, int nr_iov, =20 len =3D cvtnum(arg); if (len < 0) { - print_cvtnum_err(len, arg); + set_cvtnum_err(len, arg, errp); goto fail; } =20 if (len > BDRV_REQUEST_MAX_BYTES) { - printf("Argument '%s' exceeds maximum size %" PRIu64 "\n", arg, - (uint64_t)BDRV_REQUEST_MAX_BYTES); + error_setg(errp, "Argument '%s' exceeds maximum size %" PRIu64, + arg, (uint64_t)BDRV_REQUEST_MAX_BYTES); goto fail; } =20 if (count > BDRV_REQUEST_MAX_BYTES - len) { - printf("The total number of bytes exceed the maximum size %" P= RIu64 - "\n", (uint64_t)BDRV_REQUEST_MAX_BYTES); + error_setg(errp, + "The total number of bytes exceed the maximum size = %" + PRIu64, (uint64_t)BDRV_REQUEST_MAX_BYTES); goto fail; } =20 @@ -692,7 +695,7 @@ static void read_help(void) "\n"); } =20 -static int read_f(BlockBackend *blk, int argc, char **argv); +static int read_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t read_cmd =3D { .name =3D "read", @@ -705,7 +708,7 @@ static const cmdinfo_t read_cmd =3D { .help =3D read_help, }; =20 -static int read_f(BlockBackend *blk, int argc, char **argv) +static int read_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, vflag =3D false; @@ -732,7 +735,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) lflag =3D true; pattern_count =3D cvtnum(optarg); if (pattern_count < 0) { - print_cvtnum_err(pattern_count, optarg); + set_cvtnum_err(pattern_count, optarg, errp); return pattern_count; } break; @@ -741,7 +744,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -756,7 +759,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) sflag =3D true; pattern_offset =3D cvtnum(optarg); if (pattern_offset < 0) { - print_cvtnum_err(pattern_offset, optarg); + set_cvtnum_err(pattern_offset, optarg, errp); return pattern_offset; } break; @@ -776,18 +779,18 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); return count; } else if (count > BDRV_REQUEST_MAX_BYTES) { - printf("length cannot exceed %" PRIu64 ", given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, "length cannot exceed %" PRIu64 ", given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 @@ -801,24 +804,26 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) } =20 if ((pattern_count < 0) || (pattern_count + pattern_offset > count)) { - printf("pattern verification range exceeds end of read data\n"); + error_setg(errp, "pattern verification range exceeds end of read d= ata"); return -EINVAL; } =20 if (bflag) { if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) { - printf("%" PRId64 " is not a sector-aligned value for 'offset'= \n", - offset); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'off= set'", + offset); return -EINVAL; } if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) { - printf("%"PRId64" is not a sector-aligned value for 'count'\n", - count); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'cou= nt'", + count); return -EINVAL; } if (flags & BDRV_REQ_REGISTERED_BUF) { - printf("I/O buffer registration is not supported when reading " - "from vmstate\n"); + error_setg(errp, "I/O buffer registration is not supported whe= n" + " reading from vmstate"); return -EINVAL; } } @@ -834,7 +839,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("read failed: %s\n", strerror(-ret)); + error_setg(errp, "read failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -845,9 +850,9 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) void *cmp_buf =3D g_malloc(pattern_count); memset(cmp_buf, pattern, pattern_count); if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) { - printf("Pattern verification failed at offset %" - PRId64 ", %"PRId64" bytes\n", - offset + pattern_offset, pattern_count); + error_setg(errp, "Pattern verification failed at offset %" + PRId64 ", %" PRId64 " bytes", + offset + pattern_offset, pattern_count); ret =3D -EINVAL; } g_free(cmp_buf); @@ -890,7 +895,7 @@ static void readv_help(void) "\n"); } =20 -static int readv_f(BlockBackend *blk, int argc, char **argv); +static int readv_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t readv_cmd =3D { .name =3D "readv", @@ -902,7 +907,7 @@ static const cmdinfo_t readv_cmd =3D { .help =3D readv_help, }; =20 -static int readv_f(BlockBackend *blk, int argc, char **argv) +static int readv_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, vflag =3D false; @@ -924,7 +929,7 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -952,14 +957,14 @@ static int readv_f(BlockBackend *blk, int argc, char = **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; =20 nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, 0xab, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } @@ -969,7 +974,7 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("readv failed: %s\n", strerror(-ret)); + error_setg(errp, "readv failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -980,8 +985,8 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) void *cmp_buf =3D g_malloc(qiov.size); memset(cmp_buf, pattern, qiov.size); if (memcmp(buf, cmp_buf, qiov.size)) { - printf("Pattern verification failed at offset %" - PRId64 ", %zu bytes\n", offset, qiov.size); + error_setg(errp, "Pattern verification failed at offset %" + PRId64 ", %zu bytes", offset, qiov.size); ret =3D -EINVAL; } g_free(cmp_buf); @@ -1031,7 +1036,7 @@ static void write_help(void) "\n"); } =20 -static int write_f(BlockBackend *blk, int argc, char **argv); +static int write_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t write_cmd =3D { .name =3D "write", @@ -1045,7 +1050,7 @@ static const cmdinfo_t write_cmd =3D { .help =3D write_help, }; =20 -static int write_f(BlockBackend *blk, int argc, char **argv) +static int write_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, bflag =3D false; @@ -1082,7 +1087,7 @@ static int write_f(BlockBackend *blk, int argc, char = **argv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -1115,72 +1120,78 @@ static int write_f(BlockBackend *blk, int argc, cha= r **argv) } =20 if (bflag && zflag) { - printf("-b and -z cannot be specified at the same time\n"); + error_setg(errp, "-b and -z cannot be specified at the same time"); return -EINVAL; } =20 if ((flags & BDRV_REQ_FUA) && (bflag || cflag)) { - printf("-f and -b or -c cannot be specified at the same time\n"); + error_setg(errp, + "-f and -b or -c cannot be specified at the same time"); return -EINVAL; } =20 if ((flags & BDRV_REQ_NO_FALLBACK) && !zflag) { - printf("-n requires -z to be specified\n"); + error_setg(errp, "-n requires -z to be specified"); return -EINVAL; } =20 if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) { - printf("-u requires -z to be specified\n"); + error_setg(errp, "-u requires -z to be specified"); return -EINVAL; } =20 if (zflag + Pflag + sflag > 1) { - printf("Only one of -z, -P, and -s " - "can be specified at the same time\n"); + error_setg(errp, "Only one of -z, -P, and -s " + "can be specified at the same time"); return -EINVAL; } =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); return count; } else if (count > BDRV_REQUEST_MAX_BYTES && !(flags & BDRV_REQ_NO_FALLBACK)) { - printf("length cannot exceed %" PRIu64 " without -n, given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, + "length cannot exceed %" PRIu64 " without -n, given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 if (bflag || cflag) { if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) { - printf("%" PRId64 " is not a sector-aligned value for 'offset'= \n", - offset); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'off= set'", + offset); return -EINVAL; } =20 if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) { - printf("%"PRId64" is not a sector-aligned value for 'count'\n", - count); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'cou= nt'", + count); return -EINVAL; } } =20 if (zflag) { if (flags & BDRV_REQ_REGISTERED_BUF) { - printf("cannot combine zero write with registered I/O buffer\n= "); + error_setg(errp, + "cannot combine zero write with registered I/O buff= er"); return -EINVAL; } } else { if (sflag) { buf =3D qemu_io_alloc_from_file(blk, count, file_name, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, + errp); if (!buf) { return -EINVAL; } @@ -1203,7 +1214,7 @@ static int write_f(BlockBackend *blk, int argc, char = **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("write failed: %s\n", strerror(-ret)); + error_setg(errp, "write failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -1245,7 +1256,7 @@ writev_help(void) "\n"); } =20 -static int writev_f(BlockBackend *blk, int argc, char **argv); +static int writev_f(BlockBackend *blk, int argc, char **argv, Error **errp= ); =20 static const cmdinfo_t writev_cmd =3D { .name =3D "writev", @@ -1258,7 +1269,7 @@ static const cmdinfo_t writev_cmd =3D { .help =3D writev_help, }; =20 -static int writev_f(BlockBackend *blk, int argc, char **argv) +static int writev_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false; @@ -1287,7 +1298,7 @@ static int writev_f(BlockBackend *blk, int argc, char= **argv) flags |=3D BDRV_REQ_REGISTERED_BUF; break; case 'P': - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -1305,14 +1316,14 @@ static int writev_f(BlockBackend *blk, int argc, ch= ar **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; =20 nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } @@ -1322,7 +1333,7 @@ static int writev_f(BlockBackend *blk, int argc, char= **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("writev failed: %s\n", strerror(-ret)); + error_setg(errp, "writev failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -1367,7 +1378,7 @@ static void aio_write_done(void *opaque, int ret) =20 =20 if (ret < 0) { - printf("aio_write failed: %s\n", strerror(-ret)); + error_report("aio_write failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -1399,7 +1410,7 @@ static void aio_read_done(void *opaque, int ret) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("readv failed: %s\n", strerror(-ret)); + error_report("readv failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -1409,8 +1420,8 @@ static void aio_read_done(void *opaque, int ret) =20 memset(cmp_buf, ctx->pattern, ctx->qiov.size); if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) { - printf("Pattern verification failed at offset %" - PRId64 ", %zu bytes\n", ctx->offset, ctx->qiov.size); + error_report("Pattern verification failed at offset %" + PRId64 ", %zu bytes", ctx->offset, ctx->qiov.size= ); } g_free(cmp_buf); } @@ -1461,7 +1472,7 @@ static void aio_read_help(void) "\n"); } =20 -static int aio_read_f(BlockBackend *blk, int argc, char **argv); +static int aio_read_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); =20 static const cmdinfo_t aio_read_cmd =3D { .name =3D "aio_read", @@ -1473,7 +1484,7 @@ static const cmdinfo_t aio_read_cmd =3D { .help =3D aio_read_help, }; =20 -static int aio_read_f(BlockBackend *blk, int argc, char **argv) +static int aio_read_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { int nr_iov, c; struct aio_ctx *ctx =3D g_new0(struct aio_ctx, 1); @@ -1486,7 +1497,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) break; case 'P': ctx->Pflag =3D true; - ctx->pattern =3D parse_pattern(optarg); + ctx->pattern =3D parse_pattern(optarg, errp); if (ctx->pattern < 0) { g_free(ctx); return -EINVAL; @@ -1522,7 +1533,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { int ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -1530,7 +1541,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) =20 nr_iov =3D argc - optind; ctx->buf =3D create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab, - ctx->flags & BDRV_REQ_REGISTERED_BUF); + ctx->flags & BDRV_REQ_REGISTERED_BUF, errp); if (ctx->buf =3D=3D NULL) { block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_READ); g_free(ctx); @@ -1573,7 +1584,7 @@ static void aio_write_help(void) "\n"); } =20 -static int aio_write_f(BlockBackend *blk, int argc, char **argv); +static int aio_write_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp); =20 static const cmdinfo_t aio_write_cmd =3D { .name =3D "aio_write", @@ -1586,7 +1597,7 @@ static const cmdinfo_t aio_write_cmd =3D { .help =3D aio_write_help, }; =20 -static int aio_write_f(BlockBackend *blk, int argc, char **argv) +static int aio_write_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { int nr_iov, c; int pattern =3D 0xcd; @@ -1611,7 +1622,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) ctx->flags |=3D BDRV_REQ_MAY_UNMAP; break; case 'P': - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { g_free(ctx); return -EINVAL; @@ -1639,25 +1650,26 @@ static int aio_write_f(BlockBackend *blk, int argc,= char **argv) } =20 if (ctx->zflag && optind !=3D argc - 2) { - printf("-z supports only a single length parameter\n"); + error_setg(errp, "-z supports only a single length parameter"); g_free(ctx); return -EINVAL; } =20 if ((ctx->flags & BDRV_REQ_MAY_UNMAP) && !ctx->zflag) { - printf("-u requires -z to be specified\n"); + error_setg(errp, "-u requires -z to be specified"); g_free(ctx); return -EINVAL; } =20 if (ctx->zflag && ctx->Pflag) { - printf("-z and -P cannot be specified at the same time\n"); + error_setg(errp, "-z and -P cannot be specified at the same time"); g_free(ctx); return -EINVAL; } =20 if (ctx->zflag && (ctx->flags & BDRV_REQ_REGISTERED_BUF)) { - printf("cannot combine zero write with registered I/O buffer\n"); + error_setg(errp, + "cannot combine zero write with registered I/O buffer"); g_free(ctx); return -EINVAL; } @@ -1665,7 +1677,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { int ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -1674,7 +1686,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) if (ctx->zflag) { int64_t count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); g_free(ctx); return count; } @@ -1685,7 +1697,8 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) } else { nr_iov =3D argc - optind; ctx->buf =3D create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, - pattern, ctx->flags & BDRV_REQ_REGISTERED_= BUF); + pattern, + ctx->flags & BDRV_REQ_REGISTERED_BUF, errp= ); if (ctx->buf =3D=3D NULL) { block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_WRITE); g_free(ctx); @@ -1703,7 +1716,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) return 0; } =20 -static int aio_flush_f(BlockBackend *blk, int argc, char **argv) +static int aio_flush_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { BlockAcctCookie cookie; block_acct_start(blk_get_stats(blk), &cookie, 0, BLOCK_ACCT_FLUSH); @@ -1718,7 +1731,7 @@ static const cmdinfo_t aio_flush_cmd =3D { .oneline =3D "completes all outstanding aio requests" }; =20 -static int flush_f(BlockBackend *blk, int argc, char **argv) +static int flush_f(BlockBackend *blk, int argc, char **argv, Error **errp) { return blk_flush(blk); } @@ -1735,7 +1748,7 @@ static inline int64_t tosector(int64_t bytes) return bytes >> BDRV_SECTOR_BITS; } =20 -static int zone_report_f(BlockBackend *blk, int argc, char **argv) +static int zone_report_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; int64_t offset; @@ -1745,17 +1758,17 @@ static int zone_report_f(BlockBackend *blk, int arg= c, char **argv) ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; val =3D cvtnum(argv[optind]); if (val < 0) { - print_cvtnum_err(val, argv[optind]); + set_cvtnum_err(val, argv[optind], errp); return val; } if (val > UINT_MAX) { - printf("Number of zones must be less than 2^32\n"); + error_setg(errp, "Number of zones must be less than 2^32"); return -ERANGE; } nr_zones =3D val; @@ -1764,7 +1777,7 @@ static int zone_report_f(BlockBackend *blk, int argc,= char **argv) zones =3D g_new(BlockZoneDescriptor, nr_zones); ret =3D blk_zone_report(blk, offset, &nr_zones, zones); if (ret < 0) { - printf("zone report failed: %s\n", strerror(-ret)); + error_setg(errp, "zone report failed: %s", strerror(-ret)); } else { for (int i =3D 0; i < nr_zones; ++i) { printf("start: 0x%" PRIx64 ", len 0x%" PRIx64 ", " @@ -1788,25 +1801,25 @@ static const cmdinfo_t zone_report_cmd =3D { .oneline =3D "report zone information", }; =20 -static int zone_open_f(BlockBackend *blk, int argc, char **argv) +static int zone_open_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_OPEN, offset, len); if (ret < 0) { - printf("zone open failed: %s\n", strerror(-ret)); + error_setg(errp, "zone open failed: %s", strerror(-ret)); } return ret; } @@ -1821,25 +1834,25 @@ static const cmdinfo_t zone_open_cmd =3D { .oneline =3D "explicit open a range of zones in zone block device", }; =20 -static int zone_close_f(BlockBackend *blk, int argc, char **argv) +static int zone_close_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_CLOSE, offset, len); if (ret < 0) { - printf("zone close failed: %s\n", strerror(-ret)); + error_setg(errp, "zone close failed: %s", strerror(-ret)); } return ret; } @@ -1854,25 +1867,25 @@ static const cmdinfo_t zone_close_cmd =3D { .oneline =3D "close a range of zones in zone block device", }; =20 -static int zone_finish_f(BlockBackend *blk, int argc, char **argv) +static int zone_finish_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_FINISH, offset, len); if (ret < 0) { - printf("zone finish failed: %s\n", strerror(-ret)); + error_setg(errp, "zone finish failed: %s", strerror(-ret)); } return ret; } @@ -1887,25 +1900,25 @@ static const cmdinfo_t zone_finish_cmd =3D { .oneline =3D "finish a range of zones in zone block device", }; =20 -static int zone_reset_f(BlockBackend *blk, int argc, char **argv) +static int zone_reset_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_RESET, offset, len); if (ret < 0) { - printf("zone reset failed: %s\n", strerror(-ret)); + error_setg(errp, "zone reset failed: %s", strerror(-ret)); } return ret; } @@ -1934,7 +1947,7 @@ static int do_aio_zone_append(BlockBackend *blk, QEMU= IOVector *qiov, return async_ret < 0 ? async_ret : 1; } =20 -static int zone_append_f(BlockBackend *blk, int argc, char **argv) +static int zone_append_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; bool pflag =3D false; @@ -1956,19 +1969,19 @@ static int zone_append_f(BlockBackend *blk, int arg= c, char **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } ret =3D do_aio_zone_append(blk, &qiov, &offset, flags, &total); if (ret < 0) { - printf("zone append failed: %s\n", strerror(-ret)); + error_setg(errp, "zone append failed: %s", strerror(-ret)); goto out; } =20 @@ -1994,7 +2007,7 @@ static const cmdinfo_t zone_append_cmd =3D { .oneline =3D "append write a number of bytes at a specified offset", }; =20 -static int truncate_f(BlockBackend *blk, int argc, char **argv); +static int truncate_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); static const cmdinfo_t truncate_cmd =3D { .name =3D "truncate", .altname =3D "t", @@ -2006,9 +2019,8 @@ static const cmdinfo_t truncate_cmd =3D { .oneline =3D "truncates the current file at the given offset", }; =20 -static int truncate_f(BlockBackend *blk, int argc, char **argv) +static int truncate_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { - Error *local_err =3D NULL; int64_t offset; int c, ret; PreallocMode prealloc =3D PREALLOC_MODE_OFF; @@ -2019,7 +2031,7 @@ static int truncate_f(BlockBackend *blk, int argc, ch= ar **argv) prealloc =3D qapi_enum_parse(&PreallocMode_lookup, optarg, PREALLOC_MODE__MAX, NULL); if (prealloc =3D=3D PREALLOC_MODE__MAX) { - error_report("Invalid preallocation mode '%s'", optarg); + error_setg(errp, "Invalid preallocation mode '%s'", optarg= ); return -EINVAL; } break; @@ -2031,7 +2043,7 @@ static int truncate_f(BlockBackend *blk, int argc, ch= ar **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[1]); + set_cvtnum_err(offset, argv[1], errp); return offset; } =20 @@ -2040,23 +2052,22 @@ static int truncate_f(BlockBackend *blk, int argc, = char **argv) * exact=3Dtrue. It is better to err on the "emit more errors" side * than to be overly permissive. */ - ret =3D blk_truncate(blk, offset, false, prealloc, 0, &local_err); + ret =3D blk_truncate(blk, offset, false, prealloc, 0, errp); if (ret < 0) { - error_report_err(local_err); return ret; } =20 return 0; } =20 -static int length_f(BlockBackend *blk, int argc, char **argv) +static int length_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int64_t size; char s1[64]; =20 size =3D blk_getlength(blk); if (size < 0) { - printf("getlength: %s\n", strerror(-size)); + error_setg(errp, "getlength: %s", strerror(-size)); return size; } =20 @@ -2074,12 +2085,12 @@ static const cmdinfo_t length_cmd =3D { }; =20 =20 -static int info_f(BlockBackend *blk, int argc, char **argv) +static int info_f(BlockBackend *blk, int argc, char **argv, Error **errp) { + ERRP_GUARD(); BlockDriverState *bs =3D blk_bs(blk); BlockDriverInfo bdi; ImageInfoSpecific *spec_info; - Error *local_err =3D NULL; char s1[64], s2[64]; int ret; =20 @@ -2104,9 +2115,8 @@ static int info_f(BlockBackend *blk, int argc, char *= *argv) printf("cluster size: %s\n", s1); printf("vm state offset: %s\n", s2); =20 - spec_info =3D bdrv_get_specific_info(bs, &local_err); - if (local_err) { - error_report_err(local_err); + spec_info =3D bdrv_get_specific_info(bs, errp); + if (*errp) { return -EIO; } if (spec_info) { @@ -2143,7 +2153,7 @@ static void discard_help(void) "\n"); } =20 -static int discard_f(BlockBackend *blk, int argc, char **argv); +static int discard_f(BlockBackend *blk, int argc, char **argv, Error **err= p); =20 static const cmdinfo_t discard_cmd =3D { .name =3D "discard", @@ -2157,7 +2167,7 @@ static const cmdinfo_t discard_cmd =3D { .help =3D discard_help, }; =20 -static int discard_f(BlockBackend *blk, int argc, char **argv) +static int discard_f(BlockBackend *blk, int argc, char **argv, Error **err= p) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false; @@ -2185,18 +2195,18 @@ static int discard_f(BlockBackend *blk, int argc, c= har **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; bytes =3D cvtnum(argv[optind]); if (bytes < 0) { - print_cvtnum_err(bytes, argv[optind]); + set_cvtnum_err(bytes, argv[optind], errp); return bytes; } else if (bytes > BDRV_REQUEST_MAX_BYTES) { - printf("length cannot exceed %"PRIu64", given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, "length cannot exceed %" PRIu64 ", given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 @@ -2205,7 +2215,7 @@ static int discard_f(BlockBackend *blk, int argc, cha= r **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("discard failed: %s\n", strerror(-ret)); + error_setg(errp, "discard failed: %s", strerror(-ret)); return ret; } =20 @@ -2238,7 +2248,8 @@ static void aio_discard_help(void) "\n"); } =20 -static int aio_discard_f(BlockBackend *blk, int argc, char **argv); +static int aio_discard_f(BlockBackend *blk, int argc, char **argv, + Error **errp); =20 static const cmdinfo_t aio_discard_cmd =3D { .name =3D "aio_discard", @@ -2259,7 +2270,7 @@ static void aio_discard_done(void *opaque, int ret) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("aio_discard failed: %s\n", strerror(-ret)); + error_report("aio_discard failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -2278,7 +2289,7 @@ out: g_free(ctx); } =20 -static int aio_discard_f(BlockBackend *blk, int argc, char **argv) +static int aio_discard_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int c, ret; int64_t count; @@ -2310,7 +2321,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -2318,7 +2329,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) =20 count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); g_free(ctx); return count; } @@ -2332,7 +2343,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) return 0; } =20 -static int alloc_f(BlockBackend *blk, int argc, char **argv) +static int alloc_f(BlockBackend *blk, int argc, char **argv, Error **errp) { BlockDriverState *bs =3D blk_bs(blk); int64_t offset, start, remaining, count; @@ -2342,14 +2353,14 @@ static int alloc_f(BlockBackend *blk, int argc, cha= r **argv) =20 start =3D offset =3D cvtnum(argv[1]); if (offset < 0) { - print_cvtnum_err(offset, argv[1]); + set_cvtnum_err(offset, argv[1], errp); return offset; } =20 if (argc =3D=3D 3) { count =3D cvtnum(argv[2]); if (count < 0) { - print_cvtnum_err(count, argv[2]); + set_cvtnum_err(count, argv[2], errp); return count; } } else { @@ -2361,7 +2372,7 @@ static int alloc_f(BlockBackend *blk, int argc, char = **argv) while (remaining) { ret =3D bdrv_is_allocated(bs, offset, remaining, &num); if (ret < 0) { - printf("is_allocated failed: %s\n", strerror(-ret)); + error_setg(errp, "is_allocated failed: %s", strerror(-ret)); return ret; } offset +=3D num; @@ -2422,7 +2433,7 @@ static int map_is_allocated(BlockDriverState *bs, int= 64_t offset, return firstret; } =20 -static int map_f(BlockBackend *blk, int argc, char **argv) +static int map_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int64_t offset, bytes; char s1[64], s2[64]; @@ -2433,17 +2444,18 @@ static int map_f(BlockBackend *blk, int argc, char = **argv) offset =3D 0; bytes =3D blk_getlength(blk); if (bytes < 0) { - error_report("Failed to query image length: %s", strerror(-bytes)); + error_setg(errp, "Failed to query image length: %s", strerror(-byt= es)); return bytes; } =20 while (bytes) { ret =3D map_is_allocated(blk_bs(blk), offset, bytes, &num); if (ret < 0) { - error_report("Failed to get allocation status: %s", strerror(-= ret)); + error_setg(errp, "Failed to get allocation status: %s", + strerror(-ret)); return ret; } else if (!num) { - error_report("Unexpected end of image"); + error_setg(errp, "Unexpected end of image"); return -EIO; } =20 @@ -2485,7 +2497,7 @@ static void reopen_help(void) "\n"); } =20 -static int reopen_f(BlockBackend *blk, int argc, char **argv); +static int reopen_f(BlockBackend *blk, int argc, char **argv, Error **errp= ); =20 static QemuOptsList reopen_opts =3D { .name =3D "reopen", @@ -2507,7 +2519,7 @@ static const cmdinfo_t reopen_cmd =3D { .help =3D reopen_help, }; =20 -static int reopen_f(BlockBackend *blk, int argc, char **argv) +static int reopen_f(BlockBackend *blk, int argc, char **argv, Error **errp) { BlockDriverState *bs =3D blk_bs(blk); QemuOpts *qopts; @@ -2517,13 +2529,12 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **argv) bool writethrough =3D !blk_enable_write_cache(blk); bool has_rw_option =3D false; bool has_cache_option =3D false; - Error *local_err =3D NULL; =20 while ((c =3D getopt(argc, argv, "c:o:rw")) !=3D -1) { switch (c) { case 'c': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { - error_report("Invalid cache option: %s", optarg); + error_setg(errp, "Invalid cache option: %s", optarg); return -EINVAL; } has_cache_option =3D true; @@ -2536,7 +2547,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) break; case 'r': if (has_rw_option) { - error_report("Only one -r/-w option may be given"); + error_setg(errp, "Only one -r/-w option may be given"); return -EINVAL; } flags &=3D ~BDRV_O_RDWR; @@ -2544,7 +2555,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) break; case 'w': if (has_rw_option) { - error_report("Only one -r/-w option may be given"); + error_setg(errp, "Only one -r/-w option may be given"); return -EINVAL; } flags |=3D BDRV_O_RDWR; @@ -2566,7 +2577,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) if (!writethrough !=3D blk_enable_write_cache(blk) && blk_get_attached_dev(blk)) { - error_report("Cannot change cache.writeback: Device attached"); + error_setg(errp, "Cannot change cache.writeback: Device attached"); qemu_opts_reset(&reopen_opts); return -EBUSY; } @@ -2589,7 +2600,8 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) =20 if (qdict_haskey(opts, BDRV_OPT_READ_ONLY)) { if (has_rw_option) { - error_report("Cannot set both -r/-w and '" BDRV_OPT_READ_ONLY = "'"); + error_setg(errp, + "Cannot set both -r/-w and '" BDRV_OPT_READ_ONLY "'= "); qobject_unref(opts); return -EINVAL; } @@ -2600,7 +2612,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) if (qdict_haskey(opts, BDRV_OPT_CACHE_DIRECT) || qdict_haskey(opts, BDRV_OPT_CACHE_NO_FLUSH)) { if (has_cache_option) { - error_report("Cannot set both -c and the cache options"); + error_setg(errp, "Cannot set both -c and the cache options"); qobject_unref(opts); return -EINVAL; } @@ -2609,10 +2621,7 @@ static int reopen_f(BlockBackend *blk, int argc, cha= r **argv) qdict_put_bool(opts, BDRV_OPT_CACHE_NO_FLUSH, flags & BDRV_O_NO_FL= USH); } =20 - bdrv_reopen(bs, opts, true, &local_err); - - if (local_err) { - error_report_err(local_err); + if (bdrv_reopen(bs, opts, true, errp) < 0) { return -EINVAL; } =20 @@ -2620,26 +2629,28 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **argv) return 0; } =20 -static int break_f(BlockBackend *blk, int argc, char **argv) +static int break_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int ret; =20 ret =3D bdrv_debug_breakpoint(blk_bs(blk), argv[1], argv[2]); if (ret < 0) { - printf("Could not set breakpoint: %s\n", strerror(-ret)); + error_setg(errp, "Could not set breakpoint: %s", strerror(-ret)); return ret; } =20 return 0; } =20 -static int remove_break_f(BlockBackend *blk, int argc, char **argv) +static int remove_break_f(BlockBackend *blk, int argc, char **argv, + Error **errp) { int ret; =20 ret =3D bdrv_debug_remove_breakpoint(blk_bs(blk), argv[1]); if (ret < 0) { - printf("Could not remove breakpoint %s: %s\n", argv[1], strerror(-= ret)); + error_setg(errp, "Could not remove breakpoint %s: %s", + argv[1], strerror(-ret)); return ret; } =20 @@ -2665,13 +2676,13 @@ static const cmdinfo_t remove_break_cmd =3D { .oneline =3D "remove a breakpoint by tag", }; =20 -static int resume_f(BlockBackend *blk, int argc, char **argv) +static int resume_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int ret; =20 ret =3D bdrv_debug_resume(blk_bs(blk), argv[1]); if (ret < 0) { - printf("Could not resume request: %s\n", strerror(-ret)); + error_setg(errp, "Could not resume request: %s", strerror(-ret)); return ret; } =20 @@ -2687,7 +2698,7 @@ static const cmdinfo_t resume_cmd =3D { .oneline =3D "resumes the request tagged as tag", }; =20 -static int wait_break_f(BlockBackend *blk, int argc, char **argv) +static int wait_break_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { while (!bdrv_debug_is_suspended(blk_bs(blk), argv[1])) { aio_poll(blk_get_aio_context(blk), true); @@ -2704,7 +2715,7 @@ static const cmdinfo_t wait_break_cmd =3D { .oneline =3D "waits for the suspension of a request", }; =20 -static int abort_f(BlockBackend *blk, int argc, char **argv) +static int abort_f(BlockBackend *blk, int argc, char **argv, Error **errp) { abort(); } @@ -2730,7 +2741,7 @@ static void sigraise_help(void) "\n", SIGTERM); } =20 -static int sigraise_f(BlockBackend *blk, int argc, char **argv); +static int sigraise_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); =20 static const cmdinfo_t sigraise_cmd =3D { .name =3D "sigraise", @@ -2743,15 +2754,16 @@ static const cmdinfo_t sigraise_cmd =3D { .help =3D sigraise_help, }; =20 -static int sigraise_f(BlockBackend *blk, int argc, char **argv) +static int sigraise_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { int64_t sig =3D cvtnum(argv[1]); if (sig < 0) { - print_cvtnum_err(sig, argv[1]); + set_cvtnum_err(sig, argv[1], errp); return sig; } else if (sig > NSIG) { - printf("signal argument '%s' is too large to be a valid signal\n", - argv[1]); + error_setg(errp, + "signal argument '%s' is too large to be a valid signal= ", + argv[1]); return -EINVAL; } =20 @@ -2772,7 +2784,7 @@ static void sleep_cb(void *opaque) *expired =3D true; } =20 -static int sleep_f(BlockBackend *blk, int argc, char **argv) +static int sleep_f(BlockBackend *blk, int argc, char **argv, Error **errp) { char *endptr; long ms; @@ -2781,7 +2793,7 @@ static int sleep_f(BlockBackend *blk, int argc, char = **argv) =20 ms =3D strtol(argv[1], &endptr, 0); if (ms < 0 || *endptr !=3D '\0') { - printf("%s is not a valid number\n", argv[1]); + error_setg(errp, "%s is not a valid number", argv[1]); return -EINVAL; } =20 @@ -2833,7 +2845,7 @@ static void help_all(void) printf("\nUse 'help commandname' for extended help.\n"); } =20 -static int help_f(BlockBackend *blk, int argc, char **argv) +static int help_f(BlockBackend *blk, int argc, char **argv, Error **errp) { const cmdinfo_t *ct; =20 @@ -2844,7 +2856,7 @@ static int help_f(BlockBackend *blk, int argc, char *= *argv) =20 ct =3D find_command(argv[1]); if (ct =3D=3D NULL) { - printf("command %s not found\n", argv[1]); + error_setg(errp, "command %s not found", argv[1]); return -EINVAL; } =20 @@ -2867,7 +2879,7 @@ static const cmdinfo_t help_cmd =3D { * Called with aio context of blk acquired. Or with qemu_get_aio_context() * context acquired if blk is NULL. */ -int qemuio_command(BlockBackend *blk, const char *cmd) +int qemuio_command(BlockBackend *blk, const char *cmd, Error **errp) { char *input; const cmdinfo_t *ct; @@ -2880,9 +2892,9 @@ int qemuio_command(BlockBackend *blk, const char *cmd) if (c) { ct =3D find_command(v[0]); if (ct) { - ret =3D command(blk, ct, c, v); + ret =3D command(blk, ct, c, v, errp); } else { - fprintf(stderr, "command \"%s\" not found\n", v[0]); + error_setg(errp, "command \"%s\" not found", v[0]); ret =3D -EINVAL; } } diff --git a/qemu-io.c b/qemu-io.c index 8f2de83f3c80..598d5b1c9ca9 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -68,7 +68,7 @@ static int get_eof_char(void) #endif } =20 -static int close_f(BlockBackend *blk, int argc, char **argv) +static int close_f(BlockBackend *blk, int argc, char **argv, Error **errp) { blk_unref(qemuio_blk); qemuio_blk =3D NULL; @@ -140,7 +140,7 @@ static void open_help(void) "\n"); } =20 -static int open_f(BlockBackend *blk, int argc, char **argv); +static int open_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t open_cmd =3D { .name =3D "open", @@ -164,7 +164,7 @@ static QemuOptsList empty_opts =3D { }, }; =20 -static int open_f(BlockBackend *blk, int argc, char **argv) +static int open_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int flags =3D BDRV_O_UNMAP; int readonly =3D 0; @@ -268,7 +268,7 @@ static int open_f(BlockBackend *blk, int argc, char **a= rgv) return 0; } =20 -static int quit_f(BlockBackend *blk, int argc, char **argv) +static int quit_f(BlockBackend *blk, int argc, char **argv, Error **errp) { quit_qemu_io =3D true; return 0; @@ -414,7 +414,14 @@ static void prep_fetchline(void *opaque) =20 static int do_qemuio_command(const char *cmd) { - return qemuio_command(qemuio_blk, cmd); + Error *local_err =3D NULL; + int ret; + + ret =3D qemuio_command(qemuio_blk, cmd, &local_err); + if (local_err) { + error_report_err(local_err); + } + return ret; } =20 static int command_loop(void) diff --git a/tests/qemu-iotests/004.out b/tests/qemu-iotests/004.out index fb8593289f51..37da6024809f 100644 --- a/tests/qemu-iotests/004.out +++ b/tests/qemu-iotests/004.out @@ -6,36 +6,36 @@ wrote 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 write into image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 write at image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 write past image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 pwrite past image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 writev past image boundary -writev failed: Input/output error +qemu-io: writev failed: Input/output error =20 read before image boundary read 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 read into image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 read at image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 read past image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 pread past image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 readv past image boundary -readv failed: Input/output error +qemu-io: readv failed: Input/output error *** done diff --git a/tests/qemu-iotests/021.out b/tests/qemu-iotests/021.out index 8533f8e58ae6..dfdfeb503780 100644 --- a/tests/qemu-iotests/021.out +++ b/tests/qemu-iotests/021.out @@ -2,92 +2,92 @@ QA output created by 021 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 =20 =3D=3D testing writev -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing read -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing write -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing readv -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing aio_read -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing aio_write -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing writev -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing read -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing write -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing readv -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing aio_read -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing aio_write -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing writev -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing read -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing write -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing readv -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing aio_read -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing aio_write -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing writev -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing read -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing write -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing readv -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing aio_read -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing aio_write -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing writev -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing read -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing write -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing readv -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing aio_read -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing aio_write -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte *** done diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out index 83989996ff62..b998a9ac83da 100644 --- a/tests/qemu-iotests/026.out +++ b/tests/qemu-iotests/026.out @@ -4,442 +4,442 @@ Errors while writing 128 kB Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: on; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: on; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: off; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: off; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: on; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: on; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: off; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: off; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: off; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: off; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: off; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: off; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D Refcount table growth tests =3D=3D=3D @@ -447,122 +447,122 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write = -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write = -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D L1 growth tests =3D=3D=3D @@ -570,76 +570,76 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 5; imm: off; once: off -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 28; imm: off; once: off -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: off +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: off +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: off +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: off +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D Avoid cluster leaks after temporary failure =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 -write failed: Input/output error +qemu-io: write failed: Input/output error wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. @@ -651,6 +651,6 @@ wrote 1024/1024 bytes at offset 0 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 1024/1024 bytes at offset 0 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. *** done diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index a37bf446e942..27275fd6b70e 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -9,7 +9,7 @@ ERROR cluster 3 refcount=3D1 reference=3D3 Data may be corrupted, or further writes to the image may corrupt it. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with active L1 table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] image: TEST_DIR/t.IMGFMT file format: IMGFMT @@ -23,7 +23,7 @@ Format specific information: corrupt: true extended l2: false qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; ca= nnot be opened read/write -no file open, try 'help open' +qemu-io: no file open, try 'help open' read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -37,7 +37,7 @@ ERROR cluster 2 refcount=3D1 reference=3D2 Data may be corrupted, or further writes to the image may corrupt it. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with refcount block); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] ERROR refcount block 0 refcount=3D2 ERROR cluster 2 refcount=3D1 reference=3D2 @@ -73,7 +73,7 @@ Data may be corrupted, or further writes to the image may= corrupt it. This means waste of disk space, but no harm to data. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with inactive L2 table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] ERROR cluster 4 refcount=3D1 reference=3D2 Leaked cluster 9 refcount=3D1 reference=3D0 @@ -108,10 +108,10 @@ wrote 65536/65536 bytes at offset 0 wrote 65536/65536 bytes at offset 536870912 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with active L2 table); further corruption events will be suppressed +qemu-io: write failed: Input/output error +qemu-io: aio_write failed: No medium found blkdebug: Suspended request '0' -write failed: Input/output error blkdebug: Resuming request '0' -aio_write failed: No medium found =20 =3D=3D=3D Testing unallocated image header =3D=3D=3D =20 @@ -119,7 +119,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with qcow2_header); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing unaligned L1 entry =3D=3D=3D =20 @@ -127,7 +127,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 ind= ex: 0); further corruption events will be suppressed -read failed: Input/output error +qemu-io: read failed: Input/output error Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -140,7 +140,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unalign= ed (L2 offset: 0x40000, L2 index: 0); further corruption events will be sup= pressed -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing unaligned pre-allocated zero cluster =3D=3D=3D =20 @@ -154,7 +154,7 @@ qemu-img: Failed to turn zero into data clusters: Input= /output error =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Refblock offset 0x22a00 unaligned (reftab= le index: 0); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing non-fatal corruption on freeing =3D=3D=3D =20 @@ -171,8 +171,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Image is corrupt: Cluster allocation offset 0x52a00 unaligned (L2 o= ffset: 0x40000, L2 index: 0); further non-fatal corruption events will be s= uppressed -read failed: Input/output error -read failed: Input/output error +qemu-io: read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing non-fatal and then fatal corruption report =3D=3D=3D =20 @@ -181,15 +181,15 @@ wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Image is corrupt: Cannot free unaligned cluster 0x52a00; further no= n-fatal corruption events will be suppressed qcow2: Marking image as corrupt: Cluster allocation offset 0x62a00 unalign= ed (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be s= uppressed +qemu-io: read failed: Input/output error discard 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read failed: Input/output error =20 =3D=3D=3D Testing empty refcount table =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with refcount table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 3 refcount=3D0 reference=3D1 @@ -209,7 +209,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid allocation of refcount= block at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 3 refcount=3D0 reference=3D1 @@ -229,7 +229,7 @@ No errors were found on the image. =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 2 refcount=3D0 reference=3D1 @@ -251,7 +251,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 65536 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid allocation of compress= ed cluster at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 2 refcount=3D0 reference=3D1 @@ -286,7 +286,7 @@ No errors were found on the image. =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing dirty corrupt image =3D=3D=3D =20 @@ -319,7 +319,7 @@ wrote 65536/65536 bytes at offset 0 discard 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preallocated zero cluster offset 0x2a00 u= naligned (guest offset: 0); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error --- Repairing --- Repairing offset=3D2a00: Preallocated cluster is not properly aligned; L2 = entry corrupted. The following inconsistencies were found and repaired: @@ -337,7 +337,7 @@ wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftabl= e index: 0); further corruption events will be suppressed qcow2_free_clusters failed: Input/output error -discard failed: No medium found +qemu-io: discard failed: No medium found --- Repairing --- ERROR refcount block 0 is not cluster aligned; refcount table entry corrup= ted qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftabl= e index: 0); further corruption events will be suppressed @@ -419,8 +419,7 @@ qcow2: Marking image as corrupt: Preventing invalid wri= te on metadata (overlaps QMP_VERSION {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "none0", "msg": "Preventing i= nvalid write on metadata (overlaps with refcount table)", "offset": 65536, = "node-name": "drive", "fatal": true, "size": 65536}} -write failed: Input/output error -{"return": ""} +{"return": "Error: write failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 @@ -431,7 +430,6 @@ QMP_VERSION {"return": {}} qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0= ); further non-fatal corruption events will be suppressed {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0= x2a2a2a00 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}} -{"return": ""} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 diff --git a/tests/qemu-iotests/071.out b/tests/qemu-iotests/071.out index a2923b05c297..f2d015d8ccae 100644 --- a/tests/qemu-iotests/071.out +++ b/tests/qemu-iotests/071.out @@ -30,11 +30,11 @@ blkverify: read offset=3D0 bytes=3D512 contents mismatc= h at offset 0 =20 =3D=3D=3D Testing blkdebug through filename =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing blkdebug through file blockref =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing blkdebug on existing block device =3D=3D=3D =20 @@ -43,8 +43,7 @@ QMP_VERSION {"return": {}} {"return": {}} {"return": {}} -read failed: Input/output error -{"return": ""} +{"return": "Error: read failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 @@ -82,8 +81,7 @@ read 512/512 bytes at offset 0 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -read failed: Input/output error -{"return": ""} +{"return": "Error: read failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} QEMU_PROG: Failed to flush the L2 table cache: Input/output error QEMU_PROG: Failed to flush the refcount block cache: Input/output error diff --git a/tests/qemu-iotests/072.out b/tests/qemu-iotests/072.out index fe949d47817a..d7ce24da1f7a 100644 --- a/tests/qemu-iotests/072.out +++ b/tests/qemu-iotests/072.out @@ -15,7 +15,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Pattern verification failed at offset 0, 512 bytes +qemu-io: Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out index d8acb3e72355..b20c21faf6a9 100644 --- a/tests/qemu-iotests/080.out +++ b/tests/qemu-iotests/080.out @@ -66,8 +66,8 @@ wrote 512/512 bytes at offset 0 qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid qemu-img: Snapshot L1 table offset invalid qemu-img: Failed to turn zero into data clusters: Invalid argument +qemu-io: write failed: Invalid argument qemu-io: Failed to flush the refcount block cache: Invalid argument -write failed: Invalid argument qemu-img: Snapshot L1 table offset invalid qemu-img: Could not apply snapshot 'test': Failed to load snapshot: Invali= d argument qemu-img: Could not delete snapshot 'test': Snapshot L1 table offset inval= id @@ -89,8 +89,8 @@ wrote 512/512 bytes at offset 0 qemu-img: Failed to load snapshot: Snapshot L1 table too large qemu-img: Snapshot L1 table too large qemu-img: Failed to turn zero into data clusters: File too large +qemu-io: write failed: File too large qemu-io: Failed to flush the refcount block cache: File too large -write failed: File too large qemu-img: Snapshot L1 table too large qemu-img: Could not apply snapshot 'test': Failed to load snapshot: File t= oo large qemu-img: Could not delete snapshot 'test': Snapshot L1 table too large diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out index aba85ea56446..bc902bd81832 100644 --- a/tests/qemu-iotests/081.out +++ b/tests/qemu-iotests/081.out @@ -81,7 +81,7 @@ wrote 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D checking that quorum is broken =3D=3D -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D checking the blkverify mode with broken content =3D=3D quorum: offset=3D0 bytes=3D10485760 contents mismatch at offset 0 diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out index 2090ee693c16..a1c446d5365e 100644 --- a/tests/qemu-iotests/083.out +++ b/tests/qemu-iotests/083.out @@ -41,7 +41,7 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/foo =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 @@ -53,31 +53,31 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/foo =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 4 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before data =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after data =3D=3D=3D =20 @@ -106,7 +106,7 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/ =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before neg1 =3D=3D=3D =20 @@ -150,7 +150,7 @@ qemu-io: can't open device nbd+unix:///foo?socket=3DSOC= K_DIR/nbd.sock =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 @@ -162,31 +162,31 @@ qemu-io: can't open device nbd+unix:///foo?socket=3DS= OCK_DIR/nbd.sock =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 4 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before data =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after data =3D=3D=3D =20 @@ -215,6 +215,6 @@ qemu-io: can't open device nbd+unix:///?socket=3DSOCK_D= IR/nbd.sock =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 *** done diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out index c53fc4823a16..a29e19b12d7e 100644 --- a/tests/qemu-iotests/089.out +++ b/tests/qemu-iotests/089.out @@ -16,7 +16,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Pattern verification failed at offset 0, 512 bytes +qemu-io: Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -33,7 +33,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 512/512 bytes at offset 229376 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing qemu-img info output =3D=3D=3D =20 diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out index f51dd9d20a10..80220e440eca 100644 --- a/tests/qemu-iotests/114.out +++ b/tests/qemu-iotests/114.out @@ -11,7 +11,7 @@ cluster_size: 65536 backing file: TEST_DIR/t.IMGFMT.base backing file format: foo qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: = Unknown driver 'foo' -no file open, try 'help open' +qemu-io: no file open, try 'help open' read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qemu-img: Could not change the backing file to 'TEST_DIR/t.qcow2.base': ba= cking format must be specified diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out index 4abc5b5f7da6..ce2a0df166ee 100644 --- a/tests/qemu-iotests/134.out +++ b/tests/qemu-iotests/134.out @@ -24,7 +24,7 @@ read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D verify pattern failure with wrong password =3D=3D -Pattern verification failed at offset 0, 134217728 bytes +qemu-io: Pattern verification failed at offset 0, 134217728 bytes read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index e19df5b6ba82..1947c1a1bd7c 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -40,5 +40,5 @@ OK: Dirty bit not set Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error *** done diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out index 28e1a22952b6..e235d9e59e35 100644 --- a/tests/qemu-iotests/153.out +++ b/tests/qemu-iotests/153.out @@ -33,12 +33,12 @@ Is another process using the image [TEST_DIR/t.qcow2]? _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_img_wrapper info TEST_DIR/t.qcow2 qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock @@ -107,7 +107,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -176,7 +176,7 @@ _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -231,7 +231,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -336,7 +336,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171 index d1d77f701304..87a8aa24d967 100755 --- a/tests/qemu-iotests/171 +++ b/tests/qemu-iotests/171 @@ -188,7 +188,7 @@ img_offset=3D512 img_size=3D512 _make_test_img $size ( -$QEMU_IO "$(img_json)" <&1 < (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787685118508425.0573132219258; Tue, 25 Aug 2026 12:11:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYi-0005y9-Mz; Tue, 25 Aug 2026 15:11: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 1wywYT-0005kF-Uz for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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 1wywYQ-00046T-G6 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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-529-Bc0JutDGP-2QYaKNJCGnrw-1; Tue, 25 Aug 2026 15:11: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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D57618512F0; Tue, 25 Aug 2026 19:11:22 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6BE521944B2A; Tue, 25 Aug 2026 19:11:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9CMMKu6kzTPjhr60fVp/ni4m6u7V9jPpiJw4QDuDdfg=; b=MHA8UCJ2asxY03D5/DfJxCVf/xwSJ2AyBseVqkIIepO+4f8x43t8nNhB/bY1F8HXJGuy3f nWX40szOCvCJwwkJusfZg4qQ6zJ6la0mx/xPv5LafJa2MSQXowgSAe1KU3DiojtZVXWWZ3 lzxocYElI3ZvOZdMZ506cmSBFdm+pg8= X-MC-Unique: Bc0JutDGP-2QYaKNJCGnrw-1 X-Mimecast-MFC-AGG-ID: Bc0JutDGP-2QYaKNJCGnrw_1787685082 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:28 +0400 Subject: [PATCH v4 21/49] block: add x-qemu-io QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-21-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Eric Blake , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8511; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=H7kf02DdiNn1nFNRkOMtk6kTSmAJa1hNXFx4tWwfEJg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiH9xvvaGeU7T+ENCrWffRKPe4Ds2pkdaPLB x1ZvfkOzeWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5QniD/9xpnzmaAxSfIVinlQpNAfAiV6/ungPj7IboHQHbpwHsVyr2nqeci/+dSlXgavqOe4iG2o DZhH7h9QaNmZN91xY5hT2PqY3+vlAsWagFD175lyNiHuNExGSx1hS2vK9aLtslDjyUVriYn/E0P sPC+zq4Jr5I+bE+zyRqkWP78QB35m0olCSMgQb4nC64bvweWgwSrnse3DcDr0wiSFRr8E1MZ0gC aX0rIj3C/dG+PJmZ8Ld88zQe/C+/bDmVNvvpUJAh4aSq2ugkVpz9F6HdIwoV80iZ+OLuuRvzLq1 zbM9Gc8rvzDZSEtRFhsCJDfxEdE5GikLmu4kyRtwkcSFeyfmt0lk3dXwU5k2pWyMEfTrvow9Owq p8JJUJsfM4ski4fSkGaimM0RP7XvxhzC7R3yFCn0rtRSeMpTa3uknEuiF7q38UP9TMzqtV4yAwo xS6wO/Wgh/4ifzDaH1IQRitoJOk5C4GD80YA+FdmzT48t6dE3J7+2NO34FSsB7YBJsFV0r3xYZx x2KIYxwPfQY7kX5HUWnSxkRqzVlHACxXA5eKHyLko9quDLP4qskPhFN8JnxoftVIVukJiTG1Ax/ mzklRAGTzZQroYSr8gfoDHlm8vVKLCSkxib151519VMMWCwhN78mfCu1gL7f8zSNiltywXmhg2c RXOHATHYlgwHSwQ== 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: 1787685120735158500 Add an x-qemu-io QMP command that runs qemu-io commands on block devices. The command accepts a device name (block backend name, node-name, or qdev ID) and a qemu-io command string. Refactor hmp_qemu_io() to be a thin wrapper around the new QMP command, following the standard HMP-over-QMP pattern used by other block commands. This change is also required for the qtest qemu-io command in the following patch. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- block/monitor/block-hmp-cmds.c | 60 ++------------------------------ block/monitor/meson.build | 1 + block/monitor/qmp-cmds.c | 79 ++++++++++++++++++++++++++++++++++++++= ++++ qapi/block.json | 34 ++++++++++++++++++ 4 files changed, 117 insertions(+), 57 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 9930620a4a16..22fa03089ea3 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -56,7 +56,6 @@ #include "block/qapi.h" #include "block/block_int.h" #include "block/block-hmp-cmds.h" -#include "qemu-io.h" =20 static void hmp_drive_add_node(Monitor *mon, const char *optstr) { @@ -541,67 +540,14 @@ void hmp_eject(Monitor *mon, const QDict *qdict) =20 void hmp_qemu_io(Monitor *mon, const QDict *qdict) { - BlockBackend *blk =3D NULL; - BlockDriverState *bs =3D NULL; - BlockBackend *local_blk =3D NULL; bool qdev =3D qdict_get_try_bool(qdict, "qdev", false); const char *device =3D qdict_get_str(qdict, "device"); const char *command =3D qdict_get_str(qdict, "command"); Error *err =3D NULL; - int ret; =20 - if (qdev) { - blk =3D blk_by_qdev_id(device, &err); - if (!blk) { - goto fail; - } - } else { - blk =3D blk_by_name(device); - if (!blk) { - bs =3D bdrv_lookup_bs(NULL, device, &err); - if (!bs) { - goto fail; - } - } - } - - if (bs) { - blk =3D local_blk =3D blk_new(bdrv_get_aio_context(bs), 0, BLK_PER= M_ALL); - ret =3D blk_insert_bs(blk, bs, &err); - if (ret < 0) { - goto fail; - } - } - - /* - * Notably absent: Proper permission management. This is sad, but it s= eems - * almost impossible to achieve without changing the semantics and the= reby - * limiting the use cases of the qemu-io HMP command. - * - * In an ideal world we would unconditionally create a new BlockBacken= d for - * qemuio_command(), but we have commands like 'reopen' and want them = to - * take effect on the exact BlockBackend whose name the user passed in= stead - * of just on a temporary copy of it. - * - * Another problem is that deleting the temporary BlockBackend involves - * draining all requests on it first, but some qemu-iotests cases want= to - * issue multiple aio_read/write requests and expect them to complete = in - * the background while the monitor has already returned. - * - * This is also what prevents us from saving the original permissions = and - * restoring them later: We can't revoke permissions until all requests - * have completed, and we don't know when that is nor can we really let - * anything else run before we have revoken them to avoid race conditi= ons. - * - * What happens now is that command() in qemu-io-cmds.c can extend the - * permissions if necessary for the qemu-io command. And they simply s= tay - * extended, possibly resulting in a read-only guest device keeping wr= ite - * permissions. Ugly, but it appears to be the lesser evil. - */ - qemuio_command(blk, command, &err); - -fail: - blk_unref(local_blk); + qmp_x_qemu_io(qdev ? NULL : device, + qdev ? device : NULL, + command, &err); hmp_handle_error(mon, err); } =20 diff --git a/block/monitor/meson.build b/block/monitor/meson.build index 1022516e93c5..74faced9e17f 100644 --- a/block/monitor/meson.build +++ b/block/monitor/meson.build @@ -1,2 +1,3 @@ system_ss.add(files('block-hmp-cmds.c')) block_ss.add(files('bitmap-qmp-cmds.c')) +system_ss.add(files('qmp-cmds.c')) diff --git a/block/monitor/qmp-cmds.c b/block/monitor/qmp-cmds.c new file mode 100644 index 000000000000..e5759d824f13 --- /dev/null +++ b/block/monitor/qmp-cmds.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" + +#include "system/block-backend.h" +#include "block/block_int.h" +#include "qapi/qapi-commands-block.h" +#include "qapi/error.h" +#include "qemu-io.h" + +void qmp_x_qemu_io(const char *device, const char *qdev, + const char *command, Error **errp) +{ + BlockBackend *blk =3D NULL; + BlockBackend *local_blk =3D NULL; + BlockDriverState *bs =3D NULL; + int ret; + + if (!device && !qdev) { + error_setg(errp, "Must specify either device or qdev"); + return; + } + if (qdev && device) { + error_setg(errp, "Cannot specify both qdev and device"); + return; + } + + if (qdev) { + blk =3D blk_by_qdev_id(qdev, errp); + if (!blk) { + return; + } + } else { + blk =3D blk_by_name(device); + if (!blk) { + bs =3D bdrv_lookup_bs(NULL, device, errp); + if (!bs) { + return; + } + } + } + + if (bs) { + blk =3D local_blk =3D blk_new(bdrv_get_aio_context(bs), 0, BLK_PER= M_ALL); + ret =3D blk_insert_bs(blk, bs, errp); + if (ret < 0) { + goto fail; + } + } + + /* + * Notably absent: Proper permission management. This is sad, but it s= eems + * almost impossible to achieve without changing the semantics and the= reby + * limiting the use cases of the qemu-io command. + * + * In an ideal world we would unconditionally create a new BlockBacken= d for + * qemuio_command(), but we have commands like 'reopen' and want them = to + * take effect on the exact BlockBackend whose name the user passed in= stead + * of just on a temporary copy of it. + * + * Another problem is that deleting the temporary BlockBackend involves + * draining all requests on it first, but some qemu-iotests cases want= to + * issue multiple aio_read/write requests and expect them to complete = in + * the background while the monitor has already returned. + * + * This is also what prevents us from saving the original permissions = and + * restoring them later: We can't revoke permissions until all requests + * have completed, and we don't know when that is nor can we really let + * anything else run before we have revoken them to avoid race conditi= ons. + * + * What happens now is that command() in qemu-io-cmds.c can extend the + * permissions if necessary for the qemu-io command. And they simply s= tay + * extended, possibly resulting in a read-only guest device keeping wr= ite + * permissions. Ugly, but it appears to be the lesser evil. + */ + qemuio_command(blk, command, errp); + +fail: + blk_unref(local_blk); +} diff --git a/qapi/block.json b/qapi/block.json index 46955bbb3e34..012a9d73333b 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -603,3 +603,37 @@ '*boundaries-zap': ['uint64'], '*boundaries-flush': ['uint64'] }, 'allow-preconfig': true } + +## +# @x-qemu-io: +# +# Run a qemu-io command on a block device. Take either a block +# backend name or a qdev ID to identify the device. +# +# @device: the block backend name, node-name to run the +# command on. +# +# @qdev: the qdev ID of the block device to run the +# command on. +# +# @command: the qemu-io command string to execute. +# +# Features: +# +# @unstable: This command is for testing only. +# +# Since: 11.2 +# +# .. qmp-example:: +# +# -> { "execute": "x-qemu-io", +# "arguments": { "device": "virtio0", +# "command": "read 0 512" } } +# <- { "return": {} } +## +{ 'command': 'x-qemu-io', + 'data': { '*device': 'str', + '*qdev': 'str', + 'command': 'str' }, + 'features': [ 'unstable' ], + 'allow-preconfig': true } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685174; cv=none; d=zohomail.com; s=zohoarc; b=mJN+j6uk+Rd4W7r+i18PkuGt+IynsgCC2+Emr9ip+kuvB9LOscTViuUnYxGvnrRAKKXMxGnzVBxC0OVHCIkWPpJ/rvO5lYvLPiNI+1Qsg9FbrO2kHlLmBgkgx+00OHEu6vftY67qVk+x7TAEP5om+C44Z6rdIKsG4TKYrz2RI/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685174; 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=O8ztPa+PkYAyQ0jCSv+qksyiWwozekukERdSihks8GE=; b=kDfmFPYzNxMUar5PHSTKZ1YrEHbJxen6xe0vOUxqHqF4+/FylzQ0lq2QwTwmFL/Dm0IZWcOMvGq2LmkMvPHy1UeTPLlZlRfxALQL7Xu6Yyi6Y00jFWC+Mg3H+kQjpQe1SkY9YRqv+Rp7hMy6nlpuMtNQk6cu5DCFnu5zTklwY+Y= 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 1787685174250902.4087347654167; Tue, 25 Aug 2026 12:12:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYo-0006YO-5Y; Tue, 25 Aug 2026 15:11: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 1wywYX-0005md-M4 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:35 -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 1wywYV-00047v-6S for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:32 -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-114-rC3Qroc4O3uoAF8X_sRudg-1; Tue, 25 Aug 2026 15:11:27 -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 0E984188FECE; Tue, 25 Aug 2026 19:11:26 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3E72C30002F7; Tue, 25 Aug 2026 19:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685090; 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=O8ztPa+PkYAyQ0jCSv+qksyiWwozekukERdSihks8GE=; b=A/bWcb1wU0t27+mpPmq7/4QkdUc0VzhTj7xZKkT+p49iExSrtXjlUlvuiX1pmgGTBwZVK1 5qOX9S3GPvmsBIMwkDqO+mK3XmDTiqN6qJOhwoI/48AIe0FT1vuvU8voRMOpMYTcs42QML 4JjgbCgMKOWDSG77rAFU2RwHeYP2IJQ= X-MC-Unique: rC3Qroc4O3uoAF8X_sRudg-1 X-Mimecast-MFC-AGG-ID: rC3Qroc4O3uoAF8X_sRudg_1787685086 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:29 +0400 Subject: [PATCH v4 22/49] qtest: add qemu-io command to the qtest protocol MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-22-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=3175; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=A3jHZBymfOBXqq7imKzSxgBHpql06Irvffs0d0YLLNQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHQ6+WcNdZ/Jfw1K+2h9oiXg0CjEsKkk1Dn kh9EzNOGriJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5Sa4EAC0Drfwf1OmatHzWW2aE/hK1f3sRIyE/vr0hmG5DaDrUDEBCU5GAtYxPyuFl/dd+0GsTB5 fBcMAwUcyDeZsBkqMFJ4LUxRDN5FxSOKHm1mBgwz34Sf78MmgMj3xRZm0ExShpaOMtZgZKDlIIl U1vb28uLAPUuJ5r4Yvo/jWYTzVsRjSXP9GHQKR29SNZKw/wVHyI5kSM+zk22d7OE/HKUltIIKX1 /CkAKVLNh9KqlOuTlLaikMzY8eH9lTOSlaku22rv9bKeC2M1nn3SklgTApvXUEpCmaw50o9R0nX kStvLwAWpjJQZ0qsYQL2lQoi+vgfeRshDkaeYNHcE3Iphh4pHvofWVXUpprNuu9fBBXo+WREvkd g7AEUYlbGUw3mkej7H/6oQRCqTvjmfMC5zJjaZRghNXwC6IwRfoPMuhpiSpk5eTAwfP7UZ5ZJlg pYSAlPhOjFD0MqkUy7RJ7sy/W+1U3j0sHSasky5kJgs1riafLz/whZWM9MbapYUsuGKpNSc8NLT pg3UfpCim5kCvCbI+ZsT4BgsayMHRymq4T0Lt00itxspSs/lTlNNrxVb78YLZyFAIRNp3V3p0wa uSR8M+xbp+UxVT6n8A6YgBDfxdJPEu+kPI+5TmiqHOXJbidfDxaEv/p/mpgkZXVql1PGydZjVvq +cU9guc8/GZr3pQ== 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: 1787685174773158500 Add a "qemu-io" command to the qtest protocol so that tests can issue block layer I/O commands without going through the HMP monitor's "human-monitor-command" QMP, or use QMP at all. Unfortunately, many tests will prefer to use QMP as they also monitor and log other events. It's easier if it is pipelined in the same stream. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685295; cv=none; d=zohomail.com; s=zohoarc; b=JZmr6crDH7gEUaoxksGb+DFjZxPSEV09Ke2QegiyGTqa+oaminh1x+z4G7PgjarWIEpvdCnBVmEzjy9tajDXb5uKaevuEF5kpZbSYwbqZWU4rlqQNdgh2ghwu3E0pTDJFbO5hUDVNVxiZN3gC/Jwag5QMQ8xHWodIZ5YfUan5IU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685295; 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=+Bj3PY7FPChYS4p4u2YPAB+wgehSslQk/bWtqbtzF6g=; b=TZnuFzO+vXouzNt9zqdGttfrWMulCnP9lfhWVkoAsWghDlLFupnsJpXH53n8uohJ5fVui0CxprHSwy9oyteGQ6ZQGtHgD4cw/U0W/lENKE7PkjYGA1dgKJLBpRAhNfN8HlTz+HBWh2X0Y+e1Z3wWzJ90BWU15E7GNiThLRnD2wk= 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 1787685295432890.5847844408294; Tue, 25 Aug 2026 12:14:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYl-0006NO-OJ; Tue, 25 Aug 2026 15:11: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 1wywYc-0005qN-0f for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYY-0004BJ-Kx for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:36 -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-483-pWHVBDl0MNSnQMCE_BJ-Rw-1; Tue, 25 Aug 2026 15:11:30 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 66E1219792F3; Tue, 25 Aug 2026 19:11:29 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 964A71944B2A; Tue, 25 Aug 2026 19:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685094; 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=+Bj3PY7FPChYS4p4u2YPAB+wgehSslQk/bWtqbtzF6g=; b=ZhTdIAZVwOZJZxWhRMMRm5p1GDkB4+R+5LcbShQcaxNQ3Yh6/+M0AKpSMAeeob2q+jUsEB 13wcZs6qoVagvRZjgdoqp0aHVOQDQkjNnZwUjoZhGZsQcifdcFNNtlCP71o4dg0yoEG07B dPu4QgEtPvtp2JWfDjgv5jyRVtrIPc4= X-MC-Unique: pWHVBDl0MNSnQMCE_BJ-Rw-1 X-Mimecast-MFC-AGG-ID: pWHVBDl0MNSnQMCE_BJ-Rw_1787685089 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:30 +0400 Subject: [PATCH v4 23/49] qtest/ide-test: convert to use qtest qemu-io command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-23-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Denis V. Lunev" , John Snow , "Denis V. Lunev" , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2379; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eDuJspXtx+5PSIfDzwxXnjJDycfHfyNAMJBOLftcXR8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHXbxghZFfnL8fKreHnF/Uhixkydt46LN5p syzjXAidFiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5aSwD/9mybxduOQ8gcLNtMcdQ6zOzk7mnUuI3ogg6k7LnCOGWWGe2HAAQ75oClrBKTPWeejUUw4 vbM6ktMUs3doSk38gM57TrQzKSzlOaMqDKWZ0ayrtczY4sQs5CeA5LLeA+Kh+YlIQAAP96eVTOT DsFslt8lkXlj6J5waDt1HO0wqZ5tnDESl+BHV835qlVbzd7Y7qvEAF66AkcY0+ypuFMiG9+NNSk rGVOSONXXqKZkpNWTqBlzJS27XuWrzHAc4JME7+PeiazMGaTZdFWFGhJw4oHgw1S2Mdxh/7E6AR rKwCCdfBbOOrJk3dy3Lu+lrGQhzRQxxMIY0LGBO5TU68IC1o2+w9NuOniqp42XTPhEHsOgQogoS 2/Pigq22hXoSmTVDTX/HZoh0HOK9vk3iZNrD5Vty4yBpCIEfdYrZ39QTAvcAvWO9EC6uPSi/LwP rxSoZAYtHclDSIsRPPSYcmPdTBpAu5DwyRIKWwXn+YPIQ8uLn5rH8hcqNT50PWyN+T5UAm37dV0 v7ufhYgOd6qVc0ZkllMyo2Q/eu8ZzEOAe3EnRMWwv/jop38LwCABi7vMCrcgLKfdEOOZWOjwP/G 3Lz5U4W/K+FJiXLW45CJC1BQIAMHReod83ELhVgc9cP7rf5vHYn3dRiJnrGGdbB4eHeBPG87gjE KMYjjKnY3JIbtJg== 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: 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: 1787685297693158500 Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Denis V. Lunev Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/ahci-test.c | 5 ++--- tests/qtest/ide-test.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 71d23fe56af7..0528a422fafc 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1719,8 +1719,7 @@ static void test_atapi_engine_restart_in_flight(bool = dma) qtest_memset(ahci->parent->qts, buffer, 0x00, ATAPI_SECTOR_SIZE); =20 /* Suspend the next backend read so the ATAPI read stays in flight. */ - g_free(qtest_hmp(ahci->parent->qts, - "qemu-io drive0 \"break read_aio rd\"")); + qtest_qemu_io(ahci->parent->qts, "drive0", "break read_aio rd"); =20 cmd =3D ahci_atapi_command_create(CMD_ATAPI_READ_10, ATAPI_SECTOR_SIZE, dma); @@ -1732,7 +1731,7 @@ static void test_atapi_engine_restart_in_flight(bool = dma) ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST); ahci_px_set(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST); =20 - g_free(qtest_hmp(ahci->parent->qts, "qemu-io drive0 \"resume rd\"")); + qtest_qemu_io(ahci->parent->qts, "drive0", "resume rd"); =20 /* Round-trip through the device to confirm qemu is still alive. */ ahci_px_rreg(ahci, port, AHCI_PX_TFD); diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index b36b0f8875b2..31692f6925ac 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -836,7 +836,7 @@ static void test_flush(void) make_dirty(qts, 0); =20 /* Delay the completion of the flush request until we explicitly do it= */ - g_free(qtest_hmp(qts, "qemu-io ide0-hd0 \"break flush_to_os A\"")); + qtest_qemu_io(qts, "ide0-hd0", "break flush_to_os A"); =20 /* FLUSH CACHE command on device 0*/ qpci_io_writeb(dev, ide_bar, reg_device, 0); @@ -848,7 +848,7 @@ static void test_flush(void) assert_bit_clear(data, DF | ERR | DRQ); =20 /* Complete the command */ - g_free(qtest_hmp(qts, "qemu-io ide0-hd0 \"resume A\"")); + qtest_qemu_io(qts, "ide0-hd0", "resume A"); =20 /* Check registers */ data =3D qpci_io_readb(dev, ide_bar, reg_device); --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685312; cv=none; d=zohomail.com; s=zohoarc; b=L4XM/cWqFpTtVuIhqo2d7drXKzUt9IcV7yWQia5U/6uCTvRuHXW7M4abcWTNM7lZy0QRzNu3Vq0npSFANF6RDBxHbyBA1zfVvSrHxNhdNaY4AjQpqhuuHFwXtjIqKrGZ07H/L68BRQXQEt1m6cuDsKDgaLU4lIBEE67n1AhVaWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685312; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0PoiWTQyc+6CT3+XQBefK1rDjJHIoQVwAvU80roRsDk=; b=GAIaaiIfBXDrxe6H2qEOciWfJRTFKspeLYtzdASWoNA4xWW2Ynuq6BORRc1ykcZqaW/6r4SV6uqvkGGuU6bYIuXmBT75hlpgPoCW2BRr5OF8LR4YsEbaA8HBme0GVv02rkriRH16FXxyL97fELeKe89Z1sHfRv39M1h91/rEliM= 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 1787685312410598.4456786544376; Tue, 25 Aug 2026 12:15:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYo-0006ZX-F0; Tue, 25 Aug 2026 15:11: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 1wywYe-0005x0-PS for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:41 -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 1wywYc-0004DL-Nz for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11: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-452-_LcSR8OLO2iDTV6ZDWpg9Q-1; Tue, 25 Aug 2026 15:11:34 -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 E995818512F0; Tue, 25 Aug 2026 19:11:32 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2768818005B4; Tue, 25 Aug 2026 19:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0PoiWTQyc+6CT3+XQBefK1rDjJHIoQVwAvU80roRsDk=; b=JVKq9lmLJXhfLq9Qc++N9W5LEgzmrDrWlaCTQ8M4gdeYsya3kqjo0EZzFXRwme3tfPThlr 6MN94yOZKndeBhfJW9wzVUrNSMctv+hufzGJBtXbqxcCPO6e86Uy8aTPVPs5mhC4W4ietC iE8u1sgibf4fC1n2FQtlVskSFmqxYn8= X-MC-Unique: _LcSR8OLO2iDTV6ZDWpg9Q-1 X-Mimecast-MFC-AGG-ID: _LcSR8OLO2iDTV6ZDWpg9Q_1787685093 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:31 +0400 Subject: [PATCH v4 24/49] tests/qemu-iotests: add qmp_qemu_io() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-24-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1547; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2ie2jIETQhyqbbYcjhhut4gVUdDiVPF4PD6eQdFtxIU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHU2p75Cc9aY+/y/1UVEVOI47Berx7H0ikK 7Lfq0e1AnOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5d45D/0YeeSXxH3UWOaBLplLO2lqxDLrdGdT9vnDvwq9pYtJtcOKWH+jUPTCIk3etZhCBh+yUJV qfCezHRBnhtvmfJEd+BJrWVoULQ5wgdwpM3cz9DP7m6OeqEH4LuVRvBglMxSJV8ItuHQ3PiPYkx eja1hBcKyXAAZQKx00N1FrMAm8jPlvS7T29ZA9+OlTO0A4GpjuAycS3QCgHUP72g6AZQ8mJjmH9 gHoNCCCNsYBCp/wAl9osOr2mm4F6T2hSzr/415tvXF+KVV2+TGSshjdb6gq8pOsNIf8PXuuclmc 6aR/S8Zon6aj4jwUfHwa39gez7z6R92Os+G6NCpjFLadRv9vG9Wa4sM9YIk76MtpRgSvbp7VdJR iGmR+Mo/5sYOfZ8ZWerivW9MjHkyl3uMDwYmzq4Lli0jD3fh8QodzIELON3Jg1x4BNhk44W1z0C I+wu1xm+T2B+YqRejvrIuwhb3BLb73UVuhdnJ9mv8iwQ20OyTYgOLT4+qmskv5hxgIHgYLSFKhY ZG4Wu/WoIiXmW3GyhDMaEk1gAIjOBVdO0DbXy4Mxe4H1yqDTpldJjnN7ljF3fXjZ5lmZwt17aE7 E8iYk056TEDSB6KquU9aV1sP33XcL1VTeFRZq/13lJ4m02dyRzwBj5X8bNDUsPNSyniCxBS1TP+ peVk5Z4fIv24a+Q== 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: 1787685313480158500 Add qmp_qemu_io() method as a QMP counterpart to hmp_qemu_io(), using the x-qemu-io QMP command instead of human-monitor-command. The x-qemu-io command takes separate 'device' (or 'qdev') and 'command' arguments, and returns the error string. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- tests/qemu-iotests/iotests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 072be80e0792..c24f1e3767c4 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -953,6 +953,20 @@ def hmp_qemu_io(self, drive: str, cmd: str, d =3D '-d ' if qdev else '' return self.hmp(f'qemu-io {d}{drive} "{cmd}"', use_log=3Duse_log) =20 + def qmp_qemu_io(self, drive: str, cmd: str, + use_log: bool =3D False, qdev: bool =3D False) -> str: + """Write to a given drive using the x-qemu-io QMP command""" + kwargs: Dict[str, Any] =3D {'command': cmd} + if qdev: + kwargs['qdev'] =3D drive + else: + kwargs['device'] =3D drive + if use_log: + res =3D self.qmp_log('x-qemu-io', **kwargs) + else: + res =3D self.qmp('x-qemu-io', **kwargs) + return res.get('error', {}).get('desc', '') + def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): if output is None: output =3D {} --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685125; cv=none; d=zohomail.com; s=zohoarc; b=RgDxozZkesDhFnE0v8vJG+Rua4g3HBn+CRvuZwu7SdqERDUrdjaSgJJ9XW6mMvU96FgItaNT4yzkESc4E4ni3Fi8CpLmykc1XLHzCg8IlnTkJbw6hEjZ8+vgwAuuq0fvAkrl/70DFthdLki5z9jMlnohTh67rIZqCqqTCZN5Egc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685125; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Li9eaIRd/wq0aVwn/Br8is5mFw0E+0GI7agP3g+jan8=; b=Z8SenEXsbm9rp3dZXyG1r4FTZ6Mgl6aYDX2grQl8J/IAVyg7l9xg/uwULB5Bw5asqEuCGi6iniiyE0Vf10mL84RgHZt1MV4Zx+Iru0IHiFXQckyuK94RUSy4qht9npcy/OV2POmhV/lT43vIevQV+2bMT0MEWl7znQG0KADxEEM= 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 1787685125005781.1036813954289; Tue, 25 Aug 2026 12:12:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYm-0006Pc-MT; Tue, 25 Aug 2026 15:11: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 1wywYg-0005zi-RF for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:44 -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 1wywYe-0004FJ-IF for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:41 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-qikDHNZsOFCvNSaw4WP9CQ-1; Tue, 25 Aug 2026 15:11:37 -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 7B8E619792EE; Tue, 25 Aug 2026 19:11:36 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EC6018005BD; Tue, 25 Aug 2026 19:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Li9eaIRd/wq0aVwn/Br8is5mFw0E+0GI7agP3g+jan8=; b=CAGkO/Gi1QUQR/TEab4h1A5hiBosInybCijveHF3DhONVncOtVfIf1LQwH2/z7ej3e3aGN 9j3ppHkXxuAsSF2wiURozIxObO/jtwphNBW6e570sfYd0Ye1uksfgbpEFy/GZaBTYoNXz+ SHaOQwO3K3VZt7z7PnnzuBLvfjHhJr8= X-MC-Unique: qikDHNZsOFCvNSaw4WP9CQ-1 X-Mimecast-MFC-AGG-ID: qikDHNZsOFCvNSaw4WP9CQ_1787685096 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:32 +0400 Subject: [PATCH v4 25/49] tests/qemu-iotests: convert pause/resume_drive() to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-25-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=1251; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/L0hVAFEx3XIWnCzmZ1t+k9L/2lgK8hla0QlNAoAMqw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHAh+rynmJmjPQE6NA9ucFldrhkrG6kciKq WFj6cfQ5wmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5RAUD/9z+APFdLA4oDk3E4TPtAUYCfnyvLMSoazTeMFsBOxd61ujb9ffTYNoaNYnR5jhpNtIJck hcR/Mq+ZKvTq9OsO7B9Qvgh5+KJutYqfdsVhCvexma7zPaPSe3uMLaOuuNvqPKRxQVZ7o59L0j0 AeEZgpd+wZNNfH8GngnC6zPii3t6fut8jzXcFXm/29TsGih4L8iTaYhxcjZEJo4cqXe/wyr0P4t K0hLox75tL5z4hUg31mKh4oPL6VrTLCm1m3+CmIjgHjX3ZxS1UgBPcaz7YwNBP5l806o0FdFiRD Of0akU+sCBZxT9P6oylJYw1psOkFsaHi7p3MVSubaKFcpZXizS4QNogrt3419VTn2YnSxFAh2Rh 1wSsD4wE0eN/LHv0baUR22Fe9V3xC+FsJtSnGp189B/JVuKnO8VledWFB97pM2pPiwJMqcs4oI3 TA7RC6fpkKykUUuepbLTYnUdlRH18RjxhjtkfqC2tNIjG2hvGSIa8H9IpPYhkILZ9IYzKg7t3HY P+9yRqw4kHFDQjhsD86Av/IULHfOqP1c8jKKtXwOzM6MjRhPcf35v/OPN+fdTbk0yjFSfUafa0m eAcc9NVbtxZvGFuYjDxlYW47QIqqU8LwI+MuhRDl+eZt72MmgkYwPAHIqLSm9jbT2fQccKuypOq W9wJ0TD1zr+dBYA== 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: 1787685126418158500 Convert pause_drive() and resume_drive() to use x-qemu-io directly instead of routing through hmp(). Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index c24f1e3767c4..f36bcf316429 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -941,11 +941,11 @@ def pause_drive(self, drive: str, event: Optional[str= ] =3D None) -> None: self.pause_drive(drive, "read_aio") self.pause_drive(drive, "write_aio") return - self.hmp(f'qemu-io {drive} "break {event} bp_{drive}"') + self.qmp_qemu_io(drive, f'break {event} bp_{drive}') =20 def resume_drive(self, drive: str) -> None: """Resume drive r/w operations""" - self.hmp(f'qemu-io {drive} "remove_break bp_{drive}"') + self.qmp_qemu_io(drive, f'remove_break bp_{drive}') =20 def hmp_qemu_io(self, drive: str, cmd: str, use_log: bool =3D False, qdev: bool =3D False) -> QMPM= essage: --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685351; cv=none; d=zohomail.com; s=zohoarc; b=Hu/Zzofv0zRIFb4PimAwldETNiaelVSMaxt55MVpqLySERQZqHQ2lyGekdxORP0iFCFTyEOYLDKKOf6m8M1dp62V1mxbMKpQqQ8WJTwtUhcVuc3cxxFE9wXbTwujoT6kjY98xrksX4BvPZK+m/cukNbT/XqtTSz5Mygf90AqfBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685351; 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=I7e/G6ayjlLmnAt1YsI88wroV6wkiLiRxEzd6nwAmg4=; b=LCCXiHvnoa25uSafXoly0ILC76N+DFfv1biqxYm+5td/QL95QkK1mpqIsCdxQLCvCDLl7KnbLY+lfkjgEpzhvHyqpzrVELZ0hQ9CMA74Zy0J/oSmmh4dlz4FmFY5puknVx1V5KCR1JpbccZCvzsWw7n2kJ7gTaX8+nqudoXLA0Y= 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 178768535173948.41040179104448; Tue, 25 Aug 2026 12:15:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYq-0006jF-Cv; Tue, 25 Aug 2026 15:11:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywYo-0006ZB-91 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:50 -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 1wywYm-0004IP-L6 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:49 -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-425-O9W1MKHGO6aTg68cHuHF6A-1; Tue, 25 Aug 2026 15:11:42 -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 3DA8F188FEC9; Tue, 25 Aug 2026 19:11:40 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6FBC27D6; Tue, 25 Aug 2026 19:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685107; 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=I7e/G6ayjlLmnAt1YsI88wroV6wkiLiRxEzd6nwAmg4=; b=atLtannK2zFTufedenVZfRPFgE0RUW00X57a0LbgYMQVESzLKlOgj1qT5N5GwbYEGDe1xM pJ9uBFVqH5+nUmIh/SwTd8PTlPBMtusB4wGg88icuvKVml8fbRi1RMyNMIaD6mJVjVEql4 uG5eA8Ybtpwu1fSSipBVltCzsOg98hk= X-MC-Unique: O9W1MKHGO6aTg68cHuHF6A-1 X-Mimecast-MFC-AGG-ID: O9W1MKHGO6aTg68cHuHF6A_1787685100 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:33 +0400 Subject: [PATCH v4 26/49] monitor: reject readline monitor when HMP is disabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-26-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1168; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=7DtJbbNtCV+GK9xsiSCtjJEnA3E/Kj94gj9UFrCvS8c=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHIJ5xdn+jNX6HAMQoA4GZn/XMUkJMOPFl+ X1p1RCT2mSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5VQCD/9GFRwYtN3GbGhXrxFQ31vCBicu985vP/c9ZlDLUZDEBgLO5WSr6SBBWccW4e2ZnH/yGia Cmc0b2Ev9VAA8GnCWN/1tD/CpYPvfT4YPs+S0oJTUSRnDXaDC1CMlCOcXCNfX/hjZXDEcxnY/Sa vTKgHZrIfy1Sa2yDT3O3OT0Iis9NGY/+nfLP0JwYZB+kznBs8DaL4muSNToek5vRr2ZhNR0IdQX AWnhIH6oIpkYqliK/5DergJaajc34ayIA+UBM0b6nM/B+yBxnDlexEXoxNPzTxXMHH0Ily/OUM2 BW25vlq00xJGwVID5PJ81jRhSXNWCHcgH63dJyImtOdTaP7/iQusw7EzZsGm2CwMfNE1g8XoZrv 2d+q+Zplp7CJkMrkGoZxKSk1wa8CCZlPW1RYYqg222RzKMFt9hgSP58l+2/Lr0ottiMfGoDH6s4 fEEtxqr/eRuGuaIWwpmcRl8DbMGZy83amJtRDMy74g4iwH6Ata4x6mFFTnG002afAwLnGjUWsGU Ss01UDa4SEhIp35u9u/INqMj4V9pM6xPTtdNvt1OsRA2oJGWeO7UbE/n4TC7xcuLxWIlob4BaJ+ 8qALsikcG/thGxALHBmlFw1EJunOM8A/3utmJOZF+Pjo07gvVwY+N8CZLUufEfSo8BFvnLpah3t ++bBa/BIT8WZNqw== 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: 1787685353965158500 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 --- 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 21:37:38 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=1787685150; cv=none; d=zohomail.com; s=zohoarc; b=dLfDdQeOekB8ZjMD3RUTdKAOSMDuPJWGEE+Ne5k17c3SO1i+6B7G4D4k0wOocTOBRIKXZ6TL862CEQ3W5y3LIAfrGs3BxEzbTYiDdUIYCRN60wEX8P+bgrJ/2IFNhvPegt6CR1l6dvnfXlR2Ffc/CqqiRyw2VHynjnyva9aGuCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685150; 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=yzt3oQVtBjQ6TrWLxwLxcXzi8FaWAeSdiEMxpCf792k=; b=VdHk+8pHD/yWZNmgZSj4tK2L9Sr3NH4UnICJXuJR8s/kZ5POpdgBkjUJZgVCtw2utcBiwJbBbFwePB5xbaSZreFc+c7x8mTDz6ANiW6pM52fN5I3DzkIbSfoWiaCq25ODkGKeQqiLkqENLTZfOj9j4klaECAyAOF1och7+MbMsI= 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 178768515008267.62045843185263; Tue, 25 Aug 2026 12:12:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywYr-0006n9-ER; Tue, 25 Aug 2026 15:11:53 -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 1wywYp-0006it-PW for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:52 -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 1wywYo-0004Ie-5y for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:11:51 -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-25-fBnZphbrNqyG1Tao6AdBqA-1; Tue, 25 Aug 2026 15:11:44 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9180D195FCDD; Tue, 25 Aug 2026 19:11:43 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA80218005B4; Tue, 25 Aug 2026 19:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685109; 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=yzt3oQVtBjQ6TrWLxwLxcXzi8FaWAeSdiEMxpCf792k=; b=JLxi+Y6xIVHlWCDQ+Bnf/yf+uX93s/+ADk+RJdbyIQBwaQuyu3p+FIkeXBc0oXWwA0K67m aXwTSvmKtS3QTtwhS/4ibh1BD6ugqz7ioWW29bS3XA8cmKfdaS0DfUd4rSt5va3QTOiXlU HFeD3iB/nPQZYx3XQ/bRvMX+nxcoRas= X-MC-Unique: fBnZphbrNqyG1Tao6AdBqA-1 X-Mimecast-MFC-AGG-ID: fBnZphbrNqyG1Tao6AdBqA_1787685103 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:34 +0400 Subject: [PATCH v4 27/49] system: guard HMP initialization paths with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-27-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3769; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=NucbtIkSZZwE1hWWqwuXD6cB2sdzfg9xAMRVv7YI8qM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHmPXkF3RVXsr4PZ/1i7esYGY507DN3TpM9 6qJ44NhXGqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5aOTD/4uoq/bC8vlV8lhYO8qHL8TGSuCRVT3DUglYBajMJGg3r9gGa8Ghe7/TTO2ReSiVS+4RTF nDR135Zl5cF0ExSxQintwYuGjEs6SWAaOD6ZFKxzaC6jiXnys1XTuyoIlnP7td2+15s9lOfaV48 8xj5LerhXbzwi/RfL4PlElrGV+4wsqa4KhHox4SRlB6DOlzuRUW8BSCCKFYweK0hIaxrCyQRROy 85OOsHHXYiP7FGjnSpS2KYiFRt3+7jBuUrL4ixnFe55lkcdL0RrtIi6youQsKu7f91NanszLO6S iWpiIOKyckEb/zLtrMbEnMucMS53xDN46OwYinmVclCws9WXXvhf4C6IpBmv5/Kqfo23S4t0VGT d1ZQSTwUQCyuCCWXSJ8BTOzXOADZXxQYFM94lcapYopO3oEo9JuZnaV0IKJuH9L9Xi0+sYJwlGi R0f17bIv44dZghvFt82VdO6jbi5yK4a+o8z3x+Hzqk+Nl477ilT0OYe6d4Eeg7pn/LKNz5gCOye 0YC40E9ILL/uFXFNyENkLkZweRKI4ZKbm1M9UB5jKoZwuBpFNtD0U1a9UvJXhh8ugzD+YMm/ucB mbeUJPnvDHqM9losBsWg/RcEo7Zg3kskbwX+7+YrKtHuJoHlgGRb3xyypjBZl8QrClUhYa84m2h orjZmgSIojMbksg== 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: 1787685150574158500 - 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 --- chardev/char.c | 9 ++++++++- gdbstub/system.c | 8 ++++++++ qemu-options.hx | 6 +++++- system/vl.c | 4 ++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 22e5bae388ad..c6c8133f5c1d 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -804,8 +804,9 @@ static Chardev *qemu_chr_new_from_name(const char *labe= l, const char *filename, } =20 if (qemu_opt_get_bool(opts, "mux", 0)) { - const char *chardev_id =3D qemu_opts_id(opts); assert(permit_mux_mon); +#ifdef CONFIG_HMP + const char *chardev_id =3D qemu_opts_id(opts); monitor_new_hmp(NULL, chardev_id, true, &err); if (err) { error_report_err(err); @@ -813,6 +814,12 @@ static Chardev *qemu_chr_new_from_name(const char *lab= el, const char *filename, chr =3D NULL; goto out; } +#else + error_report("HMP monitor is disabled"); + object_unparent(OBJECT(chr)); + chr =3D NULL; + goto out; +#endif } =20 out: diff --git a/gdbstub/system.c b/gdbstub/system.c index c77d067ab458..070bc26f416c 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -387,10 +387,14 @@ bool gdbserver_start(const char *device, Error **errp) =20 qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL); =20 +#ifdef CONFIG_HMP /* Initialize a monitor terminal for gdb */ mon_chr =3D qemu_chardev_new(NULL, TYPE_CHARDEV_GDB, NULL, NULL, &error_abort); monitor_new_hmp(NULL, mon_chr->label, false, &error_abort); +#else + mon_chr =3D NULL; +#endif } else { qemu_chr_fe_deinit(&gdbserver_system_state.chr, true); mon_chr =3D gdbserver_system_state.mon_chr; @@ -524,10 +528,14 @@ void gdb_handle_query_rcmd(GArray *params, void *ctx) len =3D len / 2; gdb_hextomem(gdbserver_state.mem_buf, gdb_get_cmd_param(params, 0)->da= ta, len); g_byte_array_append(gdbserver_state.mem_buf, &zero, 1); +#ifdef CONFIG_HMP qemu_chr_be_write(gdbserver_system_state.mon_chr, gdbserver_state.mem_buf->data, gdbserver_state.mem_buf->len); gdb_put_packet("OK"); +#else + gdb_put_packet("E01"); +#endif } =20 /* diff --git a/qemu-options.hx b/qemu-options.hx index 34970fffc94b..680344162efb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4985,7 +4985,11 @@ SRST ERST =20 DEF("mon", HAS_ARG, QEMU_OPTION_mon, \ - "-mon [chardev=3D]name[,mode=3Dreadline|control][,pretty=3Don|off]\n",= QEMU_ARCH_ALL) + "-mon [chardev=3D]name[,mode=3D" +#ifdef CONFIG_HMP + "readline|" +#endif + "control][,pretty=3Don|off]\n", QEMU_ARCH_ALL) SRST ``-mon [chardev=3D]name[,mode=3Dreadline|control][,pretty=3Don|off]`` Set up a monitor connected to the chardev ``name``. diff --git a/system/vl.c b/system/vl.c index 5ccc19282ba2..760cf6e7265a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -199,7 +199,11 @@ static int has_defaults =3D 1; static int default_audio =3D 1; static int default_serial =3D 1; static int default_parallel =3D 1; +#ifdef CONFIG_HMP static int default_monitor =3D 1; +#else +static int default_monitor; /* false */ +#endif static int default_floppy =3D 1; static int default_cdrom =3D 1; static bool auto_create_sdcard =3D true; --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685137; cv=none; d=zohomail.com; s=zohoarc; b=b7kDtb+r3wWYIBrptBl07zveHH7guTQ38SFV7q/WZRXQRuLx7iZseTRz3A83i1fHdRmg2FT2i73moAltK+5wiRmfyqphG5SdG50fprpzTyvee5kZwSmRmtBzV7IDru4YZ1ltqQE6jJGbuORrsEkbc4vogjMNn4SqvWru7YdrHG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685137; 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=5sm50nC9j9AKkXq46KV+FOJM33zpmzdHl2b/Q1NzN08=; b=m5m615/fI2T/qGylFkLnx0hFcHIk17995GyEaoRA2TvEikG8kuvA06UsmyMUFL1wr0bqCwnR0QeyGUAHjELtGCu4+uXO1f6fqUxGBP+N7Mk9qiT+As7aFDPc4ELCZCCYaZTS2TAYZYkkd1OkfcXbxbdISAmaksDdwN+xmVQFUKk= 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 1787685137341868.5852917063286; Tue, 25 Aug 2026 12:12:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZ5-0000KK-NX; Tue, 25 Aug 2026 15:12: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 1wywZ3-0008SD-6y for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:05 -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 1wywYy-0004JR-HP for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:04 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-4EJ-RhX-PsewWzyUBvvcQQ-1; Tue, 25 Aug 2026 15:11:49 -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 987111954B3E; Tue, 25 Aug 2026 19:11:47 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 490A9434; Tue, 25 Aug 2026 19:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685117; 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=5sm50nC9j9AKkXq46KV+FOJM33zpmzdHl2b/Q1NzN08=; b=an5/NJ4PIYlK/VVeyGYA8wB0bJXzyITgEHaNktAprsB5x4YtPcWcmY1YOBIdy5h64sYX6s 6BHROZadsXP/cDvSJt3YAGiE2936vb9aqQTuw1pGSQ9h6BaEddAmEbqxEwtIs2YL0Yqvcy wVESK0SmfufPsTSRo/QaaMQP8Q85iWg= X-MC-Unique: 4EJ-RhX-PsewWzyUBvvcQQ-1 X-Mimecast-MFC-AGG-ID: 4EJ-RhX-PsewWzyUBvvcQQ_1787685107 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:35 +0400 Subject: [PATCH v4 28/49] tests: skip HMP-dependent tests when HMP is disabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-28-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Hyman Huang , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=41066; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=pFWGNiIId3GKva578rPE7YzSY5rMwiLn5o+Ug7lD8qo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHjD1wa8Ops90DsxRD2hafVNTLd2DsKRHIv k6CR5vGoD6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5dPuD/9lgMTwxdD/I/GjKYVBINVgNaZumCXs8ywVCl5Hads85r7HKRUe3uIILSOrbAYt4QUrzFZ 8UVw15Ejt7jWVnblKTC2GlCzUbgxNDq3S99XO74o/9MlnPhR3kne3Z7njYbmDPDwMgz/lEL14nU jrvGK0nBqBWQ/OqKYEE2L1ewWfY5UE5nqnzaD+7fquz3DR4PJhwYKVlAyLsVxbgfcxfrPO6Q9b6 KkVQ3IuVJiBgXI1zndyYRci8OAGxT0NdHC4ZxjPCOdqsSCdcOXn3ploeu0DMQBtG8Q30FT4IWGD zsiE2HAwBLldTGEiEg956Rn5ic1ZEkHgjB/FmyurC+YPq9hwjV6voRaj/kO6m591tx37f87ghZu gQk2+aeK5Kh3fc7cCcoNlgWCwlHkQcupqFzDkP0Cp6zH6Lv41oMQM9RAsFq6QkE0lboPItz6B5N aUQK3xhFnmdg/NjBfj7zsIQTA3lMgE5uwUNFNqI0bT/cYHFnM6Mk0m5wsxuJdjXVeUTdhD3Y2yH oiziuuuj0SEfQzUvFrFE5Ugm3i3M7oxjzX4Jl2fE6clh7UvgqNZflhbauckcq02hqwy4SD32H2E hEK60/fxC9ozK3YFSJ7sxixRqTm7MXxHLB2krGlJLD5BZtsOE852d6HJXNht2oaNgZ3q+ffg7Hj m6B0GyPa4JbeWPQ== 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: 1787685138794158500 Add runtime detection of HMP availability so tests gracefully skip instead of failing when QEMU is built without HMP support. For qtests (drive_del-test), use compile-time #ifndef CONFIG_HMP guards. For bash iotests, add _require_hmp() to common.rc that probes QEMU. For Python iotests, add _verify_hmp() and a require_hmp parameter threaded through execute_setup_common()/main()/script_initialize()/ script_main(). An earlier version of this series did an almost-complete conversion of the tests to QMP. However, this made the series even longer. I decided to post-pone it for now. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andre Lureau --- tests/qemu-iotests/028 | 1 + tests/qemu-iotests/045 | 3 ++- tests/qemu-iotests/051 | 1 + tests/qemu-iotests/056 | 3 ++- tests/qemu-iotests/060 | 1 + tests/qemu-iotests/068 | 1 + tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 1 + tests/qemu-iotests/091 | 1 + tests/qemu-iotests/093 | 3 ++- tests/qemu-iotests/102 | 1 + tests/qemu-iotests/117 | 1 + tests/qemu-iotests/119 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/124 | 3 ++- tests/qemu-iotests/130 | 1 + tests/qemu-iotests/132 | 3 ++- tests/qemu-iotests/136 | 3 ++- tests/qemu-iotests/142 | 1 + tests/qemu-iotests/145 | 1 + tests/qemu-iotests/146 | 1 + tests/qemu-iotests/148 | 3 ++- tests/qemu-iotests/151 | 3 ++- tests/qemu-iotests/152 | 3 ++- tests/qemu-iotests/153 | 1 + tests/qemu-iotests/156 | 1 + tests/qemu-iotests/157 | 1 + tests/qemu-iotests/161 | 1 + tests/qemu-iotests/165 | 3 ++- tests/qemu-iotests/172 | 1 + tests/qemu-iotests/181 | 1 + tests/qemu-iotests/185 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/192 | 1 + tests/qemu-iotests/201 | 1 + tests/qemu-iotests/216 | 3 ++- tests/qemu-iotests/225 | 1 + tests/qemu-iotests/232 | 1 + tests/qemu-iotests/236 | 3 ++- tests/qemu-iotests/245 | 3 ++- tests/qemu-iotests/246 | 3 ++- tests/qemu-iotests/249 | 1 + tests/qemu-iotests/254 | 3 ++- tests/qemu-iotests/255 | 3 ++- tests/qemu-iotests/257 | 3 ++- tests/qemu-iotests/260 | 3 ++- tests/qemu-iotests/264 | 3 ++- tests/qemu-iotests/267 | 1 + tests/qemu-iotests/274 | 3 ++- tests/qemu-iotests/280 | 1 + tests/qemu-iotests/281 | 3 ++- tests/qemu-iotests/283 | 1 + tests/qemu-iotests/286 | 1 + tests/qemu-iotests/298 | 3 ++- tests/qemu-iotests/300 | 3 ++- tests/qemu-iotests/304 | 3 ++- tests/qemu-iotests/310 | 3 ++- tests/qemu-iotests/common.rc | 8 +++++++ tests/qemu-iotests/iotests.py | 14 +++++++++++- tests/qemu-iotests/tests/backup-discard-source | 3 ++- tests/qemu-iotests/tests/copy-before-write | 3 ++- tests/qemu-iotests/tests/image-fleecing | 3 ++- tests/qemu-iotests/tests/iothreads-create | 3 ++- tests/qemu-iotests/tests/luks-detached-header | 3 ++- .../tests/migrate-bitmaps-postcopy-test | 3 ++- tests/qemu-iotests/tests/migrate-bitmaps-test | 3 ++- tests/qemu-iotests/tests/mirror-change-copy-mode | 3 ++- tests/qemu-iotests/tests/mirror-ready-cancel-error | 3 ++- tests/qemu-iotests/tests/qcow2-internal-snapshots | 1 + tests/qemu-iotests/tests/qsd-migrate | 3 ++- tests/qemu-iotests/tests/reopen-file | 3 ++- tests/qemu-iotests/tests/write-zeroes-unmap | 1 + tests/qtest/drive_del-test.c | 25 ++++++++++++++++++= ++++ 73 files changed, 152 insertions(+), 37 deletions(-) diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 2b232c461405..28f01439c525 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -49,6 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 # Choose a size that is not necessarily a cluster size multiple for image # formats that use clusters. This will ensure that the base image doesn't= end diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index a341f21cd70f..cd1b35edb17f 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -172,4 +172,5 @@ class TestSCMFd(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index 4c079b11e320..a722c0c1bc8f 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -45,6 +45,7 @@ _supported_proto file _unsupported_imgopts 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' data_file \ compression_type _require_drivers nbd +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" =3D "pc" ]; then _require_devices lsi53c895a diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 808ea6b48abe..7cc97486951c 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -332,4 +332,5 @@ class BackupTest(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 5cd21a6f686f..8d06f84df16b 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -56,6 +56,7 @@ _unsupported_imgopts 'compat=3D0.10' data_file \ =20 # The repair process will create a large file - so check for availability = first _require_large_file 64G +_require_hmp =20 rt_offset=3D65536 # 0x10000 (XXX: just an assumption) rb_offset=3D131072 # 0x20000 (XXX: just an assumption) diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068 index 7ecd2474093e..11b660a8b7c4 100755 --- a/tests/qemu-iotests/068 +++ b/tests/qemu-iotests/068 @@ -43,6 +43,7 @@ _supported_proto generic # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'compat=3D0.10' 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 IMG_SIZE=3D128K =20 diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 331f8cfddcf9..83c4ce6314c5 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -43,6 +43,7 @@ _require_drivers blkdebug blkverify # blkdebug can only inject errors on bs->file, not on the data_file, # so this test does not work with external data files _unsupported_imgopts data_file +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 index 1ac66f197e46..d9e729f674c6 100755 --- a/tests/qemu-iotests/081 +++ b/tests/qemu-iotests/081 @@ -44,6 +44,7 @@ _supported_proto file _supported_os Linux _require_drivers quorum _require_devices virtio-scsi +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index e396748a9179..626203d6fc93 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -48,6 +48,7 @@ _supported_fmt qcow2 _supported_proto file fuse _supported_os Linux _supported_cache_modes writethrough none writeback +_require_hmp _default_cache_mode none writeback =20 size=3D1G diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 4f9e224e8a8c..26ae6e2b2d56 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -419,4 +419,5 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): if __name__ =3D=3D '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=3D["raw"]) + iotests.main(supported_fmts=3D["raw"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index 141bfe1e9023..5db8180d3bb7 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto file fuse +_require_hmp =20 IMG_SIZE=3D64K =20 diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 index 6081473584fe..5cc9433f4a67 100755 --- a/tests/qemu-iotests/117 +++ b/tests/qemu-iotests/117 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto file fuse +_require_hmp =20 _make_test_img 64k =20 diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119 index 6cac8793bac6..ce1b62521f59 100755 --- a/tests/qemu-iotests/119 +++ b/tests/qemu-iotests/119 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt raw _supported_proto nbd _supported_os Linux +_require_hmp =20 _make_test_img 64M # This should not crash diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 index ac7bd8c4e3cd..e4ed87e1a705 100755 --- a/tests/qemu-iotests/120 +++ b/tests/qemu-iotests/120 @@ -42,6 +42,7 @@ _supported_fmt generic _supported_proto file fuse _unsupported_fmt luks _require_drivers raw +_require_hmp =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index b2f4328e3456..ab9ea4d8b59d 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -750,4 +750,5 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 index 7af85d20a892..3d10aba2594e 100755 --- a/tests/qemu-iotests/130 +++ b/tests/qemu-iotests/130 @@ -46,6 +46,7 @@ _supported_proto file _supported_os Linux # We are going to use lazy-refcounts _unsupported_imgopts 'compat=3D0.10' +_require_hmp =20 qemu_comm_method=3D"monitor" =20 diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index 12a64b3d95a3..3756573a57c0 100755 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -57,4 +57,5 @@ class TestSingleDrive(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw', 'qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 58df876bafca..72fd638aa04d 100755 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -410,4 +410,5 @@ class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTes= tCase): if __name__ =3D=3D '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=3D["raw"]) + iotests.main(supported_fmts=3D["raw"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142 index 86d65a2d1a1e..8538a727ac08 100755 --- a/tests/qemu-iotests/142 +++ b/tests/qemu-iotests/142 @@ -43,6 +43,7 @@ _supported_proto file # We test all cache modes anyway, but O_DIRECT needs to be supported _default_cache_mode none _supported_cache_modes none directsync +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145 index a2ce92516dc5..f61a50f63951 100755 --- a/tests/qemu-iotests/145 +++ b/tests/qemu-iotests/145 @@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt generic _supported_proto generic +_require_hmp =20 _make_test_img 1M =20 diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146 index 661a9d2625cc..f63291d0ffba 100755 --- a/tests/qemu-iotests/146 +++ b/tests/qemu-iotests/146 @@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt vpc _supported_proto file _supported_os Linux +_require_hmp =20 =20 qemu_comm_method=3D"monitor" diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index 7ccbde4633c2..4b092dccb7cc 100755 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -140,4 +140,5 @@ class TestFifoQuorumEvents(TestQuorumEvents): if __name__ =3D=3D '__main__': iotests.verify_quorum() iotests.main(supported_fmts=3D["raw"], - supported_protocols=3D["file"]) + supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 647194094a4c..204221a5738e 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -434,4 +434,5 @@ class TestHighThrottledWithNbdExport(TestThrottledWithN= bdExportBase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index 197bea9e7785..d9170359213a 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -61,4 +61,5 @@ class TestUnaligned(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw', 'qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153 index 1e02f6a6e344..def01d6f3ea4 100755 --- a/tests/qemu-iotests/153 +++ b/tests/qemu-iotests/153 @@ -59,6 +59,7 @@ _check_ofd || _notrun "OFD lock not available" =20 _supported_fmt qcow2 _supported_proto file +_require_hmp =20 _run_cmd() { diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 index 97c2d86ce573..a0e4d1ffd42a 100755 --- a/tests/qemu-iotests/156 +++ b/tests/qemu-iotests/156 @@ -53,6 +53,7 @@ _supported_fmt qcow2 qed _supported_proto file # Copying files around with cp does not work with external data files _unsupported_imgopts data_file +_require_hmp =20 # Create source disk TEST_IMG=3D"$TEST_IMG.backing" _make_test_img 1M diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157 index aa2ebbfb4b43..531dbd3122b1 100755 --- a/tests/qemu-iotests/157 +++ b/tests/qemu-iotests/157 @@ -41,6 +41,7 @@ _supported_fmt generic _supported_proto file =20 _require_devices virtio-blk +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161 index f25effab9360..8ca139262975 100755 --- a/tests/qemu-iotests/161 +++ b/tests/qemu-iotests/161 @@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 IMG_SIZE=3D1M =20 diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index b3b1709d71fa..8fc79daae16d 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -154,4 +154,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 4da0e0f2e297..a78e42ff0adf 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index b904e8ce0124..458cb737f1cb 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -47,6 +47,7 @@ _supported_fmt generic _unsupported_fmt qcow vdi vhdx vmdk vpc vvfat parallels _supported_proto generic _supported_os Linux +_require_hmp =20 _flaky_test https://gitlab.com/qemu-project/qemu/-/work_items/3515 =20 diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 index a62ae8d3293e..bb577a9cc999 100755 --- a/tests/qemu-iotests/185 +++ b/tests/qemu-iotests/185 @@ -50,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_require_hmp _flaky_test https://gitlab.com/qemu-project/qemu/-/issues/3270 =20 size=3D$((64 * 1048576)) diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 index eaf13c7a3340..9a4215d28e92 100755 --- a/tests/qemu-iotests/186 +++ b/tests/qemu-iotests/186 @@ -41,6 +41,7 @@ _supported_fmt qcow2 _supported_proto file fuse _require_drivers null-co _require_devices virtio-scsi-pci +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 index e66e1a4f06af..6869bd171537 100755 --- a/tests/qemu-iotests/192 +++ b/tests/qemu-iotests/192 @@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt generic _supported_proto file +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201 index 1b8eb51d8f38..a5c750c38a83 100755 --- a/tests/qemu-iotests/201 +++ b/tests/qemu-iotests/201 @@ -47,6 +47,7 @@ _supported_os Linux # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 size=3D64M _make_test_img $size diff --git a/tests/qemu-iotests/216 b/tests/qemu-iotests/216 index 311e02af3a7b..4eabada9b35d 100755 --- a/tests/qemu-iotests/216 +++ b/tests/qemu-iotests/216 @@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io =20 # Need backing file support iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vmdk'= ], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 log('') log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225 index b5949fcb58e0..8128d583d609 100755 --- a/tests/qemu-iotests/225 +++ b/tests/qemu-iotests/225 @@ -46,6 +46,7 @@ _supported_os Linux _unsupported_imgopts "subformat=3DmonolithicFlat" \ "subformat=3DtwoGbMaxExtentFlat" \ "subformat=3DtwoGbMaxExtentSparse" +_require_hmp =20 TEST_IMG=3D"$TEST_IMG.base" _make_test_img 1M TEST_IMG=3D"$TEST_IMG.not_base" _make_test_img 1M diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232 index b30faaa21806..1ee0aae481d4 100755 --- a/tests/qemu-iotests/232 +++ b/tests/qemu-iotests/232 @@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236 index 20419bbb9e54..3cf0de4043f6 100755 --- a/tests/qemu-iotests/236 +++ b/tests/qemu-iotests/236 @@ -23,7 +23,8 @@ import iotests from iotests import log =20 -iotests.script_initialize(supported_fmts=3D['generic']) +iotests.script_initialize(supported_fmts=3D['generic'], + require_hmp=3DTrue) size =3D 64 * 1024 * 1024 granularity =3D 64 * 1024 =20 diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index 03550b99715c..2f354d1d9205 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -1160,4 +1160,5 @@ class TestBlockdevReopen(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.activate_logging() iotests.main(supported_fmts=3D["qcow2"], - supported_protocols=3D["file"]) + supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/246 b/tests/qemu-iotests/246 index b009a7839775..cee5131c3ce4 100755 --- a/tests/qemu-iotests/246 +++ b/tests/qemu-iotests/246 @@ -24,7 +24,8 @@ import iotests from iotests import log =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) size =3D 64 * 1024 * 1024 * 1024 gran_small =3D 32 * 1024 gran_large =3D 128 * 1024 diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 index 28bffd4d5712..1254bf942913 100755 --- a/tests/qemu-iotests/249 +++ b/tests/qemu-iotests/249 @@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 IMG_SIZE=3D1M =20 diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 index 7ea098818cf0..d3d18a1bbf1f 100755 --- a/tests/qemu-iotests/254 +++ b/tests/qemu-iotests/254 @@ -23,7 +23,8 @@ import iotests from iotests import qemu_img_create, file_path, log =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) =20 disk, top =3D file_path('disk', 'top') size =3D 1024 * 1024 diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255 index 88b29d64b44e..8f88522f1e91 100755 --- a/tests/qemu-iotests/255 +++ b/tests/qemu-iotests/255 @@ -24,7 +24,8 @@ import iotests from iotests import imgfmt =20 -iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.script_initialize(supported_fmts=3D['qcow2'], + require_hmp=3DTrue) =20 iotests.log('Finishing a commit job with background reads') iotests.log('=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D') diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index cd0468aaa162..5e4dba02e769 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -533,4 +533,5 @@ def main(): =20 if __name__ =3D=3D '__main__': iotests.script_main(main, supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/260 b/tests/qemu-iotests/260 index c2133f998010..65165446607c 100755 --- a/tests/qemu-iotests/260 +++ b/tests/qemu-iotests/260 @@ -24,7 +24,8 @@ from iotests import qemu_img_create, file_path, log, filt= er_qmp_event =20 iotests.script_initialize( supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 base, top =3D file_path('base', 'top') diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index c6ba2754e279..b621f11ab427 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -114,4 +114,5 @@ class TestNbdReconnect(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2']) + iotests.main(supported_fmts=3D['qcow2'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267 index 2e2afdad9c57..e14aeb1f18d0 100755 --- a/tests/qemu-iotests/267 +++ b/tests/qemu-iotests/267 @@ -48,6 +48,7 @@ _require_drivers copy-on-read _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file =20 _require_devices virtio-blk +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/274 b/tests/qemu-iotests/274 index 2495e051a227..d91c11c70d2e 100755 --- a/tests/qemu-iotests/274 +++ b/tests/qemu-iotests/274 @@ -24,7 +24,8 @@ import iotests =20 iotests.script_initialize(supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], - unsupported_imgopts=3D['refcount_bits', 'compat'= ]) + unsupported_imgopts=3D['refcount_bits', 'compat'= ], + require_hmp=3DTrue) =20 size_short =3D 1 * 1024 * 1024 size_long =3D 2 * 1024 * 1024 diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280 index 5f50500fdb82..8f4750de074b 100755 --- a/tests/qemu-iotests/280 +++ b/tests/qemu-iotests/280 @@ -27,6 +27,7 @@ iotests.script_initialize( supported_fmts=3D['qcow2'], supported_protocols=3D['file'], supported_platforms=3D['linux'], + require_hmp=3DTrue, ) =20 with iotests.FilePath('base') as base_path , \ diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281 index f6746a12e881..5f3050f50d0b 100755 --- a/tests/qemu-iotests/281 +++ b/tests/qemu-iotests/281 @@ -336,4 +336,5 @@ class TestYieldingAndTimers(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283 index 5defe48e97d5..6d341d3e9745 100755 --- a/tests/qemu-iotests/283 +++ b/tests/qemu-iotests/283 @@ -24,6 +24,7 @@ import iotests # The test is unrelated to formats, restrict it to qcow2 to avoid extra ru= ns iotests.script_initialize( supported_fmts=3D['qcow2'], + require_hmp=3DTrue, ) =20 size =3D 1024 * 1024 diff --git a/tests/qemu-iotests/286 b/tests/qemu-iotests/286 index cc6aacf02283..3b030ec58aa0 100755 --- a/tests/qemu-iotests/286 +++ b/tests/qemu-iotests/286 @@ -40,6 +40,7 @@ _supported_proto file fuse # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 index 09c9290711a8..f2b94077f43a 100755 --- a/tests/qemu-iotests/298 +++ b/tests/qemu-iotests/298 @@ -177,4 +177,5 @@ class TestTruncate(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2'], required_fmts=3D['preallocate= ']) + iotests.main(supported_fmts=3D['qcow2'], required_fmts=3D['preallocate= '], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index e46616d7b19a..df2ba326327d 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -683,4 +683,5 @@ class TestAliasTransformMigration(TestDirtyBitmapMigrat= ion): self.verify_dest_error(None) =20 if __name__ =3D=3D '__main__': - iotests.main(supported_protocols=3D['file']) + iotests.main(supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/304 b/tests/qemu-iotests/304 index 198f2820871e..d465a519a932 100755 --- a/tests/qemu-iotests/304 +++ b/tests/qemu-iotests/304 @@ -24,7 +24,8 @@ import iotests from iotests import qemu_img_create, qemu_img_log, file_path =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) =20 test_img =3D file_path('test.qcow2') target_img =3D file_path('target.qcow2') diff --git a/tests/qemu-iotests/310 b/tests/qemu-iotests/310 index 650d2cb6fb3e..7f290898fea0 100755 --- a/tests/qemu-iotests/310 +++ b/tests/qemu-iotests/310 @@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io =20 # Need backing file support iotests.script_initialize(supported_fmts=3D['qcow2'], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 log('') log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index bcb1ec50a93d..262fe63da820 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -995,6 +995,14 @@ _notrun_on_fuse_error() esac } =20 +_require_hmp() +{ + if echo quit | $QEMU -M none -display none -monitor stdio 2>&1 | + grep -q "HMP monitor is not available"; then + _notrun "HMP monitor not available" + fi +} + # Check that we have a file system that allows huge (but very sparse) files # _require_large_file() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f36bcf316429..7d5a77a85e58 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1456,6 +1456,15 @@ def _verify_formats(required_formats: Sequence[str] = =3D ()) -> None: notrun(f'formats {usf_list} are not whitelisted') =20 =20 +def _verify_hmp() -> None: + args =3D [qemu_prog] + qemu_opts + ['-M', 'none', '-monitor', 'stdio'] + with subprocess.Popen(args, stdin=3Dsubprocess.PIPE, + stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.ST= DOUT, + universal_newlines=3DTrue) as subp: + out, _ =3D subp.communicate('quit\n') + if 'HMP monitor is not available' in out: + notrun('HMP monitor not available') + def _verify_virtio_blk() -> None: out =3D qemu_pipe('-M', 'none', '-device', 'help') if 'virtio-blk' not in out: @@ -1694,7 +1703,8 @@ def execute_setup_common(supported_fmts: Sequence[str= ] =3D (), supported_protocols: Sequence[str] =3D (), unsupported_protocols: Sequence[str] =3D (), required_fmts: Sequence[str] =3D (), - unsupported_imgopts: Sequence[str] =3D ()) -> boo= l: + unsupported_imgopts: Sequence[str] =3D (), + require_hmp: bool =3D False) -> bool: """ Perform necessary setup for either script-style or unittest-style test= s. =20 @@ -1715,6 +1725,8 @@ def execute_setup_common(supported_fmts: Sequence[str= ] =3D (), _verify_formats(required_fmts) _verify_virtio_blk() _verify_imgopts(unsupported_imgopts) + if require_hmp: + _verify_hmp() =20 return debug =20 diff --git a/tests/qemu-iotests/tests/backup-discard-source b/tests/qemu-io= tests/tests/backup-discard-source index 6c624bc8b0b0..80ea32c46e3f 100755 --- a/tests/qemu-iotests/tests/backup-discard-source +++ b/tests/qemu-iotests/tests/backup-discard-source @@ -160,4 +160,5 @@ class TestBackup(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index 3e43e7127f20..5531ad8a4c0d 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -321,4 +321,5 @@ wrote 524288/524288 bytes at offset 524288 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - required_fmts=3D['copy-before-write']) + required_fmts=3D['copy-before-write'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index 5e3b2c7e46a9..b42aa6967f68 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -31,7 +31,8 @@ iotests.script_initialize( supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], required_fmts=3D['copy-before-write'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 patterns =3D [('0x5d', '0', '64k'), diff --git a/tests/qemu-iotests/tests/iothreads-create b/tests/qemu-iotests= /tests/iothreads-create index 0c862d73f20e..09fe57a09ac0 100755 --- a/tests/qemu-iotests/tests/iothreads-create +++ b/tests/qemu-iotests/tests/iothreads-create @@ -22,7 +22,8 @@ import asyncio import iotests =20 iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vdi', - 'vmdk', 'parallels']) + 'vmdk', 'parallels'], + require_hmp=3DTrue) iotests.verify_virtio_scsi_pci_or_ccw() =20 with iotests.FilePath('disk.img') as img_path, \ diff --git a/tests/qemu-iotests/tests/luks-detached-header b/tests/qemu-iot= ests/tests/luks-detached-header index 3455fd8de1ef..58eb3c2cc484 100755 --- a/tests/qemu-iotests/tests/luks-detached-header +++ b/tests/qemu-iotests/tests/luks-detached-header @@ -313,4 +313,5 @@ class TestDetachedLUKSHeader(QMPTestCase): =20 if __name__ =3D=3D "__main__": # Test image creation and I/O - iotests.main(supported_fmts=3D["luks"], supported_protocols=3D["file"]) + iotests.main(supported_fmts=3D["luks"], supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests= /qemu-iotests/tests/migrate-bitmaps-postcopy-test index 33ff2b861f78..b2b37ada4b27 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test @@ -279,4 +279,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestC= ase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index 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 21:37:38 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=1787685130; cv=none; d=zohomail.com; s=zohoarc; b=J+qAPE3ixLZQQvmOH9fsTKeKIaIvZjWFVytRgb/YnrTTMQie7m/queVgvs3InYURc/soK3wU+XGP7umoPZK+sWE5kaYVeX9zn3zqRUcEI3yMxOkGQz0FN+RVzyIrDIyKE+1yL/zjeD4zIx/hBwJAqBBmOEHxsq4soTJo5PrtZH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685130; 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=UAVq8jQ2W8GQMPKZh9lwo20fWbzMAGBwvQIsMg5/FCI=; b=ZEJ3GqKl5DyCP9glMLd/mmOfClIzU9PxJg/DHy51dd+Op/DmRnYEIxNX5VjwdYdUk/yL6CfUo7p5v7eJc3TLEM92CLZgcYnLYDQtMzL5Jo19TJ+ghUmbizvoJsv4t5QoQaQrrsoum/h8tSX8eGw3HAezSS/bxiBuVxmb3gSM44o= 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 1787685130046600.4769188942943; Tue, 25 Aug 2026 12:12:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZ2-0008Ln-JS; Tue, 25 Aug 2026 15:12: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 1wywZ0-000839-MX for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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 1wywYx-0004Je-Oh for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:02 -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-418-9fDIjUJcONS6cFtfvgj5hQ-1; Tue, 25 Aug 2026 15:11:55 -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 C513618C104B; Tue, 25 Aug 2026 19:11:51 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2869930002F7; Tue, 25 Aug 2026 19:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685119; 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=UAVq8jQ2W8GQMPKZh9lwo20fWbzMAGBwvQIsMg5/FCI=; b=VX29oic96WR8jxeuIxgAExmA+o/Je8YK8Bg+rnAi4CiLHJnbwHyy9DxcxZ8bH/97eHSQCK 0nLK6ozmImysBcBIJRnEjDGoYEHHZrZVzWlcaWdrx4GP6gfJbC+yIws7B+2ZYMJOmU0GQX L/OD5BWXbYS8sLsy1XAPjLa7RMG/PWc= X-MC-Unique: 9fDIjUJcONS6cFtfvgj5hQ-1 X-Mimecast-MFC-AGG-ID: 9fDIjUJcONS6cFtfvgj5hQ_1787685112 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:36 +0400 Subject: [PATCH v4 29/49] 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: <20260825-qemu-no-hmp-v4-29-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Richard Henderson , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S. Tsirkin" , Laurent Vivier , Amit Shah , Brian Cain , Pierrick Bouvier , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , Samuel Thibault , Jason Wang , Yoshinori Sato , Stefan Hajnoczi , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=15816; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=n8fT+96oEvudRuUgQ/dnx3uxsW6aOGEO6iYpiyOTIXQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiHMbeCsIaocGDO9Y0JrkRvOQPBT9wWDsX/i T+t9yX7FG2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3ohwAKCRDa6OEJdZac 5SqyD/98pXJ+2rTVWhJDv2+W7vZXwaDhugqM+eSZowAaTap8SXdKf2vpneqGF7szUuSGA0REczp MdqmCmM0X1hYudkxOpb26I/4iLgK7fjPhoJw/M0vyX3OAQ7KN1mlSP2Qq0MOyX4jpHPowArR9rb h5dM8tLSTanHBXmgVYZhDPgW5dsVyCyYtuqakjaUZ/qBVOpmiC/L3welEVYy8qecIGsnPSsCXr8 91aHPwh9ooMgss3EuOtXr87uB8ZmCfZ5meMmTm7+m/6qnldX1FSPvSq8U0Kx59yheL+/YgwtABb 5XaLGuEjOmtlqT5OgUn9T+byv783I07iXgX6PUIfx1BE88rpjKDTurL9ELtS+dGgeqAef2ChOBg 3E9cJq3bo+YvA0X9TTmZdl1CR0rewG3ZgxuZaJIs5piygPJQt6C5P4hWPCOow3WIT1gSSAIkU8R AJmXk9aZhnxKJHpa2m5QD8iZftNQ3WJ3LQhBlqESWFsE7fArMzBQUpd8/iMAJ3IY3FAL1bZJ6HH TIPzmE+Y1s4k3mbsntGRAlpEQXTV/P891U6X353m0EVBgj/V/TzjJmsipfyg4Oc537x6NXQENs1 R4CQjD72G/Exl5kZnNMfYwffMaQTN8D/TXGU0NQEMySYAR4cJDNRTqM8++8HlZ+8kABEhWKOHlA XmxijGls1xjmuGA== 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: 1787685133379158500 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: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685178; cv=none; d=zohomail.com; s=zohoarc; b=W8/JM9gYVvC9MjS0GV3bMEQOKEZg2Z2pQZemyA7C6WkswkncNJDdKrPTUrYlXLBDQjXgKK5FrdCpf60noWHwx9rtkqc5mm2POoruuxq9CIB1ZctFe1ANbqD3cps/Pp4p8n+gsVKOrahay2bkCnPEG5eeMSbPdeDFDxp//hs7Smc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685178; 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=XTIr6N8nP8yQZ0N1ZVMTEe1eTwFUCJmWuStZK39egsg=; b=AnY9AH3rXIcl54hBr4ZP3TFxl7V4OsO3a4rdMuXxwTID2h6xDB4EXA3YAPljhP1tPKYAlEHRrkfhkRYnIlryxh14O/r/ov+pUo8938/5uj0qI1VXV+tVzMxPX8bM5LD6j8ocFR8+PiUHkBiuJF/iDFlHK+VDohWJWb606ioBBFQ= 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 1787685178155754.6104329865151; Tue, 25 Aug 2026 12:12:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZO-00010d-Th; Tue, 25 Aug 2026 15:12:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywZG-0000w9-48 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:18 -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 1wywZ9-0004Lp-J1 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:17 -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-589-C8umE3JPO42KUOykiEArFA-1; Tue, 25 Aug 2026 15:12:06 -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 B6DF219792EE; Tue, 25 Aug 2026 19:11:58 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1E05B1955F0C; Tue, 25 Aug 2026 19:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685130; 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=XTIr6N8nP8yQZ0N1ZVMTEe1eTwFUCJmWuStZK39egsg=; b=fWeX6qOvmK243S/D5akYTJalBstP7Qz6Vktu40bLsZ0VzODeh6RvYdVW5TcdQg7f4//RmB i3rxoCY7+2i083c1uMP2YHx6eQ5ERZiPbYklDKwTMqXGNbOONJMf8SGfixBEc28nwUiBut GZP0QY9O7aX69rezYxmkPVXRNmhDDDc= X-MC-Unique: C8umE3JPO42KUOykiEArFA-1 X-Mimecast-MFC-AGG-ID: C8umE3JPO42KUOykiEArFA_1787685120 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:37 +0400 Subject: [PATCH v4 30/49] monitor: change HMPCommand cmd to take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-30-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Jason J. Herne" , Gerd Hoffmann , "Gonglei (Arei)" , zhenwei pi , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , David Woodhouse , Paul Durrant , Richard Henderson , "Michael S. Tsirkin" , Marcelo Tosatti , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Halil Pasic , Christian Borntraeger , Jason Herne , Eric Farman , Matthew Rosato , Cornelia Huck , Ilya Leoshkevich , David Hildenbrand , Samuel Thibault , Hyman Huang , Peter Xu , Fabiano Rosas , =?utf-8?q?Alex_Benn=C3=A9e?= , Stefan Berger , Zhao Liu , Laurent Vivier , Nicholas Piggin , Chinmay Rath , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Artyom Tarasenko , Max Filippov , Stefan Hajnoczi , qemu-block@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=108516; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=YoFvGwE+PveUaBKD+BV+PjDKCoMPcunLJkhbo5n/6gQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIekSH2EzUk+VK62fnJpNJSRIUZEM22aw8S dirVlJTWlmJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5av6D/9yAsq/IomoYOySprr5SScpI2XLgABIqcUfB0aMEFOAnXhQ50Kt4CwV0MLtm6Uw+SmgDXY mC1pG9xE7Zj9DjNduISoYadqLTY8c1MrnfZjyzBqQfIzLe5cpcYFTn/cYrUNju3uZ6JW+btf/bN yrnk8m9kjq3/0nwnmCo9LYqiXlzGbCf7cI9dSEZqLS5vLOdqcWYQe3TcmtvzQIC6ITrIIhvD0XA 9sVTcZihbgY5b9rVpH/Ugfc+EJqoQIUhV0gr19hUGEGlmTrtCxTmLlWM88AxV+krYekuythtWVr AZkENpbI0QwetuyE9nyrPDEzWjl8oo6pEk2AxqECKJnzBX8VTOV29OkjoV6Fsu29OZr0QWdd0tW aZkifajZMreQ4EELjLAxwbH6MmM1sGQ1tTAJtVY3+qCIi8A9sQndfWi+q/bVoZnrJXsGZU0xqhr MWM+njgrm2lNw3FOLONAEb2mvXN0magQxTxwmOIitITlPHS8n3wRO/VvQYs3sPMS1lmYtDR83iD nbqwKRm8ViduZL9gOUjqFsMtiGOtuu3iHNnd6QCGhD4g22r+N48baPG50y9bz1fvcU7B4Hm2tL5 hRnsV6MJ7IsS9X+NCKY/O18kiB+OAGW9N9jSpEi2Jw1vTfne+fvgQREAbukoyrwu44x91Uh5HWe dXMJsOICK8SiBxg== 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: 1787685180816158500 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 --- audio/audio-hmp-cmds.c | 8 +- backends/cryptodev-hmp-cmds.c | 3 +- block/monitor/block-hmp-cmds.c | 78 +++++++---- chardev/char-hmp-cmds.c | 21 ++- dump/dump-hmp-cmds.c | 6 +- hw/core/machine-hmp-cmds.c | 49 ++++--- hw/i386/kvm/xen-stubs.c | 6 +- hw/i386/kvm/xen_evtchn.c | 6 +- hw/i386/sgx-hmp-stub.c | 3 +- hw/i386/sgx.c | 3 +- hw/misc/mos6522-stub.c | 3 +- hw/misc/mos6522.c | 3 +- hw/net/rocker/rocker-hmp-cmds.c | 12 +- hw/pci/pci-hmp-cmds.c | 6 +- hw/pci/pci-stub.c | 5 +- hw/s390x/s390-skeys.c | 5 +- hw/s390x/s390-stattrib.c | 6 +- hw/uefi/ovmf-log.c | 3 +- hw/usb/host-libusb.c | 3 +- hw/virtio/virtio-hmp-cmds.c | 15 +- include/block/block-hmp-cmds.h | 55 ++++---- include/hw/usb/usb.h | 3 +- include/monitor/hmp.h | 294 ++++++++++++++++++++----------------= ---- include/monitor/qdev.h | 5 +- include/net/net.h | 5 +- include/net/slirp.h | 8 +- migration/dirtyrate.c | 6 +- migration/migration-hmp-cmds.c | 48 ++++--- monitor/hmp-cmds.c | 96 ++++++++----- monitor/hmp.c | 17 ++- monitor/monitor-internal.h | 2 +- net/net-hmp-cmds.c | 14 +- net/slirp.c | 9 +- qom/qom-hmp-cmds.c | 18 ++- replay/replay-debugging.c | 9 +- replay/stubs-system.c | 8 +- stats/stats-hmp-cmds.c | 3 +- stubs/hmp-cmd-info_sev.c | 3 +- system/dirtylimit-hmp-cmds.c | 9 +- system/qdev-monitor.c | 11 +- system/runstate-hmp-cmds.c | 9 +- system/tpm-hmp-cmds.c | 3 +- target/i386/cpu-apic.c | 3 +- target/i386/monitor.c | 9 +- target/i386/sev.c | 3 +- target/m68k/monitor.c | 3 +- target/ppc/monitor.c | 3 +- target/riscv/monitor.c | 3 +- target/sh4/monitor.c | 3 +- target/sparc/monitor.c | 3 +- target/xtensa/monitor.c | 3 +- trace/trace-hmp-cmds.c | 8 +- ui/ui-hmp-cmds.c | 31 +++-- 53 files changed, 561 insertions(+), 390 deletions(-) diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 1ffb5ebc7420..4d326ec99fdf 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -32,8 +32,9 @@ =20 static QLIST_HEAD (capture_list_head, CaptureState) capture_head; =20 -void hmp_info_capture(Monitor *mon, const QDict *qdict) +void hmp_info_capture(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int i; CaptureState *s; =20 @@ -45,7 +46,7 @@ void hmp_info_capture(Monitor *mon, const QDict *qdict) } } =20 -void hmp_stopcapture(Monitor *mon, const QDict *qdict) +void hmp_stopcapture(MonitorHMP *hmp, const QDict *qdict) { int i; int n =3D qdict_get_int(qdict, "n"); @@ -63,8 +64,9 @@ void hmp_stopcapture(Monitor *mon, const QDict *qdict) } } =20 -void hmp_wavcapture(Monitor *mon, const QDict *qdict) +void hmp_wavcapture(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_str(qdict, "path"); int freq =3D qdict_get_try_int(qdict, "freq", 44100); int bits =3D qdict_get_try_int(qdict, "bits", 16); diff --git a/backends/cryptodev-hmp-cmds.c b/backends/cryptodev-hmp-cmds.c index 01396d227c88..fb62428d795a 100644 --- a/backends/cryptodev-hmp-cmds.c +++ b/backends/cryptodev-hmp-cmds.c @@ -17,8 +17,9 @@ #include "qobject/qdict.h" =20 =20 -void hmp_info_cryptodev(Monitor *mon, const QDict *qdict) +void hmp_info_cryptodev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); QCryptodevInfoList *il; QCryptodevBackendServiceTypeList *sl; QCryptodevBackendClientList *cl; diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 22fa03089ea3..3914b5189d56 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -87,8 +87,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_drive_add(Monitor *mon, const QDict *qdict) +void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; DriveInfo *dinfo; QemuOpts *opts; @@ -135,8 +136,9 @@ err: hmp_handle_error(mon, err); } =20 -void hmp_drive_del(Monitor *mon, const QDict *qdict) +void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); BlockBackend *blk; BlockDriverState *bs; @@ -194,8 +196,9 @@ unlock: hmp_handle_error(mon, err); } =20 -void hmp_commit(Monitor *mon, const QDict *qdict) +void hmp_commit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); BlockBackend *blk; int ret; @@ -232,8 +235,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_drive_mirror(Monitor *mon, const QDict *qdict) +void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "target"); const char *format =3D qdict_get_try_str(qdict, "format"); bool reuse =3D qdict_get_try_bool(qdict, "reuse", false); @@ -258,8 +262,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_drive_backup(Monitor *mon, const QDict *qdict) +void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *filename =3D qdict_get_str(qdict, "target"); const char *format =3D qdict_get_try_str(qdict, "format"); @@ -288,8 +293,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict) +void hmp_block_job_set_speed(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); int64_t value =3D qdict_get_int(qdict, "speed"); @@ -299,8 +305,9 @@ void hmp_block_job_set_speed(Monitor *mon, const QDict = *qdict) hmp_handle_error(mon, error); } =20 -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict) +void hmp_block_job_cancel(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); bool force =3D qdict_get_try_bool(qdict, "force", false); @@ -310,8 +317,9 @@ void hmp_block_job_cancel(Monitor *mon, const QDict *qd= ict) hmp_handle_error(mon, error); } =20 -void hmp_block_job_pause(Monitor *mon, const QDict *qdict) +void hmp_block_job_pause(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 @@ -320,8 +328,9 @@ void hmp_block_job_pause(Monitor *mon, const QDict *qdi= ct) hmp_handle_error(mon, error); } =20 -void hmp_block_job_resume(Monitor *mon, const QDict *qdict) +void hmp_block_job_resume(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 @@ -330,8 +339,9 @@ void hmp_block_job_resume(Monitor *mon, const QDict *qd= ict) hmp_handle_error(mon, error); } =20 -void hmp_block_job_complete(Monitor *mon, const QDict *qdict) +void hmp_block_job_complete(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); =20 @@ -340,8 +350,9 @@ void hmp_block_job_complete(Monitor *mon, const QDict *= qdict) hmp_handle_error(mon, error); } =20 -void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict) +void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *filename =3D qdict_get_str(qdict, "snapshot-file"); const char *format =3D qdict_get_try_str(qdict, "format"); @@ -355,8 +366,9 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdi= ct) hmp_handle_error(mon, err); } =20 -void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict) +void hmp_snapshot_blkdev_internal(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; @@ -365,8 +377,9 @@ void hmp_snapshot_blkdev_internal(Monitor *mon, const Q= Dict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict) +void hmp_snapshot_delete_blkdev_internal(MonitorHMP *hmp, const QDict *qdi= ct) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_str(qdict, "name"); const char *id =3D qdict_get_try_str(qdict, "id"); @@ -376,8 +389,9 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mon, = const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_nbd_server_start(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *uri =3D qdict_get_str(qdict, "uri"); bool writable =3D qdict_get_try_bool(qdict, "writable", false); bool all =3D qdict_get_try_bool(qdict, "all", false); @@ -438,8 +452,9 @@ exit: hmp_handle_error(mon, local_err); } =20 -void hmp_nbd_server_add(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *name =3D qdict_get_try_str(qdict, "name"); bool writable =3D qdict_get_try_bool(qdict, "writable", false); @@ -456,8 +471,9 @@ void hmp_nbd_server_add(Monitor *mon, const QDict *qdic= t) hmp_handle_error(mon, local_err); } =20 -void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_remove(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool force =3D qdict_get_try_bool(qdict, "force", false); Error *err =3D NULL; @@ -467,16 +483,18 @@ void hmp_nbd_server_remove(Monitor *mon, const QDict = *qdict) hmp_handle_error(mon, err); } =20 -void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict) +void hmp_nbd_server_stop(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_nbd_server_stop(&err); hmp_handle_error(mon, err); } =20 -void coroutine_fn hmp_block_resize(Monitor *mon, const QDict *qdict) +void coroutine_fn hmp_block_resize(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); int64_t size =3D qdict_get_int(qdict, "size"); Error *err =3D NULL; @@ -485,8 +503,9 @@ void coroutine_fn hmp_block_resize(Monitor *mon, const = QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_block_stream(Monitor *mon, const QDict *qdict) +void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *error =3D NULL; const char *device =3D qdict_get_str(qdict, "device"); const char *base =3D qdict_get_try_str(qdict, "base"); @@ -500,8 +519,9 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, error); } =20 -void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) +void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; char *device =3D (char *) qdict_get_str(qdict, "device"); BlockIOThrottle throttle =3D { @@ -528,8 +548,9 @@ void hmp_block_set_io_throttle(Monitor *mon, const QDic= t *qdict) hmp_handle_error(mon, err); } =20 -void hmp_eject(Monitor *mon, const QDict *qdict) +void hmp_eject(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool force =3D qdict_get_try_bool(qdict, "force", false); const char *device =3D qdict_get_str(qdict, "device"); Error *err =3D NULL; @@ -538,8 +559,9 @@ void hmp_eject(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_qemu_io(Monitor *mon, const QDict *qdict) +void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool qdev =3D qdict_get_try_bool(qdict, "qdev", false); const char *device =3D qdict_get_str(qdict, "device"); const char *command =3D qdict_get_str(qdict, "command"); @@ -666,8 +688,9 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, } } =20 -void hmp_info_block(Monitor *mon, const QDict *qdict) +void hmp_info_block(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockInfoList *block_list, *info; BlockDeviceInfoList *blockdev_list, *blockdev; const char *device =3D qdict_get_try_str(qdict, "device"); @@ -719,8 +742,9 @@ void hmp_info_block(Monitor *mon, const QDict *qdict) qapi_free_BlockDeviceInfoList(blockdev_list); } =20 -void hmp_info_blockstats(Monitor *mon, const QDict *qdict) +void hmp_info_blockstats(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockStatsList *stats_list, *stats; =20 stats_list =3D qmp_query_blockstats(false, false, NULL); @@ -757,8 +781,9 @@ void hmp_info_blockstats(Monitor *mon, const QDict *qdi= ct) qapi_free_BlockStatsList(stats_list); } =20 -void hmp_info_block_jobs(Monitor *mon, const QDict *qdict) +void hmp_info_block_jobs(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockJobInfoList *list; =20 list =3D qmp_query_block_jobs(&error_abort); @@ -793,8 +818,9 @@ void hmp_info_block_jobs(Monitor *mon, const QDict *qdi= ct) qapi_free_BlockJobInfoList(list); } =20 -void hmp_info_snapshots(Monitor *mon, const QDict *qdict) +void hmp_info_snapshots(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BlockDriverState *bs, *bs1; BdrvNextIterator it1; QEMUSnapshotInfo *sn_tab, *sn; diff --git a/chardev/char-hmp-cmds.c b/chardev/char-hmp-cmds.c index f377e00b6991..d4a5a3a255a5 100644 --- a/chardev/char-hmp-cmds.c +++ b/chardev/char-hmp-cmds.c @@ -24,8 +24,9 @@ #include "qemu/config-file.h" #include "qemu/option.h" =20 -void hmp_info_chardev(Monitor *mon, const QDict *qdict) +void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); ChardevInfoList *char_info, *info; =20 char_info =3D qmp_query_chardev(NULL); @@ -37,8 +38,9 @@ void hmp_info_chardev(Monitor *mon, const QDict *qdict) qapi_free_ChardevInfoList(char_info); } =20 -void hmp_ringbuf_write(Monitor *mon, const QDict *qdict) +void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *chardev =3D qdict_get_str(qdict, "device"); const char *data =3D qdict_get_str(qdict, "data"); Error *err =3D NULL; @@ -48,8 +50,9 @@ void hmp_ringbuf_write(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_ringbuf_read(Monitor *mon, const QDict *qdict) +void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *chardev =3D qdict_get_str(qdict, "device"); char *data; @@ -77,8 +80,9 @@ void hmp_ringbuf_read(Monitor *mon, const QDict *qdict) g_free(data); } =20 -void hmp_chardev_add(Monitor *mon, const QDict *qdict) +void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *args =3D qdict_get_str(qdict, "args"); Error *err =3D NULL; QemuOpts *opts; @@ -93,8 +97,9 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_chardev_change(Monitor *mon, const QDict *qdict) +void hmp_chardev_change(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *args =3D qdict_get_str(qdict, "args"); const char *id; Error *err =3D NULL; @@ -127,16 +132,18 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_chardev_remove(Monitor *mon, const QDict *qdict) +void hmp_chardev_remove(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; =20 qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err); hmp_handle_error(mon, local_err); } =20 -void hmp_chardev_send_break(Monitor *mon, const QDict *qdict) +void hmp_chardev_send_break(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; =20 qmp_chardev_send_break(qdict_get_str(qdict, "id"), &local_err); diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c index 21023db6fd85..ba78ad026f1e 100644 --- a/dump/dump-hmp-cmds.c +++ b/dump/dump-hmp-cmds.c @@ -12,8 +12,9 @@ #include "qapi/qapi-commands-dump.h" #include "qobject/qdict.h" =20 -void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) +void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; bool win_dmp =3D qdict_get_try_bool(qdict, "windmp", false); bool paging =3D qdict_get_try_bool(qdict, "paging", false); @@ -83,8 +84,9 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdi= ct) g_free(prot); } =20 -void hmp_info_dump(Monitor *mon, const QDict *qdict) +void hmp_info_dump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); DumpQueryResult *result =3D qmp_query_dump(NULL); =20 assert(result && result->status < DUMP_STATUS__MAX); diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 1c700aad3587..48fa27f12705 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -25,8 +25,9 @@ #include "system/numa.h" #include "hw/core/boards.h" =20 -void hmp_info_cpus(Monitor *mon, const QDict *qdict) +void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); CpuInfoFastList *cpu_list, *cpu; =20 cpu_list =3D qmp_query_cpus_fast(NULL); @@ -48,8 +49,9 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) qapi_free_CpuInfoFastList(cpu_list); } =20 -void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) +void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; HotpluggableCPUList *l =3D qmp_query_hotpluggable_cpus(&err); HotpluggableCPUList *saved =3D l; @@ -106,8 +108,9 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *q= dict) qapi_free_HotpluggableCPUList(saved); } =20 -void hmp_info_memdev(Monitor *mon, const QDict *qdict) +void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemdevList *memdev_list =3D qmp_query_memdev(&err); MemdevList *m =3D memdev_list; @@ -147,8 +150,9 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_kvm(Monitor *mon, const QDict *qdict) +void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); KvmInfo *info; =20 info =3D qmp_query_kvm(NULL); @@ -162,8 +166,9 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict) qapi_free_KvmInfo(info); } =20 -void hmp_info_accelerators(Monitor *mon, const QDict *qdict) +void hmp_info_accelerators(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); AcceleratorInfo *info; AcceleratorList *accel; =20 @@ -180,8 +185,9 @@ void hmp_info_accelerators(Monitor *mon, const QDict *q= dict) qapi_free_AcceleratorInfo(info); } =20 -void hmp_info_uuid(Monitor *mon, const QDict *qdict) +void hmp_info_uuid(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); UuidInfo *info; =20 info =3D qmp_query_uuid(NULL); @@ -189,8 +195,9 @@ void hmp_info_uuid(Monitor *mon, const QDict *qdict) qapi_free_UuidInfo(info); } =20 -void hmp_info_balloon(Monitor *mon, const QDict *qdict) +void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); BalloonInfo *info; Error *err =3D NULL; =20 @@ -204,18 +211,19 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdic= t) qapi_free_BalloonInfo(info); } =20 -void hmp_system_reset(Monitor *mon, const QDict *qdict) +void hmp_system_reset(MonitorHMP *hmp, const QDict *qdict) { qmp_system_reset(NULL); } =20 -void hmp_system_powerdown(Monitor *mon, const QDict *qdict) +void hmp_system_powerdown(MonitorHMP *hmp, const QDict *qdict) { qmp_system_powerdown(NULL); } =20 -void hmp_memsave(Monitor *mon, const QDict *qdict) +void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); @@ -231,8 +239,9 @@ void hmp_memsave(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_pmemsave(Monitor *mon, const QDict *qdict) +void hmp_pmemsave(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t size =3D qdict_get_int(qdict, "size"); const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); @@ -242,24 +251,27 @@ void hmp_pmemsave(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_system_wakeup(Monitor *mon, const QDict *qdict) +void hmp_system_wakeup(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_system_wakeup(&err); hmp_handle_error(mon, err); } =20 -void hmp_nmi(Monitor *mon, const QDict *qdict) +void hmp_nmi(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_inject_nmi(&err); hmp_handle_error(mon, err); } =20 -void hmp_balloon(Monitor *mon, const QDict *qdict) +void hmp_balloon(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t value =3D qdict_get_int(qdict, "value"); Error *err =3D NULL; =20 @@ -267,8 +279,9 @@ void hmp_balloon(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) +void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemoryDeviceInfoList *info_list =3D qmp_query_memory_devices(&err); MemoryDeviceInfoList *info; @@ -370,8 +383,9 @@ void hmp_info_memory_devices(Monitor *mon, const QDict = *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) +void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; GuidInfo *info =3D qmp_query_vm_generation_id(&err); if (info) { @@ -381,8 +395,9 @@ void hmp_info_vm_generation_id(Monitor *mon, const QDic= t *qdict) qapi_free_GuidInfo(info); } =20 -void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) +void hmp_info_memory_size_summary(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; MemoryInfo *info =3D qmp_query_memory_size_summary(&err); if (info) { diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c index bf6ac28bef47..ab1eb14f99e0 100644 --- a/hw/i386/kvm/xen-stubs.c +++ b/hw/i386/kvm/xen-stubs.c @@ -40,12 +40,14 @@ void xen_primary_console_set_be_port(uint16_t port) { } =20 -void hmp_xen_event_list(Monitor *mon, const QDict *qdict) +void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); } =20 -void hmp_xen_event_inject(Monitor *mon, const QDict *qdict) +void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); } diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 8b243984e412..845838c372d5 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -2344,8 +2344,9 @@ void qmp_xen_event_inject(uint32_t port, Error **errp) } } =20 -void hmp_xen_event_list(Monitor *mon, const QDict *qdict) +void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); EvtchnInfoList *iter, *info_list; Error *err =3D NULL; =20 @@ -2379,8 +2380,9 @@ void hmp_xen_event_list(Monitor *mon, const QDict *qd= ict) qapi_free_EvtchnInfoList(info_list); } =20 -void hmp_xen_event_inject(Monitor *mon, const QDict *qdict) +void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int port =3D qdict_get_int(qdict, "port"); Error *err =3D NULL; =20 diff --git a/hw/i386/sgx-hmp-stub.c b/hw/i386/sgx-hmp-stub.c index cf1d9a6344b0..a4848ae1d1a7 100644 --- a/hw/i386/sgx-hmp-stub.c +++ b/hw/i386/sgx-hmp-stub.c @@ -10,7 +10,8 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 -void hmp_info_sgx(Monitor *mon, const QDict *qdict) +void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "SGX is not available in this QEMU\n"); } diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 7e4c509f5a4a..77b41d234c9f 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -234,8 +234,9 @@ SgxInfo *qmp_query_sgx(Error **errp) return info; } =20 -void hmp_info_sgx(Monitor *mon, const QDict *qdict) +void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; SgxEpcSectionList *section_list, *section; g_autoptr(SgxInfo) info =3D qmp_query_sgx(&err); diff --git a/hw/misc/mos6522-stub.c b/hw/misc/mos6522-stub.c index 85eb0ee36ee1..6a7d76292f00 100644 --- a/hw/misc/mos6522-stub.c +++ b/hw/misc/mos6522-stub.c @@ -10,7 +10,8 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 -void hmp_info_via(Monitor *mon, const QDict *qdict) +void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "MOS6522 VIA is not available in this QEMU\n"); } diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index bae766ef1782..15a6a1a75745 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -586,8 +586,9 @@ static HumanReadableText *qmp_x_query_via(Error **errp) return human_readable_text_from_str(buf); } =20 -void hmp_info_via(Monitor *mon, const QDict *qdict) +void hmp_info_via(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; g_autoptr(HumanReadableText) info =3D qmp_x_query_via(&err); =20 diff --git a/hw/net/rocker/rocker-hmp-cmds.c b/hw/net/rocker/rocker-hmp-cmd= s.c index df40991f6d20..856aaef5e210 100644 --- a/hw/net/rocker/rocker-hmp-cmds.c +++ b/hw/net/rocker/rocker-hmp-cmds.c @@ -20,8 +20,9 @@ #include "qapi/qapi-commands-rocker.h" #include "qobject/qdict.h" =20 -void hmp_rocker(Monitor *mon, const QDict *qdict) +void hmp_rocker(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); RockerSwitch *rocker; Error *err =3D NULL; @@ -38,8 +39,9 @@ void hmp_rocker(Monitor *mon, const QDict *qdict) qapi_free_RockerSwitch(rocker); } =20 -void hmp_rocker_ports(Monitor *mon, const QDict *qdict) +void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RockerPortList *list, *port; const char *name =3D qdict_get_str(qdict, "name"); Error *err =3D NULL; @@ -65,8 +67,9 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict) qapi_free_RockerPortList(list); } =20 -void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict) +void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RockerOfDpaFlowList *list, *info; const char *name =3D qdict_get_str(qdict, "name"); uint32_t tbl_id =3D qdict_get_try_int(qdict, "tbl_id", -1); @@ -214,8 +217,9 @@ void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict = *qdict) qapi_free_RockerOfDpaFlowList(list); } =20 -void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict) +void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RockerOfDpaGroupList *list, *g; const char *name =3D qdict_get_str(qdict, "name"); uint8_t type =3D qdict_get_try_int(qdict, "type", 9); diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index a5f6483cc3d2..be24aecc8ac8 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -117,8 +117,9 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) } } =20 -void hmp_info_pci(Monitor *mon, const QDict *qdict) +void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); PciInfoList *info_list, *info; =20 info_list =3D qmp_query_pci(&error_abort); @@ -170,8 +171,9 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev, i= nt indent) } } =20 -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) +void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *id =3D qdict_get_str(qdict, "id"); const char *error_name; diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index 3397d0c82ea8..a80e34175462 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -34,12 +34,13 @@ PciInfoList *qmp_query_pci(Error **errp) return NULL; } =20 -void hmp_info_pci(Monitor *mon, const QDict *qdict) +void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) { } =20 -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) +void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "PCI devices not supported\n"); } =20 diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 7dca67d6618c..d8afaf730639 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -104,8 +104,9 @@ static void write_keys(FILE *f, uint8_t *keys, uint64_t= startgfn, } } =20 -void hmp_info_skeys(Monitor *mon, const QDict *qdict) +void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); S390SKeysState *ss =3D s390_get_skeys_device(); S390SKeysClass *skeyclass =3D S390_SKEYS_GET_CLASS(ss); uint64_t addr =3D qdict_get_int(qdict, "addr"); @@ -134,7 +135,7 @@ void hmp_info_skeys(Monitor *mon, const QDict *qdict) monitor_printf(mon, " key: 0x%X\n", key); } =20 -void hmp_dump_skeys(Monitor *mon, const QDict *qdict) +void hmp_dump_skeys(MonitorHMP *hmp, const QDict *qdict) { const char *filename =3D qdict_get_str(qdict, "filename"); Error *err =3D NULL; diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index b0f04eb30c7f..b4a405455901 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -59,8 +59,9 @@ void s390_stattrib_init(void) =20 /* Console commands: */ =20 -void hmp_migrationmode(Monitor *mon, const QDict *qdict) +void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); S390StAttribState *sas =3D s390_get_stattrib_device(); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint64_t what =3D qdict_get_int(qdict, "mode"); @@ -74,8 +75,9 @@ void hmp_migrationmode(Monitor *mon, const QDict *qdict) } } =20 -void hmp_info_cmma(Monitor *mon, const QDict *qdict) +void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); S390StAttribState *sas =3D s390_get_stattrib_device(); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint64_t addr =3D qdict_get_int(qdict, "addr"); diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 3a24afd9417d..c97622b2aad6 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -256,8 +256,9 @@ FirmwareLog *qmp_query_firmware_log(bool have_max_size,= uint64_t max_size, return ret; } =20 -void hmp_info_firmware_log(Monitor *mon, const QDict *qdict) +void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); g_autofree gchar *log_esc =3D NULL; g_autofree guchar *log_out =3D NULL; Error *err =3D NULL; diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index af67d5dfeb10..c02343d3a655 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1920,8 +1920,9 @@ static void usb_host_auto_check(void *unused) timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 200= 0); } =20 -void hmp_info_usbhost(Monitor *mon, const QDict *qdict) +void hmp_info_usbhost(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); libusb_device **devs =3D NULL; struct libusb_device_descriptor ddesc; char port[16]; diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c index a91bb7dbeda5..49f3367785ba 100644 --- a/hw/virtio/virtio-hmp-cmds.c +++ b/hw/virtio/virtio-hmp-cmds.c @@ -80,8 +80,9 @@ static void hmp_virtio_dump_features(Monitor *mon, } } =20 -void hmp_virtio_query(Monitor *mon, const QDict *qdict) +void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; VirtioInfoList *list =3D qmp_x_query_virtio(&err); VirtioInfoList *node; @@ -105,8 +106,9 @@ void hmp_virtio_query(Monitor *mon, const QDict *qdict) qapi_free_VirtioInfoList(list); } =20 -void hmp_virtio_status(Monitor *mon, const QDict *qdict) +void hmp_virtio_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); VirtioStatus *s =3D qmp_x_query_virtio_status(path, &err); @@ -183,8 +185,9 @@ void hmp_virtio_status(Monitor *mon, const QDict *qdict) qapi_free_VirtioStatus(s); } =20 -void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict) +void hmp_vhost_queue_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -216,8 +219,9 @@ void hmp_vhost_queue_status(Monitor *mon, const QDict *= qdict) qapi_free_VirtVhostQueueStatus(s); } =20 -void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict) +void hmp_virtio_queue_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); @@ -261,8 +265,9 @@ void hmp_virtio_queue_status(Monitor *mon, const QDict = *qdict) qapi_free_VirtQueueStatus(s); } =20 -void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict) +void hmp_virtio_queue_element(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *path =3D qdict_get_try_str(qdict, "path"); int queue =3D qdict_get_int(qdict, "queue"); diff --git a/include/block/block-hmp-cmds.h b/include/block/block-hmp-cmds.h index 71113cd7efa4..0f5908958f05 100644 --- a/include/block/block-hmp-cmds.h +++ b/include/block/block-hmp-cmds.h @@ -16,41 +16,42 @@ #define BLOCK_BLOCK_HMP_CMDS_H =20 #include "qemu/coroutine.h" +#include "monitor/hmp.h" =20 -void hmp_drive_add(Monitor *mon, const QDict *qdict); +void hmp_drive_add(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_commit(Monitor *mon, const QDict *qdict); -void hmp_drive_del(Monitor *mon, const QDict *qdict); +void hmp_commit(MonitorHMP *hmp, const QDict *qdict); +void hmp_drive_del(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_drive_mirror(Monitor *mon, const QDict *qdict); -void hmp_drive_backup(Monitor *mon, const QDict *qdict); +void hmp_drive_mirror(MonitorHMP *hmp, const QDict *qdict); +void hmp_drive_backup(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict); -void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); -void hmp_block_job_pause(Monitor *mon, const QDict *qdict); -void hmp_block_job_resume(Monitor *mon, const QDict *qdict); -void hmp_block_job_complete(Monitor *mon, const QDict *qdict); +void hmp_block_job_set_speed(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_cancel(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_pause(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_resume(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_job_complete(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict); -void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict); -void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict); +void hmp_snapshot_blkdev(MonitorHMP *hmp, const QDict *qdict); +void hmp_snapshot_blkdev_internal(MonitorHMP *hmp, const QDict *qdict); +void hmp_snapshot_delete_blkdev_internal(MonitorHMP *hmp, const QDict *qdi= ct); =20 -void hmp_nbd_server_start(Monitor *mon, const QDict *qdict); -void hmp_nbd_server_add(Monitor *mon, const QDict *qdict); -void hmp_nbd_server_remove(Monitor *mon, const QDict *qdict); -void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); +void hmp_nbd_server_start(MonitorHMP *hmp, const QDict *qdict); +void hmp_nbd_server_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_nbd_server_remove(MonitorHMP *hmp, const QDict *qdict); +void hmp_nbd_server_stop(MonitorHMP *hmp, const QDict *qdict); =20 -void coroutine_fn hmp_block_resize(Monitor *mon, const QDict *qdict); -void hmp_block_stream(Monitor *mon, const QDict *qdict); -void hmp_block_passwd(Monitor *mon, const QDict *qdict); -void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); -void hmp_eject(Monitor *mon, const QDict *qdict); +void coroutine_fn hmp_block_resize(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_stream(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_passwd(MonitorHMP *hmp, const QDict *qdict); +void hmp_block_set_io_throttle(MonitorHMP *hmp, const QDict *qdict); +void hmp_eject(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_qemu_io(Monitor *mon, const QDict *qdict); +void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_info_block(Monitor *mon, const QDict *qdict); -void hmp_info_blockstats(Monitor *mon, const QDict *qdict); -void hmp_info_block_jobs(Monitor *mon, const QDict *qdict); -void hmp_info_snapshots(Monitor *mon, const QDict *qdict); +void hmp_info_block(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_blockstats(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_block_jobs(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_snapshots(MonitorHMP *hmp, const QDict *qdict); =20 #endif diff --git a/include/hw/usb/usb.h b/include/hw/usb/usb.h index 78e2ceedd7fd..cbd4711933e8 100644 --- a/include/hw/usb/usb.h +++ b/include/hw/usb/usb.h @@ -31,6 +31,7 @@ #include "qemu/queue.h" #include "qom/object.h" #include "qapi/error.h" +#include "monitor/hmp.h" =20 /* Constants related to the USB / PCI interaction */ #define USB_SBRN 0x60 /* Serial Bus Release Number Register */ @@ -466,7 +467,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream); void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p); =20 /* usb-linux.c */ -void hmp_info_usbhost(Monitor *mon, const QDict *qdict); +void hmp_info_usbhost(MonitorHMP *hmp, const QDict *qdict); =20 /* usb ports of the VM */ =20 diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 166cd4100c63..7a270ad3f25c 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -22,7 +22,7 @@ OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP); =20 #define HMP_STUB(cmd) \ - void hmp_##cmd(Monitor *mon, const QDict *qdict) \ + void hmp_##cmd(MonitorHMP *hmp, const QDict *qdict) \ { \ g_assert_not_reached(); \ } @@ -46,7 +46,7 @@ int monitor_hmp_read_password(MonitorHMP *hmp, ReadLineFu= nc *readline_func, void *opaque); =20 void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)); + void (*cmd)(MonitorHMP *mon, const QDict *qdict)= ); void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)); =20 @@ -58,58 +58,58 @@ bool hmp_handle_error(Monitor *mon, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); strList *hmp_split_at_comma(const char *str); =20 -void hmp_info_name(Monitor *mon, const QDict *qdict); -void hmp_info_version(Monitor *mon, const QDict *qdict); -void hmp_info_kvm(Monitor *mon, const QDict *qdict); -void hmp_info_accelerators(Monitor *mon, const QDict *qdict); -void hmp_info_status(Monitor *mon, const QDict *qdict); -void hmp_info_uuid(Monitor *mon, const QDict *qdict); -void hmp_info_chardev(Monitor *mon, const QDict *qdict); -void hmp_info_mice(Monitor *mon, const QDict *qdict); -void hmp_info_migrate(Monitor *mon, const QDict *qdict); -void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict); -void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict); -void hmp_info_cpus(Monitor *mon, const QDict *qdict); -void hmp_info_vnc(Monitor *mon, const QDict *qdict); -void hmp_info_spice(Monitor *mon, const QDict *qdict); -void hmp_info_balloon(Monitor *mon, const QDict *qdict); -void hmp_info_pci(Monitor *mon, const QDict *qdict); -void hmp_info_tpm(Monitor *mon, const QDict *qdict); -void hmp_info_iothreads(Monitor *mon, const QDict *qdict); -void hmp_quit(Monitor *mon, const QDict *qdict); -void hmp_stop(Monitor *mon, const QDict *qdict); -void hmp_sync_profile(Monitor *mon, const QDict *qdict); -void hmp_system_reset(Monitor *mon, const QDict *qdict); -void hmp_system_powerdown(Monitor *mon, const QDict *qdict); -void hmp_exit_preconfig(Monitor *mon, const QDict *qdict); -void hmp_announce_self(Monitor *mon, const QDict *qdict); -void hmp_cpu(Monitor *mon, const QDict *qdict); -void hmp_memsave(Monitor *mon, const QDict *qdict); -void hmp_pmemsave(Monitor *mon, const QDict *qdict); -void hmp_ringbuf_write(Monitor *mon, const QDict *qdict); -void hmp_ringbuf_read(Monitor *mon, const QDict *qdict); -void hmp_cont(Monitor *mon, const QDict *qdict); -void hmp_system_wakeup(Monitor *mon, const QDict *qdict); -void hmp_nmi(Monitor *mon, const QDict *qdict); -void hmp_info_network(Monitor *mon, const QDict *qdict); -void hmp_set_link(Monitor *mon, const QDict *qdict); -void hmp_balloon(Monitor *mon, const QDict *qdict); -void hmp_loadvm(Monitor *mon, const QDict *qdict); -void hmp_savevm(Monitor *mon, const QDict *qdict); -void hmp_delvm(Monitor *mon, const QDict *qdict); -void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); -void hmp_migrate_continue(Monitor *mon, const QDict *qdict); -void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); -void hmp_migrate_recover(Monitor *mon, const QDict *qdict); -void hmp_migrate_pause(Monitor *mon, const QDict *qdict); -void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict); -void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict); -void hmp_client_migrate_info(Monitor *mon, const QDict *qdict); -void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict); -void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict); -void hmp_set_password(Monitor *mon, const QDict *qdict); -void hmp_expire_password(Monitor *mon, const QDict *qdict); -void hmp_change(Monitor *mon, const QDict *qdict); +void hmp_info_name(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_version(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_kvm(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_accelerators(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_uuid(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_chardev(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_migrate(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_migrate_capabilities(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_spice(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_balloon(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_tpm(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict); +void hmp_quit(MonitorHMP *hmp, const QDict *qdict); +void hmp_stop(MonitorHMP *hmp, const QDict *qdict); +void hmp_sync_profile(MonitorHMP *hmp, const QDict *qdict); +void hmp_system_reset(MonitorHMP *hmp, const QDict *qdict); +void hmp_system_powerdown(MonitorHMP *hmp, const QDict *qdict); +void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict); +void hmp_announce_self(MonitorHMP *hmp, const QDict *qdict); +void hmp_cpu(MonitorHMP *hmp, const QDict *qdict); +void hmp_memsave(MonitorHMP *hmp, const QDict *qdict); +void hmp_pmemsave(MonitorHMP *hmp, const QDict *qdict); +void hmp_ringbuf_write(MonitorHMP *hmp, const QDict *qdict); +void hmp_ringbuf_read(MonitorHMP *hmp, const QDict *qdict); +void hmp_cont(MonitorHMP *hmp, const QDict *qdict); +void hmp_system_wakeup(MonitorHMP *hmp, const QDict *qdict); +void hmp_nmi(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_network(MonitorHMP *hmp, const QDict *qdict); +void hmp_set_link(MonitorHMP *hmp, const QDict *qdict); +void hmp_balloon(MonitorHMP *hmp, const QDict *qdict); +void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict); +void hmp_savevm(MonitorHMP *hmp, const QDict *qdict); +void hmp_delvm(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict); +void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict); +void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict); +void hmp_set_password(MonitorHMP *hmp, const QDict *qdict); +void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict); +void hmp_change(MonitorHMP *hmp, const QDict *qdict); #ifdef CONFIG_VNC void hmp_change_vnc(Monitor *mon, const char *device, const char *target, const char *arg, const char *read_only, bool force, @@ -118,101 +118,101 @@ void hmp_change_vnc(Monitor *mon, const char *devic= e, const char *target, void hmp_change_medium(Monitor *mon, const char *device, const char *targe= t, const char *arg, const char *read_only, bool force, Error **errp); -void hmp_migrate(Monitor *mon, const QDict *qdict); -void hmp_device_add(Monitor *mon, const QDict *qdict); -void hmp_device_del(Monitor *mon, const QDict *qdict); -void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict); -void hmp_netdev_add(Monitor *mon, const QDict *qdict); -void hmp_netdev_del(Monitor *mon, const QDict *qdict); -void hmp_getfd(Monitor *mon, const QDict *qdict); -void hmp_closefd(Monitor *mon, const QDict *qdict); -void hmp_mouse_move(Monitor *mon, const QDict *qdict); -void hmp_mouse_button(Monitor *mon, const QDict *qdict); -void hmp_mouse_set(Monitor *mon, const QDict *qdict); -void hmp_sendkey(Monitor *mon, const QDict *qdict); -void coroutine_fn hmp_screendump(Monitor *mon, const QDict *qdict); -void hmp_chardev_add(Monitor *mon, const QDict *qdict); -void hmp_chardev_change(Monitor *mon, const QDict *qdict); -void hmp_chardev_remove(Monitor *mon, const QDict *qdict); -void hmp_chardev_send_break(Monitor *mon, const QDict *qdict); -void hmp_object_add(Monitor *mon, const QDict *qdict); -void hmp_object_del(Monitor *mon, const QDict *qdict); -void hmp_info_memdev(Monitor *mon, const QDict *qdict); -void hmp_info_memory_devices(Monitor *mon, const QDict *qdict); -void hmp_qom_list(Monitor *mon, const QDict *qdict); -void hmp_qom_get(Monitor *mon, const QDict *qdict); -void hmp_qom_set(Monitor *mon, const QDict *qdict); -void hmp_info_qom_tree(Monitor *mon, const QDict *dict); -void hmp_virtio_query(Monitor *mon, const QDict *qdict); -void hmp_virtio_status(Monitor *mon, const QDict *qdict); -void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict); -void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict); -void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict); -void hmp_xen_event_inject(Monitor *mon, const QDict *qdict); -void hmp_xen_event_list(Monitor *mon, const QDict *qdict); -void hmp_rocker(Monitor *mon, const QDict *qdict); -void hmp_rocker_ports(Monitor *mon, const QDict *qdict); -void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict); -void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict); -void hmp_info_dump(Monitor *mon, const QDict *qdict); -void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); -void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); -void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); -void hmp_info_replay(Monitor *mon, const QDict *qdict); -void hmp_replay_break(Monitor *mon, const QDict *qdict); -void hmp_replay_delete_break(Monitor *mon, const QDict *qdict); -void hmp_replay_seek(Monitor *mon, const QDict *qdict); -void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict); -void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdict); -void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); -void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); -void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); +void hmp_migrate(MonitorHMP *hmp, const QDict *qdict); +void hmp_device_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_device_del(MonitorHMP *hmp, const QDict *qdict); +void hmp_dump_guest_memory(MonitorHMP *hmp, const QDict *qdict); +void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict); +void hmp_getfd(MonitorHMP *hmp, const QDict *qdict); +void hmp_closefd(MonitorHMP *hmp, const QDict *qdict); +void hmp_mouse_move(MonitorHMP *hmp, const QDict *qdict); +void hmp_mouse_button(MonitorHMP *hmp, const QDict *qdict); +void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict); +void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict); +void coroutine_fn hmp_screendump(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_change(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_remove(MonitorHMP *hmp, const QDict *qdict); +void hmp_chardev_send_break(MonitorHMP *hmp, const QDict *qdict); +void hmp_object_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_object_del(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_memdev(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_memory_devices(MonitorHMP *hmp, const QDict *qdict); +void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict); +void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict); +void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *dict); +void hmp_virtio_query(MonitorHMP *hmp, const QDict *qdict); +void hmp_virtio_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_virtio_queue_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_vhost_queue_status(MonitorHMP *hmp, const QDict *qdict); +void hmp_virtio_queue_element(MonitorHMP *hmp, const QDict *qdict); +void hmp_xen_event_inject(MonitorHMP *hmp, const QDict *qdict); +void hmp_xen_event_list(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker_ports(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker_of_dpa_flows(MonitorHMP *hmp, const QDict *qdict); +void hmp_rocker_of_dpa_groups(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_dump(MonitorHMP *hmp, const QDict *qdict); +void hmp_hotpluggable_cpus(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_vm_generation_id(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_memory_size_summary(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict); +void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict); +void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict); +void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *qdict); +void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *qdict); +void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict); +void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict); void hmp_human_readable_text_helper(Monitor *mon, HumanReadableText *(*qmp_handler)(Erro= r **)); -void hmp_info_stats(Monitor *mon, const QDict *qdict); -void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict); -void hmp_watchdog_action(Monitor *mon, const QDict *qdict); -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict); -void hmp_info_capture(Monitor *mon, const QDict *qdict); -void hmp_stopcapture(Monitor *mon, const QDict *qdict); -void hmp_wavcapture(Monitor *mon, const QDict *qdict); -void hmp_trace_event(Monitor *mon, const QDict *qdict); -void hmp_trace_file(Monitor *mon, const QDict *qdict); -void hmp_info_trace_events(Monitor *mon, const QDict *qdict); -void hmp_help(Monitor *mon, const QDict *qdict); -void hmp_clear(Monitor *mon, const QDict *qdict); -void hmp_info_help(Monitor *mon, const QDict *qdict); -void hmp_info_sync_profile(Monitor *mon, const QDict *qdict); -void hmp_info_history(Monitor *mon, const QDict *qdict); -void hmp_logfile(Monitor *mon, const QDict *qdict); -void hmp_log(Monitor *mon, const QDict *qdict); -void hmp_gdbserver(Monitor *mon, const QDict *qdict); -void hmp_print(Monitor *mon, const QDict *qdict); -void hmp_sum(Monitor *mon, const QDict *qdict); -void hmp_ioport_read(Monitor *mon, const QDict *qdict); -void hmp_ioport_write(Monitor *mon, const QDict *qdict); -void hmp_boot_set(Monitor *mon, const QDict *qdict); -void hmp_info_mtree(Monitor *mon, const QDict *qdict); -void hmp_info_cryptodev(Monitor *mon, const QDict *qdict); -void hmp_dumpdtb(Monitor *mon, const QDict *qdict); -void hmp_info_firmware_log(Monitor *mon, const QDict *qdict); -void hmp_info_mem(Monitor *mon, const QDict *qdict); -void hmp_info_tlb(Monitor *mon, const QDict *qdict); -void hmp_mce(Monitor *mon, const QDict *qdict); -void hmp_info_local_apic(Monitor *mon, const QDict *qdict); -void hmp_info_sev(Monitor *mon, const QDict *qdict); -void hmp_info_sgx(Monitor *mon, const QDict *qdict); -void hmp_info_via(Monitor *mon, const QDict *qdict); -void hmp_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_info_registers(Monitor *mon, const QDict *qdict); -void hmp_gva2gpa(Monitor *mon, const QDict *qdict); -void hmp_gpa2hva(Monitor *mon, const QDict *qdict); -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict); +void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict); +void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qdict); +void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict); +void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_capture(MonitorHMP *hmp, const QDict *qdict); +void hmp_stopcapture(MonitorHMP *hmp, const QDict *qdict); +void hmp_wavcapture(MonitorHMP *hmp, const QDict *qdict); +void hmp_trace_event(MonitorHMP *hmp, const QDict *qdict); +void hmp_trace_file(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_trace_events(MonitorHMP *hmp, const QDict *qdict); +void hmp_help(MonitorHMP *hmp, const QDict *qdict); +void hmp_clear(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_help(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_sync_profile(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_history(MonitorHMP *hmp, const QDict *qdict); +void hmp_logfile(MonitorHMP *hmp, const QDict *qdict); +void hmp_log(MonitorHMP *hmp, const QDict *qdict); +void hmp_gdbserver(MonitorHMP *hmp, const QDict *qdict); +void hmp_print(MonitorHMP *hmp, const QDict *qdict); +void hmp_sum(MonitorHMP *hmp, const QDict *qdict); +void hmp_ioport_read(MonitorHMP *hmp, const QDict *qdict); +void hmp_ioport_write(MonitorHMP *hmp, const QDict *qdict); +void hmp_boot_set(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_cryptodev(MonitorHMP *hmp, const QDict *qdict); +void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_firmware_log(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict); +void hmp_mce(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_sgx(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_via(MonitorHMP *hmp, const QDict *qdict); +void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict); +void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict); +void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict); +void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict); +void hmp_gpa2hpa(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_dump_skeys(Monitor *mon, const QDict *qdict); -void hmp_info_skeys(Monitor *mon, const QDict *qdict); -void hmp_info_cmma(Monitor *mon, const QDict *qdict); -void hmp_migrationmode(Monitor *mon, const QDict *qdict); +void hmp_dump_skeys(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict); +void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict); =20 #endif diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h index f85f25738d58..8f7e2f616cf3 100644 --- a/include/monitor/qdev.h +++ b/include/monitor/qdev.h @@ -2,11 +2,12 @@ #define MONITOR_QDEV_H =20 #include "hw/core/qdev.h" +#include "monitor/hmp.h" =20 /*** monitor commands ***/ =20 -void hmp_info_qtree(Monitor *mon, const QDict *qdict); -void hmp_info_qdm(Monitor *mon, const QDict *qdict); +void hmp_info_qtree(MonitorHMP *hmp, const QDict *qdict); +void hmp_info_qdm(MonitorHMP *hmp, const QDict *qdict); void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp); =20 int qdev_device_help(QemuOpts *opts); diff --git a/include/net/net.h b/include/net/net.h index a7c49c543783..626b99794806 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -5,6 +5,7 @@ #include "qapi/qapi-types-net.h" #include "net/queue.h" #include "hw/core/qdev-properties-system.h" +#include "monitor/hmp.h" =20 #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X" #define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \ @@ -318,8 +319,8 @@ void net_init_clients(void); void net_check_clients(void); void net_client_set_link(NetClientState **ncs, int queues, bool up); void net_cleanup(void); -void hmp_host_net_add(Monitor *mon, const QDict *qdict); -void hmp_host_net_remove(Monitor *mon, const QDict *qdict); +void hmp_host_net_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_host_net_remove(MonitorHMP *hmp, const QDict *qdict); void netdev_add(QemuOpts *opts, Error **errp); =20 int net_hub_id_for_client(NetClientState *nc, int *id); diff --git a/include/net/slirp.h b/include/net/slirp.h index bad3e1e2416b..38859edf58ae 100644 --- a/include/net/slirp.h +++ b/include/net/slirp.h @@ -24,13 +24,13 @@ #ifndef QEMU_NET_SLIRP_H #define QEMU_NET_SLIRP_H =20 - #ifdef CONFIG_SLIRP +#include "monitor/hmp.h" =20 -void hmp_hostfwd_add(Monitor *mon, const QDict *qdict); -void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict); +void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdict); +void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict *qdict); =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict); +void hmp_info_usernet(MonitorHMP *hmp, const QDict *qdict); =20 #endif =20 diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index b360f49efeaf..567abab321cc 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -856,8 +856,9 @@ struct DirtyRateInfo *qmp_query_dirty_rate(bool has_cal= c_time_unit, has_calc_time_unit ? calc_time_unit : TIME_UNIT_SECOND); } =20 -void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict) +void hmp_info_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); DirtyRateInfo *info =3D query_dirty_rate_info(TIME_UNIT_SECOND); =20 monitor_printf(mon, "Status: %s\n", @@ -891,8 +892,9 @@ void hmp_info_dirty_rate(Monitor *mon, const QDict *qdi= ct) g_free(info); } =20 -void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdict) +void hmp_calc_dirty_rate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t sec =3D qdict_get_try_int(qdict, "second", 0); int64_t sample_pages =3D qdict_get_try_int(qdict, "sample_pages_per_GB= ", -1); bool has_sample_pages =3D (sample_pages !=3D -1); diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index ad68fa23aa4b..8d2e8735277e 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -135,8 +135,9 @@ static void migration_dump_blocktime(Monitor *mon, Migr= ationInfo *info) } } =20 -void hmp_info_migrate(Monitor *mon, const QDict *qdict) +void hmp_info_migrate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool show_all =3D qdict_get_try_bool(qdict, "all", false); MigrationInfo *info; =20 @@ -297,8 +298,9 @@ out: qapi_free_MigrationInfo(info); } =20 -void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict) +void hmp_info_migrate_capabilities(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); MigrationCapabilityStatusList *caps, *cap; =20 caps =3D qmp_query_migrate_capabilities(NULL); @@ -326,8 +328,9 @@ static void monitor_print_cpr_exec_command(Monitor *mon= , strList *args) monitor_printf(mon, "\n"); } =20 -void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) +void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); MigrationParameters *params; MigrationState *s =3D migrate_get_current(); =20 @@ -473,8 +476,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) qapi_free_MigrationParameters(params); } =20 -void hmp_loadvm(Monitor *mon, const QDict *qdict) +void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); RunState saved_state =3D runstate_get(); =20 const char *name =3D qdict_get_str(qdict, "name"); @@ -489,8 +493,9 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_savevm(Monitor *mon, const QDict *qdict) +void hmp_savevm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 save_snapshot(qdict_get_try_str(qdict, "name"), @@ -498,8 +503,9 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_delvm(Monitor *mon, const QDict *qdict) +void hmp_delvm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *name =3D qdict_get_str(qdict, "name"); =20 @@ -507,13 +513,14 @@ void hmp_delvm(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) +void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict) { qmp_migrate_cancel(NULL); } =20 -void hmp_migrate_continue(Monitor *mon, const QDict *qdict) +void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *state =3D qdict_get_str(qdict, "state"); int val =3D qapi_enum_parse(&MigrationStatus_lookup, state, -1, &err); @@ -525,8 +532,9 @@ void hmp_migrate_continue(Monitor *mon, const QDict *qd= ict) hmp_handle_error(mon, err); } =20 -void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) +void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); MigrationChannelList *caps =3D NULL; @@ -544,8 +552,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_migrate_recover(Monitor *mon, const QDict *qdict) +void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *uri =3D qdict_get_str(qdict, "uri"); =20 @@ -554,8 +563,9 @@ void hmp_migrate_recover(Monitor *mon, const QDict *qdi= ct) hmp_handle_error(mon, err); } =20 -void hmp_migrate_pause(Monitor *mon, const QDict *qdict) +void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_migrate_pause(&err); @@ -564,8 +574,9 @@ void hmp_migrate_pause(Monitor *mon, const QDict *qdict) } =20 =20 -void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) +void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *cap =3D qdict_get_str(qdict, "capability"); bool state =3D qdict_get_bool(qdict, "state"); Error *err =3D NULL; @@ -589,8 +600,9 @@ end: hmp_handle_error(mon, err); } =20 -void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) +void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); @@ -790,16 +802,18 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict) +void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; qmp_migrate_start_postcopy(&err); hmp_handle_error(mon, err); } =20 #ifdef CONFIG_REPLICATION -void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict) +void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_colo_lost_heartbeat(&err); @@ -833,8 +847,9 @@ static void hmp_migrate_status_cb(void *opaque) qapi_free_MigrationInfo(info); } =20 -void hmp_migrate(Monitor *mon, const QDict *qdict) +void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool detach =3D qdict_get_try_bool(qdict, "detach", false); bool resume =3D qdict_get_try_bool(qdict, "resume", false); const char *uri =3D qdict_get_str(qdict, "uri"); @@ -873,7 +888,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) =20 if (!detach) { HMPMigrationStatus *status; - MonitorHMP *hmp =3D MONITOR_HMP(mon); =20 if (!hmp->use_readline) { monitor_printf(mon, "terminal does not allow synchronous " diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 6718fec97047..afe4817b4056 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -103,8 +103,9 @@ strList *hmp_split_at_comma(const char *str) return res; } =20 -void hmp_info_name(Monitor *mon, const QDict *qdict) +void hmp_info_name(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); NameInfo *info; =20 info =3D qmp_query_name(NULL); @@ -114,8 +115,9 @@ void hmp_info_name(Monitor *mon, const QDict *qdict) qapi_free_NameInfo(info); } =20 -void hmp_info_version(Monitor *mon, const QDict *qdict) +void hmp_info_version(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); VersionInfo *info; =20 info =3D qmp_query_version(NULL); @@ -127,22 +129,23 @@ void hmp_info_version(Monitor *mon, const QDict *qdic= t) qapi_free_VersionInfo(info); } =20 -void hmp_quit(Monitor *mon, const QDict *qdict) +void hmp_quit(MonitorHMP *hmp, const QDict *qdict) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); + Monitor *mon =3D MONITOR(hmp); if (hmp->use_readline) { monitor_suspend(mon); } qmp_quit(NULL); } =20 -void hmp_stop(Monitor *mon, const QDict *qdict) +void hmp_stop(MonitorHMP *hmp, const QDict *qdict) { qmp_stop(NULL); } =20 -void hmp_sync_profile(Monitor *mon, const QDict *qdict) +void hmp_sync_profile(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *op =3D qdict_get_try_str(qdict, "op"); =20 if (op =3D=3D NULL) { @@ -166,16 +169,18 @@ void hmp_sync_profile(Monitor *mon, const QDict *qdic= t) } } =20 -void hmp_exit_preconfig(Monitor *mon, const QDict *qdict) +void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_exit_preconfig(&err); hmp_handle_error(mon, err); } =20 -void hmp_cpu(Monitor *mon, const QDict *qdict) +void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t cpu_index; =20 /* XXX: drop the monitor_set_cpu() usage when all HMP commands that @@ -186,16 +191,18 @@ void hmp_cpu(Monitor *mon, const QDict *qdict) } } =20 -void hmp_cont(Monitor *mon, const QDict *qdict) +void hmp_cont(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_cont(&err); hmp_handle_error(mon, err); } =20 -void hmp_change(Monitor *mon, const QDict *qdict) +void hmp_change(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *device =3D qdict_get_str(qdict, "device"); const char *target =3D qdict_get_str(qdict, "target"); const char *arg =3D qdict_get_try_str(qdict, "arg"); @@ -216,8 +223,9 @@ void hmp_change(Monitor *mon, const QDict *qdict) } =20 #ifdef CONFIG_POSIX -void hmp_getfd(Monitor *mon, const QDict *qdict) +void hmp_getfd(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 @@ -226,8 +234,9 @@ void hmp_getfd(Monitor *mon, const QDict *qdict) } #endif =20 -void hmp_closefd(Monitor *mon, const QDict *qdict) +void hmp_closefd(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 @@ -235,8 +244,9 @@ void hmp_closefd(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_info_iothreads(Monitor *mon, const QDict *qdict) +void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); IOThreadInfoList *info_list =3D qmp_query_iothreads(NULL); IOThreadInfoList *info; IOThreadInfo *value; @@ -256,13 +266,15 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qd= ict) qapi_free_IOThreadInfoList(info_list); } =20 -void hmp_help(Monitor *mon, const QDict *qdict) +void hmp_help(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hmp_help_cmd(mon, qdict_get_try_str(qdict, "name")); } =20 -void hmp_clear(Monitor *mon, const QDict *qdict) +void hmp_clear(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); /* * Send an ANSI escape sequence: * "\x1b[H" - move cursor to top-left @@ -272,12 +284,13 @@ void hmp_clear(Monitor *mon, const QDict *qdict) monitor_printf(mon, "\x1b[H\x1b[2J\x1b[3J"); } =20 -void hmp_info_help(Monitor *mon, const QDict *qdict) +void hmp_info_help(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hmp_help_cmd(mon, "info"); } =20 -void hmp_info_sync_profile(Monitor *mon, const QDict *qdict) +void hmp_info_sync_profile(MonitorHMP *hmp, const QDict *qdict) { int64_t max =3D qdict_get_try_int(qdict, "max", 10); bool mean =3D qdict_get_try_bool(qdict, "mean", false); @@ -288,9 +301,9 @@ void hmp_info_sync_profile(Monitor *mon, const QDict *q= dict) qsp_report(max, sort_by, coalesce); } =20 -void hmp_info_history(Monitor *mon, const QDict *qdict) +void hmp_info_history(MonitorHMP *hmp, const QDict *qdict) { - MonitorHMP *hmp =3D MONITOR_HMP(mon); + Monitor *mon =3D MONITOR(hmp); int i; const char *str; =20 @@ -308,7 +321,7 @@ void hmp_info_history(Monitor *mon, const QDict *qdict) } } =20 -void hmp_logfile(Monitor *mon, const QDict *qdict) +void hmp_logfile(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; =20 @@ -317,8 +330,9 @@ void hmp_logfile(Monitor *mon, const QDict *qdict) } } =20 -void hmp_log(Monitor *mon, const QDict *qdict) +void hmp_log(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int mask; const char *items =3D qdict_get_str(qdict, "items"); Error *err =3D NULL; @@ -338,8 +352,9 @@ void hmp_log(Monitor *mon, const QDict *qdict) } } =20 -void hmp_gdbserver(Monitor *mon, const QDict *qdict) +void hmp_gdbserver(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *device =3D qdict_get_try_str(qdict, "device"); =20 @@ -357,8 +372,9 @@ void hmp_gdbserver(Monitor *mon, const QDict *qdict) } } =20 -void hmp_print(Monitor *mon, const QDict *qdict) +void hmp_print(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int format =3D qdict_get_int(qdict, "format"); hwaddr val =3D qdict_get_int(qdict, "val"); =20 @@ -383,8 +399,9 @@ void hmp_print(Monitor *mon, const QDict *qdict) monitor_printf(mon, "\n"); } =20 -void hmp_sum(Monitor *mon, const QDict *qdict) +void hmp_sum(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); uint32_t addr; uint16_t sum; uint32_t start =3D qdict_get_int(qdict, "start"); @@ -401,8 +418,9 @@ void hmp_sum(Monitor *mon, const QDict *qdict) monitor_printf(mon, "%05d\n", sum); } =20 -void hmp_ioport_read(Monitor *mon, const QDict *qdict) +void hmp_ioport_read(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int size =3D qdict_get_int(qdict, "size"); int addr =3D qdict_get_int(qdict, "addr"); int has_index =3D qdict_haskey(qdict, "index"); @@ -435,7 +453,7 @@ void hmp_ioport_read(Monitor *mon, const QDict *qdict) suffix, addr, size * 2, val); } =20 -void hmp_ioport_write(Monitor *mon, const QDict *qdict) +void hmp_ioport_write(MonitorHMP *hmp, const QDict *qdict) { int size =3D qdict_get_int(qdict, "size"); int addr =3D qdict_get_int(qdict, "addr"); @@ -457,8 +475,9 @@ void hmp_ioport_write(Monitor *mon, const QDict *qdict) } } =20 -void hmp_boot_set(Monitor *mon, const QDict *qdict) +void hmp_boot_set(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *local_err =3D NULL; const char *bootdevice =3D qdict_get_str(qdict, "bootdevice"); =20 @@ -470,7 +489,7 @@ void hmp_boot_set(Monitor *mon, const QDict *qdict) } } =20 -void hmp_info_mtree(Monitor *mon, const QDict *qdict) +void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdict) { bool flatview =3D qdict_get_try_bool(qdict, "flatview", false); bool dispatch_tree =3D qdict_get_try_bool(qdict, "dispatch_tree", fals= e); @@ -481,8 +500,9 @@ void hmp_info_mtree(Monitor *mon, const QDict *qdict) } =20 #if defined(CONFIG_FDT) -void hmp_dumpdtb(Monitor *mon, const QDict *qdict) +void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); Error *local_err =3D NULL; =20 @@ -558,8 +578,9 @@ int monitor_get_cpu_index(Monitor *mon) return cs ? cs->cpu_index : UNASSIGNED_CPU_INDEX; } =20 -void hmp_info_registers(Monitor *mon, const QDict *qdict) +void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool all_cpus =3D qdict_get_try_bool(qdict, "cpustate_all", false); int vcpu =3D qdict_get_try_int(qdict, "vcpu", -1); CPUState *cs; @@ -694,8 +715,9 @@ static void memory_dump(Monitor *mon, int count, int fo= rmat, int wsize, } } =20 -void hmp_memory_dump(Monitor *mon, const QDict *qdict) +void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); @@ -704,8 +726,9 @@ void hmp_memory_dump(Monitor *mon, const QDict *qdict) memory_dump(mon, count, format, size, addr, false); } =20 -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict) +void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); @@ -714,8 +737,9 @@ void hmp_physical_memory_dump(Monitor *mon, const QDict= *qdict) memory_dump(mon, count, format, size, addr, true); } =20 -void hmp_gpa2hva(Monitor *mon, const QDict *qdict) +void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hwaddr addr =3D qdict_get_int(qdict, "addr"); Error *local_err =3D NULL; MemoryRegion *mr =3D NULL; @@ -734,8 +758,9 @@ void hmp_gpa2hva(Monitor *mon, const QDict *qdict) memory_region_unref(mr); } =20 -void hmp_gva2gpa(Monitor *mon, const QDict *qdict) +void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); vaddr addr =3D qdict_get_int(qdict, "addr"); CPUState *cs =3D mon_get_cpu(mon); TranslateForDebugResult tres; @@ -787,8 +812,9 @@ out: return ret; } =20 -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict) +void hmp_gpa2hpa(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); hwaddr addr =3D qdict_get_int(qdict, "addr"); Error *local_err =3D NULL; MemoryRegion *mr =3D NULL; diff --git a/monitor/hmp.c b/monitor/hmp.c index b4d05d47c4bf..6e6334b64685 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1228,12 +1228,12 @@ static void hmp_info_human_readable_text(Monitor *m= on, monitor_puts(mon, info->human_readable_text); } =20 -static void handle_hmp_command_exec(Monitor *mon, +static void handle_hmp_command_exec(MonitorHMP *mon, const HMPCommand *cmd, QDict *qdict) { if (cmd->cmd_info_hrt) { - hmp_info_human_readable_text(mon, + hmp_info_human_readable_text(MONITOR(mon), cmd->cmd_info_hrt); } else { cmd->cmd(mon, qdict); @@ -1241,7 +1241,7 @@ static void handle_hmp_command_exec(Monitor *mon, } =20 typedef struct HandleHmpCommandCo { - Monitor *mon; + MonitorHMP *mon; const HMPCommand *cmd; QDict *qdict; bool done; @@ -1289,19 +1289,18 @@ void handle_hmp_command(MonitorHMP *hmp, const char= *cmdline) =20 if (!cmd->coroutine) { /* old_mon is non-NULL when called from qmp_human_monitor_command(= ) */ - Monitor *old_mon =3D monitor_set_cur(qemu_coroutine_self(), - &hmp->parent_obj); - handle_hmp_command_exec(&hmp->parent_obj, cmd, qdict); + Monitor *old_mon =3D monitor_set_cur(qemu_coroutine_self(), MONITO= R(hmp)); + handle_hmp_command_exec(hmp, cmd, qdict); monitor_set_cur(qemu_coroutine_self(), old_mon); } else { HandleHmpCommandCo data =3D { - .mon =3D &hmp->parent_obj, + .mon =3D hmp, .cmd =3D cmd, .qdict =3D qdict, .done =3D false, }; Coroutine *co =3D qemu_coroutine_create(handle_hmp_command_co, &da= ta); - monitor_set_cur(co, &hmp->parent_obj); + monitor_set_cur(co, MONITOR(hmp)); aio_co_enter(qemu_get_aio_context(), co); AIO_WAIT_WHILE_UNLOCKED(NULL, !data.done); } @@ -1689,7 +1688,7 @@ int hmp_compare_cmd(const char *name, const char *lis= t) } =20 void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)) + void (*cmd)(MonitorHMP *mon, const QDict *qdict)) { HMPCommand *table =3D hmp_cmds_for_target(info); =20 diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index ee9ba0c8231e..a0fa37c887ed 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -77,7 +77,7 @@ typedef struct HMPCommand { const char *params; const char *help; const char *flags; /* p=3Dpreconfig */ - void (*cmd)(Monitor *mon, const QDict *qdict); + void (*cmd)(MonitorHMP *mon, const QDict *qdict); /* * If implementing a command that takes no arguments and simply * prints formatted data, then leave @cmd NULL, and then set diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 52ac8da770d9..702103b6a920 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -45,8 +45,9 @@ static void hmp_print_client_info(Monitor *mon, NetworkCl= ientInfo *ci) } } =20 -void hmp_info_network(Monitor *mon, const QDict *qdict) +void hmp_info_network(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; g_autoptr(NetworkInfo) info =3D qmp_x_query_network(&err); NetHubInfoList *h; @@ -83,8 +84,9 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) } } =20 -void hmp_set_link(Monitor *mon, const QDict *qdict) +void hmp_set_link(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool up =3D qdict_get_bool(qdict, "up"); Error *err =3D NULL; @@ -94,7 +96,7 @@ void hmp_set_link(Monitor *mon, const QDict *qdict) } =20 =20 -void hmp_announce_self(Monitor *mon, const QDict *qdict) +void hmp_announce_self(MonitorHMP *hmp, const QDict *qdict) { const char *interfaces_str =3D qdict_get_try_str(qdict, "interfaces"); const char *id =3D qdict_get_try_str(qdict, "id"); @@ -109,8 +111,9 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict) qapi_free_AnnounceParameters(params); } =20 -void hmp_netdev_add(Monitor *mon, const QDict *qdict) +void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; const char *type =3D qdict_get_try_str(qdict, "type"); @@ -133,8 +136,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_netdev_del(Monitor *mon, const QDict *qdict) +void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 diff --git a/net/slirp.c b/net/slirp.c index 9bf09a2c8bc9..d5c190b48b76 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -733,8 +733,9 @@ static SlirpState *slirp_lookup(Monitor *mon, const cha= r *id) } } =20 -void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict) +void hmp_hostfwd_remove(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); /* TODO: support removing unix fwd */ struct sockaddr_in host_addr =3D { .sin_family =3D AF_INET, @@ -957,8 +958,9 @@ static int slirp_hostfwd(SlirpState *s, const char *red= ir_str, Error **errp) return -1; } =20 -void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) +void hmp_hostfwd_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *redir_str; SlirpState *s; const char *arg1 =3D qdict_get_str(qdict, "arg1"); @@ -1224,8 +1226,9 @@ UsernetInfoList *qmp_x_query_usernet(Error **errp) return head; } =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict) +void hmp_info_usernet(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); g_autoptr(UsernetInfoList) list =3D NULL; UsernetInfoList *entry; =20 diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index 47110ca58c0d..16847d1ce261 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -18,8 +18,9 @@ #include "qom/object.h" #include "qom/object_interfaces.h" =20 -void hmp_qom_list(Monitor *mon, const QDict *qdict) +void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_try_str(qdict, "path"); ObjectPropertyInfoList *list; Error *err =3D NULL; @@ -44,8 +45,9 @@ void hmp_qom_list(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_qom_set(Monitor *mon, const QDict *qdict) +void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const bool json =3D qdict_get_try_bool(qdict, "json", false); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); @@ -72,8 +74,9 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_qom_get(Monitor *mon, const QDict *qdict) +void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); Error *err =3D NULL; @@ -132,8 +135,9 @@ static void print_qom_composition(Monitor *mon, Object = *obj, int indent) g_array_free(children, TRUE); } =20 -void hmp_info_qom_tree(Monitor *mon, const QDict *dict) +void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *dict) { + Monitor *mon =3D MONITOR(hmp); const char *path =3D qdict_get_try_str(dict, "path"); Object *obj; bool ambiguous =3D false; @@ -154,8 +158,9 @@ void hmp_info_qom_tree(Monitor *mon, const QDict *dict) print_qom_composition(mon, obj, 0); } =20 -void hmp_object_add(Monitor *mon, const QDict *qdict) +void hmp_object_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *options =3D qdict_get_str(qdict, "object"); Error *err =3D NULL; =20 @@ -163,8 +168,9 @@ void hmp_object_add(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 -void hmp_object_del(Monitor *mon, const QDict *qdict) +void hmp_object_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index 7b904a141654..ef69d23ff507 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -31,8 +31,9 @@ bool replay_running_debug(void) return replay_is_debugging; } =20 -void hmp_info_replay(Monitor *mon, const QDict *qdict) +void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); if (replay_mode =3D=3D REPLAY_MODE_NONE) { monitor_printf(mon, "Record/replay is not active\n"); } else { @@ -103,7 +104,7 @@ void qmp_replay_break(int64_t icount, Error **errp) } } =20 -void hmp_replay_break(Monitor *mon, const QDict *qdict) +void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); Error *err =3D NULL; @@ -124,7 +125,7 @@ void qmp_replay_delete_break(Error **errp) } } =20 -void hmp_replay_delete_break(Monitor *mon, const QDict *qdict) +void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict) { Error *err =3D NULL; =20 @@ -209,7 +210,7 @@ void qmp_replay_seek(int64_t icount, Error **errp) replay_seek(icount, replay_stop_vm, errp); } =20 -void hmp_replay_seek(Monitor *mon, const QDict *qdict) +void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); Error *err =3D NULL; diff --git a/replay/stubs-system.c b/replay/stubs-system.c index f8e17dcf1ce9..15e7411591ab 100644 --- a/replay/stubs-system.c +++ b/replay/stubs-system.c @@ -63,19 +63,19 @@ void replay_vmstate_init(void) #include "qapi/error.h" #include "qemu/error-report.h" =20 -void hmp_info_replay(Monitor *mon, const QDict *qdict) +void hmp_info_replay(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } -void hmp_replay_break(Monitor *mon, const QDict *qdict) +void hmp_replay_break(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } -void hmp_replay_delete_break(Monitor *mon, const QDict *qdict) +void hmp_replay_delete_break(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } -void hmp_replay_seek(Monitor *mon, const QDict *qdict) +void hmp_replay_seek(MonitorHMP *hmp, const QDict *qdict) { error_report("replay support not available"); } diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index b93b471b1b25..f280ad8c4314 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -187,8 +187,9 @@ static StatsFilter *stats_filter(StatsTarget target, co= nst char *names, return filter; } =20 -void hmp_info_stats(Monitor *mon, const QDict *qdict) +void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *target_str =3D qdict_get_str(qdict, "target"); const char *provider_str =3D qdict_get_try_str(qdict, "provider"); const char *names =3D qdict_get_try_str(qdict, "names"); diff --git a/stubs/hmp-cmd-info_sev.c b/stubs/hmp-cmd-info_sev.c index f3624423a334..6f2b87d1ad10 100644 --- a/stubs/hmp-cmd-info_sev.c +++ b/stubs/hmp-cmd-info_sev.c @@ -10,7 +10,8 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 -void hmp_info_sev(Monitor *mon, const QDict *qdict) +void hmp_info_sev(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); monitor_printf(mon, "SEV is not available in this QEMU\n"); } diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c index 4928d57cc8e3..4c100783778f 100644 --- a/system/dirtylimit-hmp-cmds.c +++ b/system/dirtylimit-hmp-cmds.c @@ -15,8 +15,9 @@ #include "monitor/monitor.h" #include "system/dirtylimit.h" =20 -void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) +void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; =20 @@ -30,8 +31,9 @@ void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDic= t *qdict) "dirty limit for virtual CPU]\n"); } =20 -void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) +void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); int64_t dirty_rate =3D qdict_get_int(qdict, "dirty_rate"); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; @@ -47,8 +49,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) +void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); DirtyLimitInfoList *info; g_autoptr(DirtyLimitInfoList) head =3D NULL; Error *err =3D NULL; diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 00fed791cce1..e27b9724867a 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -851,8 +851,9 @@ static void qbus_print(Monitor *mon, BusState *bus, int= indent, bool details) } #undef qdev_printf =20 -void hmp_info_qtree(Monitor *mon, const QDict *qdict) +void hmp_info_qtree(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); bool details =3D !qdict_get_try_bool(qdict, "brief", false); =20 if (sysbus_get_default()) { @@ -860,7 +861,7 @@ void hmp_info_qtree(Monitor *mon, const QDict *qdict) } } =20 -void hmp_info_qdm(Monitor *mon, const QDict *qdict) +void hmp_info_qdm(MonitorHMP *hmp, const QDict *qdict) { qdev_print_devinfos(true); } @@ -1001,8 +1002,9 @@ void qmp_device_sync_config(const char *id, Error **e= rrp) qdev_sync_config(dev, errp); } =20 -void hmp_device_add(Monitor *mon, const QDict *qdict) +void hmp_device_add(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; DeviceState *dev; @@ -1035,8 +1037,9 @@ out: hmp_handle_error(mon, err); } =20 -void hmp_device_del(Monitor *mon, const QDict *qdict) +void hmp_device_del(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 diff --git a/system/runstate-hmp-cmds.c b/system/runstate-hmp-cmds.c index 02d1d42bf392..834b95835339 100644 --- a/system/runstate-hmp-cmds.c +++ b/system/runstate-hmp-cmds.c @@ -23,8 +23,9 @@ #include "qobject/qdict.h" #include "qemu/accel.h" =20 -void hmp_info_status(Monitor *mon, const QDict *qdict) +void hmp_info_status(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); StatusInfo *info; =20 info =3D qmp_query_status(NULL); @@ -41,8 +42,9 @@ void hmp_info_status(Monitor *mon, const QDict *qdict) qapi_free_StatusInfo(info); } =20 -void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) +void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); const char *option =3D qdict_get_try_str(qdict, "option"); AccelState *accel =3D current_accel(); bool newval; @@ -66,8 +68,9 @@ void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) newval, &error_abort); } =20 -void hmp_watchdog_action(Monitor *mon, const QDict *qdict) +void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; WatchdogAction action; char *qapi_value; diff --git a/system/tpm-hmp-cmds.c b/system/tpm-hmp-cmds.c index 9ed6ad6c4d46..094c3f16cf50 100644 --- a/system/tpm-hmp-cmds.c +++ b/system/tpm-hmp-cmds.c @@ -11,8 +11,9 @@ #include "monitor/hmp.h" #include "qapi/error.h" =20 -void hmp_info_tpm(Monitor *mon, const QDict *qdict) +void hmp_info_tpm(MonitorHMP *hmp, const QDict *qdict) { + Monitor *mon =3D MONITOR(hmp); #ifdef CONFIG_TPM TPMInfoList *info_list, *info; Error *err =3D NULL; diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 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 21:37:38 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=1787685250; cv=none; d=zohomail.com; s=zohoarc; b=c/6usbKWvABqePuVLGts9TDjGF1kXcJiLxcxa9P0MWi+VXMyePyALf73KvdrRixG+o+EvBW5zbbf2Yl3Li4qWKsnaehF/UxTl+JDAozd97XbPA8n/+mg+BmRCYAh7DAy/WbCry+oXXUwyUQfr4z/5rMXu/kW+Jr0qsDuKmho1kE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685250; 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=69Wk4jq9GL2H79bxBAwt9AxAEiqwTbVxzDC5M8CUiak=; b=mBVOZSm1jnXfBnizpaBYkp1kWuQ7O2p+Tb1H6gsZmwFK0Gxcn3aZLTUnfOnVoha7TESdERnXX8T4IY1XK7G9eBjjoalHcVan64WjgImNlgnBLcsfRmgM6Rp1aleiqeeYN8r5djUJN30+eZWvogCHeNIwFeCoF3jIC+KexEIH5+A= 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 1787685250586167.171083161531; Tue, 25 Aug 2026 12:14:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZF-0000tY-Am; Tue, 25 Aug 2026 15:12: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 1wywZC-0000sR-WE for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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 1wywZ8-0004Lh-Kv for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:14 -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-189-XY1EGxKhN5eXknFqzltVTg-1; Tue, 25 Aug 2026 15:12:06 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F41B019774F7; Tue, 25 Aug 2026 19:12:03 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 63A0B1944B2D; Tue, 25 Aug 2026 19:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685129; 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=69Wk4jq9GL2H79bxBAwt9AxAEiqwTbVxzDC5M8CUiak=; b=T3ozC+ND1P/gBgb9Dc5+Z0h17ZuSNzX5WTKgHkhv9DsJ574NFdmsfCY75WQlfwhAbfDN1g hoz7Uyr/CKf2LveAdqiIBCkFLjSjtCI+NTGJv0wZ2Q6s4mVKasQUDJctDz98OZMNvNZHfD h+DXVFau1P2dAGVlx/Ihs6FFFoonZZ4= X-MC-Unique: XY1EGxKhN5eXknFqzltVTg-1 X-Mimecast-MFC-AGG-ID: XY1EGxKhN5eXknFqzltVTg_1787685124 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:38 +0400 Subject: [PATCH v4 31/49] monitor: make hmp_handle_error() take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-31-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , David Woodhouse , Paul Durrant , Richard Henderson , "Michael S. Tsirkin" , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Gerd Hoffmann , Hyman Huang , Peter Xu , Fabiano Rosas , Zhao Liu , qemu-block@nongnu.org, qemu-ppc@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=45057; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=rJ7318v61b0riISmSVoXqRVF+J/TDgFdSO7ucMDc2Is=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIHBkz+77h43WObJvmi7CXLfOJx5KeDFEl5 u3kQQW+6xKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5YAaD/9yJ44zaLsjKwesFiWiZifb9XhkOzT6p3EhIdH+bYSvy67Y/DmAH8sXBYv0TtH0zVxrMjb wY1KBk7pE3gC2QHB0DXUB7XXOQxPq/oKXEFbwJobMcRKN6tRYH2y7X2ox3dUV8BpjhpMMBz5YGe Hx1YPph9WFl9rGuuEONQFTmZ2QZ/FPcMHT0d2+vPtK3GMsW2DNRIGzaEYneGTER7Ol3NGaDL55S EP/4MnsQzqCu61C9aPUw+i4sH8Sl5xv4zzeuppyiaOf9pPJ2OOfAvtGR2JI2azB39GkSXx4/K69 dzagkw+mBtvqoQWma/GrJO+p1rgj69ODIJybmRRO1X+S3ZAtOgoFQgnkQoaA7XvlDvN5vJ3yUwt KqUwAZEgo/2dvWLWuPX30F6s6LiIrJV9a4IClzmJQrsM2ANkmBoscdz0o4czJk0asykpZmGL2Uu IkZxjwKPgCF2j3NeZITBSPk4rYo1P9antrch3QEkj5F8v41SDynP34t++R35AdwTVygR+6rJWKc 9vix7EX6fICSTsRsu8jyeH3h5BVpLq5gqtywIDk2Pj40N0gJHSho9pFMIpLwtb01wTPZ6EqL6FZ Y8FJh+AEN3VNcAX0Czv9vJxxTCX6OiDMcUS4Bav97otyuRn0LvYLpmLS+m3zV/HQykENykyWw0j CjGuSHtVQ6GuSxQ== 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: 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: 1787685251282158500 Mostly mechanical, with a few adjustments around it. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 afe4817b4056..d1e7e4de6585 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -75,7 +75,7 @@ static void __attribute__((__constructor__)) sortcmdlist(= void) compare_mon_cmd); } =20 -bool hmp_handle_error(Monitor *mon, Error *err) +bool hmp_handle_error(MonitorHMP *hmp, Error *err) { if (err) { error_reportf_err(err, "Error: "); @@ -165,17 +165,16 @@ void hmp_sync_profile(MonitorHMP *hmp, const QDict *q= dict) =20 error_setg(&err, "invalid parameter '%s'," " expecting 'on', 'off', or 'reset'", op); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } } =20 void hmp_exit_preconfig(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_x_exit_preconfig(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) @@ -193,11 +192,10 @@ void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_cont(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qmp_cont(&err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_change(MonitorHMP *hmp, const QDict *qdict) @@ -219,29 +217,27 @@ void hmp_change(MonitorHMP *hmp, const QDict *qdict) hmp_change_medium(mon, device, target, arg, read_only, force, &err= ); } =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 #ifdef CONFIG_POSIX void hmp_getfd(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 qmp_getfd(fdname, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } #endif =20 void hmp_closefd(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 qmp_closefd(fdname, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_iothreads(MonitorHMP *hmp, const QDict *qdict) @@ -502,17 +498,16 @@ void hmp_info_mtree(MonitorHMP *hmp, const QDict *qdi= ct) #if defined(CONFIG_FDT) void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); Error *local_err =3D NULL; =20 qmp_dumpdtb(filename, &local_err); =20 - if (hmp_handle_error(mon, local_err)) { + if (hmp_handle_error(hmp, local_err)) { return; } =20 - monitor_printf(mon, "DTB dumped to '%s'\n", filename); + monitor_printf(MONITOR(hmp), "DTB dumped to '%s'\n", filename); } #endif =20 diff --git a/monitor/hmp.c b/monitor/hmp.c index 6e6334b64685..57c4127641ac 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1215,28 +1215,28 @@ fail: return NULL; } =20 -static void hmp_info_human_readable_text(Monitor *mon, +static void hmp_info_human_readable_text(MonitorHMP *hmp, HumanReadableText *(*handler)(Err= or **)) { Error *err =3D NULL; g_autoptr(HumanReadableText) info =3D handler(&err); =20 - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 - monitor_puts(mon, info->human_readable_text); + monitor_puts(MONITOR(hmp), info->human_readable_text); } =20 -static void handle_hmp_command_exec(MonitorHMP *mon, +static void handle_hmp_command_exec(MonitorHMP *hmp, const HMPCommand *cmd, QDict *qdict) { if (cmd->cmd_info_hrt) { - hmp_info_human_readable_text(MONITOR(mon), + hmp_info_human_readable_text(hmp, cmd->cmd_info_hrt); } else { - cmd->cmd(mon, qdict); + cmd->cmd(hmp, qdict); } } =20 diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 702103b6a920..5b1c678f5d89 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -53,7 +53,7 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdict) NetHubInfoList *h; NetworkClientInfoList *entry; =20 - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } =20 @@ -86,13 +86,12 @@ void hmp_info_network(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_set_link(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *name =3D qdict_get_str(qdict, "name"); bool up =3D qdict_get_bool(qdict, "up"); Error *err =3D NULL; =20 qmp_set_link(name, up, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 =20 @@ -113,7 +112,6 @@ void hmp_announce_self(MonitorHMP *hmp, const QDict *qd= ict) =20 void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; const char *type =3D qdict_get_try_str(qdict, "type"); @@ -133,17 +131,16 @@ void hmp_netdev_add(MonitorHMP *hmp, const QDict *qdi= ct) } =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_netdev_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 qmp_netdev_del(id, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 =20 diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c index 16847d1ce261..2e2eb33371e2 100644 --- a/qom/qom-hmp-cmds.c +++ b/qom/qom-hmp-cmds.c @@ -42,12 +42,11 @@ void hmp_qom_list(MonitorHMP *hmp, const QDict *qdict) } qapi_free_ObjectPropertyInfoList(start); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const bool json =3D qdict_get_try_bool(qdict, "json", false); const char *path =3D qdict_get_str(qdict, "path"); const char *property =3D qdict_get_str(qdict, "property"); @@ -71,7 +70,7 @@ void hmp_qom_set(MonitorHMP *hmp, const QDict *qdict) } } =20 - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) @@ -89,7 +88,7 @@ void hmp_qom_get(MonitorHMP *hmp, const QDict *qdict) } =20 qobject_unref(obj); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 typedef struct QOMCompositionState { @@ -160,22 +159,20 @@ void hmp_info_qom_tree(MonitorHMP *hmp, const QDict *= dict) =20 void hmp_object_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *options =3D qdict_get_str(qdict, "object"); Error *err =3D NULL; =20 user_creatable_add_from_str(options, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_object_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 user_creatable_del(id, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void object_add_completion(ReadLineState *rs, int nb_args, const char *str) diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c index 4c100783778f..75194add7931 100644 --- a/system/dirtylimit-hmp-cmds.c +++ b/system/dirtylimit-hmp-cmds.c @@ -23,7 +23,7 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const Q= Dict *qdict) =20 qmp_cancel_vcpu_dirty_limit(!!(cpu_index !=3D -1), cpu_index, &err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 @@ -33,7 +33,6 @@ void hmp_cancel_vcpu_dirty_limit(MonitorHMP *hmp, const Q= Dict *qdict) =20 void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int64_t dirty_rate =3D qdict_get_int(qdict, "dirty_rate"); int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; @@ -46,7 +45,7 @@ void hmp_set_vcpu_dirty_limit(MonitorHMP *hmp, const QDic= t *qdict) qmp_set_vcpu_dirty_limit(!!(cpu_index !=3D -1), cpu_index, dirty_rate,= &err); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDict *qdict) @@ -63,7 +62,7 @@ void hmp_info_vcpu_dirty_limit(MonitorHMP *hmp, const QDi= ct *qdict) =20 head =3D qmp_query_vcpu_dirty_limit(&err); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } =20 diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index e27b9724867a..5c2de2f53cc9 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -1004,7 +1004,6 @@ void qmp_device_sync_config(const char *id, Error **e= rrp) =20 void hmp_device_add(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; QemuOpts *opts; DeviceState *dev; @@ -1034,17 +1033,16 @@ void hmp_device_add(MonitorHMP *hmp, const QDict *q= dict) } object_unref(dev); out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_device_del(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *id =3D qdict_get_str(qdict, "id"); Error *err =3D NULL; =20 qmp_device_del(id, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void device_add_completion(ReadLineState *rs, int nb_args, const char *str) diff --git a/system/runstate-hmp-cmds.c b/system/runstate-hmp-cmds.c index 834b95835339..051ee45ee74c 100644 --- a/system/runstate-hmp-cmds.c +++ b/system/runstate-hmp-cmds.c @@ -70,7 +70,6 @@ void hmp_one_insn_per_tb(MonitorHMP *hmp, const QDict *qd= ict) =20 void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; WatchdogAction action; char *qapi_value; @@ -79,7 +78,7 @@ void hmp_watchdog_action(MonitorHMP *hmp, const QDict *qd= ict) action =3D qapi_enum_parse(&WatchdogAction_lookup, qapi_value, -1, &er= r); g_free(qapi_value); if (err) { - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); return; } qmp_watchdog_set_action(action, &error_abort); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index f1d2a327ddad..f68dd38ac225 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -573,7 +573,6 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict) =20 void hmp_mce(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); X86CPU *cpu; CPUState *cs; int cpu_index =3D qdict_get_int(qdict, "cpu_index"); @@ -596,5 +595,5 @@ void hmp_mce(MonitorHMP *hmp, const QDict *qdict) } else { error_setg(&err, "Invalid CPU %d", cpu_index); } - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 5f3522943c56..186209fd0234 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -73,11 +73,10 @@ void hmp_mouse_button(MonitorHMP *hmp, const QDict *qdi= ct) =20 void hmp_mouse_set(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; =20 qemu_mouse_set(qdict_get_int(qdict, "index"), &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_info_mice(MonitorHMP *hmp, const QDict *qdict) @@ -158,7 +157,7 @@ void hmp_info_vnc(MonitorHMP *hmp, const QDict *qdict) =20 info2l =3D qmp_query_vnc_servers(&err); info2l_head =3D info2l; - if (hmp_handle_error(mon, err)) { + if (hmp_handle_error(hmp, err)) { return; } if (!info2l) { @@ -266,7 +265,6 @@ out: =20 void hmp_set_password(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *password =3D qdict_get_str(qdict, "password"); const char *display =3D qdict_get_try_str(qdict, "display"); @@ -297,12 +295,11 @@ void hmp_set_password(MonitorHMP *hmp, const QDict *q= dict) qmp_set_password(&opts, &err); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 void hmp_expire_password(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *whenstr =3D qdict_get_str(qdict, "time"); const char *display =3D qdict_get_try_str(qdict, "display"); @@ -325,7 +322,7 @@ void hmp_expire_password(MonitorHMP *hmp, const QDict *= qdict) qmp_expire_password(&opts, &err); =20 out: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } =20 #ifdef CONFIG_VNC @@ -427,7 +424,7 @@ void hmp_sendkey(MonitorHMP *hmp, const QDict *qdict) } =20 qmp_send_key(head, has_hold_time, hold_time, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); =20 out: qapi_free_KeyValue(v); @@ -465,7 +462,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args,= const char *str) void coroutine_fn hmp_screendump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); const char *filename =3D qdict_get_str(qdict, "filename"); const char *id =3D qdict_get_try_str(qdict, "device"); int64_t head =3D qdict_get_try_int(qdict, "head", 0); @@ -482,13 +478,12 @@ hmp_screendump(MonitorHMP *hmp, const QDict *qdict) qmp_screendump(filename, id, id !=3D NULL, head, input_format !=3D NULL, format, &err); end: - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } #endif =20 void hmp_client_migrate_info(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); Error *err =3D NULL; const char *protocol =3D qdict_get_str(qdict, "protocol"); const char *hostname =3D qdict_get_str(qdict, "hostname"); @@ -501,5 +496,5 @@ void hmp_client_migrate_info(MonitorHMP *hmp, const QDi= ct *qdict) qmp_client_migrate_info(protocol, hostname, has_port, port, has_tls_port, tls_port, cert_subject, &err); - hmp_handle_error(mon, err); + hmp_handle_error(hmp, err); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685186; cv=none; d=zohomail.com; s=zohoarc; b=P+whq6ul3MGUM4Po2GA0P+4wJB/6ceK3PvAs4lAqpjG5QOd+P7oEvXJKEVYFqxIwLtI5qGBBEy5UMQGVxXzqYH7dAWzilhDberSrgpl3saEDTxfBLauLVngn4BFRBW9C223pY/SVgyFPERWxvi4mMHsa4AtAc6FqWo25FbDTYYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685186; 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=VTTOSanhGHKbR3ZZ0ym2Im83p2rMYPHN3U4INkRVXUw=; b=bV8Mpp6EVjoZTH8xm1Ohh+/JPQgIh6+WIKyC4jtsESaj0q0I8gHNtDFpqyAT37bat8D0I9fjXj7PZ9wW5H6VQjGJWOwRap3r55Ynd+PXBfqNMI0jHP4JfkJBBTt0VI2ZyKWNgQ8Uo6JNagwRw+NVSvgXMLEtZm9hIpDoNxqtoNY= 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 17876851861471008.547318811393; Tue, 25 Aug 2026 12:13:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZY-0001Qx-Uf; Tue, 25 Aug 2026 15:12:37 -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 1wywZH-0000xq-DU for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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 1wywZB-0004Md-PL for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:19 -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-17-8psgVz8QPu2tQM1uXxcVeg-1; Tue, 25 Aug 2026 15:12:08 -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 C1AF318C1057; Tue, 25 Aug 2026 19:12:07 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F2FE418005B4; Tue, 25 Aug 2026 19:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685133; 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=VTTOSanhGHKbR3ZZ0ym2Im83p2rMYPHN3U4INkRVXUw=; b=B3USttgakLCsRi3aJ+jkPWGnAh9smR40IlIIeM17Zsh09I7tp4kLGBgagOYFVrb8xfetSA 98SQZMn42ph+41USCV1620kKXlPWt4r5KVBdh8vsGbDqrq5CZZq6jLi1uHI/Gt1Fh19Zke mLmIzXtFt97qyhRx2l7BJSRParN1j2M= X-MC-Unique: 8psgVz8QPu2tQM1uXxcVeg-1 X-Mimecast-MFC-AGG-ID: 8psgVz8QPu2tQM1uXxcVeg_1787685127 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:39 +0400 Subject: [PATCH v4 32/49] monitor: add monitor_cur_hmp() helper MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-32-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2283; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=27cFGH87Wmo+JiZTbLanexVZ3ePxuAtdbhaB/Ls1+ow=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIgL1o9HMkf9JTk/U+0L5ipJNCBVdeHNT/2 OKYUfOdt7mJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5ffcD/4l9JKrsX9lfy+8DzVeC+vaCEe29mcQHcgKGMNDtggHozLDwcNQ8TVBR97pQ+yhrHFLP0I X061BJ5bS2zi3xojS6B9WWL4DKo3fSmyDv7/PJNgYvC7KuIV2LthZYvr3xt3JrN5AjJm1RDcSYg TCZB0Iec3vw62iDWGVfJQCJqF0F7JYnfvfCuKi+zXCv2UK6ZHlA6sUsrhNHUK1Dr1YkYucJVIur GslDTJy6Xuo80HVUDZiO0z5qFP+pxW7+/zIqzslx7rfL8s4s7oM5jdnyQVkK7cNqIA9JMr048my 5701Stsfk+rZVJ9XQ7MZF/gI0dFHaGRQTNDJBjCvdyJ7KPKLbecekHknYHzD9eiP/ftt8DjxePU OEqglz3n1WJ/jV+5AxLMfSE4ap+a3NxIwLHlPxzboxai68xwJgcvmqexmiHPQ7nPiJPYzsOZdDq UaglLO7oguMo1pTK6vXm0V6IIFiEZW3/80kjQGvwba2d28CMGuuLHpjWZGyZ/xdLNbicqh3irjB AiPPcPIxVz0e7xUWFCYahvHr2wqAvuz/oPB0sjEUv5KDeOLnBjwxwOrXUed2TTWLMob64emLVBt 1B6/8rwDipeoteWwJDyo9ZH/DqAO7YBSuotW7DdmC/3PCkpB/+ejWF3G5SUaeX3+JScAwHkUIYW TaXPi6+HIE3t6bw== 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: 1787685186783158500 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 --- 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 21:37:38 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=1787685189; cv=none; d=zohomail.com; s=zohoarc; b=RPf8Z1LAViP1FANgbmi/AouzQoZvBoFo/vk9Bc+zvgc/hqnoSqXGm/eD/S+s4eQboPXkvandWCDByd95F3CxsFRQPF+sbqv6C9YF1ag1Z6wlWY/sa6e/ZIKR0s2zTmcF2u4EQ2OuGK4xIZtVUMl1IsgtQ3gAXiODGohECO1SdzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685189; 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=eFke7uYqhjOsM9VFIgL5HFp+d3kDilCmv27jgoE026Q=; b=Tzno+u8MqYuXzNzksbimzuSVvCOvQqgURGbQT1/JVEFFUX426HWGfclT4R1h26W+quToTz2/jlNIkiz7/itpOkAtc22cXsaDeue6xLJxW79xv0AR4f04TfivZxZ+jyf+wMyBgAq48bV2xq6gVOuvHivaYEKuaQ8gevMIkS491e4= 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 1787685189030934.0607360945587; Tue, 25 Aug 2026 12:13:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZd-0001rN-W9; Tue, 25 Aug 2026 15:12: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 1wywZI-0000zz-IQ for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:21 -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 1wywZD-0004NC-EH for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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-357-9zVFXM_SNdmHPQkKJJxx6A-1; Tue, 25 Aug 2026 15:12:12 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D54F91921ED0; Tue, 25 Aug 2026 19:12:11 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D80F27D6; Tue, 25 Aug 2026 19:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685134; 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=eFke7uYqhjOsM9VFIgL5HFp+d3kDilCmv27jgoE026Q=; b=Wq1mfxdbDrqyZxU+rvhOYxSkUfCmheeAO373agOU7R/1CInaelsejXK4MBYg5E+xaN41zw rWuaSJsM0J1Bi5nPE//Fx9jd+p5TAdMDgMJd3XQeWdugU6SZP7VVgZWLWM4CMECxgsCgTD 5dtrAoyJz12nczMckp/ykGjft3Rsu9A= X-MC-Unique: 9zVFXM_SNdmHPQkKJJxx6A-1 X-Mimecast-MFC-AGG-ID: 9zVFXM_SNdmHPQkKJJxx6A_1787685131 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:40 +0400 Subject: [PATCH v4 33/49] 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: <20260825-qemu-no-hmp-v4-33-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=968; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Mo8cBdHqWinpU57ZVLGO0vQPm4yx6iOLD7L3h7acAqw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIltuVcGz6TfC8icyJkF9WEDf4iTDg83vgh DTF5Y8q/omJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5XoSEACQ7sXpr3hYIbmN7f3BobOZhppRzhVcgOGErF3DAdo9VnGXx4Z2hMq5H1dfui5UNBvUSvT c+7fNe0oLhBay/NZkoBTM3v5NH7bgoSFvAS/55D8UqxdLVqvF9sT/MWNHU1lySN5/dyssnPIql0 trmFHPfdEuGEmRy6TaMa+/1A6ViJdUakyL/DdSyDJgcBM0b/1w8b0LjMYVCYFL5kaKT04UXkNUm +I/NejzXZJh4bfmNPGb7aVBgf7vFdU/LuLKZZazSzlr/AP2PAaiMamKmwg4HfsjuV3ZYhTIoHia P4zbN6mwe3U/5xDRw2fkMIYRd3uTsYWkTHG9crWKtZn4wr68H3paFlqa7Kq85I8Eekt39oHFSf7 wOq/mT4gv/KgxVbaNwq6EPoebMBtPlJZGvddEoKVd/40bmmcFuFCI2+LHX8tRZ+gx1MI5WgC5KH IoqnsY/pyy/F2v7KMSEX45lFMGb7+ra/1G/pmfwgDdzzvlazzweXAO7/cH4eegTmEe9Xrt4nQs5 ngAQUNCTG4RN1l0mNYAxkKLbGyWqHdiVmO7W6lnFksfqXlyojEjIItCf8yHyiatwds14rX+jRaM ZEz4POKeLJ21VCo8xTgtz7HclX0aTnM96tpT+ADq64N0kz6Od25bnCFZ0IMsP8Y2QX01Xnq6q2j BpaJG4FUoLZScdA== 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: 1787685190806158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 21:37:38 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=1787685204; cv=none; d=zohomail.com; s=zohoarc; b=fgX12SMqUS1e94id97zEXiuI3xHzZRXiCkJTu+5OexyXNLEIYZIVBQpxiO70jY9C8ACq9s7yr5rRyH+YlDd5+Zovpuw1/ix+y/UMWO0dotzY5ArVP1QaKqTS8VaETN/vcnnX3xHXJyYopGQUo/05ohNL7wGDNViLQm1DC0gLGsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685204; 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=TSdjd6mopiASN08pKQqD4mIwrYo7RWGLRrStkeh2qZc=; b=Z6W3Bre3R9Ls17bFnkPsCfpQ+MjQ06pwNa0t/U01vNqN47deayaf2Z0f6lRXWdig+ASci/owR3LSA5O3EiLMnVDVzhPOvYuzpYJyMJ6HAoFygSC7gnxmlmKT1XmTyxFhfTxPbA+ZENTtl4/QNnGs6nasCSoxBLkooEeMuj92EYw= 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 1787685204222918.5603573976792; Tue, 25 Aug 2026 12:13:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZe-0001yX-OU; Tue, 25 Aug 2026 15:12: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 1wywZK-00010E-1n for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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 1wywZI-0004OQ-5f for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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-344-fdeexbImNa2OgAeFku8_EQ-1; Tue, 25 Aug 2026 15:12:16 -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 289061953954; Tue, 25 Aug 2026 19:12:15 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5AB241955F0C; Tue, 25 Aug 2026 19:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685139; 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=TSdjd6mopiASN08pKQqD4mIwrYo7RWGLRrStkeh2qZc=; b=gaPmv673qgPQGDG3L2lXitg+Q6Rvo92EFJ2F3vFhglrm22Rnywnyr3P3JDnNd05x9LvCzY dF6F+e6hUhL7RJoZb9NlT8UCWnJIYhFxKh3liTJtg5cmBFdocnklVWf8sPf+8YnYK3W9qc EQOozWbWYohBGMx3EOe64Pfsu2OFA+M= X-MC-Unique: fdeexbImNa2OgAeFku8_EQ-1 X-Mimecast-MFC-AGG-ID: fdeexbImNa2OgAeFku8_EQ_1787685135 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:41 +0400 Subject: [PATCH v4 34/49] error-report: switch to use monitor_cur_hmp() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-34-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=5495; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=iFB7RZJyLqpDZoRjp3LCjEYK6SiM3FoDvc+n89o01zM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIW2fK5AY0BR1457vlxGHOX4IHJrRosTpXA whnmQ+jSAKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5blcD/991YI5bBoc+qR8kprAatdkxCxXzUBQta85AHiqbVos777EQ1BMRR2OnItB8TGlT9kzkFh 1MB/+7TCW5ojBbftbRtY4ZmQQhGN5RcpcvSENGJAhZiZMFj5KXhant/iobS0RgCzS/r5cq3dEEb CLOiXaotvu57l3N+C3zyQT5GB4V7Iiok47q0/y16bSlXtUtMdgZp4W7hn2dFicFEa3FzeuwqRmO DWDnDMOempJh7q0bnKJdOoKsC5KBkERhHMBHlHqWTj5pbtUNCZmxb5j89VsrMv5lXeg8WUIzzyn TESFzwIY4ddSGuMJ1Xjq7oM4HDxvNkKpYu+7ra+lBdnPw7IIeqWjWNJJv7hoxwcyXlm2+NpLWBs my+t9w0fJAX8hZ6ALpQG6wTPhzUoYICdescS3r5RN8D7yvtWdN/EgEnB3Eaqnq0Rtj1vQpjDf1t aelvLIwFdC9ky5/f6qNiDyEaiZXDxThcYSgIQda8qvv2Io9CreHlYcU2V1lBu/+5Tr/nfG/dtoG VGQOMxnqJ4AgFUVUhT3XhB0B9MqntBA7YIm9LTSZ7a4RREEaxVQmOXsgoXj9Ief0btKRMxdT3RN Nz8AomzKNXdiWuJrm8Dzkdr6B5Np/WWsfQJrtCow8eUTipk97tak54OkgB5ghSZ2AminoB9+Qxe Bp6BGaxI3EWt/EQ== 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: 1787685205050158500 Thread through the current *hmp monitor, a non-NULL pointer is guaranteed to be a valid HMP monitor. Adjust doc comments. No behavioral change. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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..aa278de6646a 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_mon(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_mon(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_mon(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_mon(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_mon(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_mon(hmp, "%s%s", sep, argp[i]); sep =3D " "; } - error_printf_mon(cur, ": "); + error_printf_mon(hmp, ": "); break; case LOC_FILE: - error_printf_mon(cur, "%s:", (const char *)cur_loc->ptr); + error_printf_mon(hmp, "%s:", (const char *)cur_loc->ptr); if (cur_loc->num) { - error_printf_mon(cur, "%d:", cur_loc->num); + error_printf_mon(hmp, "%d:", cur_loc->num); } - error_printf_mon(cur, " "); + error_printf_mon(hmp, " "); break; default: - error_printf_mon(cur, "%s", sep); + error_printf_mon(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_mon(hmp, "warning: "); break; case REPORT_TYPE_INFO: - error_printf_mon(cur, "info: "); + error_printf_mon(hmp, "info: "); break; } =20 - error_vprintf_mon(cur, fmt, ap); - error_printf_mon(cur, "\n"); + error_vprintf_mon(hmp, fmt, ap); + error_printf_mon(hmp, "\n"); =20 - if (!cur) { + if (!hmp) { qemu_funlockfile(stderr); } } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685209; cv=none; d=zohomail.com; s=zohoarc; b=Jqb/R6xj6YwX0eGwdq6np9EB1+9CCxznZQcVw20GDWEF+a3jc2DI1Z9h1x2w42nNQJGZPe50iE7iOJ88u/pP2qJi9HSwix2tnBKRBL6bk89hmeqhsSxopWvYlJx/LD5KuIk6wcURXIA4vD6i6y2HKT7fqx7EpRCM0G7gFKG6Xqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685209; 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=FR9Zi5CkWx/fsLSwkjCg+40dAod/x0DFNAOUu5ni6Cg=; b=PFJJ21wJSAWqAVEpt7EXb7EhN8QYBU9kId/CPu60v5GnBSkamn5ZzZuo5ogkWcpNvAqCG/tZL9Epx5+fEFCvK3/LyChiSya9ggtY8vbDaaO+E+JQq2IonRh6Sdj43bzUsYSZycFw+SKXUfl0A7o4wIyRt1tA/zVgMUrw/tdzyJI= 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 178768520902037.12133586156733; Tue, 25 Aug 2026 12:13:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZh-0002Pe-RZ; Tue, 25 Aug 2026 15:12: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 1wywZV-0001Ns-T9 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:35 -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 1wywZR-0004Qi-LN for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:33 -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-215-csNLfyQ5NaupNz4UcG8Z-Q-1; Tue, 25 Aug 2026 15:12:23 -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 6CCAF188FECF; Tue, 25 Aug 2026 19:12:19 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F03EC1801AEA; Tue, 25 Aug 2026 19:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685149; 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=FR9Zi5CkWx/fsLSwkjCg+40dAod/x0DFNAOUu5ni6Cg=; b=D7pASzXNvpFIRM00TqcEIDJUfyN/7FQIIjErPX+7AZpHhHD/a1gmI0a+Mc2hAMU5bd2zHZ 3YvJZlPJPCgKe5oQnwmzNBchrXi5jPXxwm1vakLeZfjagVprJIdKjYB9SAKRVG+fuddZKG A2SmPco5r4oEkTd2wZnvfx5x6Fux6zI= X-MC-Unique: csNLfyQ5NaupNz4UcG8Z-Q-1 X-Mimecast-MFC-AGG-ID: csNLfyQ5NaupNz4UcG8Z-Q_1787685139 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:42 +0400 Subject: [PATCH v4 35/49] monitor: tighten monitor_set_cpu()/get_cpu() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-35-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , 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=18353; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=vTTBrEccJ5o9lm5TlY8uXC1ek8bxch2qX/aDybena0Y=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiI1SRQOX59FBNbFRVu79RMPPK9V5IQ4K3IH YE0o8LR+d2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5a6wEACvFOi+5772fFm/iFHXuI+dybWDth6eX6seuu5z3S5biAngqz9Y/cy3aRg6UG0vnc7cl9w Rzx8+J4dnN1ylLSOqhHW4jp7ABxpK3sOrnuuU4jzwlQeDdYoaVHEJDTAlQLGHmDXoVPWo9Eu0QH lx0YrlglBNYa8cIImrjqFsFsga/G+N0/EuMpLjFazhBE5uV+nkMk2vL/3sBipem36KP879gPm6R K2cXv3HgNIrId4O1oKK4c0NbpF2a3BcvI2iggBqff+DF9pszD0fK1nL3gu8HsISKOwjYsZv88v1 b3GcdfAhJ3RxwwFS190oAkH3qXnapBs86m7iwsp2++vetHEtQVL6w1Iyat73Gp1NuXFZtv/qm5o Pxbn5xc+bXx7Jze50LxCm6cuhl1KICfQj1fg6jNzSL1LD+XiDfI7++JDjgUwo+VFl4tfdN2NL6L Sn0UnwVNG8GbJAaZuHDGxfw3QY89sUlV+nBFkItbne8wrgJ40JU35XARKWGBEiW4H7RyfKs0yZE Fy4RSYYZgQ77VrWZUczXCiT4J9Q3aeGzdhoilcZRG0djaidOJlwen+DPoRhuaoCZMsOyF9jWkRw LWpei8pDoI69UWQhxRB6yDxAsy7UGR5yY6Q32Lk5RMK5kt5uCV+aDHoaOtwUylf+xMQdxV2uI4H 35nQabmx9T7I57Q== 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=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: 1787685211211158500 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 --- hw/core/machine-hmp-cmds.c | 4 ++-- include/monitor/hmp.h | 7 +++--- include/monitor/monitor.h | 1 - monitor/hmp-cmds.c | 53 ++++++++++++++++++++++--------------------= ---- monitor/hmp.c | 18 ++++++++-------- monitor/monitor-internal.h | 2 +- monitor/qmp-cmds.c | 2 +- stats/stats-hmp-cmds.c | 2 +- target/i386/cpu-apic.c | 2 +- target/i386/cpu.c | 4 ++-- target/i386/monitor.c | 4 ++-- target/m68k/monitor.c | 2 +- target/ppc/monitor.c | 2 +- target/riscv/monitor.c | 2 +- target/sh4/monitor.c | 2 +- target/sparc/monitor.c | 2 +- target/xtensa/monitor.c | 2 +- 17 files changed, 54 insertions(+), 57 deletions(-) diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 4e2f0c212b0d..702c798ccc56 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -36,7 +36,7 @@ void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict) g_autofree char *cpu_model =3D cpu_model_from_type(cpu->value->qom= _type); int active =3D ' '; =20 - if (cpu->value->cpu_index =3D=3D monitor_get_cpu_index(mon)) { + if (cpu->value->cpu_index =3D=3D monitor_hmp_get_cpu_index(hmp)) { active =3D '*'; } =20 @@ -228,7 +228,7 @@ void hmp_memsave(MonitorHMP *hmp, const QDict *qdict) const char *filename =3D qdict_get_str(qdict, "filename"); uint64_t addr =3D qdict_get_int(qdict, "val"); Error *err =3D NULL; - int cpu_index =3D monitor_get_cpu_index(mon); + int cpu_index =3D monitor_hmp_get_cpu_index(hmp); =20 if (cpu_index < 0) { monitor_printf(mon, "No CPU available\n"); diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 6aa562ddbaa2..3fd17048b319 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -30,7 +30,7 @@ OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_= HMP); struct MonitorDef { const char *name; int offset; - int64_t (*get_value)(Monitor *mon, const MonitorDef *md, int offset); + int64_t (*get_value)(MonitorHMP *hmp, const MonitorDef *md, int offset= ); }; =20 void monitor_new_hmp(const char *id, const char *chardev_id, @@ -53,8 +53,9 @@ void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)); =20 =20 -CPUArchState *mon_get_cpu_env(Monitor *mon); -CPUState *mon_get_cpu(Monitor *mon); +CPUArchState *monitor_hmp_get_cpu_env(MonitorHMP *hmp); +CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp); +int monitor_hmp_get_cpu_index(MonitorHMP *hmp); =20 bool hmp_handle_error(MonitorHMP *hmp, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 72a8f6ea5b4f..2a550aec023f 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -39,7 +39,6 @@ int monitor_fd_param(Monitor *mon, const char *fdname, Er= ror **errp); =20 int monitor_puts(Monitor *mon, const char *str); void monitor_flush(Monitor *mon); -int monitor_get_cpu_index(Monitor *mon); =20 int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index d1e7e4de6585..89cc19c2431d 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -182,10 +182,10 @@ void hmp_cpu(MonitorHMP *hmp, const QDict *qdict) Monitor *mon =3D MONITOR(hmp); int64_t cpu_index; =20 - /* XXX: drop the monitor_set_cpu() usage when all HMP commands that + /* XXX: drop the monitor_hmp_set_cpu() usage when all HMP commands that use it are converted to the QAPI */ cpu_index =3D qdict_get_int(qdict, "index"); - if (monitor_set_cpu(mon, cpu_index) < 0) { + if (monitor_hmp_set_cpu(hmp, cpu_index) < 0) { monitor_printf(mon, "invalid CPU index\n"); } } @@ -512,39 +512,37 @@ void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict) #endif =20 /* Set the current CPU defined by the user. Callers must hold BQL. */ -int monitor_set_cpu(Monitor *mon, int cpu_index) +int monitor_hmp_set_cpu(MonitorHMP *hmp, int cpu_index) { - MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu; =20 cpu =3D qemu_get_cpu(cpu_index); if (cpu =3D=3D NULL) { return -1; } - g_free(hmp_mon->mon_cpu_path); - hmp_mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); + g_free(hmp->mon_cpu_path); + hmp->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); return 0; } =20 /* Callers must hold BQL. */ -static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize) +static CPUState *monitor_hmp_get_cpu_sync(MonitorHMP *hmp, bool synchroniz= e) { - MonitorHMP *hmp_mon =3D MONITOR_HMP(mon); CPUState *cpu =3D NULL; =20 - if (hmp_mon->mon_cpu_path) { - cpu =3D (CPUState *) object_resolve_path_type(hmp_mon->mon_cpu_pat= h, + if (hmp->mon_cpu_path) { + cpu =3D (CPUState *) object_resolve_path_type(hmp->mon_cpu_path, TYPE_CPU, NULL); if (!cpu) { - g_free(hmp_mon->mon_cpu_path); - hmp_mon->mon_cpu_path =3D NULL; + g_free(hmp->mon_cpu_path); + hmp->mon_cpu_path =3D NULL; } } - if (!hmp_mon->mon_cpu_path) { + if (!hmp->mon_cpu_path) { if (!first_cpu) { return NULL; } - monitor_set_cpu(mon, first_cpu->cpu_index); + monitor_hmp_set_cpu(hmp, first_cpu->cpu_index); cpu =3D first_cpu; } assert(cpu !=3D NULL); @@ -554,21 +552,21 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool = synchronize) return cpu; } =20 -CPUState *mon_get_cpu(Monitor *mon) +CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp) { - return mon_get_cpu_sync(mon, true); + return monitor_hmp_get_cpu_sync(hmp, true); } =20 -CPUArchState *mon_get_cpu_env(Monitor *mon) +CPUArchState *monitor_hmp_get_cpu_env(MonitorHMP *hmp) { - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); =20 return cs ? cpu_env(cs) : NULL; } =20 -int monitor_get_cpu_index(Monitor *mon) +int monitor_hmp_get_cpu_index(MonitorHMP *hmp) { - CPUState *cs =3D mon_get_cpu_sync(mon, false); + CPUState *cs =3D monitor_hmp_get_cpu_sync(hmp, false); =20 return cs ? cs->cpu_index : UNASSIGNED_CPU_INDEX; } @@ -586,7 +584,7 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict *q= dict) cpu_dump_state(cs, NULL, CPU_DUMP_FPU | CPU_DUMP_VPU); } } else { - cs =3D vcpu >=3D 0 ? qemu_get_cpu(vcpu) : mon_get_cpu(mon); + cs =3D vcpu >=3D 0 ? qemu_get_cpu(vcpu) : monitor_hmp_get_cpu(hmp); =20 if (!cs) { if (vcpu >=3D 0) { @@ -602,13 +600,14 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict = *qdict) } } =20 -static void memory_dump(Monitor *mon, int count, int format, int wsize, +static void memory_dump(MonitorHMP *hmp, int count, int format, int wsize, uint64_t addr, bool is_physical) { + Monitor *mon =3D MONITOR(hmp); int l, line_size, i, max_digits, len; uint8_t buf[16]; uint64_t v; - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); const unsigned int addr_width =3D is_physical ? 8 : (target_long_bits(= ) / 4); const bool big_endian =3D target_big_endian(); =20 @@ -712,24 +711,22 @@ static void memory_dump(Monitor *mon, int count, int = format, int wsize, =20 void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); vaddr addr =3D qdict_get_int(qdict, "addr"); =20 - memory_dump(mon, count, format, size, addr, false); + memory_dump(hmp, count, format, size, addr, false); } =20 void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict) { - Monitor *mon =3D MONITOR(hmp); int count =3D qdict_get_int(qdict, "count"); int format =3D qdict_get_int(qdict, "format"); int size =3D qdict_get_int(qdict, "size"); hwaddr addr =3D qdict_get_int(qdict, "addr"); =20 - memory_dump(mon, count, format, size, addr, true); + memory_dump(hmp, count, format, size, addr, true); } =20 void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict) @@ -757,7 +754,7 @@ void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict) { Monitor *mon =3D MONITOR(hmp); vaddr addr =3D qdict_get_int(qdict, "addr"); - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); TranslateForDebugResult tres; =20 if (!cs) { diff --git a/monitor/hmp.c b/monitor/hmp.c index 47fb7cef6de2..2484a2310dff 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -411,10 +411,10 @@ void hmp_help_cmd(Monitor *mon, const char *name) * Set @pval to the value in the register identified by @name. * return %true if the register is found, %false otherwise. */ -static bool gdb_get_register(Monitor *mon, int64_t *pval, const char *name) +static bool gdb_get_register(MonitorHMP *hmp, int64_t *pval, const char *n= ame) { g_autoptr(GArray) regs =3D NULL; - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); =20 if (cs =3D=3D NULL) { return false; @@ -452,7 +452,7 @@ static bool gdb_get_register(Monitor *mon, int64_t *pva= l, const char *name) static const char *pch; static sigjmp_buf expr_env; =20 -static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name); +static int get_monitor_def(MonitorHMP *mon, int64_t *pval, const char *nam= e); =20 static G_NORETURN G_GNUC_PRINTF(2, 3) void expr_error(Monitor *mon, const char *fmt, ...) @@ -535,8 +535,8 @@ static int64_t expr_unary(Monitor *mon) pch++; } *q =3D 0; - if (!gdb_get_register(mon, ®, buf) - && get_monitor_def(mon, ®, buf) < 0) { + if (!gdb_get_register(MONITOR_HMP(mon), ®, buf) + && get_monitor_def(MONITOR_HMP(mon), ®, buf) < 0) { expr_error(mon, "unknown register"); } n =3D reg; @@ -1733,9 +1733,9 @@ void monitor_register_hmp_info_hrt(const char *name, * Set @pval to the value in the register identified by @name. * return 0 if OK, -1 if not found */ -static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name) +static int get_monitor_def(MonitorHMP *hmp, int64_t *pval, const char *nam= e) { - CPUState *cs =3D mon_get_cpu(mon); + CPUState *cs =3D monitor_hmp_get_cpu(hmp); const MonitorDef *md; void *ptr; =20 @@ -1750,9 +1750,9 @@ static int get_monitor_def(Monitor *mon, int64_t *pva= l, const char *name) for (; md->name !=3D NULL; md++) { if (hmp_compare_cmd(name, md->name)) { if (md->get_value) { - *pval =3D md->get_value(mon, md, md->offset); + *pval =3D md->get_value(hmp, md, md->offset); } else { - CPUArchState *env =3D mon_get_cpu_env(mon); + CPUArchState *env =3D monitor_hmp_get_cpu_env(hmp); ptr =3D (uint8_t *)env + md->offset; *pval =3D *(int32_t *)ptr; } diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index a0fa37c887ed..afdda1386080 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -215,7 +215,7 @@ int monitor_can_read(void *opaque); void monitor_cancel_out_watch(Monitor *mon); void monitor_list_append(Monitor *mon); void monitor_fdsets_cleanup(void); -int monitor_set_cpu(Monitor *mon, int cpu_index); +int monitor_hmp_set_cpu(MonitorHMP *mon, int cpu_index); =20 void qmp_send_response(MonitorQMP *mon, const QDict *rsp); void monitor_data_destroy_qmp(MonitorQMP *mon); diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 6cb0b587fbd4..b16119f4858c 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -169,7 +169,7 @@ char *qmp_human_monitor_command(const char *command_lin= e, bool has_cpu_index, MonitorHMP *hmp =3D MONITOR_HMP(object_new(TYPE_MONITOR_HMP)); =20 if (has_cpu_index) { - int ret =3D monitor_set_cpu(&hmp->parent_obj, cpu_index); + int ret =3D monitor_hmp_set_cpu(hmp, cpu_index); if (ret < 0) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number"); diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index f280ad8c4314..cd1f1deb58bc 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -226,7 +226,7 @@ void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict) filter =3D stats_filter(target, names, -1, provider); break; case STATS_TARGET_VCPU: {} - int cpu_index =3D monitor_get_cpu_index(mon); + int cpu_index =3D monitor_hmp_get_cpu_index(hmp); filter =3D stats_filter(target, names, cpu_index, provider); break; case STATS_TARGET_CRYPTODEV: diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 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 21:37:38 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=1787685184; cv=none; d=zohomail.com; s=zohoarc; b=P9k59b2j/uETYmhR3CuGibkx8WRKbDyHrNv0vqzaHZ46mjbygtD7HoJSHh+hW/KDp1cECkRHvAqdJltf+4HVS+SXBjiBb6NpvpYfWPjdNI5f07mMHR29KJoVPD4nHGyxeWPXYI3SGy54yAe8jul7LBR8C+N2R7nFRnGaNKaBadg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685184; 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=B3gfQeMRpqcT6fvw5+6QDwVK+TK1Gu++g6G25wuWQdY=; b=gcLUnwYb5O2IYS7/CNpb3Q/Zg08XD98Jnozo4UIqUpdOoRXPpSOgZldJVPjXAJ5o1ASw7UMdV7uFG2B0K1vANv8lzYXJZtcatiHvi91+BwolkHWUddscKp32qsnrPJKLTxUtGYR69NO5KATQg/0JSQkZ5NZVA5sCyOpXKj+cW5E= 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 1787685184576406.38886996502936; Tue, 25 Aug 2026 12:13:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1399394.1635503 (Exim 4.92) (envelope-from ) id 1wywZf-0000F6-3Q; Tue, 25 Aug 2026 19:12:43 +0000 Received: by outflank-mailman (output) from mailman id 1399394.1635503; Tue, 25 Aug 2026 19:12:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wywZe-0000E0-Tr; Tue, 25 Aug 2026 19:12:42 +0000 Received: by outflank-mailman (input) for mailman id 1399394; Tue, 25 Aug 2026 19:12:41 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wywZc-0008RD-Rg for xen-devel@lists.xenproject.org; Tue, 25 Aug 2026 19:12:41 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wywZb-00CDYd-RL for xen-devel@lists.xenproject.org; Tue, 25 Aug 2026 21:12:39 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8de900-8faa-0a2a0a5109dd-0a2a4506ab2e-28 for ; Tue, 25 Aug 2026 21:12:39 +0200 Received: from [170.10.129.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8de926-195a-0a2a45060019-aa0a817ce05d-3 for ; Tue, 25 Aug 2026 21:12:39 +0200 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-107-3V-NR7mON9-SCl6skE93Sg-1; Tue, 25 Aug 2026 15:12:33 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5F482195FCDD; Tue, 25 Aug 2026 19:12:25 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6B0EE18005B4; Tue, 25 Aug 2026 19:12:21 +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=1787685157; 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=B3gfQeMRpqcT6fvw5+6QDwVK+TK1Gu++g6G25wuWQdY=; b=MdMQZlzioRmHVdImIe/Ul2ZJEmyyj6vOWTx8lDbxCAiQoCzr1KeHqPXotmmuaTWYPdUnhy A/oJMw/vwSH1Cwz+Tm6iotJtRBpk2NNA9Y3UVCV5V0j5pVyvjVpBH40hlfmQY3nq9USdep 660c8t9a5DYKrVV/q9xqqtAdXpiqrPM= X-MC-Unique: 3V-NR7mON9-SCl6skE93Sg-1 X-Mimecast-MFC-AGG-ID: 3V-NR7mON9-SCl6skE93Sg_1787685145 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:43 +0400 Subject: [PATCH v4 36/49] monitor: tighten monitor_printf*() MIME-Version: 1.0 Message-Id: <20260825-qemu-no-hmp-v4-36-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Gerd Hoffmann , "Gonglei (Arei)" , zhenwei pi , Kevin Wolf , Hanna Reitz , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Ani Sinha , "Michael S. Tsirkin" , Laurent Vivier , Amit Shah , Brian Cain , David Woodhouse , Paul Durrant , Richard Henderson , Marcelo Tosatti , Mark Cave-Ayland , Jiri Pirko , Jason Wang , Halil Pasic , Christian Borntraeger , Jason Herne , Eric Farman , Matthew Rosato , Ilya Leoshkevich , David Hildenbrand , Cornelia Huck , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , 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=268258; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=deAi5Oa+Rn2mNob+zYtTDbsvfemyws/tuR7OyEF6fto=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiI/nalr50MvmayuYNRrnwgrUrOISz1ndShm 4mx6cUO2HiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5exzD/4oqHqbL4A2MpsJTYXt21iUWonjxnVLUquYdYKxXn0r5Wmm2TEcnKsXrZEUVt6bu5Hu8gz Cynvh417Z0qDOQ7M/U4ETGU8XXSdeDFM15jpr13ar5E/UafxluyZepHzcuTZJaDqXGNlLCDijtK HM3huWDj0d0kIJ311zwbc/MTlmtnlsY7Qcw16avNdmoy15c+5L+Ml6PFIj6VbtTaXVWW3qlsj+Q ZdBZhxWGSKEbBkjhYKuYHIn+wwNSH8v2JM71Jo3rBcS2gVJJBisYScKcX37g+drErztRFSCOULU 0zWxbluycNHy93vGPOZAMWo5pfPmMk2RgGQvX95Rynqut5ykdQR6eDcA76kSmxtSuBINZxys00E bK7fmfNQL4dUKTKsTIaO5/izTHZ2ouy7OfMW0vsyAe44O6qfbGyU/7Gr3GQqc/HwFm+U2J2lnSb J58jJUrBqWAZQYXciFQj2fLRvDQxueoU1HBjavcCW+eKOhsALKhcJ2DcFFS/N0H2gbM8+vasZua jtFfYEaxmO5KBpQeKB/aUrJ/EY06SkfqpGcPzMlTga9M1gnHCJzHM1tAk5pV8gqYE6U4HMt2kfd H5qa/FzVS2436LJh7BmDqvZX9BihTECd4pmP+wrVHLbe7hzYkAD5+xlm//FoU6h2kEl5axxQqmf LJ05XsVgwFyQaqg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-MFC-PROC-ID: qWF6G0ce1GPhftmOi4Po1xAQQUtVOR2ADIzTtmLr2CY_1787685145 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-16d1c6/1787685159-FDA0C4DB-A19B3320/0/0 X-purgate-type: clean X-purgate-size: 268260 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1787685187107158501 Rename monitor_printf->monitor_hmp_printf, monitor_vprintf-> monitor_hmp_vprintf, and monitor_printc->monitor_hmp_printc, changing the first parameter from Monitor * to MonitorHMP * to enforce type safety. The implementation is also simplified: monitor_hmp_vprintf now directly calls g_strdup_vprintf + monitor_puts, removing the virtual dispatch via moncls->vprintf. The dev_print() callbacks are temporarily using the MONITOR_HMP(mon) cast, they are fixed in the following commits. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Jason J. Herne Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 | 11 +- 63 files changed, 1219 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 aa278de6646a..78ccb6ea608e 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -36,7 +36,7 @@ static int G_GNUC_PRINTF(2, 0) error_vprintf_mon(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..5938f2b6c338 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,13 @@ 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); + return monitor_hmp_vprintf(hmp, fmt, ap); } return vprintf(fmt, ap); } @@ -55,7 +61,8 @@ int qemu_printf(const char *fmt, ...) int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) { if (!stream) { - return monitor_vprintf(monitor_cur(), fmt, ap); + MonitorHMP *hmp =3D monitor_cur_hmp(); + return monitor_hmp_vprintf(hmp, fmt, ap); } return vfprintf(stream, fmt, ap); } --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685249; cv=none; d=zohomail.com; s=zohoarc; b=ffURJDT/cZtWwfuonRT4vNuq5rrK6X4f90RbqVogkAF4GV3LBfUqwcBSAFmypPoRnkD47yTmO6e78rcEvlskZR7cVZveheTXD+kQCT1o2W4hhNySLc6Q9wlYrIXkX0u52alp80Sp0Q7e9mhHmM5FJZ7kpw051Loy9QZs1PO/PW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685249; 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=GiBkNiJCWkhLudqYCox+TEE808yd/DMUw1XGeC8PWto=; b=h2gOeGijvmJ9ysG7e0l8cEk87ifBLvJk/o5NO8tYIP4XhbTEShLq1VLH4ou3xrmJqgJQOXr8X6KkguBOkxVdXXW27UFkQk2bwP06ka5n7mFTEqYsFj3gC33FVRunxMF6qYG0jjfvW6919t+JEbOF18eHxweUMZAGe8x8839HjfI= 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 1787685249565612.1536649843273; Tue, 25 Aug 2026 12:14:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZe-0001yZ-Ov; Tue, 25 Aug 2026 15:12: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 1wywZY-0001R0-9j for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:36 -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 1wywZW-0004RP-EY for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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-690-4gGFBSTBP9OOcHizqCEm0w-1; Tue, 25 Aug 2026 15:12:30 -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 09BD318C0FF6; Tue, 25 Aug 2026 19:12:29 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3996230002F9; Tue, 25 Aug 2026 19:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685153; 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=GiBkNiJCWkhLudqYCox+TEE808yd/DMUw1XGeC8PWto=; b=ECjrhVihfbWDfi6MM2HCO1s8HewSBJqnPpueVNniVjs/AaL6b6WXDysygEKmxdnth3FDam 0k1h9H+FP0Sh51YN0EhQIOrho3PxPvQiTSWlfnUlVz92Dl+PTwe2a2+W+O07H47CRgoKJr BgOSQafnswg4JxufccyjlC8v2lfOOK4= X-MC-Unique: 4gGFBSTBP9OOcHizqCEm0w-1 X-Mimecast-MFC-AGG-ID: 4gGFBSTBP9OOcHizqCEm0w_1787685149 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:44 +0400 Subject: [PATCH v4 37/49] hexagon: make dump_mmu() take MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-37-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Brian Cain , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Brian Cain , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=4101; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=m0TAD9vj/bYDPy4FtEhvqyEw85alOnUDGy3Cn4My1AE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIGZUf+m44tD0q21Fho+jCB2HEsr+qxjm7x i3qrSb3C8uJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5azUEACGwxOlXyknhncnwrrCqTOVu8RGE9BDZu+nkt2I0mi7b/UohMsBKN6+oyKAaDSRYzxkWV2 y0WJ2KTdCkpY2EoLBCH3U2Ab6gr8gwuicqYQ1rkJgNYNy0V2LnUOKWvB9I+dvywhdOs8Y5hr5Rh M16CZ38gkNTQe/qn/rNXlXitoWBPsZjqWVKGosFgYiDLCRqnvoH3haGYT8JfmcwTnZylwiC+7YW fZHJWbfkTs/+EmLleFGoqZmuvD/eTu5xU77J3Oksyk/rrQwB31DUgRitOp1KF2jhE6rjKeEdlll /SJ7AAVQk/ZylPf2vuABdZnxD/x3mc+uk0F1pQJ7UmblrYneMqAG/peH+12Ezh6v0I4Wxr1ODbh 0ojBzt5M/wz3+rmWLojNC3BIoV535MR/CXymqfcS/ubruHlepy3L3svdK3zS6/xUn3ZydHnQ3wk nQDS0rIlUoB+8kgOTwrGTd9a4Kx0yindIzRKndqJc947uNqOr4VgRwj/uM6wwqax6P7rZO3jI+k AdqL95H+0gWBH8BTHEq4NUE9B+OXw1EzKuivF+ChALzj9Xac4UGF+9UGTQittW/eFTRCMFV2K1d cIwQA7dIAoa1Dl8oQTELl8IQH2Nif+uVLMDNnaR3Y+RommeubLeXaeRD6cijrp3fa3QcxYZrc28 44Hk2pclRIuTLxg== 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: 1787685251183158500 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 --- 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 21:37:38 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=1787685174; cv=none; d=zohomail.com; s=zohoarc; b=I5RSsDAtr7T8oKNoR/0jHzNHQJRxaVRNA43hW5kmc4AcJKdwo7FRq1eLWXB0dXrXOwl9YWW/IRHo1w/KO2ipWZDev1DhNZCIhZ6PyyGYRwMe5GmqUCvCHUaR6MEzbD0j/kSkY0O3PTNaC45huyu+uJrBsandboBbhvNvJywACm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685174; 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=57QfcTR5j/zJ5KMJTDu3qOnAc1zj+QlnuAt4vX2DJrQ=; b=FH8q/tVdVybmMAWbYkrAzkEioWau1md6Cv+bYhl9r/W6bh9E6h+xnOvSsCRSzycCW1F06caloicr2Svi1Bxoc2A1XotVX23zrHRvlr17V4u1Wd3rxqtOl3P1VrTI4EStXbBPEsQ45Qhhu5+15vMMWIVWrbwrN47otIKXWgztTPI= 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 1787685174441477.892639521153; Tue, 25 Aug 2026 12:12:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1399393.1635494 (Exim 4.92) (envelope-from ) id 1wywZd-0008RV-Lo; Tue, 25 Aug 2026 19:12:41 +0000 Received: by outflank-mailman (output) from mailman id 1399393.1635494; Tue, 25 Aug 2026 19:12:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wywZd-0008RO-IY; Tue, 25 Aug 2026 19:12:41 +0000 Received: by outflank-mailman (input) for mailman id 1399393; Tue, 25 Aug 2026 19:12:40 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wywZc-0008RC-Cx for xen-devel@lists.xenproject.org; Tue, 25 Aug 2026 19:12:40 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wywZb-0069WB-Q2 for xen-devel@lists.xenproject.org; Tue, 25 Aug 2026 21:12:39 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8de91e-e002-0a2a0a5209dd-0a2a450ab4bc-6 for ; Tue, 25 Aug 2026 21:12:39 +0200 Received: from [170.10.129.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8de926-f2d2-0a2a450a0019-aa0a817cae25-3 for ; Tue, 25 Aug 2026 21:12:39 +0200 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-jc1F5kuNMgCFWJ1OoF_V0A-1; Tue, 25 Aug 2026 15:12:34 -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 9DB4618C0FEF; Tue, 25 Aug 2026 19:12:32 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 79C8F30002F7; Tue, 25 Aug 2026 19:12:31 +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=1787685158; 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=57QfcTR5j/zJ5KMJTDu3qOnAc1zj+QlnuAt4vX2DJrQ=; b=SoyWS7eBvrH/fxRhefT2W9N4C1sQozLRobQ9cql0ycx6eBKHV7egvLkeuSCoiBsnlfyftd TE3twQvjiUvsfzH6XC192zjmAIUqqjczm5v55WVmmqbxJEiA5Nio63EtVe7ZcQ5GlpVOyg Zl+TG2MkZJR9Vp9NAcwQAIaCmh8X4TA= X-MC-Unique: jc1F5kuNMgCFWJ1OoF_V0A-1 X-Mimecast-MFC-AGG-ID: jc1F5kuNMgCFWJ1OoF_V0A_1787685152 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:45 +0400 Subject: [PATCH v4 38/49] qdev-monitor: make print_dev() callback take MonitorHMP MIME-Version: 1.0 Message-Id: <20260825-qemu-no-hmp-v4-38-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , Paolo Bonzini , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=8798; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TnV/ecEwZ8dNWntwBJ1/B+qLywO2KqD7Jgy5xW81cUE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiI1ORwMVhtLFs/MqLkfYMW91qiIkX2bbWKf zaoUdClu3aJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5RPJD/9voh4Ssrd7KFIE0Of1vZrgv5Zzbs1/rJAoLNlOOYasoOJkkCKkLa1JiPZnapucPEmaZgk tJIpDEUZjgDr4MYLEMX1Ef67nCjqNJwWZvZSNzmdPaCqtjfCwtQ0Ssq8pz5nBHaqwn2bw/pPXap yRtz7/QjwE8RGAx8ARfyqqRjiqMFbCAqF0Dy4m2povT+XADWrKkocSmET2f8/6r0yW+AvLzX8Y7 mIdXyGQyPOPdtz7Sw5wUs6Oi84opLDTv3E0IqvqXlGgWTwDfFClnuf49OFxYDv7OlLFjtkBtxQf Q9Zohr7W0CcYFy4H1vYfFTSE0EG2On8Ko+M5o0JsLwmXHwsQCxbuAiIgNnVzWbNOR5nokD5489P KwZaItJuo8vmzQ9I24Dw8GQxZ29/qh1ARZFs5ppqgXxIxT992Ll8s3ZknfqZ2MOPNj2zwm62K2I 99ZzagmgL8Q5tdL3yRe2h3qiMjxbm5dFHZEzHtrxELmoV5qjP5HkMkiQ6WN0mquoT0Frsk4k31l HrOA5RjvIhGOF2v3QBPw4pSC4fPyLA3yzimjelERjskqygwttoTQ9z+StNDCsTfqDTmE7f+FvAk swtTMwRUm96FjFpwGc5LQ3aOEWOM1hiKl1vYkgo9DgXXyt7/BldDn4F+MT5ItYID3qGc9eYB3Yc IPsRMZMFKhJfXJA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-MFC-PROC-ID: KlfHz8KkB4YBx1zGPM7KXSFQ4hVNcIMY9_XSkYL8pF4_1787685152 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-4011c0/1787685159-538D5CFC-31B1F244/0/0 X-purgate-type: clean X-purgate-size: 8800 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1787685176967158500 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 --- 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 21:37:38 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=1787685351; cv=none; d=zohomail.com; s=zohoarc; b=hDnfI4kOsmJ0dHxKm9yMsLPFtrMy/AdPpp/0hJCR2TGAdQ1LtkByXwyoi57f1U88s2JU5CG/EwDpMfctEU8Wg4kIHIfXscJIYWP1TFrJVcRBpwaWDdFmUS97azxZ1TudtjsxCGur4eDXsHL9iDVw1eeYM/7aOS89HjuM0FL3d5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685351; 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=TTn5AAb/qW3hra4wCQGpwQBFN1XcyzK6Ftmm43uRe+Y=; b=flWCsKEHCmptJVV7DhGjuKQ5+r8zi07dNFrOydT/lwsneUWD+nwThCPaE8Lu9YnzTy2UZwbPq7aSvdm4d/YXZ+XvtHpQpMHHgFKV3VA56KkswAudFyyDSbQ0Yva3He1VCnmsx5QZTdPTFxzAeiPnzPB1SuMeMP+IpRx03IEfRVY= 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 1787685351699810.3451181914568; Tue, 25 Aug 2026 12:15:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZq-0003RY-Hy; Tue, 25 Aug 2026 15:12: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 1wywZm-000360-Sw for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywZg-0004T0-6b for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:50 -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-350-5IsedT4WPF61GbN4-jyU4w-1; Tue, 25 Aug 2026 15:12:38 -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 1DADC190A349; Tue, 25 Aug 2026 19:12:36 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 50EE918005B4; Tue, 25 Aug 2026 19:12:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685163; 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=TTn5AAb/qW3hra4wCQGpwQBFN1XcyzK6Ftmm43uRe+Y=; b=T+D0DEbTKr4rdEA0ggPwZi6MgLGjmY3rTVsenLLrT5o9sMPQ88EOubYp11eK7iM4tPxbLP LzyRgQxj5SrjMUlzrS9CR12V9rht0rnc8bQIU/9gDLubyb5U3TTOoOofnxoD4cP0DJXCdl jPMek5PSfZxm71bI7lNpN+ne1keO9rU= X-MC-Unique: 5IsedT4WPF61GbN4-jyU4w-1 X-Mimecast-MFC-AGG-ID: 5IsedT4WPF61GbN4-jyU4w_1787685156 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:46 +0400 Subject: [PATCH v4 39/49] qapi: make HMP-specific schema entries conditional on CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-39-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake X-Developer-Signature: v=1; a=openpgp-sha256; l=2974; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Wa0NXaHs68Z5F8WoCU+QPlrnfaG01+49mRJLDSgZc1w=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiI7EJtUqGtkg6burSEt240/fFC3Y4m5pDBw nHzce+U6FaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5aUwEACFzLSfLgcDaCZkimYGPYqo0WThOLsRNIuN5IGqI1P39tkyWAERx9tTM4WcnwvLo6gBWeb bE9SoU8Zu7PS95HhVcBXXe/5LhphYMJd5TBnoc3LlYMyb9aDfvuWolrSRHavZ/H1d/6dbzM8wjy TTYTcrwLxN15plC7Ty/LwUlcxEa12kTJlipQDW6ZxupKjS7GW6SUFLB+JiA28ukaSxmpj6oo3U3 MfNbgPHh+lqLeFQXwFWFZrQ0N+LYVnWrecdNWpu999LGLfWAWEw0t9KoyS7dNUkSBkYlzlYrR8z 3lshB4Guuv+FpTRrz13hJoXxxmO/k417YwpYE0XsCDuIshbZ+o2+u0JatTKge/MoRYjCw80hMwI CsJu9h5MvoVNgoe4sY3RJMoAAiUxe6d2topjzjkREa7fUtyVvHym2EzUZTRI1qsSO5RQS0x9LUq AmPjiJLFYWDLqxQlSOfhZHjFC8Ys4YZUoQ9teO78Z8Jq3lL0hjzKSIEOUJfaXO4VvnAoGk0ybmg L+7WzmG8oM/8S0y2SkbqBTR53FdYU/zgNQ82qaejt+tUvPDtTjZRVE1D3+WodTM7xn4wx/hK+M3 EjDzWYoSfEbn623aonJYzgBpKr4raiDspDifzO3+UVTXUUXiHl18NoDaK8VFJwE2eWENxw6/MqQ yw+NRVosj1lXywg== 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: 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: 1787685353988158500 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 --- monitor/monitor.c | 8 +++++++- monitor/qmp-cmds.c | 2 ++ qapi/control.json | 4 +++- qapi/misc.json | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/monitor/monitor.c b/monitor/monitor.c index da76e6e4ac19..da0c8eda86b0 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -740,13 +740,18 @@ int monitor_new(MonitorOptions *opts, bool allow_hmp,= Error **errp) ERRP_GUARD(); =20 if (!opts->has_mode) { - opts->mode =3D allow_hmp ? MONITOR_MODE_READLINE : MONITOR_MODE_CO= NTROL; + opts->mode =3D +#ifdef CONFIG_HMP + allow_hmp ? MONITOR_MODE_READLINE : +#endif + MONITOR_MODE_CONTROL; } =20 switch (opts->mode) { case MONITOR_MODE_CONTROL: monitor_new_qmp(opts->id, opts->chardev, opts->pretty, errp); break; +#ifdef CONFIG_HMP case MONITOR_MODE_READLINE: if (!allow_hmp) { error_setg(errp, "Only QMP is supported"); @@ -758,6 +763,7 @@ int monitor_new(MonitorOptions *opts, bool allow_hmp, E= rror **errp) } monitor_new_hmp(opts->id, opts->chardev, true, errp); break; +#endif /* CONFIG_HMP */ default: g_assert_not_reached(); } diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index b16119f4858c..c9f24febdc96 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -162,6 +162,7 @@ void qmp_add_client(const char *protocol, const char *f= dname, } } =20 +#ifdef CONFIG_HMP char *qmp_human_monitor_command(const char *command_line, bool has_cpu_ind= ex, int64_t cpu_index, Error **errp) { @@ -187,6 +188,7 @@ out: object_unref(hmp); return output; } +#endif /* CONFIG_HMP */ =20 static void __attribute__((__constructor__)) monitor_init_qmp_commands(voi= d) { diff --git a/qapi/control.json b/qapi/control.json index 9a5302193d67..9898552814b1 100644 --- a/qapi/control.json +++ b/qapi/control.json @@ -186,7 +186,9 @@ # # Since: 5.0 ## -{ 'enum': 'MonitorMode', 'data': [ 'readline', 'control' ] } +{ 'enum': 'MonitorMode', 'data': [ + { 'name': 'readline', 'if': 'CONFIG_HMP' }, + 'control' ] } =20 ## # @MonitorOptions: diff --git a/qapi/misc.json b/qapi/misc.json index 22b7afed9f65..a21ba61b96e0 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -247,7 +247,8 @@ { 'command': 'human-monitor-command', 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str', - 'features': [ 'savevm-monitor-nodes' ] } + 'features': [ 'savevm-monitor-nodes' ], + 'if': 'CONFIG_HMP' } =20 ## # @getfd: --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685185; cv=none; d=zohomail.com; s=zohoarc; b=H4v68V28MEUwLCf9sJ3oow3S7hEfaQJgyyCg6iPbxQvr9SYkbukQnlCX3m/SfPf+rka8AnU9XoCtHdyft9r//pq5YLZ98Wx3BHfSMCovWWvC6y1n898zzrZbk6IMrmSwXQTAbt6jBc56TMwtRzYMzG9nAJ7ZdZ9RFTJkZBfFHl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685185; 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=97mBDltfk7bj8xemWvoAHpbNKvvYjwqbqC8EVeBtPno=; b=ZMVA+yH9nfZMHo/pt0c4ChbFY6MpvF5q/IYrmHeLiDslItwSgptutFE/FfxE1V7Tzm2K0QIg9qw8c/aH61gaOqGjBNHYG7ZwDxNCM7Wz51p+pGEk/IFEi49n8yTi1Jpxoo1gYAP9XYHaAIaN87Dcr131HQEGXuAejvLpXT4eR9E= 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 1787685185247756.1103486151158; Tue, 25 Aug 2026 12:13:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZu-0003nb-9n; Tue, 25 Aug 2026 15:12: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 1wywZt-0003jE-1N for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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 1wywZp-0004W1-SU for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12:56 -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-586-N2SleJzyPi2OTeGieeUOkw-1; Tue, 25 Aug 2026 15:12:47 -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 4486D195394D; Tue, 25 Aug 2026 19:12:40 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3AEDE1803A5B; Tue, 25 Aug 2026 19:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685173; 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=97mBDltfk7bj8xemWvoAHpbNKvvYjwqbqC8EVeBtPno=; b=fRxDj00j1ThjsUDjl2TMr8GPGijNO3YW02iSAPNocBmqA+rbQnh+wG3t9AFQdfFSJRYNWk L7QIcvGhfOQY9/QUTkvq0p3v4JlMyrApzSeS4y4Tt7c5E3/4hoG3RAJSXnNrZjrzfmP6jz +ukzrrHe4K6FF6peFPFz2jJvl7t7b90= X-MC-Unique: N2SleJzyPi2OTeGieeUOkw-1 X-Mimecast-MFC-AGG-ID: N2SleJzyPi2OTeGieeUOkw_1787685160 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:47 +0400 Subject: [PATCH v4 40/49] Guard HMP command implementations with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-40-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , "Jason J. Herne" , Richard Henderson , Paolo Bonzini , 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 , Samuel Thibault , Jason Wang , =?utf-8?q?Alex_Benn=C3=A9e?= , Zhao Liu , Laurent Vivier , Nicholas Piggin , Chinmay Rath , Glenn Miles , Harsh Prateek Bora , Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , Yoshinori Sato , Artyom Tarasenko , Max Filippov , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=20696; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/wYkUfMO1tP2nc3oenx66myTJUECduDZd+6MS/3QVGE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIE6259R7j6MTT3+lHWMnzQjfbgUQRhonum yDZAWoPEo2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5bAMD/4iX99YxlZJKgV/3ys4wWU4rsGPnOQrn1wyJR9BggwqYMIXhFKuUqCpMOTfwUzVYZ4RWhj a33Vq083CBDoStC+vwQl+8t8ui5pv3h8FeF5CGIw59JQUI5YnVOBy7F0F1on91Rwq8avix0tuiD HYQljMZKRXPnK21gqAv2yQlhDjzRIZkIjc5o90mF80HPRWYBeWADAvFSH3K+TfIdlfLKiRgNzyn +A/z9myZL/YLBRTBKree2vlkzz95htqcxeLWG5z4l8iRwdt2rrVW9LxQEcFO6UfRwjFb9a/yXD1 fXzVrn1ETnlxvW9cBiMlII5lBQteUbCffnlMsh5Z13sIpeUsHw2+T6jGaVCWH7wpVLmmtUxXbfs nutAwxEx1I1PS3Bzuuphxobg42v95fo7YFyYxcrXTywzcRmNqtuvns3WjYAF0yP8bDn93qr5Cft ok94RXlZsewUhNs/nmLyav8apd3uJl3FvCeLTK8VlTyr1zzr1xHoFmQ03Z+q+zuo0spsseQQ7XW yn0963vrfgz1294vUHQ67YS54FJrM9tVlu+8oHPWIwcswdZ12TKP5XYNzZVg3/NI+xlDQGnl9rS 8tz+Qk1GJ7sk+YhVF0Bj6YhRp0E1K7eplttXZWqZl6K5Qfj8VGW6BA7DRi/S58ycbOJkWWRrCtp JJuS8Tkulr+dUKA== 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: 1787685187183158500 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 --- 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 21:37:38 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=1787685341; cv=none; d=zohomail.com; s=zohoarc; b=AUyjF+cK1IP6kwLQ+fYWDL2JdmRkAW5i1im5EPqEntQdgn9tngtvTlyYeEMaHgyYvtYsa01a7g/7O4j9Usds2hfzbMsoIdZV7QVpN7oYLR0KuTDbACgegTaKfI8lCho4aQmW7mCJx2Yr/mLNt7qikgKcNCNsmO1j8t+7YozMM6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685341; 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=9T6RaGwiQ6RIqSqxskSTyz+FMmYOIOpZr0dqTULlFiM=; b=Cw3GD0T9R3QaALYk3fDgmKbU6u0F1J2PNW3HssgbGvK0TqtCdEBmXkoDWN3Yt0ezC6DU82HXw16aeCpGsM5YZJLs65R2fr8NacrC4LG+sg1nKoXu047binyO/OxpasiS34Sn78MKPQ/IpPc+wcuFqfaLNR8jjZ8l4V4tPqcBbuA= 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 1787685341213368.86723020141574; Tue, 25 Aug 2026 12:15:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZr-0003a4-JJ; Tue, 25 Aug 2026 15:12:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywZp-0003Q4-PD for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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 1wywZm-0004UT-OP for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:12: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-628-opN8Fv_sO7-qBHvlE_kjLA-1; Tue, 25 Aug 2026 15:12:45 -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 E8E1119774E1; Tue, 25 Aug 2026 19:12:43 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B6261800765; Tue, 25 Aug 2026 19:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685170; 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=9T6RaGwiQ6RIqSqxskSTyz+FMmYOIOpZr0dqTULlFiM=; b=KxSRuRUdpB3TGyRONle0cOzJ+TbarrSJNzhXBTOEXRSvAQhYV2kn0L921xC2u5jNqT5ejp GaRRao/hvgejhNhPuXh4fGgBbzcWpXKchSvjWub/Enuo2fnnWYoE7RBfrP6DnBQ3hyz6Je mssWds1mbUtTwjH5lf4zPH3TlT8f8ok= X-MC-Unique: opN8Fv_sO7-qBHvlE_kjLA-1 X-Mimecast-MFC-AGG-ID: opN8Fv_sO7-qBHvlE_kjLA_1787685164 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:48 +0400 Subject: [PATCH v4 41/49] target: guard MonitorDef tables with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-41-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Zhao Liu , Laurent Vivier , Mark Cave-Ayland , Artyom Tarasenko X-Developer-Signature: v=1; a=openpgp-sha256; l=4721; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=h5FgoNjZJ7je4rF+cX6DwK/vCwNzqzMapRKbSonoaXg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIIooTBxpwGTAtgEf9u0MUUFvOKQVrUFA+X gAPpALOutSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5UACEACXPKv0N7v4/HS0QorSOPW7JXAgBw6tDgDxnjvpvoVFXy4nHgaeOfW0EgGQ0rylSVrSH4A LUVzlcqbn1f7MBfNYn+aXE2xHGfRERae6L4ufGZZ6qGirthA6U2CbJU9uo8udpqnG/dDTjF34jY XrRIHPrN3Xx3cXSZ0hpr/4aNLxt2LWzqx34UbmbpTPJX5oqhtXHDiPgRphNODrMbF74taHanr/m HO+7L3QwSGOLoXpBTo/mZRMb5c9Hd9jU8I7DbTfZhSWUwt1QxNN3cOf1StdMw+82BdT12acaYDC tZYnUo1r//mLkQX8jf1t+EcRzJbvJZ0oF8xO85OYr4NPgkNMSkfS770pWxQlqpaTPt8HtX2hr6Z XhfXPJX5fPFeU7/a/WZP3jUefPEofIV3vwHawUcNHwI+u1udLiJPNJ0fLxKpphiWRb2fOkJTxsJ hriA5S6kqPowntNCJCIFDrm7lWu6ZXUEgrB+gBtGITt2zKijJ/KPxiluJNBEWANtoQ18xK9dqf6 EdZwDzZeKk75VYn6QJHUeM0APFQHBSwcnPyr0dMtLsCiGyWblg1jbvx8z42u2eiflgY2vWp1uyZ 3QAXMh9KMek5fJlCV8hI32GTc4PaaaN6aVaQ8uw0hhr0sFayIvMCX6gn/O0IpdYS5n0eNbQGnT6 jsYqzpJFwWM4vVg== 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: 1787685342044158500 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 --- 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 21:37:38 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=1787685187; cv=none; d=zohomail.com; s=zohoarc; b=VGGgkCCgP+V48AVu9+vX735yiGyfRpUOPo2jrPInuAhC8EiCYzX3JLSem3oy1cHpUCuBhrhicFwlfWo8mzDGn1jB3WsgrR4wSNVwu3FaoOJtdrXTnpnl+LdGOAWgkPqTN3CLaViU9+nBPX9LpqZGbSpf/xgL5MjYR/wiDcWMKd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685187; 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=S+aPoqqisu2J1a6Pr1LukLQArfAFqh3ZKUjQId9ja9Q=; b=RtMdz5afB/+PGwOYduHQfpIQ7hNUJu81D7awGCH9yRNY+Vs9rnpnE/bV1BWP7++wPVG5c0HFyouusChyUed1qW40C0zk8JUpL9Pui1d9hUSimJ7XTBG90y0ezaWtMhBuLe1bn30EfFJbfkgW3VrjjFiS5D+9dBKeq8emY+i6q7o= 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 1787685187579425.04846558509746; Tue, 25 Aug 2026 12:13:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1399398.1635512 (Exim 4.92) (envelope-from ) id 1wywZs-0000cD-JK; Tue, 25 Aug 2026 19:12:56 +0000 Received: by outflank-mailman (output) from mailman id 1399398.1635512; Tue, 25 Aug 2026 19:12:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wywZs-0000c6-GO; Tue, 25 Aug 2026 19:12:56 +0000 Received: by outflank-mailman (input) for mailman id 1399398; Tue, 25 Aug 2026 19:12:55 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wywZr-0000bT-QO for xen-devel@lists.xenproject.org; Tue, 25 Aug 2026 19:12:55 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wywZr-0069WB-7A for xen-devel@lists.xenproject.org; Tue, 25 Aug 2026 21:12:55 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8de91e-e002-0a2a0a5209dd-0a2a450ab4bc-24 for ; Tue, 25 Aug 2026 21:12:55 +0200 Received: from [170.10.133.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8de936-f2d2-0a2a450a0019-aa0a857c841f-3 for ; Tue, 25 Aug 2026 21:12:55 +0200 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-eR1SK0X7NtqLKSA6GRE-jQ-1; Tue, 25 Aug 2026 15:12:50 -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 CC4B41955F1F; Tue, 25 Aug 2026 19:12:47 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 96F2B1955F0C; Tue, 25 Aug 2026 19:12:46 +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=1787685173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S+aPoqqisu2J1a6Pr1LukLQArfAFqh3ZKUjQId9ja9Q=; b=GTDjEDY96iGN3Ih7joQsmUCbvbBOyrPCXesDqv/RBh503YU/Duh/aspOXNfbQrj3iBK2UC enUXPi+ahxeiKVlLyJEXqrxZUPjOLGu6ZqRtNkxDP0Zt9QYe82R2YXvwwT7KwhftkUwdJO 3jzecdDdw+xBrFSIIls0gOOOKVug6aM= X-MC-Unique: eR1SK0X7NtqLKSA6GRE-jQ-1 X-Mimecast-MFC-AGG-ID: eR1SK0X7NtqLKSA6GRE-jQ_1787685168 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:49 +0400 Subject: [PATCH v4 42/49] hw: guard BusClass::print_dev with CONFIG_HMP MIME-Version: 1.0 Message-Id: <20260825-qemu-no-hmp-v4-42-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Laurent Vivier , Amit Shah , "Michael S. Tsirkin" , Paolo Bonzini , Stefano Stabellini , Anthony PERARD , "Edgar E. Iglesias" , xen-devel@lists.xenproject.org X-Developer-Signature: v=1; a=openpgp-sha256; l=9448; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DXclgUj/8CLlvYxtSJ1BdyFBBPgVkYBaEJYVSnhsRxE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIY3eGI48Kf0/aoiQ/MKgC5Wp2woFurnxxS F0lWsgFNX2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5WsND/wPl9/v92x/AquvMWdZ7rOg9DwenVSjQrgi/syQ0XPxEnuU+BHW+vlRlhR589DQBK2JWux whjt1aLkn4GALepRB5E0sb//roHo1ZL/q/NtTCm80KMl2DIzoYmHMRE9ti0jia4yXhEB+/5weh3 duFyQM6L0T4VjWf5hCEXQObSK6tFNjpo5lHKh2221Olk/39vrXFGBZ09tkm8FEM9O4Tmw+mdRX/ TdmN2/TPQh8IIqBG4IcNi7b+cSdn6jN03LH1RvlObtcX+EPfGmR7yUY5tqT/St87Q9wkK64jVH6 Z5kUu/8yyyN9UBFJMb9WRHgqZxz6XPeyJLm1oGjuRndTjsa/yqey+0blEI82/jvIc2IVRSWoRRg NwUE48TuAh18Z/y/nRdL9EJezQidLYFunldTAf9esvGjqRfePHAGmUVA4sdzydMGSmlukuD3I27 VfOTAYt4VNVzvz0ti0VZ3pJ/gTrQeUgaUygsEFts4ch3cGiUdeJNikOW8WRp2Udgp/KRyjyhAph AwHY9BCRwoYna9TwznrW18P8ZXhM5+rzu2VsuCYAvgC3tQnslsSut1QiLmA8FOmZBxrh7TpRP0b 1Zej4GBAE74/uaZ+3jqzzvr/VXTr9u21Yxa+Zt0wQTcy+ymsoP3nG5p2waObhk1gXBP4xBVVBbU fsT43EF7iIos1fQ== 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: 13JeL9OTXl5uVED9xyt1r2bsU1OEaPcaLrZlpCRir4o_1787685168 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-4011c0/1787685175-583CCCFC-5991F728/0/0 X-purgate-type: clean X-purgate-size: 9450 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1787685188893158500 The print_dev callback is only used by HMP 'info qtree'. Guard the field in BusClass, all implementations, and the caller with CONFIG_HMP. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/char/virtio-serial-bus.c | 6 ++++++ hw/core/sysbus.c | 6 ++++++ hw/misc/auxbus.c | 16 +++++++++++----- hw/pci/pci-hmp-cmds.c | 2 ++ hw/pci/pci.c | 2 ++ hw/usb/bus.c | 6 ++++++ hw/xen/xen-bus.c | 4 ++++ include/hw/core/qdev.h | 2 ++ 8 files changed, 39 insertions(+), 5 deletions(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 4dcc4516e45e..83a033ce8555 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -814,7 +814,9 @@ static int virtio_serial_load_device(VirtIODevice *vdev= , QEMUFile *f, return 0; } =20 +#ifdef CONFIG_HMP static void virtser_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int = indent); +#endif =20 static const Property virtser_props[] =3D { DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID), @@ -823,8 +825,10 @@ static const Property virtser_props[] =3D { =20 static void virtser_bus_class_init(ObjectClass *klass, const void *data) { +#ifdef CONFIG_HMP BusClass *k =3D BUS_CLASS(klass); k->print_dev =3D virtser_bus_dev_print; +#endif } =20 static const TypeInfo virtser_bus_info =3D { @@ -834,6 +838,7 @@ static const TypeInfo virtser_bus_info =3D { .class_init =3D virtser_bus_class_init, }; =20 +#ifdef CONFIG_HMP static void virtser_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int = indent) { VirtIOSerialPort *port =3D VIRTIO_SERIAL_PORT(qdev); @@ -844,6 +849,7 @@ static void virtser_bus_dev_print(MonitorHMP *hmp, Devi= ceState *qdev, int indent port->host_connected ? "on" : "off", port->throttled ? "on" : "off"); } +#endif =20 /* This function is only used if a port id is not provided by the user */ static uint32_t find_free_port_id(VirtIOSerial *vser) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 31c4fdf79d48..fe8f867a8d9c 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -24,7 +24,9 @@ #include "monitor/hmp.h" #include "system/address-spaces.h" =20 +#ifdef CONFIG_HMP static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent= ); +#endif static char *sysbus_get_fw_dev_path(DeviceState *dev); =20 typedef struct SysBusFind { @@ -76,7 +78,9 @@ static void system_bus_class_init(ObjectClass *klass, con= st void *data) { BusClass *k =3D BUS_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D sysbus_dev_print; +#endif k->get_fw_dev_path =3D sysbus_get_fw_dev_path; } =20 @@ -249,6 +253,7 @@ bool sysbus_realize_and_unref(SysBusDevice *dev, Error = **errp) return qdev_realize_and_unref(DEVICE(dev), sysbus_get_default(), errp); } =20 +#ifdef CONFIG_HMP static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { SysBusDevice *s =3D SYS_BUS_DEVICE(dev); @@ -261,6 +266,7 @@ static void sysbus_dev_print(MonitorHMP *hmp, DeviceSta= te *dev, int indent) indent, "", s->mmio[i].addr, size); } } +#endif =20 static char *sysbus_get_fw_dev_path(DeviceState *dev) { diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index 0bb89c5a60ab..3f17784d9b8a 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -47,18 +47,22 @@ } while (0) =20 =20 +#ifdef CONFIG_HMP static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int ind= ent); +#endif static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge); =20 /* aux-bus implementation (internal not public) */ static void aux_bus_class_init(ObjectClass *klass, const void *data) { +#ifdef CONFIG_HMP BusClass *k =3D BUS_CLASS(klass); =20 /* AUXSlave has an MMIO so we need to change the way we print informat= ion * in monitor. */ k->print_dev =3D aux_slave_dev_print; +#endif } =20 AUXBus *aux_bus_init(DeviceState *parent, const char *name) @@ -91,11 +95,6 @@ void aux_map_slave(AUXSlave *aux_dev, hwaddr addr) memory_region_add_subregion(bus->aux_io, addr, aux_dev->mmio); } =20 -static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) -{ - return (dev =3D=3D DEVICE(bus->bridge)); -} - I2CBus *aux_get_i2c_bus(AUXBus *bus) { return aux_bridge_get_i2c_bus(bus->bridge); @@ -288,6 +287,12 @@ static const TypeInfo aux_to_i2c_type_info =3D { }; =20 /* aux-slave implementation */ +#ifdef CONFIG_HMP +static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) +{ + return (dev =3D=3D DEVICE(bus->bridge)); +} + static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int ind= ent) { AUXBus *bus =3D AUX_BUS(qdev_get_parent_bus(dev)); @@ -305,6 +310,7 @@ static void aux_slave_dev_print(MonitorHMP *hmp, Device= State *dev, int indent) object_property_get_uint(OBJECT(s->mmio), "addr", N= ULL), memory_region_size(s->mmio)); } +#endif =20 void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio) { diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index bcccfaf07f4d..879011da1384 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -135,6 +135,7 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict) qapi_free_PciInfoList(info_list); } =20 +#ifdef CONFIG_HMP void pcibus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) { PCIDevice *d =3D (PCIDevice *)dev; @@ -170,6 +171,7 @@ void pcibus_dev_print(MonitorHMP *hmp, DeviceState *dev= , int indent) r->addr, r->addr + r->size - 1); } } +#endif =20 void hmp_pcie_aer_inject_error(MonitorHMP *hmp, const QDict *qdict) { diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d3191609e283..9e5db9529379 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -290,7 +290,9 @@ static void pci_bus_class_init(ObjectClass *klass, cons= t void *data) ResettableClass *rc =3D RESETTABLE_CLASS(klass); FWCfgDataGeneratorClass *fwgc =3D FW_CFG_DATA_GENERATOR_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D pcibus_dev_print; +#endif k->get_dev_path =3D pcibus_get_dev_path; k->get_fw_dev_path =3D pcibus_get_fw_dev_path; k->realize =3D pci_bus_realize; diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 8bd25a9d872a..5cc5ffec33a1 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -13,7 +13,9 @@ #include "trace.h" #include "qemu/cutils.h" =20 +#ifdef CONFIG_HMP static void usb_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int inde= nt); +#endif =20 static char *usb_get_dev_path(DeviceState *dev); static char *usb_get_fw_dev_path(DeviceState *qdev); @@ -32,7 +34,9 @@ static void usb_bus_class_init(ObjectClass *klass, const = void *data) BusClass *k =3D BUS_CLASS(klass); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D usb_bus_dev_print; +#endif k->get_dev_path =3D usb_get_dev_path; k->get_fw_dev_path =3D usb_get_fw_dev_path; hc->unplug =3D qdev_simple_device_unplug_cb; @@ -544,6 +548,7 @@ static const char *usb_speed(unsigned int speed) return txt[speed]; } =20 +#ifdef CONFIG_HMP static void usb_bus_dev_print(MonitorHMP *hmp, DeviceState *qdev, int inde= nt) { USBDevice *dev =3D USB_DEVICE(qdev); @@ -555,6 +560,7 @@ static void usb_bus_dev_print(MonitorHMP *hmp, DeviceSt= ate *qdev, int indent) usb_speed(dev->speed), dev->product_desc, dev->attached ? ", attached" : ""); } +#endif =20 static char *usb_get_dev_path(DeviceState *qdev) { diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index b81a067e7753..1762816bf469 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -101,6 +101,7 @@ abort: qemu_xen_xs_transaction_end(xenbus->xsh, tid, true); } =20 +#ifdef CONFIG_HMP static void xen_bus_print_dev(MonitorHMP *hmp, DeviceState *dev, int inden= t) { XenDevice *xendev =3D XEN_DEVICE(dev); @@ -108,6 +109,7 @@ static void xen_bus_print_dev(MonitorHMP *hmp, DeviceSt= ate *dev, int indent) monitor_hmp_printf(hmp, "%*sname =3D '%s' frontend_id =3D %u\n", indent, "", xendev->name, xendev->frontend_id); } +#endif =20 static char *xen_bus_get_dev_path(DeviceState *dev) { @@ -386,7 +388,9 @@ static void xen_bus_class_init(ObjectClass *class, cons= t void *data) BusClass *bus_class =3D BUS_CLASS(class); HotplugHandlerClass *hotplug_class =3D HOTPLUG_HANDLER_CLASS(class); =20 +#ifdef CONFIG_HMP bus_class->print_dev =3D xen_bus_print_dev; +#endif bus_class->get_dev_path =3D xen_bus_get_dev_path; bus_class->realize =3D xen_bus_realize; bus_class->unrealize =3D xen_bus_unrealize; diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index 1391dc060caf..f054a214fc6a 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -323,8 +323,10 @@ DECLARE_OBJ_CHECKERS(BusState, BusClass, struct BusClass { ObjectClass parent_class; =20 +#ifdef CONFIG_HMP /* FIXME first arg should be BusState */ void (*print_dev)(MonitorHMP *mon, DeviceState *dev, int indent); +#endif /* * Return a newly allocated string containing the path of the * device on this bus. --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685318; cv=none; d=zohomail.com; s=zohoarc; b=OLNdHKx7yrjIkFU1vgZquOJCepM9QxRwZDHuN2fgmrqyiPhldmdSIjRMZ/UZaDpKDEAgXSGFpCKmmBKxc5lGyyRTt05jTfqXXvcHynOivC/BcbgZDzNtqEe1D3mer9gDxRMK9dBXiwscOeXJj1OzzGkgm8T587/hrp/NeUSmMOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685318; 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=+2OWslZr5vWUQBSkoi9YO3Fwis1ewdPH5RJSX4B6XlY=; b=FdHx+U9PAZiPMAM38wntxijEm/vyJYrFAjpUuHHMAbxTuRrD/1S3jJBNpBti0fJKKsGNHQ9Ly3Fp47sA0RJp3hJh2FHgeV4YiccNziwbzglnHG6jpewUl363okng55LejRJ3bNGMTEnUF9ifovJ3BIiYBcLUOOvsxhoYffyb8x8= 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 1787685318590356.6164420251299; Tue, 25 Aug 2026 12:15:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywZz-0003vE-Ke; Tue, 25 Aug 2026 15:13: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 1wywZy-0003uq-7J for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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 1wywZw-0004YX-Gi for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:01 -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-427-YwXIEcrxOeW5mUaP22lFCw-1; Tue, 25 Aug 2026 15:12:53 -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 385221886217; Tue, 25 Aug 2026 19:12:52 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CC3A018005B4; Tue, 25 Aug 2026 19:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685179; 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=+2OWslZr5vWUQBSkoi9YO3Fwis1ewdPH5RJSX4B6XlY=; b=A7vjLtibY5PgbDZsiYbWPngzt9v6yyVU2WKRho5DCmzdc54ZCFEroYTVVQ5tM02ewicJss yDv/kWnAo61nFUqYIm040h76hJsSHWv46R4F9XuvI48zOkm1y+y6lX3hD9uE+Z8C//B8Cj j4mcGMPkgy+t1e2O97mDieLs7Tn2lXE= X-MC-Unique: YwXIEcrxOeW5mUaP22lFCw-1 X-Mimecast-MFC-AGG-ID: YwXIEcrxOeW5mUaP22lFCw_1787685172 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:50 +0400 Subject: [PATCH v4 43/49] hexagon: condition HMP-specific code MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-43-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Brian Cain , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Brian Cain , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=2830; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+5CvDxMVY4yUu1Tik+sPP0HrV0rn2K4sJvVIbqYbbf0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIw+1s3D8TG7kqu5xx7POESSnuJ10eQWIxb nmNYV6LGVqJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5VJgD/4nJwJKcaFFEsYEJxxhQaBRQwob19c0xoPVrHedzbjjf5uiLSzd/3sa0vpAbPiFFXj5epT CvTNbmAgMzhy2bJvNe23HZgjcGPpEQDdWiUv8jHmZ0rluQgpKdmwSu0VgFAnkMD07iTKX1yF9Oq 3AxH9kvXYYyjrFrCntltNqtwayEolrOHT9N6KGq7VSV2/xbsR5gm3LZ5n+evsxYiPTLjHKMXLjs NUwyIQgmgibWLgRcZdDp+Nrfr8xhtUPQS7ZzMjE56DkFnY5PumIXcGNYemM2R8lTE6IFfAm3FZ1 r34a7Kh3Cvy3RVPZyq2/fEFcwt3q6dfYPQXEaSMEYt+robi4TJCWrK3/EvBTaZTtSfZriVberng MaCHOWsnY8afzqzd69tewF/CDSADhXh/xeCM8LAc37XOSe73w2S268cYMqrFtcKLz2ZQ+8cMpW+ BhRXOIuAOvbd9pFvWgG2IqLx5YccdTXk/sf3pnWOuXgCWZCs3TAnR+CSSDRX2j7ariztRDCrUYP Qt0UOPmcCIJc8kAq95RDEEul3I5i4+e6avM7oROWqSIvVTQs2VLAbLNACQzuyArR1H4N515f7ya liqhMIXfnME56o/h2T1VKJyhIL4hxOkP0viNSJc8zIeVf/hcu+OpzB4AXdyL0cGGeABRsZoaAiT 8S6tBeQe8VKdA/w== 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: 1787685319529158500 Reviewed-by: Brian Cain Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- 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 21:37:38 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=1787685202; cv=none; d=zohomail.com; s=zohoarc; b=NWtzkp/XbJ4+4G9cNVTIKbsebr0xM+YNJWJ+N/7DN4JLIB12pXGxsYyrshdrJvXBEvQ86pvc0VRqoJwbaMPD5mK+ITNoTny2iL+s+OyFbjPhN/1Krh0i6piFJjg/DZ7xWYDKQ6Zi8imwHe9XN6Czn557lqQQuN2KCUH4K2br1IA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685202; 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=ppszL6gTBrA2CVHXSdQ72mVxNlv6agP/ol+ztvlZfEo=; b=RYwpo9ezo3Dyu2ZqOf/lTqTg7yxUCFdIuxfqWMybWCpubXmBKLFeEalYxkcJNITQO5DiIbk4CUG3WcEojULV+bTrH4cxsTOXR5r6agkngatwv6K5VmdNOuOljG1I6BLSmMNeVsRM9kW5ofc1+rlzU1cD2XNGkhtfZpJRBAMDiIQ= 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 1787685202766699.5268181695308; Tue, 25 Aug 2026 12:13:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywa1-00040Q-UO; Tue, 25 Aug 2026 15:13:06 -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 1wywa0-0003wq-CY for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:04 -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 1wywZx-0004Yh-TR for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:04 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-ZrYLw0QtNfeCriy-zYPIYw-1; Tue, 25 Aug 2026 15:12:57 -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 919B01977403; Tue, 25 Aug 2026 19:12:56 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9CD7A1801AEA; Tue, 25 Aug 2026 19:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685181; 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=ppszL6gTBrA2CVHXSdQ72mVxNlv6agP/ol+ztvlZfEo=; b=ghHr2Gd7xRnG2oc4sTmbbXVfSPPy89fHZ1uvND/kE3cvGZZrTJGvJElv61KujnUJEcROAt XfgjH4Tgyq8syRNA3VUVH2FxZO14aHQ0tByUJ4dNVvWYwKF98tUwhzbmHrpKlvUD3Bfy81 VUsC2zReEL1uhOVcxysNBvKlwiFd0Hw= X-MC-Unique: ZrYLw0QtNfeCriy-zYPIYw-1 X-Mimecast-MFC-AGG-ID: ZrYLw0QtNfeCriy-zYPIYw_1787685176 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:51 +0400 Subject: [PATCH v4 44/49] build-sys: make HMP source files conditional on have_hmp MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-44-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Gerd Hoffmann , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Ani Sinha , "Michael S. Tsirkin" , Richard Henderson , Jason Wang , Pierrick Bouvier , Peter Xu , Fabiano Rosas , Laurent Vivier , Stefan Hajnoczi , qemu-block@nongnu.org X-Developer-Signature: v=1; a=openpgp-sha256; l=12975; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=XjKyU2aKA3DYV2lINAL24fmf5BDImmZsSgJpZ6i8wM8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIzpWymTprfNynitLlgY/i3fGmAbGzi+cdW nhvog+UWayJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5bVuEACufGnFxF9WJQBy8ErjMeqE39w1b5w5M52g9qLeWD8/KnfwrVc0EyB3PCwcUm2ui2ufRoJ xBPSkpfcQLdEImMuftdLECymep3NBOx2wqSWyZ6UGOSMGvwObSOSVeVSjHxDtqMiZzF8jhj60to NXznqX/3Qu+hlsKzgxN3POR4tasEvv3MaEFa8L1tRCOzyX4W3hJfcy2GiCNHjGPJ4ooNHn/Nv/I AdY4MQt+YIpJ3vs33TVfACGmVMMfAi7ioT3dpMNIrYe3sA6oWVG+gMqkwTn4rUAiULQkPwoOuTI SZemi1Ie47/oY1y/dU+FBHkSNtNfffSisYwbsZrWUIpgUDSIjpVKGraaNw5AYvEAS9xNivL+5m1 mK0VKkVdxY95pz4fPbsC5etaL4S7PSPmdeyp4SKHkog3oG+UjTHifW3fgxQWs91amma4ceBqtUn cVaEWIjdeTyqEi0PS4PApSEzJeHkas58yK0T77QbRg1jh+hUpyYKpyqVeHN1WoYyiy6MFNMi0rw EI/cV6CVksCx+h1ny5dDnqk3ieWJpdCvXJrTd6EJVGi+os6IKqhaYIkbFgg3rw+tG1rkIzCm61d Lw1vaVP08qiZogdjR2x9hkoU89AYOPZk0rmJdWaVZWp25gse0LwUugfThDcyLv/udnNBPQiqMF6 BFwqi1b7Od8qbsg== 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: 1787685205017158500 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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685300; cv=none; d=zohomail.com; s=zohoarc; b=cNjlswudF/wEPtBCpbc9T8MUHXu2lp72qLtgYcVAJRJaHoppEXigIRo4/W1Ak/xEr3fVbTcFGFv99ADYt1TMxrerRiFTHNqDlijQr1Fjuol7zfuaHjdSg4eSq0pFh6vXNHxxq6cIdorJa9ILGHPDjYjyoTHORrLCr4GHdCJ+anA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685300; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lEHcK7z4lsrjo+b0nnSXK3UE3eXILpOvD/vKXVIjWIU=; b=hhlXpTXGLpp/VplpJCq+8ZrbOx8a8KdSe5YoR/vSB3SCmomB/6VCBtveLGiuOYGXd3yon+aWNmMtpuDSJFMKW90ECpy10ZbnhZpvYouyAO1TZD2YCZOBTHsccSkeV6FvhoUCNzZjwie+/Y5RJZ5+6+jXqaf2anGLvUGiPC6MKPQ= 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 17876853009191010.203984069296; Tue, 25 Aug 2026 12:15:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywa4-00043G-5e; Tue, 25 Aug 2026 15:13: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 1wywa2-00041F-D7 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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 1wywa0-0004ZK-Py for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:06 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-gjlp3K6GOQ-zuPg59FVhMA-1; Tue, 25 Aug 2026 15:13:02 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C44D4195F17E; Tue, 25 Aug 2026 19:13:01 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8900D180025A; Tue, 25 Aug 2026 19:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lEHcK7z4lsrjo+b0nnSXK3UE3eXILpOvD/vKXVIjWIU=; b=WFHcxAb7u/xSKIKbiinCb5wSvK3atY3UBKIlAAz8XgYgg9HTeZQF6+/NyPR2tm2RaR86Gc PpAxf1D3+WhN1dxpw03HGY3B+oZJTnIaRxxCRGauhSPvs2G0QcnUV8WV2dLuL24lXW15Z4 jiw/AN71YEjtxln+pWpIAh33Z+LAYD0= X-MC-Unique: gjlp3K6GOQ-zuPg59FVhMA-1 X-Mimecast-MFC-AGG-ID: gjlp3K6GOQ-zuPg59FVhMA_1787685181 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:52 +0400 Subject: [PATCH v4 45/49] stubs: split monitor-core stubs into separate compilation units MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-45-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=2638; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2XvwU4FzVi+iQ75+LAQigV0q9d5xv2A741epbvOZt8c=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIcTA8NBxJvkNmR1JJjOxfWE2/dxPz4Ysqi Cc5rAl+MXSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5c2aEACMFLek0X0CLO3IOqmMDPx/xgPfua1QtL9mRo6UPSqNRumWGIAvBPR9eCMYc5S3KwUtKHF QmCOOZpW/GpOxcQmZwRS7n3yvyYyHYr2+86yPPWYalG/xdpfkZobZkEIspoasL+qk5odB6OtKgP +yBZPOzf1NoE/kH/xZwWKJcsjiF84ktbEDrnOHJFJlEfG4OIzKPI/7OTINHruq0E5OjTJPEDhRC cuNO7569qoSHuqSbpFVQR5BRPLY8yFifymluGkie96geX+qEtEVTapRvUKG0uRARxkrnZUol4bx ngnYmLueWXsTHsC6p2h0b8kU2Lv53Oeqo+BE98ue8nrnRZxvuTKTkj+yDv0ZOoUbF1+agqBdN8r 4dRw7dR2AOhiQujC01vIvIg7Zu7IowtQWP/8lvFtkAaFV9ijGAhrQ6yHcV6FCOnj3i1Wfu3AjF5 3CVhpR139lt+Bc2UlO6l0jb83Ag5OZa/3qS3SguNz0ZrT58o5urqnhOAwoAkPddgrIcQEx/upfO hbWCYaSABgyO7Z9uHDsGemrPP7fcMd4Zd3o1out7HhZynTtL/X6tbcTVuz0z2ezFmkY4MNU0nfA HdfcZL3hIzEAPjMWs04EK1ssZq+iqj8VOY951ASlXNe2sTXwEinujYmRdR7BfD5Mcz+5EJsS0SL nqPj3bviqLjBauw== 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: 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: 1787685301458158500 The wild linker rejects duplicate symbols even from archive members. When qemu-storage-daemon links both libqmp (with monitor/monitor.c) and libqemuutil (with stubs/monitor-core.c), all symbols from the stub .o are pulled in, causing duplicates for monitor_cur, monitor_set_cur, and qapi_event_emit. Split each stub group into its own file so the linker only pulls in archive members whose symbols are actually needed. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 21:37:38 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=1787685280; cv=none; d=zohomail.com; s=zohoarc; b=HlqD9pcqRB82P7+Lp+OZhwKpd2pPpPRByyr4KYZr1zEyHXBguMRX2h8XoWGBtyW62GyzZEwhDLdZ0tdVjreBMTqwu6QxD9nvyoS0rzS1GDcpnw10/cQKhP1g4MtWbrXfVi5yPLA/4pEi47egxTJ6RhwVkKjEy2sSpo9rNfk3cBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685280; 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=3ZyJ/smMSnxR8Ex2EKaOlL6B9GMxgiL6O1F1ULR5HLs=; b=G1mz2icxmh576D1opNWbs+6CrlVW+QuQyqTIOj+BQ8d23kXfRIK/C5KJNyL2/SBGuBTM16lF6hHroquA93isymB+ieJ4ckxIdu6Q5eeq61KJEeo2cxHGIUxTDGIOT3mxWhsBNtNbo3YEcMkXvC1oLImgKomzDIQw/hkJn1EviYY= 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 1787685280989946.8860332755295; Tue, 25 Aug 2026 12:14:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywaE-0004Gi-WD; Tue, 25 Aug 2026 15:13:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wywaB-00049w-4J for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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 1wywa4-0004Zp-NV for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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-681-Kind9XcLMQOON9LepLH8vQ-1; Tue, 25 Aug 2026 15:13:05 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D723018C0FC9; Tue, 25 Aug 2026 19:13:04 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1684A1800765; Tue, 25 Aug 2026 19:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685188; 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=3ZyJ/smMSnxR8Ex2EKaOlL6B9GMxgiL6O1F1ULR5HLs=; b=C98M6t+wCXE8FgsqNQL310NSzBr4gFqlI5X3lk0Skvbmi5H40xolWIcOUBTDBE644PqrZi ym4QiZDzq2LF8CAT9hjaw9N6nj9GE4C+1eTmzLqm8Fn9IjHjaSze15UsCTxtOI9SNmz2b/ RTAlVPnIMO2rEd07qOLPbzoEsbGX4AE= X-MC-Unique: Kind9XcLMQOON9LepLH8vQ-1 X-Mimecast-MFC-AGG-ID: Kind9XcLMQOON9LepLH8vQ_1787685184 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:53 +0400 Subject: [PATCH v4 46/49] monitor: move monitor_hmp_print*() functions to hmp.c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-46-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=4964; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=cT8eQSuF4lEc2cg9pW9E3wa9JurJOTD+0OT9/xe0Qew=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiImb0exNL1C3DcxkXg9S3gLpG5myE9u0m/5 rivhAMKOO6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5bXiD/9Hbss8o+Uw0ylFvu4Py/XQhAuFJDjqcLuz/kQTiQqznutdDeWyL+NL0cssWN6sGj49md3 +1xbgcyP1exq2bwSm+P/4Ud3QxtUiStIXqes7c1jogataMVsUgoUY2edyEN5MuA0LYwAe1+CEDu m5Epx15AeU3KMcwtWK1Ejw92QqmB3E/t6FStHzSqgmBDyrj+9RQGbGL1BE1GSKd1YwIFjPSFdSP V8libT7mYCFTCPdO+s8YeEFuPwp7en8G+IXV6bqW1QYxLmMTwqiZH6hfv6glbPqDQWwPxHtZ0YV +ltw6edkufbcVFAfffGGHhTTYtK/uclhPaDKcE2N1vuR49Bwu186SrVsHzHTTKfzWNgTaPMfOvT MTb++H89ViAzPsWxQEKdcWurPmOnulG+PVsUF8fpJ87hQEORSjcepwd2IVjwlYg9wWSaswzWR13 7Hdmbmil/cFARCRhvZlXng7BZmncLmdT+Pmz4D/MgGzALGKwZmu7kOMnNNcH/Me1YqMdhprqyMj A1Oz9Iq3RLAEZ4KFAqarvhJ2mdTvJyHMvOncnS59wVb4tymtIwNl86X6OwafXbIqpjpWIhESFJ0 e+Db847gk8mATcZ3w1INFYvXCAmIoJawmgLq8yXGoDQBlloluspcya7klQMNZmDutyXdnnsLujt Cv3LMTnn8gfMlvQ== 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: 1787685281341158500 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 --- 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 da0c8eda86b0..7979cd1cbcfd 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -272,55 +272,6 @@ int monitor_puts(Monitor *mon, const char *str) return monitor_puts_locked(mon, str); } =20 -int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) -{ - g_autofree char *buf =3D g_strdup_vprintf(fmt, ap); - - if (!mon) { - return -1; - } - - return monitor_puts(MONITOR(mon), buf); -} - -int monitor_hmp_printf(MonitorHMP *mon, const char *fmt, ...) -{ - int ret; - - va_list ap; - va_start(ap, fmt); - ret =3D monitor_hmp_vprintf(mon, fmt, ap); - va_end(ap); - return ret; -} - -void monitor_hmp_printc(MonitorHMP *mon, int c) -{ - monitor_hmp_printf(mon, "'"); - switch(c) { - case '\'': - monitor_hmp_printf(mon, "\\'"); - break; - case '\\': - monitor_hmp_printf(mon, "\\\\"); - break; - case '\n': - monitor_hmp_printf(mon, "\\n"); - break; - case '\r': - monitor_hmp_printf(mon, "\\r"); - break; - default: - if (c >=3D 32 && c <=3D 126) { - monitor_hmp_printf(mon, "%c", c); - } else { - monitor_hmp_printf(mon, "\\x%02x", c); - } - break; - } - monitor_hmp_printf(mon, "'"); -} - static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { /* Limit guest-triggerable events to 1 per second */ [QAPI_EVENT_RTC_CHANGE] =3D { 1000 * SCALE_MS }, diff --git a/util/error-report.c b/util/error-report.c index 78ccb6ea608e..111bfe29020b 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_mon(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 5938f2b6c338..07e48829b226 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -27,10 +27,14 @@ 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); return monitor_hmp_vprintf(hmp, fmt, ap); +#else + return -1; +#endif } return vprintf(fmt, ap); } @@ -60,10 +64,12 @@ int qemu_printf(const char *fmt, ...) */ int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) { +#ifdef CONFIG_HMP if (!stream) { MonitorHMP *hmp =3D monitor_cur_hmp(); return monitor_hmp_vprintf(hmp, fmt, ap); } +#endif return vfprintf(stream, fmt, ap); } =20 --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685262; cv=none; d=zohomail.com; s=zohoarc; b=gn2FQ8xLDDLG7Snj2xklYbbdzV0Q9sI7G1BjzYY3RVJbvtl2ZyR1M9YkpqSHbMLTibzS6eKOGUUFCvgBw/oBIALmR5WZz3JF7kZygTnV/9S0VQwEVGsFAG1r2X1FR2K/xkw39Lpl1UGePjY1V0588SzsGOvgttNWD+GhMEvQRf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685262; 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=psCBHhahy7mWTT2IZmj2GdxJeX38kxxc3eYiT9dQSKM=; b=Ef4/9TtqnY5a8DPjhYoVbPOXndgPLv1ESIJ8vD6rT1lTRArUb2ifTrMcfCbTMkmGmzyNeXVmksGowGmRw0G9dJf2F99+ofKNJmAu+5EQu0Jugf0zwO3abZQLJTI/ZGNOrVapIcpHDzwl18/v6b1BA4zVEkfxA0S0ah46KQPWgh8= 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 1787685262753854.5536199662047; Tue, 25 Aug 2026 12:14:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywaL-0004eT-9n; Tue, 25 Aug 2026 15:13:25 -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 1wywaH-0004KC-02 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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 1wywaC-0004aK-M6 for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:19 -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-694-KG61LDSOO2uXebRNMp7zUg-1; Tue, 25 Aug 2026 15:13:10 -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 21988188FEFC; Tue, 25 Aug 2026 19:13:09 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1A8CE1955F0F; Tue, 25 Aug 2026 19:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685195; 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=psCBHhahy7mWTT2IZmj2GdxJeX38kxxc3eYiT9dQSKM=; b=b0Lqnsg934M347z6AW1hEooHhplEKwSC0aBOptyDbpF8sK5oubEgpjfAoQdMxxDdRsUBIs Hs6FZjPCcMbrVGszkrAik+MJAqPmS0Jw1FfUsB08X5wrfqEIGrwhJDO1Tz95WA/WU2ndnx yXEu3KfieNDjK/UM3Rsut/rnsHFoheM= X-MC-Unique: KG61LDSOO2uXebRNMp7zUg-1 X-Mimecast-MFC-AGG-ID: KG61LDSOO2uXebRNMp7zUg_1787685189 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:54 +0400 Subject: [PATCH v4 47/49] monitor: move HMP-specific to monitor-hmp-internal.h MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-47-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Peter Xu , Fabiano Rosas , Paolo Bonzini X-Developer-Signature: v=1; a=openpgp-sha256; l=15397; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ZAA8THWMw6NBBtIdSrYLHCe+efXZ90gkzXafw65rFsk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiIGqi6ElohycCsvlIefFHNYhd0mE1eKjIY4 1BMhccWAnyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5ac4D/9slC4hhk07YZ5B+9GvppWZmjRisAS+qPr3NBv9yoHwKxCxsHOVcXUnvBIcwStO70OeiQm 7f/oBFKsmmMBPu30wMa7AyuQ84lvTy1js7nvJw/kqipHYp7DpmYY6m3EgM7NG8i2dErMcfdFPxs 4rrmapo5EqUOVukMpmMmCeW2+ELFGSW1fkeR44KfeV1p4a4/+H6+QptcB5Gqr3ZRYetTb6XyeWL 8e2umkP47avwmUENqTiopfvydcMNiNivAYmLMSOKJtscNo3wWA7DWv7vdzSMSzUlDoMiM44Y12i 5VbDCwo9yTW7uUW2dVFRkSVkwDgzNzAA4yfHLHyRwP7lnPbgoKNffoZzzhAVQESnQi26Dez9n6g 2vu+WCErWYikIjBMiw2he8briru35nACictbZ5CaLjrRxz0NlorvD/+JMCqpijuUyP0YlcEK/mH woRMT67/y4+He9Qs9iWs+knYC769YY48Wt03Ty6FGGm7nkl663dNzJ0K3Nb/JE3Jqeg1gfvFCvR bVlwCj0xxMYhk/reTGujIvElHIHopAl5NqzD7c5dLkV+vNWVM/MAAjg5ou/wBb+QDwJExbF5xaF 4I2c1sYjBpnEjhD6j+XOUmyhH9IkYm/c1kZCwwYbfarPMtrvqVSWvi0ZgSBL+rOSdFsMH1H5MDd HYbK2PdHX73fdYg== 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: 1787685263312158500 Move HMP-specific declarations to its own CONFIG_HMP guarded header. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/monitor/hmp.h | 8 +++- migration/migration-hmp-cmds.c | 1 + monitor/hmp-cmds.c | 1 + monitor/hmp.c | 1 + monitor/monitor-hmp-internal.h | 106 +++++++++++++++++++++++++++++++++++++= ++++ monitor/monitor-internal.h | 99 -------------------------------------- monitor/monitor.c | 1 + monitor/qmp-cmds.c | 1 + stubs/monitor-core.c | 2 + stubs/monitor-internal.c | 2 + tests/unit/test-util-sockets.c | 2 - tools/qemu-vnc/stubs.c | 6 --- 12 files changed, 121 insertions(+), 109 deletions(-) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index f10bf83df86d..ef53e87f7608 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -21,6 +21,10 @@ #define TYPE_MONITOR_HMP "monitor-hmp" OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP); =20 +MonitorHMP *monitor_cur_hmp(void); + +#ifdef CONFIG_HMP + #define HMP_STUB(cmd) \ void hmp_##cmd(MonitorHMP *hmp, const QDict *qdict) \ { \ @@ -36,8 +40,6 @@ struct MonitorDef { void monitor_new_hmp(const char *id, const char *chardev_id, bool use_readline, Error **errp); =20 -MonitorHMP *monitor_cur_hmp(void); - int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); int monitor_hmp_printf(MonitorHMP *mon, const char *fmt, ...) G_GNUC_PRINT= F(2, 3); @@ -218,4 +220,6 @@ void hmp_info_skeys(MonitorHMP *hmp, const QDict *qdict= ); void hmp_info_cmma(MonitorHMP *hmp, const QDict *qdict); void hmp_migrationmode(MonitorHMP *hmp, const QDict *qdict); =20 +#endif /* CONFIG_HMP */ + #endif diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 6fe189471899..27b38d0e5f85 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -21,6 +21,7 @@ #include "monitor/hmp-completion.h" #include "monitor/monitor.h" #include "monitor/monitor-internal.h" +#include "monitor/monitor-hmp-internal.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 3ac70c3f1123..91701ddf331b 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -25,6 +25,7 @@ #include "monitor/hmp.h" #include "monitor/hmp-completion.h" #include "monitor/monitor-internal.h" +#include "monitor/monitor-hmp-internal.h" #include "monitor/qdev.h" #include "qapi/error.h" #include "qapi/qapi-commands-control.h" diff --git a/monitor/hmp.c b/monitor/hmp.c index e3fc05f521a8..488ec23937df 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -27,6 +27,7 @@ #include "hw/core/qdev.h" #include "hw/core/sysemu-cpu-ops.h" #include "monitor-internal.h" +#include "monitor-hmp-internal.h" #include "monitor/hmp.h" #include "qobject/qdict.h" #include "qobject/qnum.h" diff --git a/monitor/monitor-hmp-internal.h b/monitor/monitor-hmp-internal.h new file mode 100644 index 000000000000..4e2430551abf --- /dev/null +++ b/monitor/monitor-hmp-internal.h @@ -0,0 +1,106 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef MONITOR_HMP_INTERNAL_H +#define MONITOR_HMP_INTERNAL_H + +#ifdef CONFIG_HMP +#include "monitor/hmp.h" +/* + * Supported types: + * + * 'F' filename + * 'B' block device name + * 's' string (accept optional quote) + * 'S' it just appends the rest of the string (accept optional qu= ote) + * 'O' option string of the form NAME=3DVALUE,... + * parsed according to QemuOptsList given by its name + * Example: 'device:O' uses qemu_device_opts. + * Restriction: only lists with empty desc are supported + * TODO lift the restriction + * 'i' 32 bit integer + * 'l' target long (32 or 64 bit) + * 'M' Non-negative target long (32 or 64 bit), in user mode the + * value is multiplied by 2^20 (think Mebibyte) + * 'o' octets (aka bytes) + * user mode accepts an optional E, e, P, p, T, t, G, g, M, m, + * K, k suffix, which multiplies the value by 2^60 for suffix= es E + * and e, 2^50 for suffixes P and p, 2^40 for suffixes T and = t, + * 2^30 for suffixes G and g, 2^20 for M and m, 2^10 for K an= d k + * 'T' double + * user mode accepts an optional ms, us, ns suffix, + * which divides the value by 1e3, 1e6, 1e9, respectively + * '/' optional gdb-like print format (like "/10x") + * + * '?' optional type (for all types, except '/') + * '.' other form of optional type (for 'i' and 'l') + * 'b' boolean + * user mode accepts "on" or "off" + * '-' optional parameter (eg. '-f'); if followed by a 's', it + * specifies an optional string param (e.g. '-fs' allows '-f = foo') + * + */ + +typedef struct HMPCommand { + const char *name; + const char *args_type; + const char *params; + const char *help; + const char *flags; /* p=3Dpreconfig */ + void (*cmd)(MonitorHMP *hmp, const QDict *qdict); + /* + * If implementing a command that takes no arguments and simply + * prints formatted data, then leave @cmd NULL, and then set + * @cmd_info_hrt to the corresponding QMP handler that returns + * the formatted text. + */ + HumanReadableText *(*cmd_info_hrt)(Error **errp); + /* + * @sub_table is a list of 2nd level of commands. If it does not exist, + * cmd should be used. If it exists, sub_table[?].cmd should be + * used, and cmd of 1st level plays the role of help function. + */ + struct HMPCommand *sub_table; + void (*command_completion)(ReadLineState *rs, int nb_args, const char = *str); + + /* Keep non-pointer data at the end to minimize holes. */ + + /** + * @arch_bitmask: bitmask of QEMU_ARCH_* constants + * Allow to restrict the command for a particular set of + * target architectures. + */ + uint32_t arch_bitmask; + bool coroutine; +} HMPCommand; + +struct MonitorHMPClass { + MonitorClass parent_class; +}; + +struct MonitorHMP { + Monitor parent_obj; + bool use_readline; + /* + * State used only in the thread "owning" the monitor. + * This is currently always the main thread, since + * HMP does not allow use of the I/O thread at this time. + * These members can be safely accessed without locks. + */ + ReadLineState *rs; + char *mon_cpu_path; + int reset_seen; +}; + +int monitor_hmp_set_cpu(MonitorHMP *hmp, int cpu_index); +void handle_hmp_command(MonitorHMP *hmp, const char *cmdline); +int hmp_compare_cmd(const char *name, const char *list); + +/* + * hmp_cmds_for_target: Return array of HMPCommand entries + * + * If @info_command is true, return the particular 'info foo' commands arr= ay. + */ +HMPCommand *hmp_cmds_for_target(bool info_command); + +#endif /* CONFIG_HMP */ +#endif diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index c198c12eaa00..822a66d06d00 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -27,7 +27,6 @@ =20 #include "chardev/char-fe.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" #include "qapi/qapi-emit-events.h" #include "qapi/qapi-types-control.h" #include "qapi/qapi-types-qom.h" @@ -36,75 +35,6 @@ #include "qemu/readline.h" #include "system/iothread.h" =20 -/* - * Supported types: - * - * 'F' filename - * 'B' block device name - * 's' string (accept optional quote) - * 'S' it just appends the rest of the string (accept optional qu= ote) - * 'O' option string of the form NAME=3DVALUE,... - * parsed according to QemuOptsList given by its name - * Example: 'device:O' uses qemu_device_opts. - * Restriction: only lists with empty desc are supported - * TODO lift the restriction - * 'i' 32 bit integer - * 'l' target long (32 or 64 bit) - * 'M' Non-negative target long (32 or 64 bit), in user mode the - * value is multiplied by 2^20 (think Mebibyte) - * 'o' octets (aka bytes) - * user mode accepts an optional E, e, P, p, T, t, G, g, M, m, - * K, k suffix, which multiplies the value by 2^60 for suffix= es E - * and e, 2^50 for suffixes P and p, 2^40 for suffixes T and = t, - * 2^30 for suffixes G and g, 2^20 for M and m, 2^10 for K an= d k - * 'T' double - * user mode accepts an optional ms, us, ns suffix, - * which divides the value by 1e3, 1e6, 1e9, respectively - * '/' optional gdb-like print format (like "/10x") - * - * '?' optional type (for all types, except '/') - * '.' other form of optional type (for 'i' and 'l') - * 'b' boolean - * user mode accepts "on" or "off" - * '-' optional parameter (eg. '-f'); if followed by a 's', it - * specifies an optional string param (e.g. '-fs' allows '-f = foo') - * - */ - -typedef struct HMPCommand { - const char *name; - const char *args_type; - const char *params; - const char *help; - const char *flags; /* p=3Dpreconfig */ - void (*cmd)(MonitorHMP *mon, const QDict *qdict); - /* - * If implementing a command that takes no arguments and simply - * prints formatted data, then leave @cmd NULL, and then set - * @cmd_info_hrt to the corresponding QMP handler that returns - * the formatted text. - */ - HumanReadableText *(*cmd_info_hrt)(Error **errp); - /* - * @sub_table is a list of 2nd level of commands. If it does not exist, - * cmd should be used. If it exists, sub_table[?].cmd should be - * used, and cmd of 1st level plays the role of help function. - */ - struct HMPCommand *sub_table; - void (*command_completion)(ReadLineState *rs, int nb_args, const char = *str); - - /* Keep non-pointer data at the end to minimize holes. */ - - /** - * @arch_bitmask: bitmask of QEMU_ARCH_* constants - * Allow to restrict the command for a particular set of - * target architectures. - */ - uint32_t arch_bitmask; - bool coroutine; -} HMPCommand; - - struct MonitorClass { ObjectClass parent_class; =20 @@ -149,24 +79,6 @@ struct Monitor { int mux_out; }; =20 -struct MonitorHMPClass { - MonitorClass parent_class; -}; - -struct MonitorHMP { - Monitor parent_obj; - bool use_readline; - /* - * State used only in the thread "owning" the monitor. - * This is currently always the main thread, since - * HMP does not allow use of the I/O thread at this time. - * These members can be safely accessed without locks. - */ - ReadLineState *rs; - char *mon_cpu_path; - int reset_seen; -}; - struct MonitorQMPClass { MonitorClass parent_class; }; @@ -209,21 +121,10 @@ int monitor_can_read(void *opaque); void monitor_cancel_out_watch(Monitor *mon); void monitor_list_append(Monitor *mon); void monitor_fdsets_cleanup(void); -int monitor_hmp_set_cpu(MonitorHMP *mon, int cpu_index); =20 void qmp_send_response(MonitorQMP *mon, const QDict *rsp); void monitor_data_destroy_qmp(MonitorQMP *mon); void coroutine_fn monitor_qmp_dispatcher_co(void *data); void qmp_dispatcher_co_wake(void); =20 -void handle_hmp_command(MonitorHMP *hmp, const char *cmdline); -int hmp_compare_cmd(const char *name, const char *list); - -/* - * hmp_cmds_for_target: Return array of HMPCommand entries - * - * If @info_command is true, return the particular 'info foo' commands arr= ay. - */ -HMPCommand *hmp_cmds_for_target(bool info_command); - #endif diff --git a/monitor/monitor.c b/monitor/monitor.c index 7979cd1cbcfd..6ba06280e023 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "monitor-internal.h" +#include "monitor-hmp-internal.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" #include "qapi/qapi-emit-events.h" diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index c9f24febdc96..7525a88e0494 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" #include "qemu/sockets.h" #include "monitor-internal.h" +#include "monitor-hmp-internal.h" #include "monitor/qdev.h" #include "monitor/qmp-helpers.h" #include "system/system.h" diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index 0e74d78d52e4..8dfd46d2a8a3 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { /* @@ -17,3 +18,4 @@ int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt,= va_list ap) } return -1; } +#endif diff --git a/stubs/monitor-internal.c b/stubs/monitor-internal.c index 6f69f1f14ae4..4483ca25557f 100644 --- a/stubs/monitor-internal.c +++ b/stubs/monitor-internal.c @@ -8,8 +8,10 @@ int monitor_get_fd(Monitor *mon, const char *name, Error *= *errp) return -1; } =20 +#ifdef CONFIG_HMP void monitor_new_hmp(const char *id, const char *chardev_id, bool use_readline, Error **errp) { g_assert_not_reached(); } +#endif diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index 530a3fee3c13..006f5e579c6b 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -24,7 +24,6 @@ #include "qapi/error.h" #include "socket-helpers.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" =20 static void test_fd_is_socket_bad(void) { @@ -75,7 +74,6 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Erro= r **errp) */ Monitor *monitor_cur(void) { return cur_mon; } Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } -int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) { ab= ort(); } =20 #ifndef _WIN32 static void test_socket_fd_pass_name_good(void) diff --git a/tools/qemu-vnc/stubs.c b/tools/qemu-vnc/stubs.c index 0aa50a901d37..1e4c14913b56 100644 --- a/tools/qemu-vnc/stubs.c +++ b/tools/qemu-vnc/stubs.c @@ -9,7 +9,6 @@ #include "system/runstate.h" #include "hw/core/qdev.h" #include "monitor/monitor.h" -#include "monitor/hmp.h" #include "migration/vmstate.h" =20 bool runstate_is_running(void) @@ -42,11 +41,6 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) return NULL; } =20 -int monitor_hmp_vprintf(MonitorHMP *mon, const char *fmt, va_list ap) -{ - return -1; -} - /* * Link-time stubs for VMState symbols referenced by VNC code. * The standalone binary never performs migration, so these are --=20 2.55.0.543.g5ebe2ebe4ea8 From nobody Sat Sep 26 21:37:38 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=1787685269; cv=none; d=zohomail.com; s=zohoarc; b=JYO6fYf1Cg7n5lzSR/VWt4tkrn5i6Jc1+z8u4+Z1QdIqW4zYXFB04I4NA3nqrYe8vbynm7WSnDZHK8hXVT5gQxkMB60lHy2PLmtYT7vHuHNw10MgRjFGexoDCYzDFADhZ+xRERDjLDQW3q8coG4nJY9vUy9cz++NO5G+H6/2C80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685269; 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=mSmGlFfDgm+HyFoKIfpAObVWasfTYjRZnIs3K/RyDls=; b=A4/9kVT6xW4GuGzgqd7ttxLKGIfw1xAhLFqWgfDu8VQUmCOlfYszlsSJLIk9iQKdzdCWVwK/XtEEqkwwf5XCF1eioALbidtwWk1R6hvzxKocgb8QpyvNSYX+YBWA58QaH/04PbuXIj20IQMUnNnF559xm0DdGraDtv7jUJh//w0= 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 1787685269148717.2542600225859; Tue, 25 Aug 2026 12:14:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywaL-0004i8-Ui; Tue, 25 Aug 2026 15:13:25 -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 1wywaG-0004JW-Un for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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 1wywaE-0004al-Oa for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:20 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-xS49o_OVN4OkVx3jBmOvrA-1; Tue, 25 Aug 2026 15:13:14 -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 25374195FDCD; Tue, 25 Aug 2026 19:13:13 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 45A7C1803A67; Tue, 25 Aug 2026 19:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685197; 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=mSmGlFfDgm+HyFoKIfpAObVWasfTYjRZnIs3K/RyDls=; b=LOUT+bHmvVD5/mj0uhfDWMlQKJhoSiuzq05fm7/gAOtm1NkTdhHIFZxjba0yU95CjbO8XB mO/JTZ8vsaNO2uvqFOnQPF71aztiU4vu4aHezMVVOORzizQbG4KW63m6nCBO21Xok/FLuC +BZwerqI27rybynn6vmEC45pcmENNj0= X-MC-Unique: xS49o_OVN4OkVx3jBmOvrA-1 X-Mimecast-MFC-AGG-ID: xS49o_OVN4OkVx3jBmOvrA_1787685193 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:55 +0400 Subject: [PATCH v4 48/49] build-sys: add 'hmp' option MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-48-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2885; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DLK1RtIEVsfGHkCcmDDSawvnMR7eyKfceqbddAXsWwE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiITEwcQ3EcLD2Jl432HDNyDpNceMEUTXYMi ymgvaj5T8qJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5ZcWEACM4GieP8EPaWvRsWriVyL3zs4CxOmIN2avXnyQwEZCtEinDVeaTj4EpAGld1zW0N0QYew nHUCVD1RdBoG8YKgGg2GvDej8E+M7sp8mtv4YM/cqVqub1wsYf/B8xGkuqctKMC2EHCWaFnHC6U D9tsnqe1rYf6Ar7UekBL24XrPiO8OfZpOs9itGwQUWhHWHXTf+l9l1O+n2XEpnJWnM9GayNrxW+ bNQHKKoVN9SnGrHDbp88+ZP4q3FZjuTYzcyc9be13ijKDuo0zMnM32u2nbiTZzIQv6F7MfInjj4 0GPo06G92EPg35eOFi2lQ2kZaQr+BaDVYjymhvlxDYSxmC8P/mtZgkrHEZxqUwD3ZVcDyoHB3Ah S4z+bWAjDqvvEOB3s9gHrtWzJFHzXTBOCHCuCihtkEKei5SitGDLolf6kgPy14+4sV2Xdxz+CkS 1vbelQZbjEgCOvurK1LPoG7AUSk8NEOrjAKlc9Lv1DQwsYMEUeOHqbIhjv/5drbIkpeP9nQlowS LLmo/jRxwc6j8iG4KIsxrxSH/8oCPsQ+0SyyIA8lxqjtShwE1tnkNn0iNqRGXtmZS1wlAIMQNt4 KIN0wOSl4jVsEttVwpIudh5M+lM6uMpsYQeZmAAd5E1rb3amsZhE1ZcGVDDeQQ80P15GrHIe9QG bRwJoHtUVdEP4sA== 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: 1787685271268158500 Add an option to enable/disable HMP support, default to true. The following commits are going to make --disable-hmp gradually work. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 4 +++- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 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 21:37:38 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=1787685247; cv=none; d=zohomail.com; s=zohoarc; b=jAl4aEk/RLpdZE2cjsYaxsbAT2SA5Bb0iNG3ZFhVW46IN5N9ExjE4xJ2i2Xm1bBbI5fv6bbbEQalV0JTx6vHefgI9qC0bN0hn06t0He6IJfd7F+b7/8l0npk3Ji0ESeBi3yH10vm5eHBHGt2NIED6S4uFS3tmvUqMnff220wqvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787685247; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YAFwmbIv/8Iz1PvzfVdH8TCC2X8FuwRSRiP92lMbPeE=; b=PpOJLugCueDFKtZxh2S3LTLJVz2q47qtydwVkTJ+TwO922uXx9e0r2HvfscKpip3clFazeO1PEtyM9KH/2oUjaa6HVznz2cMWAavQrda6u7tWHN0mp8GpRnlwmsyRnS2vAeP1wYboKOke5jnYSjejm6zRGFvFvVwtwX/2xc2mtY= 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 1787685247067762.2676337161377; Tue, 25 Aug 2026 12:14:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wywaM-0004iS-1O; Tue, 25 Aug 2026 15:13: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 1wywaJ-0004SU-2X for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13:23 -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 1wywaG-0004bQ-QQ for qemu-devel@nongnu.org; Tue, 25 Aug 2026 15:13: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-133-SbUMpSz3Mtuc_-v47zVIhA-1; Tue, 25 Aug 2026 15:13:18 -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 EBA9D18C1067; Tue, 25 Aug 2026 19:13:16 +0000 (UTC) Received: from localhost (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 23FDF18005B4; Tue, 25 Aug 2026 19:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787685200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YAFwmbIv/8Iz1PvzfVdH8TCC2X8FuwRSRiP92lMbPeE=; b=gs4NzuIjvtqbIgzsbXeTxI3h+Rh3MvG5LwPe84fcQ6PSdMalE7UI5xD48gbjir+bvesMxI TUHYCL1O2ck/2nq3ab60O20ITO6x4Wj/ok81drJf83XFfU2bC3HZjFimPqjsbO8jkOxB0j ib2ro3xwBj8eDx2u00ksH1ZRdxSSIP0= X-MC-Unique: SbUMpSz3Mtuc_-v47zVIhA-1 X-Mimecast-MFC-AGG-ID: SbUMpSz3Mtuc_-v47zVIhA_1787685197 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Tue, 25 Aug 2026 23:09:56 +0400 Subject: [PATCH v4 49/49] gitlab: --disable-hmp in build-without-defaults MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260825-qemu-no-hmp-v4-49-af60857c2fbe@redhat.com> References: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> In-Reply-To: <20260825-qemu-no-hmp-v4-0-af60857c2fbe@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , dave@treblig.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier X-Developer-Signature: v=1; a=openpgp-sha256; l=664; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2PfBfGSrrAVwhOfSkL4rieqVo4dBCVB2xaPbnEs7CSI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqjeiID6zGtV1rO2ksPWC737V9d9qlxEtQC7DJb iGlTibu/AuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCao3oiAAKCRDa6OEJdZac 5W+cEACY1gB5UA4WuuEAXON28T+ZnEC2kHwUBDiYB0hINUKq12auycmMI0Fwv/1rxCh3kQAev+q TFlNYeYyzAaxGJZEXzh/1L3x7pYK9nZH55Bh7vDtu63kvzNBlVA6AD1rvxFd/gXb1Xu7DeX0ihX isPapYZnrdEO/DFaGkyYtelzfJbuB74CxXlq6/u7gFt5+WftBRXwifhFFpDKlzPgHwjWjg35tI/ YvEyBBlszkIZEOOSEBgFzgRl/EsSUP/QHOWmLE94PVLpHwWZaXp+aT2ul33VPtX8Uhxub6DSRJ4 jEVK02s2B+cGiClqdjJ5g7JkAyMOMHOy7M8LcXx9WpRYtEXvnx7ucIEcr68FuV4MLFAeF/xe1p2 Qc61GkZCkK91d8QffiyoC0eOzzNTBVrPew2xo40Ul/HlhBS/k6v7gusREitxKXDc3oqV59DAbuR g108N/RQjcdJDOYD3QCRM34Hhu/khh+2meWGROpaUr3IwjZrG3MWt4H7bwz5TQmTARh/dbAy0gw 0Q9e6uZFVM7w0/0nlDuOQDDIDB6ERWQie1ZduS4FVB6HHurrV07x8oZDn1eH2ioswGkYWRhvV/U EIKJ7XvnSVu0aObEsupBlTLllgpRj8qZqR0skTiERM+LUQv9qglU0kGSy5ClNQQtWG8lHG+cX9l uxtMf2p24kPP8Ww== 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: 1787685249135158500 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- .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